Search in sources :

Example 21 with BadgeDrawable

use of com.google.android.material.badge.BadgeDrawable in project ScoreCounter by n-apps.

the class MainActivity method hideDiceBadge.

private void hideDiceBadge() {
    BadgeDrawable badge = bottomNavigationBar.getBadge(R.id.dices);
    if (badge != null) {
        badge.setVisible(false);
        badge.clearNumber();
    }
}
Also used : BadgeDrawable(com.google.android.material.badge.BadgeDrawable)

Example 22 with BadgeDrawable

use of com.google.android.material.badge.BadgeDrawable in project Hentoid by avluis.

the class QueueActivity method onQueueChanged.

private void onQueueChanged(List<QueueRecord> result) {
    // Update queue tab
    if (result.isEmpty())
        queueTab.removeBadge();
    else {
        BadgeDrawable badge = queueTab.getOrCreateBadge();
        badge.setVisible(true);
        badge.setNumber(result.size());
    }
}
Also used : BadgeDrawable(com.google.android.material.badge.BadgeDrawable)

Example 23 with BadgeDrawable

use of com.google.android.material.badge.BadgeDrawable in project Hentoid by avluis.

the class BaseWebActivity method onSearchForExtraImagesSuccess.

private void onSearchForExtraImagesSuccess(@NonNull final Content storedContent, @NonNull final Content onlineContent, @NonNull final List<ImageFile> additionalImages) {
    searchExtraImagesdisposable.dispose();
    progressBar.setProgress(progressBar.getMax());
    progressBar.setVisibility(View.VISIBLE);
    progressBar.setProgressTintList(ColorStateList.valueOf(getResources().getColor(R.color.green)));
    if (null == currentContent || additionalImages.isEmpty())
        return;
    if (currentContent.getUrl().equalsIgnoreCase(onlineContent.getUrl()) || duplicateId == storedContent.getId()) {
        // User hasn't left the book page since
        // Retrieve the URLs of stored pages
        Set<String> storedUrls = new HashSet<>();
        if (storedContent.getImageFiles() != null) {
            storedUrls.addAll(Stream.of(storedContent.getImageFiles()).filter(i -> ContentHelper.isInLibrary(i.getStatus())).map(ImageFile::getUrl).toList());
        }
        // Display the "download more" button only if extra images URLs aren't duplicates
        List<ImageFile> additionalNonDownloadedImages = Stream.of(additionalImages).filterNot(i -> storedUrls.contains(i.getUrl())).toList();
        if (!additionalNonDownloadedImages.isEmpty()) {
            extraImages = additionalNonDownloadedImages;
            setActionMode(ActionMode.DOWNLOAD_PLUS);
            BadgeDrawable badge = bottomToolbar.getOrCreateBadge(R.id.web_menu_action);
            badge.setNumber(additionalNonDownloadedImages.size());
        }
    }
}
Also used : JavascriptInterface(android.webkit.JavascriptInterface) Bundle(android.os.Bundle) QueueActivity(me.devsaki.hentoid.activities.QueueActivity) ProgressBar(android.widget.ProgressBar) NonNull(androidx.annotation.NonNull) ImageView(android.widget.ImageView) NestedScrollWebView(me.devsaki.hentoid.views.NestedScrollWebView) Chapter(me.devsaki.hentoid.database.domains.Chapter) BadgeDrawable(com.google.android.material.badge.BadgeDrawable) ColorStateList(android.content.res.ColorStateList) Site(me.devsaki.hentoid.enums.Site) CookieManager(android.webkit.CookieManager) Handler(android.os.Handler) Map(java.util.Map) ImageFile(me.devsaki.hentoid.database.domains.ImageFile) ResponseBody(okhttp3.ResponseBody) CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) Set(java.util.Set) ToastHelper(me.devsaki.hentoid.util.ToastHelper) HttpHelper(me.devsaki.hentoid.util.network.HttpHelper) SiteBookmark(me.devsaki.hentoid.database.domains.SiteBookmark) StringRes(androidx.annotation.StringRes) Message(android.os.Message) QUEUE_NEW_DOWNLOADS_POSITION_TOP(me.devsaki.hentoid.util.Preferences.Constant.QUEUE_NEW_DOWNLOADS_POSITION_TOP) QUEUE_NEW_DOWNLOADS_POSITION_BOTTOM(me.devsaki.hentoid.util.Preferences.Constant.QUEUE_NEW_DOWNLOADS_POSITION_BOTTOM) SiteHistory(me.devsaki.hentoid.database.domains.SiteHistory) Stream(com.annimon.stream.Stream) PrefsBundle(me.devsaki.hentoid.activities.bundles.PrefsBundle) BookmarksDialogFragment(me.devsaki.hentoid.fragments.web.BookmarksDialogFragment) AddQueueMenu(me.devsaki.hentoid.widget.AddQueueMenu) ArrayList(java.util.ArrayList) TooltipHelper(me.devsaki.hentoid.util.TooltipHelper) RQST_STORAGE_PERMISSION(me.devsaki.hentoid.util.PermissionHelper.RQST_STORAGE_PERMISSION) WebSettings(android.webkit.WebSettings) DownloadPreparationEvent(me.devsaki.hentoid.events.DownloadPreparationEvent) Helper(me.devsaki.hentoid.util.Helper) Instant(org.threeten.bp.Instant) DuplicateHelper(me.devsaki.hentoid.util.DuplicateHelper) Response(okhttp3.Response) PermissionHelper(me.devsaki.hentoid.util.PermissionHelper) WebChromeClient(android.webkit.WebChromeClient) ContentParserFactory(me.devsaki.hentoid.parsers.ContentParserFactory) ErrorRecord(me.devsaki.hentoid.database.domains.ErrorRecord) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) TextUtils(android.text.TextUtils) IOException(java.io.IOException) ImageListParser(me.devsaki.hentoid.parsers.images.ImageListParser) BiConsumer(com.annimon.stream.function.BiConsumer) WebHistoryItem(android.webkit.WebHistoryItem) ArrowOrientation(com.skydoves.balloon.ArrowOrientation) R(me.devsaki.hentoid.R) SharedPreferences(android.content.SharedPreferences) Content(me.devsaki.hentoid.database.domains.Content) WindowManager(android.view.WindowManager) DrawableRes(androidx.annotation.DrawableRes) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) AlertStatus(me.devsaki.hentoid.enums.AlertStatus) ContentHelper(me.devsaki.hentoid.util.ContentHelper) Optional(com.annimon.stream.Optional) BuildConfig(me.devsaki.hentoid.BuildConfig) StringHelper(me.devsaki.hentoid.util.StringHelper) View(android.view.View) WebBackForwardList(android.webkit.WebBackForwardList) Schedulers(io.reactivex.schedulers.Schedulers) WebView(android.webkit.WebView) BaseWebActivityBundle(me.devsaki.hentoid.activities.bundles.BaseWebActivityBundle) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) BaseActivity(me.devsaki.hentoid.activities.BaseActivity) DownloadEvent(me.devsaki.hentoid.events.DownloadEvent) ThreadMode(org.greenrobot.eventbus.ThreadMode) Animatable(android.graphics.drawable.Animatable) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) List(java.util.List) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) Toolbar(androidx.appcompat.widget.Toolbar) CollectionDAO(me.devsaki.hentoid.database.CollectionDAO) ErrorType(me.devsaki.hentoid.enums.ErrorType) UpdateEvent(me.devsaki.hentoid.events.UpdateEvent) InputDialog(me.devsaki.hentoid.ui.InputDialog) DuplicateDialogFragment(me.devsaki.hentoid.fragments.web.DuplicateDialogFragment) LibraryActivity(me.devsaki.hentoid.activities.LibraryActivity) KeyEvent(android.view.KeyEvent) Preferences(me.devsaki.hentoid.util.Preferences) Pair(android.util.Pair) ToOne(io.objectbox.relation.ToOne) Intent(android.content.Intent) HashMap(java.util.HashMap) PrefsActivity(me.devsaki.hentoid.activities.PrefsActivity) IntDef(androidx.annotation.IntDef) Single(io.reactivex.Single) QueueActivityBundle(me.devsaki.hentoid.activities.bundles.QueueActivityBundle) StatusContent(me.devsaki.hentoid.enums.StatusContent) MenuItem(android.view.MenuItem) Retention(java.lang.annotation.Retention) HashSet(java.util.HashSet) SuppressLint(android.annotation.SuppressLint) QUEUE_NEW_DOWNLOADS_POSITION_ASK(me.devsaki.hentoid.util.Preferences.Constant.QUEUE_NEW_DOWNLOADS_POSITION_ASK) EventBus(org.greenrobot.eventbus.EventBus) UpdateInfo(me.devsaki.hentoid.json.core.UpdateInfo) ContentQueueManager(me.devsaki.hentoid.util.download.ContentQueueManager) FileHelper(me.devsaki.hentoid.util.FileHelper) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ObjectBoxDAO(me.devsaki.hentoid.database.ObjectBoxDAO) Subscribe(org.greenrobot.eventbus.Subscribe) Bitmap(android.graphics.Bitmap) Collections(java.util.Collections) Resources(android.content.res.Resources) InputStream(java.io.InputStream) RetentionPolicy(java.lang.annotation.RetentionPolicy) BadgeDrawable(com.google.android.material.badge.BadgeDrawable) ImageFile(me.devsaki.hentoid.database.domains.ImageFile) HashSet(java.util.HashSet)

