use of com.google.android.material.bottomnavigation.BottomNavigationMenuView in project android-chat by wildfirechat.
the class MainActivity method showUnreadMessageBadgeView.
private void showUnreadMessageBadgeView(int count) {
if (unreadMessageUnreadBadgeView == null) {
BottomNavigationMenuView bottomNavigationMenuView = ((BottomNavigationMenuView) bottomNavigationView.getChildAt(0));
View view = bottomNavigationMenuView.getChildAt(0);
unreadMessageUnreadBadgeView = new QBadgeView(MainActivity.this);
unreadMessageUnreadBadgeView.bindTarget(view);
}
unreadMessageUnreadBadgeView.setBadgeNumber(count);
}
use of com.google.android.material.bottomnavigation.BottomNavigationMenuView in project android-chat by wildfirechat.
the class MainActivity method updateMomentBadgeView.
private void updateMomentBadgeView() {
if (!WfcUIKit.getWfcUIKit().isSupportMoment()) {
return;
}
List<Message> messages = ChatManager.Instance().getMessagesEx2(Collections.singletonList(Conversation.ConversationType.Single), Collections.singletonList(1), Arrays.asList(MessageStatus.Unread), 0, true, 100, null);
int count = messages == null ? 0 : messages.size();
if (count > 0) {
if (discoveryBadgeView == null) {
BottomNavigationMenuView bottomNavigationMenuView = ((BottomNavigationMenuView) bottomNavigationView.getChildAt(0));
View view = bottomNavigationMenuView.getChildAt(2);
discoveryBadgeView = new QBadgeView(MainActivity.this);
discoveryBadgeView.bindTarget(view);
}
discoveryBadgeView.setBadgeNumber(count);
} else {
if (discoveryBadgeView != null) {
discoveryBadgeView.hide(true);
discoveryBadgeView = null;
}
}
}
use of com.google.android.material.bottomnavigation.BottomNavigationMenuView in project android-chat by wildfirechat.
the class MainActivity method showUnreadFriendRequestBadgeView.
private void showUnreadFriendRequestBadgeView(int count) {
if (unreadFriendRequestBadgeView == null) {
BottomNavigationMenuView bottomNavigationMenuView = ((BottomNavigationMenuView) bottomNavigationView.getChildAt(0));
View view = bottomNavigationMenuView.getChildAt(1);
unreadFriendRequestBadgeView = new QBadgeView(MainActivity.this);
unreadFriendRequestBadgeView.bindTarget(view);
}
unreadFriendRequestBadgeView.setBadgeNumber(count);
}
use of com.google.android.material.bottomnavigation.BottomNavigationMenuView in project BaseProject by fly803.
the class BottomNavigationViewHelper method disableShiftMode.
@SuppressLint({ "RestrictedApi", "WrongConstant" })
public static void disableShiftMode(BottomNavigationView navigationView) {
BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
try {
Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
shiftingMode.setAccessible(true);
shiftingMode.setBoolean(menuView, false);
shiftingMode.setAccessible(false);
for (int i = 0; i < menuView.getChildCount(); i++) {
BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
itemView.setLabelVisibilityMode(0);
itemView.setShifting(false);
// itemView.setShiftingMode(false);
itemView.setChecked(itemView.getItemData().isChecked());
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
use of com.google.android.material.bottomnavigation.BottomNavigationMenuView 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