我正在尝试实现这一点
就像我之前的其他人一样。
到目前为止我发现了什么:
我到目前为止:
父片段
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initViewModel();
setupRecyclerView();
initViewModelSubscriptions();
}
@Override
public void onClick(View v, CustomNavigator.Extras extras) {
Bundle bundle = new Bundle();
bundle.putString("transitionName", v.getTransitionName());
NavController navController = NavHostFragment.findNavController(this);
navController.navigate(R.id.action_devicemgmt_to_deviceMgmtEditFragment,
bundle, // Bundle of args
null, // NavOptions
extras);
}
Run Code Online (Sandbox Code Playgroud)
细节片段
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Transition t = TransitionInflater.from(getContext()).inflateTransition(R.transition.test).setDuration(1000);
setSharedElementEnterTransition(t);
}
@Override …Run Code Online (Sandbox Code Playgroud) android material-design shared-element-transition android-recyclerview
我正在使用Bluetooth LE设备,正在考虑当前的方法和最佳实践。当前,我有一个处理连接和GattCallbacks的活动,我决定重组代码以得到更好的概览和可维护性,从而使它实际上很混乱。
我从NordicSemiconductor https://github.com/NordicSemiconductor/Android-BLE-Library/找到了BleManager
它是与BLE设备连接的基本步骤的抽象,它处理GattCallbacks +提供适当的接口,以从服务或ViewModel中使用它。
我想使用ViewModel方法,但对MVC,MVP,MVVM模式不太熟悉,有些问题我仍然无法回答
此类扩展了BleManager(BlinkyManager.java)
它显示了如何利用BleManager,因此我采用了该类并对其进行了调用ECountBleManager。
编辑:
最近6天,我确实收获颇多,尤其是面对MVVM模式和体系结构组件。不幸的是,我仍然无法回答很多问题。但是我真的想变得更好,所以我草拟了我当前的概念。希望您能帮助我回答问题并改善我的项目。
我对最佳做法特别感兴趣。
这是我的草稿:
这是我的类实现:
ECountActivity.java
public class ECountActivity extends AppCompatActivity {
private ECountViewModel viewModel;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_view);
// hide magnifier icon
GifImageView customLoader = findViewById(R.id.progressBar);
customLoader.setVisibility(View.GONE);
// Get additional data from previous activity
final BluetoothDevice device = getIntent().getParcelableExtra("device");
initViewModel();
viewModel.connect(device);
}
private void initViewModel() {
viewModel = ViewModelProviders.of(this).get(ECountViewModel.class);
subscribeDataStreams(viewModel);
}
private void subscribeDataStreams(ECountViewModel viewModel) {
viewModel.isDeviceReady().observe(this, deviceReady -> openOptionsFragment()); …Run Code Online (Sandbox Code Playgroud) 我做了一个全新的Windows 10安装,安装了python,cygwin和一个名为ConEmu的改进控制台.安装python 3.4.3后我执行:
pip install -U pip
Run Code Online (Sandbox Code Playgroud)
并得到了这个错误.
File "C:\Anwendungsentwicklung\Python34\lib\site-packages\pip\utils\__init__.py", line 70, in rmtree_errorhandler
os.makedirs(path)
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-dxm8d3xg-uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
Run Code Online (Sandbox Code Playgroud)
我使用预定义的管理员帐户登录,临时目录以及Python的安装目录(C:\ Anwendungsentwicklung\Python34)具有完全访问权限.
请通过设置不同的权限测试所有变体,但Windows不会让我.我甚至在安全选项卡中添加了"Everyone",但这并没有帮助,尽管我记得它正在使用Windows 7进行这种"技巧".它一定是Windows 10的问题.有人可以帮忙吗?
这是完全追溯
Exception:
Traceback (most recent call last):
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 372, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\basecommand.py", line 232, in main
logger.critical('Operation cancelled by user')
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\commands\install.py", line 347, in run
ensure_dir(options.target_dir)
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_set.py", …Run Code Online (Sandbox Code Playgroud)