Search in sources :

Example 1 with StatusInstallerFragment

use of de.robv.android.xposed.installer.installation.StatusInstallerFragment in project XposedInstaller by rovo89.

the class WelcomeActivity method navigate.

private void navigate(final int itemId) {
    final View elevation = findViewById(R.id.elevation);
    Fragment navFragment = null;
    switch(itemId) {
        case R.id.nav_item_framework:
            mPrevSelectedId = itemId;
            setTitle(R.string.app_name);
            navFragment = new StatusInstallerFragment();
            break;
        case R.id.nav_item_modules:
            mPrevSelectedId = itemId;
            setTitle(R.string.nav_item_modules);
            navFragment = new ModulesFragment();
            break;
        case R.id.nav_item_downloads:
            mPrevSelectedId = itemId;
            setTitle(R.string.nav_item_download);
            navFragment = new DownloadFragment();
            break;
        case R.id.nav_item_logs:
            mPrevSelectedId = itemId;
            setTitle(R.string.nav_item_logs);
            navFragment = new LogsFragment();
            break;
        case R.id.nav_item_settings:
            startActivity(new Intent(this, SettingsActivity.class));
            mNavigationView.getMenu().findItem(mPrevSelectedId).setChecked(true);
            return;
        case R.id.nav_item_support:
            startActivity(new Intent(this, SupportActivity.class));
            mNavigationView.getMenu().findItem(mPrevSelectedId).setChecked(true);
            return;
        case R.id.nav_item_about:
            startActivity(new Intent(this, AboutActivity.class));
            mNavigationView.getMenu().findItem(mPrevSelectedId).setChecked(true);
            return;
    }
    final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(4));
    if (navFragment != null) {
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.setCustomAnimations(R.animator.fade_in, R.animator.fade_out);
        try {
            transaction.replace(R.id.content_frame, navFragment).commit();
            if (elevation != null) {
                Animation a = new Animation() {

                    @Override
                    protected void applyTransformation(float interpolatedTime, Transformation t) {
                        elevation.setLayoutParams(params);
                    }
                };
                a.setDuration(150);
                elevation.startAnimation(a);
            }
        } catch (IllegalStateException ignored) {
        }
    }
}
Also used : Transformation(android.view.animation.Transformation) StatusInstallerFragment(de.robv.android.xposed.installer.installation.StatusInstallerFragment) Intent(android.content.Intent) NavigationView(android.support.design.widget.NavigationView) View(android.view.View) StatusInstallerFragment(de.robv.android.xposed.installer.installation.StatusInstallerFragment) Fragment(android.app.Fragment) FragmentTransaction(android.app.FragmentTransaction) Animation(android.view.animation.Animation) LinearLayout(android.widget.LinearLayout)

Aggregations

Fragment (android.app.Fragment)1 FragmentTransaction (android.app.FragmentTransaction)1 Intent (android.content.Intent)1 NavigationView (android.support.design.widget.NavigationView)1 View (android.view.View)1 Animation (android.view.animation.Animation)1 Transformation (android.view.animation.Transformation)1 LinearLayout (android.widget.LinearLayout)1 StatusInstallerFragment (de.robv.android.xposed.installer.installation.StatusInstallerFragment)1