Search in sources :

Example 1 with DrawerLayoutContainer

use of org.telegram.ui.ActionBar.DrawerLayoutContainer in project Telegram-FOSS by Telegram-FOSS-Team.

the class BubbleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    ApplicationLoader.postInitApplication();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(R.style.Theme_TMessages);
    getWindow().setBackgroundDrawableResource(R.drawable.transparent);
    if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
        try {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
    super.onCreate(savedInstanceState);
    if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.appLocked) {
        SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000);
    }
    AndroidUtilities.fillStatusBarHeight(this);
    Theme.createDialogsResources(this);
    Theme.createChatResources(this, false);
    actionBarLayout = new ActionBarLayout(this);
    actionBarLayout.setInBubbleMode(true);
    actionBarLayout.setRemoveActionBarExtraHeight(true);
    drawerLayoutContainer = new DrawerLayoutContainer(this);
    drawerLayoutContainer.setAllowOpenDrawer(false, false);
    setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    RelativeLayout launchLayout = new RelativeLayout(this);
    drawerLayoutContainer.addView(launchLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    launchLayout.addView(actionBarLayout, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
    actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
    actionBarLayout.init(mainFragmentsStack);
    actionBarLayout.setDelegate(this);
    passcodeView = new PasscodeView(this);
    drawerLayoutContainer.addView(passcodeView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeOtherAppActivities, this);
    actionBarLayout.removeAllFragments();
    handleIntent(getIntent(), false, savedInstanceState != null, false, UserConfig.selectedAccount, 0);
}
Also used : ViewGroup(android.view.ViewGroup) RelativeLayout(android.widget.RelativeLayout) PasscodeView(org.telegram.ui.Components.PasscodeView) DrawerLayoutContainer(org.telegram.ui.ActionBar.DrawerLayoutContainer) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout)

Example 2 with DrawerLayoutContainer

use of org.telegram.ui.ActionBar.DrawerLayoutContainer in project Telegram-FOSS by Telegram-FOSS-Team.

