Search in sources :

Example 1 with Slide

use of android.transition.Slide in project android_frameworks_base by ResurrectionRemix.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
    mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
    mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
    mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
    mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
    mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
    mTransitionManager = new TransitionManager();
    // Custom transitions in/out of NewUser screen - slide in the 2nd password UI
    TransitionSet slider = new TransitionSet();
    slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit));
    slider.addTransition(new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit));
    slider.addTransition(new Fade());
    mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider);
    // Custom transitions with recoloring password field
    Transition colorizer = new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit);
    mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer);
    mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer);
    mCurrentScene = mLoginScene;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) Transition(android.transition.Transition) TextView(android.widget.TextView) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 2 with Slide

use of android.transition.Slide in project platform_frameworks_base by android.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
    mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
    mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
    mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
    mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
    mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
    mTransitionManager = new TransitionManager();
    // Custom transitions in/out of NewUser screen - slide in the 2nd password UI
    TransitionSet slider = new TransitionSet();
    slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit));
    slider.addTransition(new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit));
    slider.addTransition(new Fade());
    mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider);
    // Custom transitions with recoloring password field
    Transition colorizer = new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit);
    mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer);
    mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer);
    mCurrentScene = mLoginScene;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) Transition(android.transition.Transition) TextView(android.widget.TextView) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 3 with Slide

use of android.transition.Slide in project android_frameworks_base by crdroidandroid.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
    mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
    mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
    mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
    mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
    mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
    mTransitionManager = new TransitionManager();
    // Custom transitions in/out of NewUser screen - slide in the 2nd password UI
    TransitionSet slider = new TransitionSet();
    slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit));
    slider.addTransition(new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit));
    slider.addTransition(new Fade());
    mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider);
    // Custom transitions with recoloring password field
    Transition colorizer = new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit);
    mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer);
    mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer);
    mCurrentScene = mLoginScene;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) Transition(android.transition.Transition) TextView(android.widget.TextView) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 4 with Slide

use of android.transition.Slide in project Camera-Roll-Android-App by kollerlukas.

