@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(); }
@Override protected void onDestroy() { if (AppController.getController().getBus().isRegistered(this)) { AppController.getController().getBus().unregister(this); } if (mHelper != null) mHelper.dispose(); mHelper = null; super.onDestroy(); }
@Override public void onRequestPermissionsResult( int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_STORAGE) { if (verifyPermissions(grantResults)) { Snackbar.make( findViewById(R.id.toolbar), "Permission Granted, you may continue using" + " this function now.", Snackbar.LENGTH_LONG) .show(); } else { Snackbar.make( findViewById(R.id.toolbar), "Permission Denied, you may not be able to " + "use this functionality", Snackbar.LENGTH_LONG) .show(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (!mHelper.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } }