use of com.yydcdut.noteplugin.adapter.NavigationAdapter in project PhotoNoter by yydcdut.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
mToolbar.setTitle("");
AppCompat.setElevation(mToolbar, getResources().getDimension(R.dimen.ui_elevation));
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerLayout.setDrawerListener(toggle);
toggle.syncState();
mNavigationView.setNavigationItemSelectedListener(this);
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
PackageManager pm = getPackageManager();
List<ResolveInfo> info = pm.queryIntentActivities(intent, 0);
List<GalleryApp> galleryAppList = new ArrayList<>(info.size());
for (int i = 0; i < info.size(); i++) {
ActivityInfo activityInfo = info.get(i).activityInfo;
galleryAppList.add(new GalleryApp(activityInfo.loadIcon(getPackageManager()), activityInfo.packageName, activityInfo.loadLabel(getPackageManager()) + ""));
}
for (int i = 0; i < mNavigationView.getChildCount(); i++) {
View view = mNavigationView.getChildAt(i);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
mNavigationAdapter = new NavigationAdapter(recyclerView.getAdapter(), galleryAppList, this);
recyclerView.setAdapter(mNavigationAdapter);
}
}
FragmentManager fragmentManager = getSupportFragmentManager();
mMediaPhotoFragment = MediaPhotoFragment.newInstance();
fragmentManager.beginTransaction().replace(R.id.layout_photo, mMediaPhotoFragment).commit();
}
Aggregations