the class FileExplorerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_file_explorer);
    currentDir = new File_POJO("", false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setEnterTransition(new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER).addTransition(new Slide(Gravity.BOTTOM)).addTransition(new Fade()).setInterpolator(new AccelerateDecelerateInterpolator()));
        getWindow().setReturnTransition(new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER).addTransition(new Slide(Gravity.BOTTOM)).addTransition(new Fade()).setInterpolator(new AccelerateDecelerateInterpolator()));
    }
    final Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(toolbarColor);
    toolbar.setTitleTextColor(textColorPrimary);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && showAnimations()) {
        AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) ContextCompat.getDrawable(FileExplorerActivity.this, R.drawable.back_to_cancel_avd);
        // mutating avd to reset it
        drawable.mutate();
        toolbar.setNavigationIcon(drawable);
    } else {
        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white);
    }
    Drawable navIcon = toolbar.getNavigationIcon();
    if (navIcon != null) {
        navIcon = DrawableCompat.wrap(navIcon);
        DrawableCompat.setTint(navIcon.mutate(), textColorSecondary);
        toolbar.setNavigationIcon(navIcon);
    }
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(getString(R.string.file_explorer));
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    Util.colorToolbarOverflowMenuIcon(toolbar, textColorSecondary);
    // need to be called after setTitle(), to ensure, that mTitleTextView exists
    final TextView titleTextView = Util.setToolbarTypeface(toolbar);
    if (titleTextView != null) {
        titleTextView.setEllipsize(TextUtils.TruncateAt.START);
    }
    final ViewGroup rootView = findViewById(R.id.swipeBackView);
    if (rootView instanceof SwipeBackCoordinatorLayout) {
        ((SwipeBackCoordinatorLayout) rootView).setOnSwipeListener(this);
    }
    recyclerView = findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerViewAdapter = new FileExplorerAdapter(new OnDirectoryChangeCallback() {

        @Override
        public void changeDir(String path) {
            loadDirectory(path);
        }
    }, this);
    if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_DIR)) {
        recyclerViewAdapter.setFiles(currentDir);
    }
    recyclerViewAdapter.notifyDataSetChanged();
    recyclerView.setAdapter(recyclerViewAdapter);
    // setup fab
    final FloatingActionButton fab = findViewById(R.id.fab);
    fab.setImageResource(R.drawable.ic_create_new_folder_white);
    Drawable d = fab.getDrawable();
    d = DrawableCompat.wrap(d);
    DrawableCompat.setTint(d.mutate(), accentTextColor);
    fab.setImageDrawable(d);
    fab.setScaleX(0.0f);
    fab.setScaleY(0.0f);
    // setting window insets manually
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        rootView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {

            @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
            @Override
            public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
                toolbar.setPadding(toolbar.getPaddingStart(), /*+ insets.getSystemWindowInsetLeft()*/
                toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(), toolbar.getPaddingEnd(), /*+ insets.getSystemWindowInsetRight()*/
                toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin += insets.getSystemWindowInsetLeft();
                toolbarParams.rightMargin += insets.getSystemWindowInsetRight();
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(), recyclerView.getPaddingTop() + insets.getSystemWindowInsetTop(), recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(), recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
                fab.setTranslationY(-insets.getSystemWindowInsetBottom());
                fab.setTranslationX(-insets.getSystemWindowInsetRight());
                // clear this listener so insets aren't re-applied
                rootView.setOnApplyWindowInsetsListener(null);
                return insets.consumeSystemWindowInsets();
            }
        });
    } else {
        rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                // hacky way of getting window insets on pre-Lollipop
                // somewhat works...
                int[] screenSize = Util.getScreenSize(FileExplorerActivity.this);
                int[] windowInsets = new int[] { Math.abs(screenSize[0] - rootView.getLeft()), Math.abs(screenSize[1] - rootView.getTop()), Math.abs(screenSize[2] - rootView.getRight()), Math.abs(screenSize[3] - rootView.getBottom()) };
                toolbar.setPadding(toolbar.getPaddingStart(), toolbar.getPaddingTop() + windowInsets[1], toolbar.getPaddingEnd(), toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin += windowInsets[0];
                toolbarParams.rightMargin += windowInsets[2];
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0], recyclerView.getPaddingTop() + windowInsets[1], recyclerView.getPaddingEnd() + windowInsets[2], recyclerView.getPaddingBottom() + windowInsets[3]);
                fab.setTranslationY(-windowInsets[2]);
                fab.setTranslationX(-windowInsets[3]);
                rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }
    // needed to achieve transparent navBar
    setSystemUiFlags();
    // load files
    if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_DIR) && savedInstanceState.containsKey(ROOTS)) {
        roots = savedInstanceState.getParcelable(ROOTS);
        currentDir = savedInstanceState.getParcelable(CURRENT_DIR);
        recyclerViewAdapter.setFiles(currentDir);
        recyclerViewAdapter.notifyDataSetChanged();
        onDataChanged();
        if (savedInstanceState.containsKey(MODE)) {
            int mode = savedInstanceState.getInt(MODE);
            if (mode == FileExplorerAdapter.SELECTOR_MODE) {
                if (savedInstanceState.containsKey(SELECTED_ITEMS)) {
                    final File_POJO[] selectedItems = (File_POJO[]) savedInstanceState.getParcelableArray(SELECTED_ITEMS);
                    if (selectedItems != null) {
                        rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

                            @Override
                            public void onGlobalLayout() {
                                rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                                recyclerViewAdapter.enterSelectorMode(selectedItems);
                            }
                        });
                    }
                }
            } else if (mode == FileExplorerAdapter.PICK_TARGET_MODE && savedInstanceState.containsKey(FILE_OPERATION)) {
                onSelectorModeEnter();
                // fileOp = savedInstanceState.getParcelable(FILE_OPERATION);
                /*FileOperation.operation = fileOp != null ?
                                fileOp.getType() : FileOperation.EMPTY;*/
                // need to call pick target after onSelectorModeEnter animation are done
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        recyclerViewAdapter.pickTarget();
                    }
                }, (int) (500 * Util.getAnimatorSpeed(this)));
            }
        }
    } else {
        loadRoots();
    // show warning dialog
    /*new AlertDialog.Builder(this, getDialogThemeRes())
                    .setTitle(R.string.warning)
                    .setMessage(Html.fromHtml(getString(R.string.file_explorer_warning_message)))
                    .setPositiveButton(R.string.ok, null)
                    .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            finish();
                        }
                    })
                    .show();*/
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WindowInsets(android.view.WindowInsets) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) SwipeBackCoordinatorLayout(us.koller.cameraroll.ui.widget.SwipeBackCoordinatorLayout) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) FloatingActionButton(android.support.design.widget.FloatingActionButton) TextView(android.widget.TextView) ViewTreeObserver(android.view.ViewTreeObserver) ActionBar(android.support.v7.app.ActionBar) FileExplorerAdapter(us.koller.cameraroll.adapter.fileExplorer.FileExplorerAdapter) Toolbar(android.support.v7.widget.Toolbar) ViewGroup(android.view.ViewGroup) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) Handler(android.os.Handler) File_POJO(us.koller.cameraroll.data.models.File_POJO) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) RequiresApi(android.support.annotation.RequiresApi) ColorFade(us.koller.cameraroll.util.animators.ColorFade) Fade(android.transition.Fade)

