SetupWizard: Reveal the default wallpaper on oobe finish
Change-Id: I68a256853f256af3464da7eba57a307a810d80cd
This commit is contained in:
parent
aaec6f7e3e
commit
9d72db9dbe
|
@ -77,6 +77,7 @@
|
||||||
android:label="@string/product_name"
|
android:label="@string/product_name"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
android:uiOptions="none"
|
||||||
android:immersive="true">
|
android:immersive="true">
|
||||||
|
|
||||||
<intent-filter android:priority="9">
|
<intent-filter android:priority="9">
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
|
||||||
android:interpolator="@android:anim/accelerate_interpolator"
|
|
||||||
android:duration="1000"/>
|
|
||||||
</set>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
|
|
||||||
android:interpolator="@android:anim/accelerate_interpolator"
|
|
||||||
android:duration="1000"/>
|
|
||||||
</set>
|
|
|
@ -20,6 +20,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingTop="@dimen/header_logo_margin_top"
|
android:paddingTop="@dimen/header_logo_margin_top"
|
||||||
|
android:background="@color/primary"
|
||||||
style="@style/Header">
|
style="@style/Header">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/button_bar"
|
android:id="@+id/button_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/button_bar_background">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/ButtonBar.Left"
|
style="@style/ButtonBar.Left"
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
android:id="@+id/header"
|
android:id="@+id/header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/header_height"
|
android:layout_height="@dimen/header_height"
|
||||||
|
android:background="@color/header_bg"
|
||||||
style="@style/Header">
|
style="@style/Header">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/header"
|
android:id="@+id/header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/page_title_height"
|
android:layout_height="@dimen/header_condensed_height"
|
||||||
|
android:background="@color/header_condensed_bg"
|
||||||
style="@style/Header">
|
style="@style/Header">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
android:id="@+id/header"
|
android:id="@+id/header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/logo_header_height"
|
android:layout_height="@dimen/logo_header_height"
|
||||||
|
android:background="@color/primary"
|
||||||
style="@style/Header">
|
style="@style/Header">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -14,12 +14,16 @@
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.cyanogenmod.setupwizard.ui.widget.ScrimInsetsFrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="true">
|
android:clickable="true"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:insetForeground="@android:color/transparent">
|
||||||
|
|
||||||
<LinearLayout android:orientation="vertical"
|
<LinearLayout android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -41,5 +45,5 @@
|
||||||
android:background="@drawable/reveal"
|
android:background="@drawable/reveal"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</com.cyanogenmod.setupwizard.ui.widget.ScrimInsetsFrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<color name="status_bar">@color/primary_dark</color>
|
<color name="header_bg">@color/header_condensed_bg</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="header_height">@dimen/page_title_height</dimen>
|
<dimen name="header_height">@dimen/header_condensed_height</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!--
|
||||||
|
Copyright 2014 Google Inc. All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="ScrimInsetsView">
|
||||||
|
<attr name="insetForeground" format="reference|color" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
|
@ -17,7 +17,6 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="black">#000000</color>
|
<color name="black">#000000</color>
|
||||||
<color name="white">#ffffff</color>
|
<color name="white">#ffffff</color>
|
||||||
<color name="window_background">#e4e7e8</color>
|
|
||||||
<color name="page_background">#efefef</color>
|
<color name="page_background">#efefef</color>
|
||||||
|
|
||||||
<color name="primary">#00B1E5</color>
|
<color name="primary">#00B1E5</color>
|
||||||
|
@ -26,5 +25,7 @@
|
||||||
<color name="primary_text">#8a000000</color>
|
<color name="primary_text">#8a000000</color>
|
||||||
<color name="secondary_text">#727272</color>
|
<color name="secondary_text">#727272</color>
|
||||||
<color name="divider">#40000000</color>
|
<color name="divider">#40000000</color>
|
||||||
<color name="status_bar">@color/primary</color>
|
<color name="header_bg">@color/primary</color>
|
||||||
|
<color name="header_condensed_bg">@color/primary_dark</color>
|
||||||
|
<color name="button_bar_background">#e4e7e8</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="logo_header_height">220dp</dimen>
|
<dimen name="logo_header_height">244dp</dimen>
|
||||||
<dimen name="header_height">220dp</dimen>
|
<dimen name="header_height">244dp</dimen>
|
||||||
|
<dimen name="header_condensed_height">88dp</dimen>
|
||||||
<dimen name="page_title_height">64dp</dimen>
|
<dimen name="page_title_height">64dp</dimen>
|
||||||
<dimen name="header_title_margin_left">26dp</dimen>
|
<dimen name="header_title_margin_left">26dp</dimen>
|
||||||
<dimen name="header_logo_margin_left">25dp</dimen>
|
<dimen name="header_logo_margin_left">25dp</dimen>
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
<style name="Theme.Setup" parent="@android:style/Theme.Material.Light">
|
<style name="Theme.Setup" parent="@android:style/Theme.Material.Light">
|
||||||
<item name="android:windowActionBar">false</item>
|
<item name="android:windowActionBar">false</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowBackground">@color/window_background</item>
|
<item name="android:windowBackground">@color/page_background</item>
|
||||||
<item name="android:colorPrimary">@color/primary</item>
|
<item name="android:colorPrimary">@color/primary</item>
|
||||||
<item name="android:colorPrimaryDark">@color/primary</item>
|
<item name="android:colorPrimaryDark">@color/primary</item>
|
||||||
<item name="android:colorAccent">@color/accent</item>
|
<item name="android:colorAccent">@color/accent</item>
|
||||||
<item name="android:textColorLink">@color/accent</item>
|
<item name="android:textColorLink">@color/accent</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Header">
|
<style name="Header">
|
||||||
<item name="android:elevation">4dp</item>
|
<item name="android:elevation">4dp</item>
|
||||||
<item name="android:background">@color/primary</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="PageContainer">
|
<style name="PageContainer">
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
|
|
|
@ -16,13 +16,11 @@
|
||||||
|
|
||||||
package com.cyanogenmod.setupwizard.setup;
|
package com.cyanogenmod.setupwizard.setup;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
@ -210,13 +208,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
final Activity activity = getActivity();
|
|
||||||
activity.getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializePage() {
|
protected void initializePage() {
|
||||||
String privacy_policy = getString(R.string.services_privacy_policy);
|
String privacy_policy = getString(R.string.services_privacy_policy);
|
||||||
|
|
|
@ -70,12 +70,6 @@ public class FinishPage extends SetupPage {
|
||||||
|
|
||||||
public static class FinishFragment extends SetupPageFragment {
|
public static class FinishFragment extends SetupPageFragment {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializePage() {}
|
protected void initializePage() {}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class OtherSettingsPage extends SetupPage {
|
||||||
|
|
||||||
private static final String TAG = "OtherSettingsPage";
|
private static final String TAG = "OtherSettingsPage";
|
||||||
|
|
||||||
private static final String PRIVACY_POLICY_URI = "https://www.google.com/intl/en/policies/privacy/?fg=1";
|
private static final String PRIVACY_POLICY_URI =
|
||||||
|
"https://www.google.com/intl/en/policies/privacy/?fg=1";
|
||||||
|
|
||||||
public OtherSettingsPage(Context context, SetupDataCallbacks callbacks) {
|
public OtherSettingsPage(Context context, SetupDataCallbacks callbacks) {
|
||||||
super(context, callbacks);
|
super(context, callbacks);
|
||||||
|
@ -140,7 +141,6 @@ public class OtherSettingsPage extends SetupPage {
|
||||||
mContentResolver = getActivity().getContentResolver();
|
mContentResolver = getActivity().getContentResolver();
|
||||||
mBackupManager = IBackupManager.Stub.asInterface(
|
mBackupManager = IBackupManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.BACKUP_SERVICE));
|
ServiceManager.getService(Context.BACKUP_SERVICE));
|
||||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,7 +157,8 @@ public class OtherSettingsPage extends SetupPage {
|
||||||
public void onClick(View textView) {
|
public void onClick(View textView) {
|
||||||
WebViewDialogFragment.newInstance()
|
WebViewDialogFragment.newInstance()
|
||||||
.setUri(PRIVACY_POLICY_URI)
|
.setUri(PRIVACY_POLICY_URI)
|
||||||
.show(getActivity().getFragmentManager(), WebViewDialogFragment.TAG);
|
.show(getActivity().getFragmentManager(),
|
||||||
|
WebViewDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ss.setSpan(clickableSpan,
|
ss.setSpan(clickableSpan,
|
||||||
|
@ -219,11 +220,13 @@ public class OtherSettingsPage extends SetupPage {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
// listen for Location Manager settings changes
|
// listen for Location Manager settings changes
|
||||||
Cursor settingsCursor = getActivity().getContentResolver().query(Settings.Secure.CONTENT_URI, null,
|
Cursor settingsCursor = getActivity().getContentResolver()
|
||||||
|
.query(Settings.Secure.CONTENT_URI, null,
|
||||||
"(" + Settings.System.NAME + "=?)",
|
"(" + Settings.System.NAME + "=?)",
|
||||||
new String[]{Settings.Secure.LOCATION_PROVIDERS_ALLOWED},
|
new String[]{Settings.Secure.LOCATION_PROVIDERS_ALLOWED},
|
||||||
null);
|
null);
|
||||||
mContentQueryMap = new ContentQueryMap(settingsCursor, Settings.System.NAME, true, null);
|
mContentQueryMap =
|
||||||
|
new ContentQueryMap(settingsCursor, Settings.System.NAME, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,12 +105,6 @@ public class WelcomePage extends SetupPage {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializePage() {
|
protected void initializePage() {
|
||||||
mLanguagePicker = (LocalePicker) mRootView.findViewById(R.id.locale_list);
|
mLanguagePicker = (LocalePicker) mRootView.findViewById(R.id.locale_list);
|
||||||
|
|
|
@ -66,7 +66,6 @@ public abstract class SetupPageFragment extends Fragment {
|
||||||
}
|
}
|
||||||
initializePage();
|
initializePage();
|
||||||
mCallbacks.onPageLoaded(mPage);
|
mCallbacks.onPageLoaded(mPage);
|
||||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.status_bar));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,9 +19,11 @@ package com.cyanogenmod.setupwizard.ui;
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AppGlobals;
|
import android.app.AppGlobals;
|
||||||
|
import android.app.WallpaperManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
@ -45,6 +47,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
private static final String TAG = SetupWizardActivity.class.getSimpleName();
|
private static final String TAG = SetupWizardActivity.class.getSimpleName();
|
||||||
|
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
|
private View mButtonBar;
|
||||||
private Button mNextButton;
|
private Button mNextButton;
|
||||||
private Button mPrevButton;
|
private Button mPrevButton;
|
||||||
private View mReveal;
|
private View mReveal;
|
||||||
|
@ -59,9 +62,12 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
setContentView(R.layout.setup_main);
|
setContentView(R.layout.setup_main);
|
||||||
getWindow().setWindowAnimations(android.R.anim.fade_in);
|
getWindow().setWindowAnimations(android.R.anim.fade_in);
|
||||||
mRootView = findViewById(R.id.root);
|
mRootView = findViewById(R.id.root);
|
||||||
|
mButtonBar = findViewById(R.id.button_bar);
|
||||||
((SetupWizardApp)getApplicationContext()).disableStatusBar();
|
((SetupWizardApp)getApplicationContext()).disableStatusBar();
|
||||||
mSetupData = (CMSetupWizardData)getLastNonConfigurationInstance();
|
mSetupData = (CMSetupWizardData)getLastNonConfigurationInstance();
|
||||||
if (mSetupData == null) {
|
if (mSetupData == null) {
|
||||||
|
@ -70,16 +76,19 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
mNextButton = (Button) findViewById(R.id.next_button);
|
mNextButton = (Button) findViewById(R.id.next_button);
|
||||||
mPrevButton = (Button) findViewById(R.id.prev_button);
|
mPrevButton = (Button) findViewById(R.id.prev_button);
|
||||||
mReveal = findViewById(R.id.reveal);
|
mReveal = findViewById(R.id.reveal);
|
||||||
|
setupRevealImage();
|
||||||
mSetupData.registerListener(this);
|
mSetupData.registerListener(this);
|
||||||
mNextButton.setOnClickListener(new View.OnClickListener() {
|
mNextButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
enableButtonBar(false);
|
||||||
mSetupData.onNextPage();
|
mSetupData.onNextPage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mPrevButton.setOnClickListener(new View.OnClickListener() {
|
mPrevButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
enableButtonBar(false);
|
||||||
mSetupData.onPreviousPage();
|
mSetupData.onPreviousPage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -120,8 +129,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateSystemUI();
|
|
||||||
onPageTreeChanged();
|
onPageTreeChanged();
|
||||||
|
enableButtonBar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,8 +177,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageLoaded(Page page) {
|
public void onPageLoaded(Page page) {
|
||||||
updateSystemUI();
|
|
||||||
updateButtonBar();
|
updateButtonBar();
|
||||||
|
enableButtonBar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -177,16 +186,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
updateButtonBar();
|
updateButtonBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSystemUI() {
|
private void enableButtonBar(boolean enabled) {
|
||||||
if (getResources().getConfiguration().orientation
|
mNextButton.setEnabled(enabled);
|
||||||
== Configuration.ORIENTATION_LANDSCAPE &&
|
mPrevButton.setEnabled(enabled);
|
||||||
mSetupData.isFirstPage()) {
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE
|
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
|
||||||
} else {
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE
|
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtonBar() {
|
private void updateButtonBar() {
|
||||||
|
@ -208,7 +210,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
}
|
}
|
||||||
final Resources resources = getResources();
|
final Resources resources = getResources();
|
||||||
if (mSetupData.isLastPage()) {
|
if (mSetupData.isLastPage()) {
|
||||||
mRootView.setBackgroundColor(resources.getColor(R.color.primary));
|
mButtonBar.setBackgroundResource(R.color.primary);
|
||||||
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||||
getDrawable(R.drawable.ic_chevron_right_wht), null);
|
getDrawable(R.drawable.ic_chevron_right_wht), null);
|
||||||
mNextButton.setTextColor(resources.getColor(R.color.white));
|
mNextButton.setTextColor(resources.getColor(R.color.white));
|
||||||
|
@ -217,7 +219,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
null, null);
|
null, null);
|
||||||
mPrevButton.setTextColor(resources.getColor(R.color.white));
|
mPrevButton.setTextColor(resources.getColor(R.color.white));
|
||||||
} else {
|
} else {
|
||||||
mRootView.setBackgroundColor(resources.getColor(R.color.window_background));
|
mButtonBar.setBackgroundResource(R.color.button_bar_background);
|
||||||
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||||
getDrawable(R.drawable.ic_chevron_right_dark), null);
|
getDrawable(R.drawable.ic_chevron_right_dark), null);
|
||||||
mNextButton.setTextColor(resources.getColor(R.color.primary_text));
|
mNextButton.setTextColor(resources.getColor(R.color.primary_text));
|
||||||
|
@ -246,13 +248,35 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
|
||||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupRevealImage() {
|
||||||
|
Thread t = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Point p = new Point();
|
||||||
|
getWindowManager().getDefaultDisplay().getRealSize(p);
|
||||||
|
final Drawable drawable = WallpaperManager.getInstance(SetupWizardActivity.this)
|
||||||
|
.getBuiltInDrawable(
|
||||||
|
p.x, p.y, false, 0, 0);
|
||||||
|
if (drawable != null) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mReveal.setBackground(drawable);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
|
||||||
private void animateOut() {
|
private void animateOut() {
|
||||||
int cx = (mReveal.getLeft() + mReveal.getRight()) / 2;
|
int cx = (mReveal.getLeft() + mReveal.getRight()) / 2;
|
||||||
int cy = (mReveal.getTop() + mReveal.getBottom()) / 2;
|
int cy = (mReveal.getTop() + mReveal.getBottom()) / 2;
|
||||||
int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight());
|
int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight());
|
||||||
Animator anim =
|
Animator anim =
|
||||||
ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius);
|
ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius);
|
||||||
anim.setDuration(800);
|
anim.setDuration(900);
|
||||||
anim.addListener(new Animator.AnimatorListener() {
|
anim.addListener(new Animator.AnimatorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Google Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cyanogenmod.setupwizard.ui.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.support.v4.view.ViewCompat;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import com.cyanogenmod.setupwizard.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A layout that draws something in the insets passed to {@link #fitSystemWindows(android.graphics.Rect)}, i.e. the area above UI chrome
|
||||||
|
* (status and navigation bars, overlay action bars).
|
||||||
|
*/
|
||||||
|
public class ScrimInsetsFrameLayout extends FrameLayout {
|
||||||
|
private Drawable mInsetForeground;
|
||||||
|
|
||||||
|
private Rect mInsets;
|
||||||
|
private Rect mTempRect = new Rect();
|
||||||
|
private OnInsetsCallback mOnInsetsCallback;
|
||||||
|
|
||||||
|
public ScrimInsetsFrameLayout(Context context) {
|
||||||
|
super(context);
|
||||||
|
init(context, null, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
final TypedArray a = context.obtainStyledAttributes(attrs,
|
||||||
|
R.styleable.ScrimInsetsView, defStyle, 0);
|
||||||
|
if (a == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground);
|
||||||
|
a.recycle();
|
||||||
|
|
||||||
|
setWillNotDraw(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean fitSystemWindows(Rect insets) {
|
||||||
|
mInsets = new Rect(insets);
|
||||||
|
setWillNotDraw(mInsetForeground == null);
|
||||||
|
ViewCompat.postInvalidateOnAnimation(this);
|
||||||
|
if (mOnInsetsCallback != null) {
|
||||||
|
mOnInsetsCallback.onInsetsChanged(insets);
|
||||||
|
}
|
||||||
|
return true; // consume insets
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas) {
|
||||||
|
super.draw(canvas);
|
||||||
|
|
||||||
|
int width = getWidth();
|
||||||
|
int height = getHeight();
|
||||||
|
if (mInsets != null && mInsetForeground != null) {
|
||||||
|
int sc = canvas.save();
|
||||||
|
canvas.translate(getScrollX(), getScrollY());
|
||||||
|
|
||||||
|
// Top
|
||||||
|
mTempRect.set(0, 0, width, mInsets.top);
|
||||||
|
mInsetForeground.setBounds(mTempRect);
|
||||||
|
mInsetForeground.draw(canvas);
|
||||||
|
|
||||||
|
// Bottom
|
||||||
|
mTempRect.set(0, height - mInsets.bottom, width, height);
|
||||||
|
mInsetForeground.setBounds(mTempRect);
|
||||||
|
mInsetForeground.draw(canvas);
|
||||||
|
|
||||||
|
// Left
|
||||||
|
mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
|
||||||
|
mInsetForeground.setBounds(mTempRect);
|
||||||
|
mInsetForeground.draw(canvas);
|
||||||
|
|
||||||
|
// Right
|
||||||
|
mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom);
|
||||||
|
mInsetForeground.setBounds(mTempRect);
|
||||||
|
mInsetForeground.draw(canvas);
|
||||||
|
|
||||||
|
canvas.restoreToCount(sc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
if (mInsetForeground != null) {
|
||||||
|
mInsetForeground.setCallback(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
if (mInsetForeground != null) {
|
||||||
|
mInsetForeground.setCallback(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows the calling container to specify a callback for custom processing when insets change (i.e. when
|
||||||
|
* {@link #fitSystemWindows(android.graphics.Rect)} is called. This is useful for setting padding on UI elements based on
|
||||||
|
* UI chrome insets (e.g. a Google Map or a ListView). When using with ListView or GridView, remember to set
|
||||||
|
* clipToPadding to false.
|
||||||
|
*/
|
||||||
|
public void setOnInsetsCallback(OnInsetsCallback onInsetsCallback) {
|
||||||
|
mOnInsetsCallback = onInsetsCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface OnInsetsCallback {
|
||||||
|
public void onInsetsChanged(Rect insets);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue