Android Open Source - example-lock-app Prompt Fragment






From Project

Back to project page example-lock-app.

License

The source code is released under:

Apache License

If you think the Android project example-lock-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lockapp.fragments.lollipop;
//ww  w  .j a  va2 s .  c o m
import android.annotation.TargetApi;
import android.app.Fragment;
import android.os.Build;
import android.os.Bundle;
import android.transition.TransitionInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lockapp.R;
import com.lockapp.fragments.FragmentUtils;
import com.lockapp.fragments.PromptUtils;

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class PromptFragment extends Fragment {


    FragmentUtils utils = new PromptUtils() {

        @Override
        public void swapFragment() {
            if (getActivity() != null) {
                Fragment controlsFragment = new ControlsFragment();
                controlsFragment.setSharedElementEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.change_transform));
                controlsFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.explode));
                getFragmentManager().beginTransaction().replace(R.id.content, controlsFragment)
                        .addSharedElement(getSharedElement(), SHARED_ELEMENT_NAME)
                        .commit();
            }
        }
    };

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedState) {
        return utils.onCreateView(getActivity(), inflater, parent, savedState);
    }


    @Override
    public void onResume() {
        super.onResume();
        utils.onResume();
    }

    @Override
    public void onPause() {
        utils.onPause();
        super.onPause();
    }
}




Java Source Code List

com.lockapp.AboutActivity.java
com.lockapp.LockDeviceReceiver.java
com.lockapp.LockWidgetProvider.java
com.lockapp.MainActivity.java
com.lockapp.fragments.FragmentUtils.java
com.lockapp.fragments.NotificationStatus.java
com.lockapp.fragments.PromptUtils.java
com.lockapp.fragments.lollipop.ControlsFragment.java
com.lockapp.fragments.lollipop.ControlsUtils.java
com.lockapp.fragments.lollipop.PromptFragment.java
com.lockapp.fragments.others.ControlsFragment.java
com.lockapp.fragments.others.PromptFragment.java