Example 24 with BadgeDrawable

use of com.google.android.material.badge.BadgeDrawable in project GreenHouse by utsanjan.

the class BottomNavigationItemView method onInitializeAccessibilityNodeInfo.

// android.view.View
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    BadgeDrawable badgeDrawable = this.badgeDrawable;
    if (badgeDrawable != null && badgeDrawable.isVisible()) {
        CharSequence customContentDescription = this.itemData.getTitle();
        if (!TextUtils.isEmpty(this.itemData.getContentDescription())) {
            customContentDescription = this.itemData.getContentDescription();
        }
        info.setContentDescription(((Object) customContentDescription) + ", " + ((Object) this.badgeDrawable.getContentDescription()));
    }
}
Also used : BadgeDrawable(com.google.android.material.badge.BadgeDrawable)

Example 25 with BadgeDrawable

use of com.google.android.material.badge.BadgeDrawable in project GreenHouse by utsanjan.

the class BottomNavigationMenuView method removeBadge.

/* JADX INFO: Access modifiers changed from: package-private */
public void removeBadge(int menuItemId) {
    validateMenuItemId(menuItemId);
    BadgeDrawable badgeDrawable = this.badgeDrawables.get(menuItemId);
    BottomNavigationItemView itemView = findItemView(menuItemId);
    if (itemView != null) {
        itemView.removeBadge();
    }
    if (badgeDrawable != null) {
        this.badgeDrawables.remove(menuItemId);
    }
}
Also used : BadgeDrawable(com.google.android.material.badge.BadgeDrawable)

Aggregations

BadgeDrawable (com.google.android.material.badge.BadgeDrawable)34 MenuItem (android.view.MenuItem)7 BottomNavigationView (com.google.android.material.bottomnavigation.BottomNavigationView)7 SuppressLint (android.annotation.SuppressLint)5 TabLayout (com.google.android.material.tabs.TabLayout)5 View (android.view.View)4 TextView (android.widget.TextView)4 Bundle (android.os.Bundle)3 ViewGroup (android.view.ViewGroup)3 ImageView (android.widget.ImageView)3 NonNull (androidx.annotation.NonNull)3 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 Resources (android.content.res.Resources)2 Bitmap (android.graphics.Bitmap)2 Handler (android.os.Handler)2 Message (android.os.Message)2 TextUtils (android.text.TextUtils)2 KeyEvent (android.view.KeyEvent)2 WindowManager (android.view.WindowManager)2