diff options
author | d34d <clark@cyngn.com> | 2015-12-03 16:48:54 -0800 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2015-12-03 16:53:37 -0800 |
commit | a2f4c5812e83812a94f9b608456a233d4c12019a (patch) | |
tree | b6326cb237d66c8927528681dfe3c59f52b4c394 /src/com/cyanogenmod/setupwizard/setup | |
parent | 070fbeaf5d4f0a25282f64936a21b4ac7e5c469b (diff) | |
download | packages_apps_SetupWizard-a2f4c5812e83812a94f9b608456a233d4c12019a.zip packages_apps_SetupWizard-a2f4c5812e83812a94f9b608456a233d4c12019a.tar.gz packages_apps_SetupWizard-a2f4c5812e83812a94f9b608456a233d4c12019a.tar.bz2 |
Revert "Fingerprint: Use AOSP fingerprint setup"
This reverts commit 070fbeaf5d4f0a25282f64936a21b4ac7e5c469b.
We still need to show the fingerprint setup screen which allows
the user to skip setting up a fingerprint if they choose to do so.
Change-Id: Ifa49ad1ac0e5cf113290b973ac5e9cd8abdbed9a
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/FingerprintSetupPage.java | 98 |
1 files changed, 55 insertions, 43 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/FingerprintSetupPage.java b/src/com/cyanogenmod/setupwizard/setup/FingerprintSetupPage.java index 86f45ee..890a4f6 100644 --- a/src/com/cyanogenmod/setupwizard/setup/FingerprintSetupPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/FingerprintSetupPage.java @@ -23,32 +23,33 @@ import android.app.FragmentManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.view.View; +import android.widget.TextView; +import com.android.internal.widget.LockPatternUtils; import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.SetupWizardApp; import com.cyanogenmod.setupwizard.cmstats.SetupStats; -import com.cyanogenmod.setupwizard.ui.LoadingFragment; +import com.cyanogenmod.setupwizard.ui.SetupPageFragment; public class FingerprintSetupPage extends SetupPage { private static final String TAG = "FingerprintSetupPage"; - private LoadingFragment mLoadingFragment; - public FingerprintSetupPage(Context context, SetupDataCallbacks callbacks) { super(context, callbacks); } @Override public Fragment getFragment(FragmentManager fragmentManager, int action) { - mLoadingFragment = (LoadingFragment)fragmentManager.findFragmentByTag(getKey()); - if (mLoadingFragment == null) { + Fragment fragment = fragmentManager.findFragmentByTag(getKey()); + if (fragment == null) { Bundle args = new Bundle(); args.putString(Page.KEY_PAGE_ARGUMENT, getKey()); args.putInt(Page.KEY_PAGE_ACTION, action); - mLoadingFragment = new LoadingFragment(); - mLoadingFragment.setArguments(args); + fragment = new FingerprintSetupFragment(); + fragment.setArguments(args); } - return mLoadingFragment; + return fragment; } @Override @@ -63,49 +64,60 @@ public class FingerprintSetupPage extends SetupPage { @Override public int getTitleResId() { - return R.string.loading; - } - - @Override - public void doLoadAction(FragmentManager fragmentManager, int action) { - super.doLoadAction(fragmentManager, action); - launchFingerprintSetup(); + return R.string.fingerprint_setup_title; } - private void launchFingerprintSetup() { - Intent intent = new Intent(SetupWizardApp.ACTION_SETUP_FINGERPRINT); - intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true); - intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT); - ActivityOptions options = - ActivityOptions.makeCustomAnimation(mContext, - android.R.anim.fade_in, - android.R.anim.fade_out); - SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, - SetupStats.Action.EXTERNAL_PAGE_LAUNCH, - SetupStats.Label.PAGE, SetupStats.Label.FINGERPRINT_SETUP); - mLoadingFragment.startActivityForResult(intent, - SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT, options.toBundle()); - } @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT == requestCode) { - if (resultCode == Activity.RESULT_CANCELED) { - SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, - SetupStats.Action.EXTERNAL_PAGE_RESULT, - SetupStats.Label.FINGERPRINT_SETUP, "canceled"); - getCallbacks().onPreviousPage(); - } else if (resultCode == Activity.RESULT_OK) { - SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, - SetupStats.Action.EXTERNAL_PAGE_RESULT, - SetupStats.Label.FINGERPRINT_SETUP, "success"); - getCallbacks().onNextPage(); - } else { - SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, - SetupStats.Action.EXTERNAL_PAGE_RESULT, - SetupStats.Label.FINGERPRINT_SETUP, "skipped"); + if (resultCode == Activity.RESULT_OK) { getCallbacks().onNextPage(); } } return true; } + + public static class FingerprintSetupFragment extends SetupPageFragment { + + private TextView mSetupFingerprint; + + @Override + protected void initializePage() { + mSetupFingerprint = (TextView) mRootView.findViewById(R.id.setup_fingerprint); + mSetupFingerprint.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + launchFingerprintSetup(); + } + }); + } + + @Override + protected int getLayoutResource() { + return R.layout.setup_fingerprint; + } + + private void launchFingerprintSetup() { + Intent intent = new Intent(SetupWizardApp.ACTION_SETUP_FINGERPRINT); + intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true); + intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true); + intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true); + intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT); + intent.putExtra(SetupWizardApp.EXTRA_AUTO_FINISH, false); + /*intent.putExtra(LockPatternUtils.LOCKSCREEN_FINGERPRINT_FALLBACK, true);*/ + intent.putExtra(SetupWizardApp.EXTRA_TITLE, + getString(R.string.settings_fingerprint_setup_title)); + intent.putExtra(SetupWizardApp.EXTRA_DETAILS, + getString(R.string.settings_fingerprint_setup_details)); + ActivityOptions options = + ActivityOptions.makeCustomAnimation(getActivity(), + android.R.anim.fade_in, + android.R.anim.fade_out); + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_LAUNCH, + SetupStats.Label.PAGE, SetupStats.Label.FINGERPRINT_SETUP); + startActivityForResult(intent, SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT, + options.toBundle()); + } + } } |