the class ExternalActionActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    ApplicationLoader.postInitApplication();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(R.style.Theme_TMessages);
    getWindow().setBackgroundDrawableResource(R.drawable.transparent);
    if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
        try {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
    super.onCreate(savedInstanceState);
    if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.appLocked) {
        SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000);
    }
    AndroidUtilities.fillStatusBarHeight(this);
    Theme.createDialogsResources(this);
    Theme.createChatResources(this, false);
    actionBarLayout = new ActionBarLayout(this);
    drawerLayoutContainer = new DrawerLayoutContainer(this);
    drawerLayoutContainer.setAllowOpenDrawer(false, false);
    setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (AndroidUtilities.isTablet()) {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        RelativeLayout launchLayout = new RelativeLayout(this);
        drawerLayoutContainer.addView(launchLayout);
        FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) launchLayout.getLayoutParams();
        layoutParams1.width = LayoutHelper.MATCH_PARENT;
        layoutParams1.height = LayoutHelper.MATCH_PARENT;
        launchLayout.setLayoutParams(layoutParams1);
        backgroundTablet = new SizeNotifierFrameLayout(this) {

            @Override
            protected boolean isActionBarVisible() {
                return false;
            }
        };
        backgroundTablet.setOccupyStatusBar(false);
        backgroundTablet.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
        launchLayout.addView(backgroundTablet, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        launchLayout.addView(actionBarLayout, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        FrameLayout shadowTablet = new FrameLayout(this);
        shadowTablet.setBackgroundColor(0x7F000000);
        launchLayout.addView(shadowTablet, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        shadowTablet.setOnTouchListener((v, event) -> {
            if (!actionBarLayout.fragmentsStack.isEmpty() && event.getAction() == MotionEvent.ACTION_UP) {
                float x = event.getX();
                float y = event.getY();
                int[] location = new int[2];
                layersActionBarLayout.getLocationOnScreen(location);
                int viewX = location[0];
                int viewY = location[1];
                if (layersActionBarLayout.checkTransitionAnimation() || x > viewX && x < viewX + layersActionBarLayout.getWidth() && y > viewY && y < viewY + layersActionBarLayout.getHeight()) {
                    return false;
                } else {
                    if (!layersActionBarLayout.fragmentsStack.isEmpty()) {
                        for (int a = 0; a < layersActionBarLayout.fragmentsStack.size() - 1; a++) {
                            layersActionBarLayout.removeFragmentFromStack(layersActionBarLayout.fragmentsStack.get(0));
                            a--;
                        }
                        layersActionBarLayout.closeLastFragment(true);
                    }
                    return true;
                }
            }
            return false;
        });
        shadowTablet.setOnClickListener(v -> {
        });
        layersActionBarLayout = new ActionBarLayout(this);
        layersActionBarLayout.setRemoveActionBarExtraHeight(true);
        layersActionBarLayout.setBackgroundView(shadowTablet);
        layersActionBarLayout.setUseAlphaAnimations(true);
        layersActionBarLayout.setBackgroundResource(R.drawable.boxshadow);
        launchLayout.addView(layersActionBarLayout, LayoutHelper.createRelative(530, (AndroidUtilities.isSmallTablet() ? 528 : 700)));
        layersActionBarLayout.init(layerFragmentsStack);
        layersActionBarLayout.setDelegate(this);
        layersActionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
    } else {
        RelativeLayout launchLayout = new RelativeLayout(this);
        drawerLayoutContainer.addView(launchLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        backgroundTablet = new SizeNotifierFrameLayout(this) {

            @Override
            protected boolean isActionBarVisible() {
                return false;
            }
        };
        backgroundTablet.setOccupyStatusBar(false);
        backgroundTablet.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
        launchLayout.addView(backgroundTablet, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        launchLayout.addView(actionBarLayout, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    }
    // drawerLayoutContainer.setDrawerLayout(listView);
    drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
    actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
    actionBarLayout.init(mainFragmentsStack);
    actionBarLayout.setDelegate(this);
    passcodeView = new PasscodeView(this);
    drawerLayoutContainer.addView(passcodeView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeOtherAppActivities, this);
    actionBarLayout.removeAllFragments();
    if (layersActionBarLayout != null) {
        layersActionBarLayout.removeAllFragments();
    }
    handleIntent(getIntent(), false, savedInstanceState != null, false, UserConfig.selectedAccount, 0);
    needLayout();
}
Also used : ViewGroup(android.view.ViewGroup) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) PasscodeView(org.telegram.ui.Components.PasscodeView) DrawerLayoutContainer(org.telegram.ui.ActionBar.DrawerLayoutContainer) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout) FrameLayout(android.widget.FrameLayout) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) RelativeLayout(android.widget.RelativeLayout)

Example 3 with DrawerLayoutContainer

use of org.telegram.ui.ActionBar.DrawerLayoutContainer in project Telegram-FOSS by Telegram-FOSS-Team.

the class LaunchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    ApplicationLoader.postInitApplication();
    AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
    currentAccount = UserConfig.selectedAccount;
    if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
        Intent intent = getIntent();
        boolean isProxy = false;
        if (intent != null && intent.getAction() != null) {
            if (Intent.ACTION_SEND.equals(intent.getAction()) || Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) {
                super.onCreate(savedInstanceState);
                finish();
                return;
            } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
                Uri uri = intent.getData();
                if (uri != null) {
                    String url = uri.toString().toLowerCase();
                    isProxy = url.startsWith("tg:proxy") || url.startsWith("tg://proxy") || url.startsWith("tg:socks") || url.startsWith("tg://socks");
                }
            }
        }
        SharedPreferences preferences = MessagesController.getGlobalMainSettings();
        long crashed_time = preferences.getLong("intro_crashed_time", 0);
        boolean fromIntro = intent != null && intent.getBooleanExtra("fromIntro", false);
        if (fromIntro) {
            preferences.edit().putLong("intro_crashed_time", 0).commit();
        }
        if (!isProxy && Math.abs(crashed_time - System.currentTimeMillis()) >= 60 * 2 * 1000 && intent != null && !fromIntro) {
            preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", MODE_PRIVATE);
            Map<String, ?> state = preferences.getAll();
            if (state.isEmpty()) {
                Intent intent2 = new Intent(this, IntroActivity.class);
                intent2.setData(intent.getData());
                startActivity(intent2);
                super.onCreate(savedInstanceState);
                finish();
                return;
            }
        }
    }
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(R.style.Theme_TMessages);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        try {
            setTaskDescription(new ActivityManager.TaskDescription(null, null, Theme.getColor(Theme.key_actionBarDefault) | 0xff000000));
        } catch (Exception ignore) {
        }
        try {
            getWindow().setNavigationBarColor(0xff000000);
        } catch (Exception ignore) {
        }
    }
    getWindow().setBackgroundDrawableResource(R.drawable.transparent);
    if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
        try {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 24) {
        AndroidUtilities.isInMultiwindow = isInMultiWindowMode();
    }
    Theme.createCommonChatResources();
    Theme.createDialogsResources(this);
    if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.appLocked) {
        SharedConfig.lastPauseTime = (int) (SystemClock.elapsedRealtime() / 1000);
    }
    AndroidUtilities.fillStatusBarHeight(this);
    actionBarLayout = new ActionBarLayout(this) {

        @Override
        public void setThemeAnimationValue(float value) {
            super.setThemeAnimationValue(value);
            if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
                ArticleViewer.getInstance().updateThemeColors(value);
            }
            drawerLayoutContainer.setBehindKeyboardColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            if (PhotoViewer.hasInstance()) {
                PhotoViewer.getInstance().updateColors();
            }
        }
    };
    frameLayout = new FrameLayout(this);
    setContentView(frameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (Build.VERSION.SDK_INT >= 21) {
        themeSwitchImageView = new ImageView(this);
        themeSwitchImageView.setVisibility(View.GONE);
    }
    drawerLayoutContainer = new DrawerLayoutContainer(this) {

        @Override
        protected void onLayout(boolean changed, int l, int t, int r, int b) {
            super.onLayout(changed, l, t, r, b);
            setDrawerPosition(getDrawerPosition());
        }
    };
    drawerLayoutContainer.setBehindKeyboardColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    frameLayout.addView(drawerLayoutContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    if (Build.VERSION.SDK_INT >= 21) {
        themeSwitchSunView = new View(this) {

            @Override
            protected void onDraw(Canvas canvas) {
                if (themeSwitchSunDrawable != null) {
                    themeSwitchSunDrawable.draw(canvas);
                    invalidate();
                }
            }
        };
        frameLayout.addView(themeSwitchSunView, LayoutHelper.createFrame(48, 48));
        themeSwitchSunView.setVisibility(View.GONE);
    }
    if (AndroidUtilities.isTablet()) {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        RelativeLayout launchLayout = new RelativeLayout(this) {

            private boolean inLayout;

            @Override
            public void requestLayout() {
                if (inLayout) {
                    return;
                }
                super.requestLayout();
            }

            @Override
            protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                inLayout = true;
                int width = MeasureSpec.getSize(widthMeasureSpec);
                int height = MeasureSpec.getSize(heightMeasureSpec);
                setMeasuredDimension(width, height);
                if (!AndroidUtilities.isInMultiwindow && (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)) {
                    tabletFullSize = false;
                    int leftWidth = width / 100 * 35;
                    if (leftWidth < AndroidUtilities.dp(320)) {
                        leftWidth = AndroidUtilities.dp(320);
                    }
                    actionBarLayout.measure(MeasureSpec.makeMeasureSpec(leftWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                    shadowTabletSide.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                    rightActionBarLayout.measure(MeasureSpec.makeMeasureSpec(width - leftWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                } else {
                    tabletFullSize = true;
                    actionBarLayout.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                }
                backgroundTablet.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                shadowTablet.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                layersActionBarLayout.measure(MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(530), width), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(528), height), MeasureSpec.EXACTLY));
                inLayout = false;
            }

            @Override
            protected void onLayout(boolean changed, int l, int t, int r, int b) {
                int width = r - l;
                int height = b - t;
                if (!AndroidUtilities.isInMultiwindow && (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)) {
                    int leftWidth = width / 100 * 35;
                    if (leftWidth < AndroidUtilities.dp(320)) {
                        leftWidth = AndroidUtilities.dp(320);
                    }
                    shadowTabletSide.layout(leftWidth, 0, leftWidth + shadowTabletSide.getMeasuredWidth(), shadowTabletSide.getMeasuredHeight());
                    actionBarLayout.layout(0, 0, actionBarLayout.getMeasuredWidth(), actionBarLayout.getMeasuredHeight());
                    rightActionBarLayout.layout(leftWidth, 0, leftWidth + rightActionBarLayout.getMeasuredWidth(), rightActionBarLayout.getMeasuredHeight());
                } else {
                    actionBarLayout.layout(0, 0, actionBarLayout.getMeasuredWidth(), actionBarLayout.getMeasuredHeight());
                }
                int x = (width - layersActionBarLayout.getMeasuredWidth()) / 2;
                int y = (height - layersActionBarLayout.getMeasuredHeight()) / 2;
                layersActionBarLayout.layout(x, y, x + layersActionBarLayout.getMeasuredWidth(), y + layersActionBarLayout.getMeasuredHeight());
                backgroundTablet.layout(0, 0, backgroundTablet.getMeasuredWidth(), backgroundTablet.getMeasuredHeight());
                shadowTablet.layout(0, 0, shadowTablet.getMeasuredWidth(), shadowTablet.getMeasuredHeight());
            }
        };
        drawerLayoutContainer.addView(launchLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        backgroundTablet = new SizeNotifierFrameLayout(this) {

            @Override
            protected boolean isActionBarVisible() {
                return false;
            }
        };
        backgroundTablet.setOccupyStatusBar(false);
        backgroundTablet.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
        launchLayout.addView(backgroundTablet, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
        launchLayout.addView(actionBarLayout);
        rightActionBarLayout = new ActionBarLayout(this);
        rightActionBarLayout.init(rightFragmentsStack);
        rightActionBarLayout.setDelegate(this);
        launchLayout.addView(rightActionBarLayout);
        shadowTabletSide = new FrameLayout(this);
        shadowTabletSide.setBackgroundColor(0x40295274);
        launchLayout.addView(shadowTabletSide);
        shadowTablet = new FrameLayout(this);
        shadowTablet.setVisibility(layerFragmentsStack.isEmpty() ? View.GONE : View.VISIBLE);
        shadowTablet.setBackgroundColor(0x7f000000);
        launchLayout.addView(shadowTablet);
        shadowTablet.setOnTouchListener((v, event) -> {
            if (!actionBarLayout.fragmentsStack.isEmpty() && event.getAction() == MotionEvent.ACTION_UP) {
                float x = event.getX();
                float y = event.getY();
                int[] location = new int[2];
                layersActionBarLayout.getLocationOnScreen(location);
                int viewX = location[0];
                int viewY = location[1];
                if (layersActionBarLayout.checkTransitionAnimation() || x > viewX && x < viewX + layersActionBarLayout.getWidth() && y > viewY && y < viewY + layersActionBarLayout.getHeight()) {
                    return false;
                } else {
                    if (!layersActionBarLayout.fragmentsStack.isEmpty()) {
                        for (int a = 0; a < layersActionBarLayout.fragmentsStack.size() - 1; a++) {
                            layersActionBarLayout.removeFragmentFromStack(layersActionBarLayout.fragmentsStack.get(0));
                            a--;
                        }
                        layersActionBarLayout.closeLastFragment(true);
                    }
                    return true;
                }
            }
            return false;
        });
        shadowTablet.setOnClickListener(v -> {
        });
        layersActionBarLayout = new ActionBarLayout(this);
        layersActionBarLayout.setRemoveActionBarExtraHeight(true);
        layersActionBarLayout.setBackgroundView(shadowTablet);
        layersActionBarLayout.setUseAlphaAnimations(true);
        layersActionBarLayout.setBackgroundResource(R.drawable.boxshadow);
        layersActionBarLayout.init(layerFragmentsStack);
        layersActionBarLayout.setDelegate(this);
        layersActionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
        layersActionBarLayout.setVisibility(layerFragmentsStack.isEmpty() ? View.GONE : View.VISIBLE);
        launchLayout.addView(layersActionBarLayout);
    } else {
        drawerLayoutContainer.addView(actionBarLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    }
    sideMenuContainer = new FrameLayout(this);
    sideMenu = new RecyclerListView(this) {

        @Override
        public boolean drawChild(Canvas canvas, View child, long drawingTime) {
            int restore = -1;
            if (itemAnimator != null && itemAnimator.isRunning() && itemAnimator.isAnimatingChild(child)) {
                restore = canvas.save();
                canvas.clipRect(0, itemAnimator.getAnimationClipTop(), getMeasuredWidth(), getMeasuredHeight());
            }
            boolean result = super.drawChild(canvas, child, drawingTime);
            if (restore >= 0) {
                canvas.restoreToCount(restore);
                invalidate();
                invalidateViews();
            }
            return result;
        }
    };
    itemAnimator = new SideMenultItemAnimator(sideMenu);
    sideMenu.setItemAnimator(itemAnimator);
    sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
    sideMenu.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    sideMenu.setAllowItemsInteractionDuringAnimation(false);
    sideMenu.setAdapter(drawerLayoutAdapter = new DrawerLayoutAdapter(this, itemAnimator));
    sideMenuContainer.addView(sideMenu, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    drawerLayoutContainer.setDrawerLayout(sideMenuContainer);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) sideMenuContainer.getLayoutParams();
    Point screenSize = AndroidUtilities.getRealScreenSize();
    layoutParams.width = AndroidUtilities.isTablet() ? AndroidUtilities.dp(320) : Math.min(AndroidUtilities.dp(320), Math.min(screenSize.x, screenSize.y) - AndroidUtilities.dp(56));
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    sideMenuContainer.setLayoutParams(layoutParams);
    sideMenu.setOnItemClickListener((view, position, x, y) -> {
        if (position == 0) {
            DrawerProfileCell profileCell = (DrawerProfileCell) view;
            if (profileCell.isInAvatar(x, y)) {
                openSettings(profileCell.hasAvatar());
            } else {
                drawerLayoutAdapter.setAccountsShown(!drawerLayoutAdapter.isAccountsShown(), true);
            }
        } else if (view instanceof DrawerUserCell) {
            switchToAccount(((DrawerUserCell) view).getAccountNumber(), true);
            drawerLayoutContainer.closeDrawer(false);
        } else if (view instanceof DrawerAddCell) {
            int freeAccount = -1;
            for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
                if (!UserConfig.getInstance(a).isClientActivated()) {
                    freeAccount = a;
                    break;
                }
            }
            if (freeAccount >= 0) {
                presentFragment(new LoginActivity(freeAccount));
            }
            drawerLayoutContainer.closeDrawer(false);
        } else {
            int id = drawerLayoutAdapter.getId(position);
            if (id == 2) {
                Bundle args = new Bundle();
                presentFragment(new GroupCreateActivity(args));
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 3) {
                Bundle args = new Bundle();
                args.putBoolean("onlyUsers", true);
                args.putBoolean("destroyAfterSelect", true);
                args.putBoolean("createSecretChat", true);
                args.putBoolean("allowBots", false);
                args.putBoolean("allowSelf", false);
                presentFragment(new ContactsActivity(args));
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 4) {
                SharedPreferences preferences = MessagesController.getGlobalMainSettings();
                if (!BuildVars.DEBUG_VERSION && preferences.getBoolean("channel_intro", false)) {
                    Bundle args = new Bundle();
                    args.putInt("step", 0);
                    presentFragment(new ChannelCreateActivity(args));
                } else {
                    presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANNEL_CREATE));
                    preferences.edit().putBoolean("channel_intro", true).commit();
                }
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 6) {
                presentFragment(new ContactsActivity(null));
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 7) {
                presentFragment(new InviteContactsActivity());
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 8) {
                openSettings(false);
            } else if (id == 9) {
                Browser.openUrl(LaunchActivity.this, LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl));
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 10) {
                presentFragment(new CallLogActivity());
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 11) {
                Bundle args = new Bundle();
                args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId());
                presentFragment(new ChatActivity(args));
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 12) {
                if (Build.VERSION.SDK_INT >= 23) {
                    if (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                        presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_NEARBY_LOCATION_ACCESS));
                        drawerLayoutContainer.closeDrawer(false);
                        return;
                    }
                }
                boolean enabled = true;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                    LocationManager lm = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE);
                    enabled = lm.isLocationEnabled();
                } else if (Build.VERSION.SDK_INT >= 19) {
                    try {
                        int mode = Settings.Secure.getInt(ApplicationLoader.applicationContext.getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
                        enabled = (mode != Settings.Secure.LOCATION_MODE_OFF);
                    } catch (Throwable e) {
                        FileLog.e(e);
                    }
                }
                if (enabled) {
                    presentFragment(new PeopleNearbyActivity());
                } else {
                    presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_NEARBY_LOCATION_ENABLED));
                }
                drawerLayoutContainer.closeDrawer(false);
            } else if (id == 13) {
                Browser.openUrl(LaunchActivity.this, LocaleController.getString("TelegramFeaturesUrl", R.string.TelegramFeaturesUrl));
                drawerLayoutContainer.closeDrawer(false);
            }
        }
    });
    final ItemTouchHelper sideMenuTouchHelper = new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0) {

        private RecyclerView.ViewHolder selectedViewHolder;

        @Override
        public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
            if (viewHolder.getItemViewType() != target.getItemViewType()) {
                return false;
            }
            drawerLayoutAdapter.swapElements(viewHolder.getAdapterPosition(), target.getAdapterPosition());
            return true;
        }

        @Override
        public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
        }

        @Override
        public boolean isLongPressDragEnabled() {
            return false;
        }

        @Override
        public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
            clearSelectedViewHolder();
            if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
                selectedViewHolder = viewHolder;
                final View view = viewHolder.itemView;
                sideMenu.cancelClickRunnables(false);
                view.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
                if (Build.VERSION.SDK_INT >= 21) {
                    ObjectAnimator.ofFloat(view, "elevation", AndroidUtilities.dp(1)).setDuration(150).start();
                }
            }
        }

        @Override
        public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
            clearSelectedViewHolder();
        }

        private void clearSelectedViewHolder() {
            if (selectedViewHolder != null) {
                final View view = selectedViewHolder.itemView;
                selectedViewHolder = null;
                view.setTranslationX(0f);
                view.setTranslationY(0f);
                if (Build.VERSION.SDK_INT >= 21) {
                    final ObjectAnimator animator = ObjectAnimator.ofFloat(view, "elevation", 0f);
                    animator.addListener(new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            view.setBackground(null);
                        }
                    });
                    animator.setDuration(150).start();
                }
            }
        }

        @Override
        public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
            final View view = viewHolder.itemView;
            if (drawerLayoutAdapter.isAccountsShown()) {
                RecyclerView.ViewHolder topViewHolder = recyclerView.findViewHolderForAdapterPosition(drawerLayoutAdapter.getFirstAccountPosition() - 1);
                RecyclerView.ViewHolder bottomViewHolder = recyclerView.findViewHolderForAdapterPosition(drawerLayoutAdapter.getLastAccountPosition() + 1);
                if (topViewHolder != null && topViewHolder.itemView != null && topViewHolder.itemView.getBottom() == view.getTop() && dY < 0f) {
                    dY = 0f;
                } else if (bottomViewHolder != null && bottomViewHolder.itemView != null && bottomViewHolder.itemView.getTop() == view.getBottom() && dY > 0f) {
                    dY = 0f;
                }
            }
            view.setTranslationX(dX);
            view.setTranslationY(dY);
        }
    });
    sideMenuTouchHelper.attachToRecyclerView(sideMenu);
    sideMenu.setOnItemLongClickListener((view, position) -> {
        if (view instanceof DrawerUserCell) {
            final int accountNumber = ((DrawerUserCell) view).getAccountNumber();
            if (accountNumber == currentAccount || AndroidUtilities.isTablet()) {
                sideMenuTouchHelper.startDrag(sideMenu.getChildViewHolder(view));
            } else {
                final BaseFragment fragment = new DialogsActivity(null) {

                    @Override
                    protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
                        super.onTransitionAnimationEnd(isOpen, backward);
                        if (!isOpen && backward) {
                            // closed
                            drawerLayoutContainer.setDrawCurrentPreviewFragmentAbove(false);
                        }
                    }

                    @Override
                    protected void onPreviewOpenAnimationEnd() {
                        super.onPreviewOpenAnimationEnd();
                        drawerLayoutContainer.setAllowOpenDrawer(false, false);
                        drawerLayoutContainer.setDrawCurrentPreviewFragmentAbove(false);
                        switchToAccount(accountNumber, true);
                    }
                };
                fragment.setCurrentAccount(accountNumber);
                actionBarLayout.presentFragmentAsPreview(fragment);
                drawerLayoutContainer.setDrawCurrentPreviewFragmentAbove(true);
                return true;
            }
        }
        return false;
    });
    drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
    actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
    actionBarLayout.init(mainFragmentsStack);
    actionBarLayout.setDelegate(this);
    Theme.loadWallpaper();
    checkCurrentAccount();
    updateCurrentConnectionState(currentAccount);
    NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeOtherAppActivities, this);
    currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needShowAlert);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.reloadInterface);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.suggestedLangpack);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewTheme);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needSetDayNightTheme);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needCheckSystemBarColors);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeOtherAppActivities);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.notificationsCountUpdated);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.screenStateChanged);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.showBulletin);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.appUpdateAvailable);
    if (actionBarLayout.fragmentsStack.isEmpty()) {
        if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
            actionBarLayout.addFragmentToStack(new LoginActivity());
            drawerLayoutContainer.setAllowOpenDrawer(false, false);
        } else {
            DialogsActivity dialogsActivity = new DialogsActivity(null);
            dialogsActivity.setSideMenu(sideMenu);
            actionBarLayout.addFragmentToStack(dialogsActivity);
            drawerLayoutContainer.setAllowOpenDrawer(true, false);
        }
        try {
            if (savedInstanceState != null) {
                String fragmentName = savedInstanceState.getString("fragment");
                if (fragmentName != null) {
                    Bundle args = savedInstanceState.getBundle("args");
                    switch(fragmentName) {
                        case "chat":
                            if (args != null) {
                                ChatActivity chat = new ChatActivity(args);
                                if (actionBarLayout.addFragmentToStack(chat)) {
                                    chat.restoreSelfArgs(savedInstanceState);
                                }
                            }
                            break;
                        case "settings":
                            {
                                args.putLong("user_id", UserConfig.getInstance(currentAccount).clientUserId);
                                ProfileActivity settings = new ProfileActivity(args);
                                actionBarLayout.addFragmentToStack(settings);
                                settings.restoreSelfArgs(savedInstanceState);
                                break;
                            }
                        case "group":
                            if (args != null) {
                                GroupCreateFinalActivity group = new GroupCreateFinalActivity(args);
                                if (actionBarLayout.addFragmentToStack(group)) {
                                    group.restoreSelfArgs(savedInstanceState);
                                }
                            }
                            break;
                        case "channel":
                            if (args != null) {
                                ChannelCreateActivity channel = new ChannelCreateActivity(args);
                                if (actionBarLayout.addFragmentToStack(channel)) {
                                    channel.restoreSelfArgs(savedInstanceState);
                                }
                            }
                            break;
                        case "chat_profile":
                            if (args != null) {
                                ProfileActivity profile = new ProfileActivity(args);
                                if (actionBarLayout.addFragmentToStack(profile)) {
                                    profile.restoreSelfArgs(savedInstanceState);
                                }
                            }
                            break;
                        case "wallpapers":
                            {
                                WallpapersListActivity settings = new WallpapersListActivity(WallpapersListActivity.TYPE_ALL);
                                actionBarLayout.addFragmentToStack(settings);
                                settings.restoreSelfArgs(savedInstanceState);
                                break;
                            }
                    }
                }
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    } else {
        BaseFragment fragment = actionBarLayout.fragmentsStack.get(0);
        if (fragment instanceof DialogsActivity) {
            ((DialogsActivity) fragment).setSideMenu(sideMenu);
        }
        boolean allowOpen = true;
        if (AndroidUtilities.isTablet()) {
            allowOpen = actionBarLayout.fragmentsStack.size() <= 1 && layersActionBarLayout.fragmentsStack.isEmpty();
            if (layersActionBarLayout.fragmentsStack.size() == 1 && layersActionBarLayout.fragmentsStack.get(0) instanceof LoginActivity) {
                allowOpen = false;
            }
        }
        if (actionBarLayout.fragmentsStack.size() == 1 && actionBarLayout.fragmentsStack.get(0) instanceof LoginActivity) {
            allowOpen = false;
        }
        drawerLayoutContainer.setAllowOpenDrawer(allowOpen, false);
    }
    checkLayout();
    checkSystemBarColors();
    handleIntent(getIntent(), false, savedInstanceState != null, false);
    try {
        String os1 = Build.DISPLAY;
        String os2 = Build.USER;
        if (os1 != null) {
            os1 = os1.toLowerCase();
        } else {
            os1 = "";
        }
        if (os2 != null) {
            os2 = os1.toLowerCase();
        } else {
            os2 = "";
        }
        if (BuildVars.LOGS_ENABLED) {
            FileLog.d("OS name " + os1 + " " + os2);
        }
        if ((os1.contains("flyme") || os2.contains("flyme")) && Build.VERSION.SDK_INT <= 24) {
            AndroidUtilities.incorrectDisplaySizeFix = true;
            final View view = getWindow().getDecorView().getRootView();
            view.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener = () -> {
                int height = view.getMeasuredHeight();
                FileLog.d("height = " + height + " displayHeight = " + AndroidUtilities.displaySize.y);
                if (Build.VERSION.SDK_INT >= 21) {
                    height -= AndroidUtilities.statusBarHeight;
                }
                if (height > AndroidUtilities.dp(100) && height < AndroidUtilities.displaySize.y && height + AndroidUtilities.dp(100) > AndroidUtilities.displaySize.y) {
                    AndroidUtilities.displaySize.y = height;
                    if (BuildVars.LOGS_ENABLED) {
                        FileLog.d("fix display size y to " + AndroidUtilities.displaySize.y);
                    }
                }
            });
        }
    } catch (Exception e) {
        FileLog.e(e);
    }
    MediaController.getInstance().setBaseActivity(this, true);
    AndroidUtilities.startAppCenter(this);
    updateAppUpdateViews(false);
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) SideMenultItemAnimator(org.telegram.ui.Components.SideMenultItemAnimator) ImageView(android.widget.ImageView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) ObjectAnimator(android.animation.ObjectAnimator) Canvas(android.graphics.Canvas) RelativeLayout(android.widget.RelativeLayout) DrawerUserCell(org.telegram.ui.Cells.DrawerUserCell) DrawerLayoutContainer(org.telegram.ui.ActionBar.DrawerLayoutContainer) ActivityManager(android.app.ActivityManager) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout) RecyclerListView(org.telegram.ui.Components.RecyclerListView) DrawerProfileCell(org.telegram.ui.Cells.DrawerProfileCell) Uri(android.net.Uri) ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) LocationManager(android.location.LocationManager) SharedPreferences(android.content.SharedPreferences) ViewGroup(android.view.ViewGroup) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) Bundle(android.os.Bundle) DrawerLayoutAdapter(org.telegram.ui.Adapters.DrawerLayoutAdapter) DrawerAddCell(org.telegram.ui.Cells.DrawerAddCell) Intent(android.content.Intent) Point(android.graphics.Point) ImageView(android.widget.ImageView) UndoView(org.telegram.ui.Components.UndoView) PipRoundVideoView(org.telegram.ui.Components.PipRoundVideoView) PasscodeView(org.telegram.ui.Components.PasscodeView) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) ThemeEditorView(org.telegram.ui.Components.ThemeEditorView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TermsOfServiceView(org.telegram.ui.Components.TermsOfServiceView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) BlockingUpdateView(org.telegram.ui.Components.BlockingUpdateView) TextView(android.widget.TextView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) ParseException(java.text.ParseException) Paint(android.graphics.Paint) Point(android.graphics.Point) SideMenultItemAnimator(org.telegram.ui.Components.SideMenultItemAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) FrameLayout(android.widget.FrameLayout) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 4 with DrawerLayoutContainer

use of org.telegram.ui.ActionBar.DrawerLayoutContainer in project Telegram-FOSS by Telegram-FOSS-Team.

the class LaunchActivity method didReceivedNotification.

@Override
@SuppressWarnings("unchecked")
public void didReceivedNotification(int id, final int account, Object... args) {
    if (id == NotificationCenter.appDidLogout) {
        switchToAvailableAccountOrLogout();
    } else if (id == NotificationCenter.closeOtherAppActivities) {
        if (args[0] != this) {
            onFinish();
            finish();
        }
    } else if (id == NotificationCenter.didUpdateConnectionState) {
        int state = ConnectionsManager.getInstance(account).getConnectionState();
        if (currentConnectionState != state) {
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("switch to state " + state);
            }
            currentConnectionState = state;
            updateCurrentConnectionState(account);
        }
    } else if (id == NotificationCenter.mainUserInfoChanged) {
        drawerLayoutAdapter.notifyDataSetChanged();
    } else if (id == NotificationCenter.needShowAlert) {
        final Integer reason = (Integer) args[0];
        if (reason == 6 || reason == 3 && proxyErrorDialog != null) {
            return;
        } else if (reason == 4) {
            showTosActivity(account, (TLRPC.TL_help_termsOfService) args[1]);
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        if (reason != 2 && reason != 3) {
            builder.setNegativeButton(LocaleController.getString("MoreInfo", R.string.MoreInfo), (dialogInterface, i) -> {
                if (!mainFragmentsStack.isEmpty()) {
                    MessagesController.getInstance(account).openByUserName("spambot", mainFragmentsStack.get(mainFragmentsStack.size() - 1), 1);
                }
            });
        }
        if (reason == 5) {
            builder.setMessage(LocaleController.getString("NobodyLikesSpam3", R.string.NobodyLikesSpam3));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
        } else if (reason == 0) {
            builder.setMessage(LocaleController.getString("NobodyLikesSpam1", R.string.NobodyLikesSpam1));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
        } else if (reason == 1) {
            builder.setMessage(LocaleController.getString("NobodyLikesSpam2", R.string.NobodyLikesSpam2));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
        } else if (reason == 2) {
            builder.setMessage((String) args[1]);
            String type = (String) args[2];
            if (type.startsWith("AUTH_KEY_DROP_")) {
                builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                builder.setNegativeButton(LocaleController.getString("LogOut", R.string.LogOut), (dialog, which) -> MessagesController.getInstance(currentAccount).performLogout(2));
            } else {
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            }
        } else if (reason == 3) {
            builder.setTitle(LocaleController.getString("Proxy", R.string.Proxy));
            builder.setMessage(LocaleController.getString("UseProxyTelegramError", R.string.UseProxyTelegramError));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            proxyErrorDialog = showAlertDialog(builder);
            return;
        }
        if (!mainFragmentsStack.isEmpty()) {
            mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(builder.create());
        }
    } else if (id == NotificationCenter.wasUnableToFindCurrentLocation) {
        final HashMap<String, MessageObject> waitingForLocation = (HashMap<String, MessageObject>) args[0];
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
        builder.setNegativeButton(LocaleController.getString("ShareYouLocationUnableManually", R.string.ShareYouLocationUnableManually), (dialogInterface, i) -> {
            if (mainFragmentsStack.isEmpty()) {
                return;
            }
            BaseFragment lastFragment = mainFragmentsStack.get(mainFragmentsStack.size() - 1);
            if (!AndroidUtilities.isGoogleMapsInstalled(lastFragment)) {
                return;
            }
            LocationActivity fragment = new LocationActivity(0);
            fragment.setDelegate((location, live, notify, scheduleDate) -> {
                for (HashMap.Entry<String, MessageObject> entry : waitingForLocation.entrySet()) {
                    MessageObject messageObject = entry.getValue();
                    SendMessagesHelper.getInstance(account).sendMessage(location, messageObject.getDialogId(), messageObject, null, null, null, notify, scheduleDate);
                }
            });
            presentFragment(fragment);
        });
        builder.setMessage(LocaleController.getString("ShareYouLocationUnable", R.string.ShareYouLocationUnable));
        if (!mainFragmentsStack.isEmpty()) {
            mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(builder.create());
        }
    } else if (id == NotificationCenter.didSetNewWallpapper) {
        if (sideMenu != null) {
            View child = sideMenu.getChildAt(0);
            if (child != null) {
                child.invalidate();
            }
        }
        if (backgroundTablet != null) {
            backgroundTablet.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
        }
    } else if (id == NotificationCenter.didSetPasscode) {
        if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
            try {
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
            } catch (Exception e) {
                FileLog.e(e);
            }
        } else if (!AndroidUtilities.hasFlagSecureFragment()) {
            try {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    } else if (id == NotificationCenter.reloadInterface) {
        boolean last = mainFragmentsStack.size() > 1 && mainFragmentsStack.get(mainFragmentsStack.size() - 1) instanceof ProfileActivity;
        if (last) {
            ProfileActivity profileActivity = (ProfileActivity) mainFragmentsStack.get(mainFragmentsStack.size() - 1);
            if (!profileActivity.isSettings()) {
                last = false;
            }
        }
        rebuildAllFragments(last);
    } else if (id == NotificationCenter.suggestedLangpack) {
        showLanguageAlert(false);
    } else if (id == NotificationCenter.openArticle) {
        if (mainFragmentsStack.isEmpty()) {
            return;
        }
        ArticleViewer.getInstance().setParentActivity(this, mainFragmentsStack.get(mainFragmentsStack.size() - 1));
        ArticleViewer.getInstance().open((TLRPC.TL_webPage) args[0], (String) args[1]);
    } else if (id == NotificationCenter.hasNewContactsToImport) {
        if (actionBarLayout == null || actionBarLayout.fragmentsStack.isEmpty()) {
            return;
        }
        final int type = (Integer) args[0];
        final HashMap<String, ContactsController.Contact> contactHashMap = (HashMap<String, ContactsController.Contact>) args[1];
        final boolean first = (Boolean) args[2];
        final boolean schedule = (Boolean) args[3];
        BaseFragment fragment = actionBarLayout.fragmentsStack.get(actionBarLayout.fragmentsStack.size() - 1);
        AlertDialog.Builder builder = new AlertDialog.Builder(LaunchActivity.this);
        builder.setTitle(LocaleController.getString("UpdateContactsTitle", R.string.UpdateContactsTitle));
        builder.setMessage(LocaleController.getString("UpdateContactsMessage", R.string.UpdateContactsMessage));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, false));
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (dialog, which) -> ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, true));
        builder.setOnBackButtonListener((dialogInterface, i) -> ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, true));
        AlertDialog dialog = builder.create();
        fragment.showDialog(dialog);
        dialog.setCanceledOnTouchOutside(false);
    } else if (id == NotificationCenter.didSetNewTheme) {
        Boolean nightTheme = (Boolean) args[0];
        if (!nightTheme) {
            if (sideMenu != null) {
                sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
                sideMenu.setGlowColor(Theme.getColor(Theme.key_chats_menuBackground));
                sideMenu.setListSelectorColor(Theme.getColor(Theme.key_listSelector));
                sideMenu.getAdapter().notifyDataSetChanged();
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                try {
                    setTaskDescription(new ActivityManager.TaskDescription(null, null, Theme.getColor(Theme.key_actionBarDefault) | 0xff000000));
                } catch (Exception ignore) {
                }
            }
        }
        drawerLayoutContainer.setBehindKeyboardColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        boolean checkNavigationBarColor = true;
        if (args.length > 1) {
            checkNavigationBarColor = (boolean) args[1];
        }
        checkSystemBarColors(true, checkNavigationBarColor);
    } else if (id == NotificationCenter.needSetDayNightTheme) {
        boolean instant = false;
        if (Build.VERSION.SDK_INT >= 21 && args[2] != null) {
            if (themeSwitchImageView.getVisibility() == View.VISIBLE) {
                return;
            }
            try {
                int[] pos = (int[]) args[2];
                boolean toDark = (Boolean) args[4];
                RLottieImageView darkThemeView = (RLottieImageView) args[5];
                int w = drawerLayoutContainer.getMeasuredWidth();
                int h = drawerLayoutContainer.getMeasuredHeight();
                if (!toDark) {
                    darkThemeView.setVisibility(View.INVISIBLE);
                }
                Bitmap bitmap = Bitmap.createBitmap(drawerLayoutContainer.getMeasuredWidth(), drawerLayoutContainer.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(bitmap);
                HashMap<View, Integer> viewLayerTypes = new HashMap<>();
                invalidateCachedViews(drawerLayoutContainer);
                drawerLayoutContainer.draw(canvas);
                frameLayout.removeView(themeSwitchImageView);
                if (toDark) {
                    frameLayout.addView(themeSwitchImageView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
                    themeSwitchSunView.setVisibility(View.GONE);
                } else {
                    frameLayout.addView(themeSwitchImageView, 1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
                    themeSwitchSunView.setTranslationX(pos[0] - AndroidUtilities.dp(14));
                    themeSwitchSunView.setTranslationY(pos[1] - AndroidUtilities.dp(14));
                    themeSwitchSunView.setVisibility(View.VISIBLE);
                    themeSwitchSunView.invalidate();
                }
                themeSwitchImageView.setImageBitmap(bitmap);
                themeSwitchImageView.setVisibility(View.VISIBLE);
                themeSwitchSunDrawable = darkThemeView.getAnimatedDrawable();
                float finalRadius = (float) Math.max(Math.sqrt((w - pos[0]) * (w - pos[0]) + (h - pos[1]) * (h - pos[1])), Math.sqrt(pos[0] * pos[0] + (h - pos[1]) * (h - pos[1])));
                float finalRadius2 = (float) Math.max(Math.sqrt((w - pos[0]) * (w - pos[0]) + pos[1] * pos[1]), Math.sqrt(pos[0] * pos[0] + pos[1] * pos[1]));
                finalRadius = Math.max(finalRadius, finalRadius2);
                Animator anim = ViewAnimationUtils.createCircularReveal(toDark ? drawerLayoutContainer : themeSwitchImageView, pos[0], pos[1], toDark ? 0 : finalRadius, toDark ? finalRadius : 0);
                anim.setDuration(400);
                anim.setInterpolator(Easings.easeInOutQuad);
                anim.addListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        themeSwitchImageView.setImageDrawable(null);
                        themeSwitchImageView.setVisibility(View.GONE);
                        themeSwitchSunView.setVisibility(View.GONE);
                        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeAccentListUpdated);
                        if (!toDark) {
                            darkThemeView.setVisibility(View.VISIBLE);
                        }
                        DrawerProfileCell.switchingTheme = false;
                    }
                });
                anim.start();
                instant = true;
            } catch (Throwable e) {
                FileLog.e(e);
                try {
                    themeSwitchImageView.setImageDrawable(null);
                    frameLayout.removeView(themeSwitchImageView);
                    DrawerProfileCell.switchingTheme = false;
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
            }
        } else {
            DrawerProfileCell.switchingTheme = false;
        }
        Theme.ThemeInfo theme = (Theme.ThemeInfo) args[0];
        boolean nigthTheme = (Boolean) args[1];
        int accentId = (Integer) args[3];
        actionBarLayout.animateThemedValues(theme, accentId, nigthTheme, instant);
        if (AndroidUtilities.isTablet()) {
            layersActionBarLayout.animateThemedValues(theme, accentId, nigthTheme, instant);
            rightActionBarLayout.animateThemedValues(theme, accentId, nigthTheme, instant);
        }
    } else if (id == NotificationCenter.notificationsCountUpdated) {
        if (sideMenu != null) {
            Integer accountNum = (Integer) args[0];
            int count = sideMenu.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = sideMenu.getChildAt(a);
                if (child instanceof DrawerUserCell) {
                    if (((DrawerUserCell) child).getAccountNumber() == accountNum) {
                        child.invalidate();
                        break;
                    }
                }
            }
        }
    } else if (id == NotificationCenter.fileLoaded) {
        String path = (String) args[0];
        if (SharedConfig.isAppUpdateAvailable()) {
            String name = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
            if (name.equals(path)) {
                updateAppUpdateViews(true);
            }
        }
        if (loadingThemeFileName != null) {
            if (loadingThemeFileName.equals(path)) {
                loadingThemeFileName = null;
                File locFile = new File(ApplicationLoader.getFilesDirFixed(), "remote" + loadingTheme.id + ".attheme");
                Theme.ThemeInfo themeInfo = Theme.fillThemeValues(locFile, loadingTheme.title, loadingTheme);
                if (themeInfo != null) {
                    if (themeInfo.pathToWallpaper != null) {
                        File file = new File(themeInfo.pathToWallpaper);
                        if (!file.exists()) {
                            TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper();
                            TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
                            inputWallPaperSlug.slug = themeInfo.slug;
                            req.wallpaper = inputWallPaperSlug;
                            ConnectionsManager.getInstance(themeInfo.account).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                                if (response instanceof TLRPC.TL_wallPaper) {
                                    TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) response;
                                    loadingThemeInfo = themeInfo;
                                    loadingThemeWallpaperName = FileLoader.getAttachFileName(wallPaper.document);
                                    loadingThemeWallpaper = wallPaper;
                                    FileLoader.getInstance(themeInfo.account).loadFile(wallPaper.document, wallPaper, 1, 1);
                                } else {
                                    onThemeLoadFinish();
                                }
                            }));
                            return;
                        }
                    }
                    Theme.ThemeInfo finalThemeInfo = Theme.applyThemeFile(locFile, loadingTheme.title, loadingTheme, true);
                    if (finalThemeInfo != null) {
                        presentFragment(new ThemePreviewActivity(finalThemeInfo, true, ThemePreviewActivity.SCREEN_TYPE_PREVIEW, false, false));
                    }
                }
                onThemeLoadFinish();
            }
        } else if (loadingThemeWallpaperName != null) {
            if (loadingThemeWallpaperName.equals(path)) {
                loadingThemeWallpaperName = null;
                File file = (File) args[1];
                if (loadingThemeAccent) {
                    openThemeAccentPreview(loadingTheme, loadingThemeWallpaper, loadingThemeInfo);
                    onThemeLoadFinish();
                } else {
                    Theme.ThemeInfo info = loadingThemeInfo;
                    Utilities.globalQueue.postRunnable(() -> {
                        info.createBackground(file, info.pathToWallpaper);
                        AndroidUtilities.runOnUIThread(() -> {
                            if (loadingTheme == null) {
                                return;
                            }
                            File locFile = new File(ApplicationLoader.getFilesDirFixed(), "remote" + loadingTheme.id + ".attheme");
                            Theme.ThemeInfo finalThemeInfo = Theme.applyThemeFile(locFile, loadingTheme.title, loadingTheme, true);
                            if (finalThemeInfo != null) {
                                presentFragment(new ThemePreviewActivity(finalThemeInfo, true, ThemePreviewActivity.SCREEN_TYPE_PREVIEW, false, false));
                            }
                            onThemeLoadFinish();
                        });
                    });
                }
            }
        }
    } else if (id == NotificationCenter.fileLoadFailed) {
        String path = (String) args[0];
        if (path.equals(loadingThemeFileName) || path.equals(loadingThemeWallpaperName)) {
            onThemeLoadFinish();
        }
        if (SharedConfig.isAppUpdateAvailable()) {
            String name = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
            if (name.equals(path)) {
                updateAppUpdateViews(true);
            }
        }
    } else if (id == NotificationCenter.screenStateChanged) {
        if (ApplicationLoader.mainInterfacePaused) {
            return;
        }
        if (ApplicationLoader.isScreenOn) {
            onPasscodeResume();
        } else {
            onPasscodePause();
        }
    } else if (id == NotificationCenter.needCheckSystemBarColors) {
        checkSystemBarColors();
    } else if (id == NotificationCenter.historyImportProgressChanged) {
        if (args.length > 1 && !mainFragmentsStack.isEmpty()) {
            AlertsCreator.processError(currentAccount, (TLRPC.TL_error) args[2], mainFragmentsStack.get(mainFragmentsStack.size() - 1), (TLObject) args[1]);
        }
    } else if (id == NotificationCenter.stickersImportComplete) {
        MediaDataController.getInstance(account).toggleStickerSet(this, (TLObject) args[0], 2, !mainFragmentsStack.isEmpty() ? mainFragmentsStack.get(mainFragmentsStack.size() - 1) : null, false, true);
    } else if (id == NotificationCenter.newSuggestionsAvailable) {
        sideMenu.invalidateViews();
    } else if (id == NotificationCenter.showBulletin) {
        if (!mainFragmentsStack.isEmpty()) {
            int type = (int) args[0];
            FrameLayout container = null;
            BaseFragment fragment = null;
            if (GroupCallActivity.groupCallUiVisible && GroupCallActivity.groupCallInstance != null) {
                container = GroupCallActivity.groupCallInstance.getContainer();
            }
            if (container == null) {
                fragment = mainFragmentsStack.get(mainFragmentsStack.size() - 1);
            }
            if (type == Bulletin.TYPE_NAME_CHANGED) {
                long peerId = (long) args[1];
                String text = peerId > 0 ? LocaleController.getString("YourNameChanged", R.string.YourNameChanged) : LocaleController.getString("CannelTitleChanged", R.string.ChannelTitleChanged);
                (container != null ? BulletinFactory.of(container, null) : BulletinFactory.of(fragment)).createErrorBulletin(text).show();
            } else if (type == Bulletin.TYPE_BIO_CHANGED) {
                long peerId = (long) args[1];
                String text = peerId > 0 ? LocaleController.getString("YourBioChanged", R.string.YourBioChanged) : LocaleController.getString("CannelDescriptionChanged", R.string.ChannelDescriptionChanged);
                (container != null ? BulletinFactory.of(container, null) : BulletinFactory.of(fragment)).createErrorBulletin(text).show();
            } else if (type == Bulletin.TYPE_STICKER) {
                TLRPC.Document sticker = (TLRPC.Document) args[1];
                StickerSetBulletinLayout layout = new StickerSetBulletinLayout(this, null, (int) args[2], sticker, null);
                if (fragment != null) {
                    Bulletin.make(fragment, layout, Bulletin.DURATION_SHORT).show();
                } else {
                    Bulletin.make(container, layout, Bulletin.DURATION_SHORT).show();
                }
            } else if (type == Bulletin.TYPE_ERROR) {
                if (fragment != null) {
                    BulletinFactory.of(fragment).createErrorBulletin((String) args[1]).show();
                } else {
                    BulletinFactory.of(container, null).createErrorBulletin((String) args[1]).show();
                }
            }
        }
    } else if (id == NotificationCenter.groupCallUpdated) {
        checkWasMutedByAdmin(false);
    } else if (id == NotificationCenter.fileLoadProgressChanged) {
        if (updateTextView != null && SharedConfig.isAppUpdateAvailable()) {
            String location = (String) args[0];
            String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
            if (fileName != null && fileName.equals(location)) {
                Long loadedSize = (Long) args[1];
                Long totalSize = (Long) args[2];
                float loadProgress = loadedSize / (float) totalSize;
                updateLayoutIcon.setProgress(loadProgress, true);
                updateTextView.setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) (loadProgress * 100)));
            }
        }
    } else if (id == NotificationCenter.appUpdateAvailable) {
        updateAppUpdateViews(mainFragmentsStack.size() == 1);
    }
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) UpdateAppAlertDialog(org.telegram.ui.Components.UpdateAppAlertDialog) Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) AbstractSerializedData(org.telegram.tgnet.AbstractSerializedData) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) StickersAlert(org.telegram.ui.Components.StickersAlert) LocationController(org.telegram.messenger.LocationController) Bulletin(org.telegram.ui.Components.Bulletin) VoIPPendingCall(org.telegram.messenger.voip.VoIPPendingCall) MediaActionDrawable(org.telegram.ui.Components.MediaActionDrawable) ShortcutManagerCompat(androidx.core.content.pm.ShortcutManagerCompat) Manifest(android.Manifest) Matcher(java.util.regex.Matcher) DrawerProfileCell(org.telegram.ui.Cells.DrawerProfileCell) Map(java.util.Map) Shader(android.graphics.Shader) Canvas(android.graphics.Canvas) Function(androidx.arch.core.util.Function) UndoView(org.telegram.ui.Components.UndoView) ContactsLoadingObserver(org.telegram.messenger.ContactsLoadingObserver) Set(java.util.Set) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) NotificationCenter(org.telegram.messenger.NotificationCenter) Paint(android.graphics.Paint) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) FileLoader(org.telegram.messenger.FileLoader) GroupCallPip(org.telegram.ui.Components.GroupCallPip) ViewParent(android.view.ViewParent) PipRoundVideoView(org.telegram.ui.Components.PipRoundVideoView) SimpleDateFormat(java.text.SimpleDateFormat) SystemClock(android.os.SystemClock) AlertsCreator(org.telegram.ui.Components.AlertsCreator) WebRtcAudioTrack(org.webrtc.voiceengine.WebRtcAudioTrack) ArrayList(java.util.ArrayList) ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) TLRPC(org.telegram.tgnet.TLRPC) Toast(android.widget.Toast) PhoneFormat(org.telegram.PhoneFormat.PhoneFormat) Menu(android.view.Menu) PasscodeView(org.telegram.ui.Components.PasscodeView) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) Settings(android.provider.Settings) JoinGroupAlert(org.telegram.ui.Components.JoinGroupAlert) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) LinearGradient(android.graphics.LinearGradient) Parcelable(android.os.Parcelable) R(org.telegram.messenger.R) LanguageCell(org.telegram.ui.Cells.LanguageCell) SideMenultItemAnimator(org.telegram.ui.Components.SideMenultItemAnimator) TextUtils(android.text.TextUtils) InputStreamReader(java.io.InputStreamReader) DrawerLayoutContainer(org.telegram.ui.ActionBar.DrawerLayoutContainer) File(java.io.File) Gravity(android.view.Gravity) UserObject(org.telegram.messenger.UserObject) DrawerAddCell(org.telegram.ui.Cells.DrawerAddCell) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) ContactsController(org.telegram.messenger.ContactsController) MessagesStorage(org.telegram.messenger.MessagesStorage) Configuration(android.content.res.Configuration) Easings(org.telegram.ui.Components.Easings) BufferedReader(java.io.BufferedReader) ChatObject(org.telegram.messenger.ChatObject) CameraController(org.telegram.messenger.camera.CameraController) AlertDialog(org.telegram.ui.ActionBar.AlertDialog) AudioPlayerAlert(org.telegram.ui.Components.AudioPlayerAlert) VoIPHelper(org.telegram.ui.Components.voip.VoIPHelper) ActionMode(android.view.ActionMode) LinearLayout(android.widget.LinearLayout) RadialProgress2(org.telegram.ui.Components.RadialProgress2) PackageManager(android.content.pm.PackageManager) Date(java.util.Date) DrawerLayoutAdapter(org.telegram.ui.Adapters.DrawerLayoutAdapter) WindowManager(android.view.WindowManager) AccountInstance(org.telegram.messenger.AccountInstance) AndroidUtilities(org.telegram.messenger.AndroidUtilities) CubicBezierInterpolator(org.telegram.ui.Components.CubicBezierInterpolator) VideoCapturerDevice(org.telegram.messenger.voip.VideoCapturerDevice) Animator(android.animation.Animator) ApplicationLoader(org.telegram.messenger.ApplicationLoader) ContactsContract(android.provider.ContactsContract) MediaController(org.telegram.messenger.MediaController) ThemeEditorView(org.telegram.ui.Components.ThemeEditorView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TermsOfServiceView(org.telegram.ui.Components.TermsOfServiceView) Matrix(android.graphics.Matrix) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) ImageLoader(org.telegram.messenger.ImageLoader) DrawerUserCell(org.telegram.ui.Cells.DrawerUserCell) Utilities(org.telegram.messenger.Utilities) RLottieImageView(org.telegram.ui.Components.RLottieImageView) ObjectAnimator(android.animation.ObjectAnimator) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) BitmapDrawable(android.graphics.drawable.BitmapDrawable) ViewAnimationUtils(android.view.ViewAnimationUtils) SendMessagesHelper(org.telegram.messenger.SendMessagesHelper) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) BlockingUpdateView(org.telegram.ui.Components.BlockingUpdateView) ViewGroup(android.view.ViewGroup) UserConfig(org.telegram.messenger.UserConfig) List(java.util.List) TextView(android.widget.TextView) PhonebookShareAlert(org.telegram.ui.Components.PhonebookShareAlert) RelativeLayout(android.widget.RelativeLayout) Pattern(java.util.regex.Pattern) Location(android.location.Location) LocationManager(android.location.LocationManager) Window(android.view.Window) ActivityManager(android.app.ActivityManager) Context(android.content.Context) KeyEvent(android.view.KeyEvent) VoIPService(org.telegram.messenger.voip.VoIPService) Theme(org.telegram.ui.ActionBar.Theme) BulletinFactory(org.telegram.ui.Components.BulletinFactory) Intent(android.content.Intent) LocaleController(org.telegram.messenger.LocaleController) HashMap(java.util.HashMap) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout) SharingLocationsAlert(org.telegram.ui.Components.SharingLocationsAlert) AudioManager(android.media.AudioManager) MotionEvent(android.view.MotionEvent) TLObject(org.telegram.tgnet.TLObject) MessageObject(org.telegram.messenger.MessageObject) SharedConfig(org.telegram.messenger.SharedConfig) BuildVars(org.telegram.messenger.BuildVars) MediaDataController(org.telegram.messenger.MediaDataController) Build(android.os.Build) ShortcutInfoCompat(androidx.core.content.pm.ShortcutInfoCompat) Cursor(android.database.Cursor) Browser(org.telegram.messenger.browser.Browser) EmbedBottomSheet(org.telegram.ui.Components.EmbedBottomSheet) DialogObject(org.telegram.messenger.DialogObject) Point(android.graphics.Point) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FileLog(org.telegram.messenger.FileLog) MessagesController(org.telegram.messenger.MessagesController) Color(android.graphics.Color) StatFs(android.os.StatFs) Bitmap(android.graphics.Bitmap) Base64(android.util.Base64) ViewTreeObserver(android.view.ViewTreeObserver) UpdateAppAlertDialog(org.telegram.ui.Components.UpdateAppAlertDialog) Activity(android.app.Activity) RecyclerListView(org.telegram.ui.Components.RecyclerListView) StickerSetBulletinLayout(org.telegram.ui.Components.StickerSetBulletinLayout) RLottieDrawable(org.telegram.ui.Components.RLottieDrawable) InputStream(java.io.InputStream) HashMap(java.util.HashMap) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) TLRPC(org.telegram.tgnet.TLRPC) Canvas(android.graphics.Canvas) DrawerUserCell(org.telegram.ui.Cells.DrawerUserCell) File(java.io.File) ContactsController(org.telegram.messenger.ContactsController) RLottieImageView(org.telegram.ui.Components.RLottieImageView) StickerSetBulletinLayout(org.telegram.ui.Components.StickerSetBulletinLayout) ActivityManager(android.app.ActivityManager) Bitmap(android.graphics.Bitmap) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ImageView(android.widget.ImageView) UndoView(org.telegram.ui.Components.UndoView) PipRoundVideoView(org.telegram.ui.Components.PipRoundVideoView) PasscodeView(org.telegram.ui.Components.PasscodeView) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) ThemeEditorView(org.telegram.ui.Components.ThemeEditorView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TermsOfServiceView(org.telegram.ui.Components.TermsOfServiceView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) BlockingUpdateView(org.telegram.ui.Components.BlockingUpdateView) TextView(android.widget.TextView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) Paint(android.graphics.Paint) Point(android.graphics.Point) ParseException(java.text.ParseException) SideMenultItemAnimator(org.telegram.ui.Components.SideMenultItemAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) TLObject(org.telegram.tgnet.TLObject) FrameLayout(android.widget.FrameLayout) SizeNotifierFrameLayout(org.telegram.ui.Components.SizeNotifierFrameLayout) Theme(org.telegram.ui.ActionBar.Theme) MessageObject(org.telegram.messenger.MessageObject)

Aggregations

ViewGroup (android.view.ViewGroup)4 RelativeLayout (android.widget.RelativeLayout)4 ActionBarLayout (org.telegram.ui.ActionBar.ActionBarLayout)4 DrawerLayoutContainer (org.telegram.ui.ActionBar.DrawerLayoutContainer)4 PasscodeView (org.telegram.ui.Components.PasscodeView)4 FrameLayout (android.widget.FrameLayout)3 SizeNotifierFrameLayout (org.telegram.ui.Components.SizeNotifierFrameLayout)3 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ObjectAnimator (android.animation.ObjectAnimator)2 ActivityManager (android.app.ActivityManager)2 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 Canvas (android.graphics.Canvas)2 Paint (android.graphics.Paint)2 Point (android.graphics.Point)2 LocationManager (android.location.LocationManager)2 Uri (android.net.Uri)2 Bundle (android.os.Bundle)2 View (android.view.View)2