Search in sources :

Example 21 with DialogCell

use of org.telegram.ui.Cells.DialogCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class SearchViewPager method updateColors.

public void updateColors() {
    for (int i = 0; i < getChildCount(); i++) {
        if (getChildAt(i) instanceof FilteredSearchView) {
            RecyclerListView recyclerListView = ((FilteredSearchView) getChildAt(i)).recyclerListView;
            int count = recyclerListView.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = recyclerListView.getChildAt(a);
                if (child instanceof DialogCell) {
                    ((DialogCell) child).update(0);
                }
            }
        }
    }
    int n = viewsByType.size();
    for (int i = 0; i < n; i++) {
        View v = viewsByType.valueAt(i);
        if (v instanceof FilteredSearchView) {
            RecyclerListView recyclerListView = ((FilteredSearchView) v).recyclerListView;
            int count = recyclerListView.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = recyclerListView.getChildAt(a);
                if (child instanceof DialogCell) {
                    ((DialogCell) child).update(0);
                }
            }
        }
    }
    if (noMediaFiltersSearchView != null) {
        RecyclerListView recyclerListView = noMediaFiltersSearchView.recyclerListView;
        int count = recyclerListView.getChildCount();
        for (int a = 0; a < count; a++) {
            View child = recyclerListView.getChildAt(a);
            if (child instanceof DialogCell) {
                ((DialogCell) child).update(0);
            }
        }
    }
}
Also used : FilteredSearchView(org.telegram.ui.FilteredSearchView) DialogCell(org.telegram.ui.Cells.DialogCell) FiltersView(org.telegram.ui.Adapters.FiltersView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) FilteredSearchView(org.telegram.ui.FilteredSearchView)

Example 22 with DialogCell

use of org.telegram.ui.Cells.DialogCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class ThemePreviewActivity method didReceivedNotification.

