use of com.ichi2.anki.DeckPicker.CONFIRM_PRIVATE_STRATEGY in project AnkiChinaAndroid by ankichinateam.
the class DeckPicker method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.navigation_activity);
AnkiChinaSyncer.SYNCING = false;
// Toolbar toolbar = findViewById(R.id.toolbar);
// if (toolbar != null) {
// setSupportActionBar(toolbar);
// }
viewPager = findViewById(R.id.viewpager);
viewPager.setUserInputEnabled(false);
// viewPager.setScrolledListener(new CustomScrollViewPager.ScrolledListener() {
// @Override
// public void onScroll() {
// openCardBrowser();
// }
// });
bottomNavigationView = findViewById(R.id.navigation);
bottomNavigationView.setItemIconTintList(null);
BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigationView.getChildAt(0);
mBottomAddMenuIcon = menuView.getChildAt(2).findViewById(com.google.android.material.R.id.navigation_bar_item_icon_view);
// menuView.getItemIconSize()
// mBottomAddMenuIcon =( (NavigationBarItemView)menuView.getChildAt(2)).setIcon();
final ViewGroup.LayoutParams layoutParams = mBottomAddMenuIcon.getLayoutParams();
final DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 37, displayMetrics);
layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 37, displayMetrics);
mBottomAddMenuIcon.setLayoutParams(layoutParams);
restoreWelcomeMessage(savedInstanceState);
registerExternalStorageListener();
SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this);
if (!preferences.contains(CONFIRM_PRIVATE_STRATEGY) && !mShowingPrivateStrategyDialog) {
mShowingPrivateStrategyDialog = true;
new MaterialDialog.Builder(this).title(R.string.collection_load_welcome_request_permissions_title).titleGravity(GravityEnum.CENTER).content(getClickableSpan(this)).negativeText(R.string.dialog_disagree).positiveText(R.string.dialog_agree).onPositive((innerDialog, innerWhich) -> {
preferences.edit().putBoolean(CONFIRM_PRIVATE_STRATEGY, true).apply();
mShowingPrivateStrategyDialog = false;
continueActivity(preferences);
}).positiveColor(ContextCompat.getColor(this, R.color.new_primary_color)).onNegative((innerDialog, innerWhich) -> {
mShowingPrivateStrategyDialog = false;
finishWithoutAnimation();
}).negativeColor(ContextCompat.getColor(this, R.color.new_primary_text_secondary_color)).cancelable(false).canceledOnTouchOutside(false).show();
} else {
continueActivity(preferences);
}
int count = preferences.getInt(START_APP_COUNT, 0);
count++;
if (count == 5) {
CustomStyleDialog customDialog = new CustomStyleDialog.Builder(this).setTitle("给个好评,鼓励一下吧!").setMessage("每一份好评对我们都是极大的鼓励,也是我们持续优化的动力").setPositiveButton("好评鼓励", (dialog, which) -> {
dialog.dismiss();
goAppShop(DeckPicker.this, BuildConfig.APPLICATION_ID, "");
}).setNegativeButton("残忍拒绝", (dialog, which) -> dialog.dismiss()).create();
customDialog.show();
}
preferences.edit().putInt(START_APP_COUNT, count).apply();
}
Aggregations