Esempio n. 1
0
  private void setupNavigationView() {

    NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(
        new NavigationView.OnNavigationItemSelectedListener() {

          @Override
          public boolean onNavigationItemSelected(MenuItem item) {
            switch (item.getItemId()) {
              case R.id.nav_profile:
                fragmentManager.beginTransaction().replace(R.id.frame_layout, fragment1).commit();
                break;
              case R.id.nav_settings:
                fragmentManager.beginTransaction().replace(R.id.frame_layout, fragment2).commit();
                break;
              case R.id.nav_social:
                fragmentManager.beginTransaction().replace(R.id.frame_layout, fragment3).commit();
                break;
              default:
                break;
            }

            drawerLayout.closeDrawers();
            return true;
          }
        });

    navigationView.setItemIconTintList(ContextCompat.getColorStateList(this, R.color.my_icon_tint));
    navigationView.setItemTextColor(ContextCompat.getColorStateList(this, R.color.my_icon_tint));
    navigationView.setItemTextAppearance(R.style.myNavigationText);
  }
Esempio n. 2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   AppController.getController().getBus().register(this);
   manager = new GridLayoutManager(this, getResources().getInteger(R.integer.num_row));
   recycler.setItemAnimator(new DefaultItemAnimator());
   recycler.setHasFixedSize(true);
   recycler.setLayoutManager(manager);
   mDrawerLayout.setStatusBarBackgroundColor(
       AppHelper.getPrimaryDarkColor(AppHelper.getPrimaryColor(this)));
   navigationView.setItemIconTintList(ColorStateList.valueOf(AppHelper.getAccentColor(this)));
   if (AppHelper.isDarkTheme(this)) {
     navigationView.setItemTextColor(ColorStateList.valueOf(AppHelper.getAccentColor(this)));
   }
   adapter = new AppsAdapter(this, new ArrayList<AppsModel>());
   recycler.setAdapter(adapter);
   mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
   if (navigationView != null) {
     setupDrawerContent(navigationView);
   }
   getLoaderManager().restartLoader(0, null, this);
   productsList.addAll(Arrays.asList(getResources().getStringArray(R.array.in_app_billing)));
   mHelper = new IabHelper(this, getString(R.string.base64));
   mHelper.startSetup(mPurchaseFinishedListener);
   showWhatsNew();
   countBackup();
 }
Esempio n. 3
0
 public static void updateNavigationItemTint(NavigationView navigationView, int primaryColorRes) {
   Context context = navigationView.getContext();
   int primaryColor = ContextCompat.getColor(context, primaryColorRes);
   navigationView.setItemIconTintList(
       createNavigationItemTintList(android.R.attr.textColorSecondary, primaryColor, context));
   navigationView.setItemTextColor(
       createNavigationItemTintList(android.R.attr.textColorPrimary, primaryColor, context));
 }