@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.emojiLoaded) {
        if (listView == null) {
            return;
        }
        int count = listView.getChildCount();
        for (int a = 0; a < count; a++) {
            View child = listView.getChildAt(a);
            if (child instanceof DialogCell) {
                DialogCell cell = (DialogCell) child;
                cell.update(0);
            }
        }
    } else if (id == NotificationCenter.invalidateMotionBackground) {
        if (listView2 != null) {
            listView2.invalidateViews();
        }
    } else if (id == NotificationCenter.didSetNewWallpapper) {
        if (page2 != null) {
            setCurrentImage(true);
        }
    } else if (id == NotificationCenter.wallpapersNeedReload) {
        if (currentWallpaper instanceof WallpapersListActivity.FileWallpaper) {
            WallpapersListActivity.FileWallpaper fileWallpaper = (WallpapersListActivity.FileWallpaper) currentWallpaper;
            if (fileWallpaper.slug == null) {
                fileWallpaper.slug = (String) args[0];
            }
        }
    } else if (id == NotificationCenter.wallpapersDidLoad) {
        ArrayList<TLRPC.WallPaper> arrayList = (ArrayList<TLRPC.WallPaper>) args[0];
        patterns.clear();
        patternsDict.clear();
        boolean added = false;
        for (int a = 0, N = arrayList.size(); a < N; a++) {
            TLRPC.WallPaper wallPaper = arrayList.get(a);
            if (wallPaper instanceof TLRPC.TL_wallPaper && wallPaper.pattern) {
                if (wallPaper.document != null && !patternsDict.containsKey(wallPaper.document.id)) {
                    patterns.add(wallPaper);
                    patternsDict.put(wallPaper.document.id, wallPaper);
                }
                if (accent != null && accent.patternSlug.equals(wallPaper.slug)) {
                    selectedPattern = (TLRPC.TL_wallPaper) wallPaper;
                    added = true;
                    setCurrentImage(false);
                    updateButtonState(false, false);
                } else if (accent == null && selectedPattern != null && selectedPattern.slug.equals(wallPaper.slug)) {
                    added = true;
                }
            }
        }
        if (!added && selectedPattern != null) {
            patterns.add(0, selectedPattern);
        }
        if (patternsAdapter != null) {
            patternsAdapter.notifyDataSetChanged();
        }
        long acc = 0;
        for (int a = 0, N = arrayList.size(); a < N; a++) {
            TLRPC.WallPaper wallPaper = arrayList.get(a);
            if (wallPaper instanceof TLRPC.TL_wallPaper) {
                acc = MediaDataController.calcHash(acc, wallPaper.id);
            }
        }
        TLRPC.TL_account_getWallPapers req = new TLRPC.TL_account_getWallPapers();
        req.hash = acc;
        int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
            if (response instanceof TLRPC.TL_account_wallPapers) {
                TLRPC.TL_account_wallPapers res = (TLRPC.TL_account_wallPapers) response;
                patterns.clear();
                patternsDict.clear();
                boolean added2 = false;
                for (int a = 0, N = res.wallpapers.size(); a < N; a++) {
                    if (!(res.wallpapers.get(a) instanceof TLRPC.TL_wallPaper)) {
                        continue;
                    }
                    TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) res.wallpapers.get(a);
                    if (wallPaper.pattern) {
                        if (wallPaper.document != null && !patternsDict.containsKey(wallPaper.document.id)) {
                            patterns.add(wallPaper);
                            patternsDict.put(wallPaper.document.id, wallPaper);
                        }
                        if (accent != null && accent.patternSlug.equals(wallPaper.slug)) {
                            selectedPattern = wallPaper;
                            added2 = true;
                            setCurrentImage(false);
                            updateButtonState(false, false);
                        } else if (accent == null && selectedPattern != null && selectedPattern.slug.equals(wallPaper.slug)) {
                            added2 = true;
                        }
                    }
                }
                if (!added2 && selectedPattern != null) {
                    patterns.add(0, selectedPattern);
                }
                if (patternsAdapter != null) {
                    patternsAdapter.notifyDataSetChanged();
                }
                MessagesStorage.getInstance(currentAccount).putWallpapers(res.wallpapers, 1);
            }
            if (selectedPattern == null && accent != null && !TextUtils.isEmpty(accent.patternSlug)) {
                TLRPC.TL_account_getWallPaper req2 = new TLRPC.TL_account_getWallPaper();
                TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
                inputWallPaperSlug.slug = accent.patternSlug;
                req2.wallpaper = inputWallPaperSlug;
                int reqId2 = getConnectionsManager().sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> {
                    if (response1 instanceof TLRPC.TL_wallPaper) {
                        TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) response1;
                        if (wallPaper.pattern) {
                            selectedPattern = wallPaper;
                            setCurrentImage(false);
                            updateButtonState(false, false);
                            patterns.add(0, selectedPattern);
                            if (patternsAdapter != null) {
                                patternsAdapter.notifyDataSetChanged();
                            }
                        }
                    }
                }));
                ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId2, classGuid);
            }
        }));
        ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
    }
}
Also used : SvgHelper(org.telegram.messenger.SvgHelper) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) MediaActionDrawable(org.telegram.ui.Components.MediaActionDrawable) StateListAnimator(android.animation.StateListAnimator) Shader(android.graphics.Shader) Canvas(android.graphics.Canvas) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) UndoView(org.telegram.ui.Components.UndoView) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) NotificationCenter(org.telegram.messenger.NotificationCenter) MenuDrawable(org.telegram.ui.ActionBar.MenuDrawable) Outline(android.graphics.Outline) TextPaint(android.text.TextPaint) HintView(org.telegram.ui.Components.HintView) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Paint(android.graphics.Paint) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) FileLoader(org.telegram.messenger.FileLoader) ViewPager(androidx.viewpager.widget.ViewPager) SystemClock(android.os.SystemClock) AlertsCreator(org.telegram.ui.Components.AlertsCreator) BackgroundGradientDrawable(org.telegram.ui.Components.BackgroundGradientDrawable) ArrayList(java.util.ArrayList) TLRPC(org.telegram.tgnet.TLRPC) GradientDrawable(android.graphics.drawable.GradientDrawable) ColorPicker(org.telegram.ui.Components.ColorPicker) DialogCell(org.telegram.ui.Cells.DialogCell) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) R(org.telegram.messenger.R) FileOutputStream(java.io.FileOutputStream) TextUtils(android.text.TextUtils) File(java.io.File) Gravity(android.view.Gravity) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) MessagesStorage(org.telegram.messenger.MessagesStorage) Configuration(android.content.res.Configuration) WallpaperParallaxEffect(org.telegram.ui.Components.WallpaperParallaxEffect) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) EditText(android.widget.EditText) ThemeDescription(org.telegram.ui.ActionBar.ThemeDescription) Rect(android.graphics.Rect) ActionBarMenuItem(org.telegram.ui.ActionBar.ActionBarMenuItem) RadialProgress2(org.telegram.ui.Components.RadialProgress2) WallpaperCheckBoxView(org.telegram.ui.Components.WallpaperCheckBoxView) AndroidUtilities(org.telegram.messenger.AndroidUtilities) CubicBezierInterpolator(org.telegram.ui.Components.CubicBezierInterpolator) Animator(android.animation.Animator) ApplicationLoader(org.telegram.messenger.ApplicationLoader) PatternCell(org.telegram.ui.Cells.PatternCell) MediaController(org.telegram.messenger.MediaController) View(android.view.View) ChatMessageCell(org.telegram.ui.Cells.ChatMessageCell) RecyclerView(androidx.recyclerview.widget.RecyclerView) DataSetObserver(android.database.DataSetObserver) RectF(android.graphics.RectF) ImageLoader(org.telegram.messenger.ImageLoader) Utilities(org.telegram.messenger.Utilities) ObjectAnimator(android.animation.ObjectAnimator) ImageLocation(org.telegram.messenger.ImageLocation) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) BitmapDrawable(android.graphics.drawable.BitmapDrawable) ChatActionCell(org.telegram.ui.Cells.ChatActionCell) PorterDuff(android.graphics.PorterDuff) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) BackDrawable(org.telegram.ui.ActionBar.BackDrawable) ViewGroup(android.view.ViewGroup) ShareAlert(org.telegram.ui.Components.ShareAlert) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) UserConfig(org.telegram.messenger.UserConfig) List(java.util.List) TextView(android.widget.TextView) MotionBackgroundDrawable(org.telegram.ui.Components.MotionBackgroundDrawable) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Theme(org.telegram.ui.ActionBar.Theme) PagerAdapter(androidx.viewpager.widget.PagerAdapter) ViewOutlineProvider(android.view.ViewOutlineProvider) LocaleController(org.telegram.messenger.LocaleController) HashMap(java.util.HashMap) HeaderCell(org.telegram.ui.Cells.HeaderCell) SuppressLint(android.annotation.SuppressLint) MotionEvent(android.view.MotionEvent) ActionBar(org.telegram.ui.ActionBar.ActionBar) AnimatorSet(android.animation.AnimatorSet) MessageObject(org.telegram.messenger.MessageObject) SharedConfig(org.telegram.messenger.SharedConfig) BuildVars(org.telegram.messenger.BuildVars) MediaDataController(org.telegram.messenger.MediaDataController) Build(android.os.Build) SeekBarView(org.telegram.ui.Components.SeekBarView) DownloadController(org.telegram.messenger.DownloadController) DialogInterface(android.content.DialogInterface) LongSparseArray(androidx.collection.LongSparseArray) BackupImageView(org.telegram.ui.Components.BackupImageView) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FileLog(org.telegram.messenger.FileLog) MessagesController(org.telegram.messenger.MessagesController) BlendMode(android.graphics.BlendMode) Bitmap(android.graphics.Bitmap) ViewTreeObserver(android.view.ViewTreeObserver) Activity(android.app.Activity) ImageReceiver(org.telegram.messenger.ImageReceiver) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LoadingCell(org.telegram.ui.Cells.LoadingCell) ArrayList(java.util.ArrayList) TLRPC(org.telegram.tgnet.TLRPC) DialogCell(org.telegram.ui.Cells.DialogCell) ImageView(android.widget.ImageView) UndoView(org.telegram.ui.Components.UndoView) HintView(org.telegram.ui.Components.HintView) WallpaperCheckBoxView(org.telegram.ui.Components.WallpaperCheckBoxView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) SeekBarView(org.telegram.ui.Components.SeekBarView) BackupImageView(org.telegram.ui.Components.BackupImageView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint)

Aggregations

DialogCell (org.telegram.ui.Cells.DialogCell)22 View (android.view.View)19 RecyclerView (androidx.recyclerview.widget.RecyclerView)12 RecyclerListView (org.telegram.ui.Components.RecyclerListView)11 TextView (android.widget.TextView)8 FlickerLoadingView (org.telegram.ui.Components.FlickerLoadingView)8 ImageView (android.widget.ImageView)7 ArrayList (java.util.ArrayList)7 TLRPC (org.telegram.tgnet.TLRPC)7 HintDialogCell (org.telegram.ui.Cells.HintDialogCell)7 SuppressLint (android.annotation.SuppressLint)6 Paint (android.graphics.Paint)6 TextPaint (android.text.TextPaint)6 FiltersView (org.telegram.ui.Adapters.FiltersView)6 ProfileSearchCell (org.telegram.ui.Cells.ProfileSearchCell)6 Theme (org.telegram.ui.ActionBar.Theme)5 BackupImageView (org.telegram.ui.Components.BackupImageView)5 ChatActivityEnterView (org.telegram.ui.Components.ChatActivityEnterView)5 FragmentContextView (org.telegram.ui.Components.FragmentContextView)5 NumberTextView (org.telegram.ui.Components.NumberTextView)5