Example 5 with Slide

use of android.transition.Slide in project malp by gateship-one.

the class MainActivity method showAlbumsForPath.

@Override
public void showAlbumsForPath(String path) {
    if (mNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
        NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
        if (nowPlayingView != null) {
            View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
            coordinatorLayout.setVisibility(View.VISIBLE);
            nowPlayingView.minimize();
        }
    }
    // Create fragment and give it an argument for the selected article
    AlbumsFragment newFragment = new AlbumsFragment();
    Bundle args = new Bundle();
    args.putString(AlbumsFragment.BUNDLE_STRING_EXTRA_PATH, path);
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    newFragment.setEnterTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.START, getResources().getConfiguration().getLayoutDirection())));
    newFragment.setExitTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.END, getResources().getConfiguration().getLayoutDirection())));
    // Replace whatever is in the fragment_container view with this
    // fragment,
    // and add the transaction to the back stack so the user can navigate
    // back
    transaction.replace(R.id.fragment_container, newFragment, AlbumsFragment.TAG);
    transaction.addToBackStack("DirectoryAlbumsFragment");
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.nav_library);
    // Commit the transaction
    transaction.commit();
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) NavigationView(android.support.design.widget.NavigationView) Slide(android.transition.Slide) Bundle(android.os.Bundle) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Aggregations

Slide (android.transition.Slide)32 View (android.view.View)11 Fade (android.transition.Fade)9 TextView (android.widget.TextView)9 FragmentTransaction (android.support.v4.app.FragmentTransaction)7 TransitionSet (android.transition.TransitionSet)7 Bundle (android.os.Bundle)6 ActionBar (android.support.v7.app.ActionBar)6 Transition (android.transition.Transition)5 Recolor (android.transition.Recolor)4 TransitionManager (android.transition.TransitionManager)4 ImageView (android.widget.ImageView)4 RequiresApi (android.support.annotation.RequiresApi)3 NavigationView (android.support.design.widget.NavigationView)3 Toolbar (android.support.v7.widget.Toolbar)3 ViewGroup (android.view.ViewGroup)3 ViewTreeObserver (android.view.ViewTreeObserver)3 WindowInsets (android.view.WindowInsets)3 AdapterView (android.widget.AdapterView)3 SwipeBackCoordinatorLayout (us.koller.cameraroll.ui.widget.SwipeBackCoordinatorLayout)3