SetupWizard: More refactor to match redlines

Change-Id: I74f422ba0c294d5e91aefb9356458c681cc53b37
This commit is contained in:
cretin45 2015-01-21 15:55:03 -08:00
parent 48ca24eb9b
commit 716ffa86dc
35 changed files with 822 additions and 602 deletions

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="-100%"
android:toXDelta="0"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"/>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator android:duration="@android:integer/config_mediumAnimTime"
android:interpolator="@android:anim/accelerate_interpolator"
android:propertyName="x"
android:valueFrom="1280"
android:valueTo="0"
android:valueType="floatType"/>
</set>

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="100%"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"/>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator android:duration="@android:integer/config_mediumAnimTime"
android:interpolator="@android:anim/accelerate_interpolator"
android:propertyName="x"
android:valueFrom="0"
android:valueTo="-1280"
android:valueType="floatType"/>
</set>

View File

@ -16,5 +16,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/divider" />
<size android:width="316dp" android:height="1dp"/>
<size android:width="316dp" android:height="1px"/>
</shape>

19
res/drawable/reveal.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The CyanogenMod Project
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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/page_background" />
</shape>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The CyanogenMod Project
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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingTop="@dimen/header_logo_margin_top"
style="@style/Header">
<ImageView
android:id="@+id/brand_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/brand"
android:paddingLeft="@dimen/header_logo_margin_left"
android:paddingBottom="@dimen/header_logo_margin_bottom"
android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/powered_by_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/powered_by"
android:visibility="gone"
android:paddingLeft="@dimen/header_logo_margin_left"
android:paddingBottom="@dimen/header_logo_margin_bottom"
android:layout_below="@+id/brand_logo"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/page_title_height"
style="@style/PageTitle" />
</RelativeLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The CyanogenMod Project
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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/logo_header" />
<RelativeLayout android:id="@+id/page"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_left"
style="@style/PageContent">
<com.cyanogenmod.setupwizard.ui.LocalePicker
android:id="@+id/locale_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/min_locale_picker_height"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_centerInParent="true"/>
</RelativeLayout>
</LinearLayout>

View File

@ -14,8 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -23,14 +34,14 @@
android:id="@+id/page_view"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
style="@style/PageContent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/PageSummaryText"
android:textSize="15sp"
android:paddingTop="@dimen/content_margin_top"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
android:paddingBottom="@dimen/summary_margin_bottom"
@ -39,6 +50,8 @@
<include layout="@layout/divider" />
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -15,8 +15,10 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="@dimen/header_height">
android:layout_height="@dimen/header_height"
style="@style/Header">
<TextView
android:layout_width="match_parent"

View File

@ -15,8 +15,10 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="@dimen/page_title_height">
android:layout_height="@dimen/page_title_height"
style="@style/Header">
<TextView
android:layout_width="match_parent"

View File

@ -14,8 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header_condensed" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -30,6 +41,8 @@
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginBottom="@dimen/summary_margin_bottom"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
style="@style/PageSummaryText"
android:text="@string/location_services_summary" />
@ -59,6 +72,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -94,6 +108,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -128,6 +143,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -137,4 +153,6 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -15,8 +15,10 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="@dimen/logo_header_height">
android:layout_height="@dimen/logo_header_height"
style="@style/Header">
<ImageView
android:id="@+id/brand_logo"

View File

@ -14,15 +14,27 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
style="@style/PageContent">
<TextView
android:id="@+id/mobile_data_summary"
@ -30,7 +42,6 @@
android:layout_height="wrap_content"
style="@style/PageSummaryText"
android:textSize="15sp"
android:paddingTop="@dimen/content_margin_top"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
android:paddingBottom="@dimen/summary_margin_bottom"
@ -79,5 +90,7 @@
<include layout="@layout/divider" />
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -14,8 +14,20 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header_condensed" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -32,6 +44,8 @@
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginBottom="@dimen/summary_margin_bottom"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
style="@style/PageSummaryText"
android:text="@string/services_explanation"
android:clickable="true"/>
@ -63,6 +77,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -99,6 +114,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -134,6 +150,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:lineSpacingExtra="@dimen/setup_line_spacing"
android:gravity="top"
android:layout_marginLeft="@dimen/location_text_margin_left"
android:layout_marginRight="@dimen/location_text_margin_right"
@ -143,4 +160,6 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -14,8 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -23,6 +34,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
style="@style/PageContent">
<TextView
@ -95,4 +108,6 @@
</TwoLineListItem>
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
style="@android:style/Widget.Material.ProgressBar.Horizontal" />
</LinearLayout>

View File

@ -16,6 +16,15 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primary">
@ -27,6 +36,12 @@
android:src="@drawable/brand_finish"
android:scaleType="centerInside"/>
</LinearLayout>
<ImageView android:id="@+id/reveal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/reveal"
android:visibility="invisible"/>
</FrameLayout>
</LinearLayout>

View File

@ -18,29 +18,14 @@
android:id="@+id/root"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/RootView">
<LinearLayout android:id="@+id/page"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
style="@style/PageContainer" >
<FrameLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Header"/>
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
android:layout_weight="1"
style="@style/PageContainer"/>
<include layout="@layout/button_bar" />

View File

@ -14,19 +14,31 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="match_parent">
<include layout="@layout/logo_header" />
<RelativeLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_left"
style="@style/PageContent">
<com.cyanogenmod.setupwizard.ui.LocalePicker
android:id="@+id/locale_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="12dp"
android:gravity="left"
android:minHeight="@dimen/min_locale_picker_height"
android:focusable="true"
android:focusableInTouchMode="true"/>
android:focusableInTouchMode="true"
android:layout_centerInParent="true"/>
</FrameLayout>
</RelativeLayout>
</LinearLayout>

View File

@ -14,15 +14,27 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
style="@style/PageContent">
<TextView
android:layout_width="match_parent"
@ -31,7 +43,6 @@
style="@style/PageSummaryText"
android:textSize="15sp"
android:layout_marginBottom="@dimen/summary_margin_bottom"
android:paddingTop="@dimen/content_margin_top"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
android:text="@string/sim_missing_summary" />
@ -43,7 +54,10 @@
android:src="@drawable/sim_back"/>
</LinearLayout>
</ScrollView>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The CyanogenMod Project
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>
<color name="status_bar">@color/primary_dark</color>
</resources>

View File

@ -15,5 +15,5 @@
limitations under the License.
-->
<resources>
<dimen name="header_height">@dimen/page_title_height</dimen>
</resources>

View File

@ -20,10 +20,11 @@
<color name="window_background">#e4e7e8</color>
<color name="page_background">#efefef</color>
<color name="primary">#2196f3</color>
<color name="primary_dark">#1481d8</color>
<color name="primary">#00B1E5</color>
<color name="primary_dark">#00A2E5</color>
<color name="accent">#009789</color>
<color name="primary_text">#8a000000</color>
<color name="secondary_text">#727272</color>
<color name="divider">#40000000</color>
<color name="status_bar">@color/primary</color>
</resources>

View File

@ -15,12 +15,13 @@
limitations under the License.
-->
<resources>
<dimen name="logo_header_height">290dp</dimen>
<dimen name="logo_header_height">220dp</dimen>
<dimen name="header_height">220dp</dimen>
<dimen name="page_title_height">56dp</dimen>
<dimen name="header_title_margin_left">26dp</dimen>
<dimen name="header_logo_margin_left">25dp</dimen>
<dimen name="header_logo_margin_bottom">11dp</dimen>
<dimen name="header_logo_margin_top">30dp</dimen>
<dimen name="content_margin_top">26dp</dimen>
<dimen name="content_margin_left">26dp</dimen>
<dimen name="content_margin_right">14dp</dimen>
@ -31,4 +32,6 @@
<dimen name="location_text_margin_right">30dp</dimen>
<dimen name="data_switch_margin_right">30dp</dimen>
<dimen name="carrier_text_margin_left">15dp</dimen>
<dimen name="setup_line_spacing">3sp</dimen>
<dimen name="min_locale_picker_height">100dp</dimen>
</resources>

View File

@ -49,9 +49,9 @@
<string name="date_time_summary">Set your time zone and adjust current date and time if needed</string>
<string name="location_services_summary">Location services allows Maps and other apps to gather and use data such as your approximate location. For example, Maps may use your approximate location to locate nearby coffee shops.</string>
<string name="location_access_summary">Allow apps that have asked your permission to use your location information. This may include your current location and past locations.</string>
<string name="location_gps">Improve location accuracy by allowing apps to use the GPS on your phone.</string>
<string name="location_network">Use Google\'s location service to help apps determine your location. This means sending annonymous location data to Google, even when no apps are running.</string>
<string name="location_access_summary"><b>Allow apps that have asked your permission</b> to use your location information. This may include your current location and past locations.</string>
<string name="location_gps"><b>Improve location accuracy</b> by allowing apps to use the GPS on your phone.</string>
<string name="location_network"><b>Use Google\'s location service</b> to help apps determine your location. This means sending annonymous location data to Google, even when no apps are running.</string>
<string name="setup_mobile_data">Turn On Mobile Data</string>
<string name="setup_mobile_data_no_service">No service</string>

View File

@ -18,17 +18,15 @@
<style name="Theme.Setup" parent="@android:style/Theme.Material.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/primary</item>
<item name="android:windowActivityTransitions">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowExitTransition">@android:transition/explode</item>
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary</item>
<item name="android:colorPrimaryDark">#00000000</item>
<item name="android:colorAccent">@color/accent</item>
</style>
<style name="RootView">
<item name="android:background">@color/window_background</item>
</style>
<style name="Header">
<item name="android:elevation">4dp</item>
<item name="android:background">@color/primary</item>
@ -36,13 +34,11 @@
<style name="PageContainer">
<item name="android:textColor">@color/primary_text</item>
<item name="android:background">@color/page_background</item>
</style>
<style name="PageContent">
<item name="android:background">@color/page_background</item>
<item name="android:paddingTop">@dimen/content_margin_top</item>
<item name="android:paddingLeft">@dimen/content_margin_left</item>
<item name="android:paddingRight">@dimen/content_margin_right</item>
</style>
<style name="PageTitle">
@ -57,6 +53,7 @@
<style name="PageSummaryText">
<item name="android:id">@android:id/summary</item>
<item name="android:lineSpacingExtra">@dimen/setup_line_spacing</item>
</style>
<style name="SpinnerItem">

View File

@ -18,7 +18,6 @@ package com.cyanogenmod.setupwizard.setup;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import java.util.ArrayList;
@ -104,10 +103,6 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
}
}
@Override
public void onPageViewCreated(LayoutInflater inflater, Bundle savedInstanceState,
int layoutResource) {}
private boolean advanceToNextUncompleted() {
while (mCurrentPageIndex < mPageList.size()) {
mCurrentPageIndex++;

View File

@ -17,8 +17,6 @@
package com.cyanogenmod.setupwizard.setup;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@ -137,8 +135,6 @@ public class CyanogenServicesPage extends SetupPage {
private CheckBox mNavKeys;
private CheckBox mSecureSms;
private Runnable mDeferredAction;
private Handler mHandler;
@ -250,23 +246,10 @@ public class CyanogenServicesPage extends SetupPage {
return R.layout.setup_cyanogen_services;
}
@Override
protected int getHeaderLayoutResource() {
return R.layout.header_condensed;
}
@Override
public void onResume() {
super.onResume();
updateDisableNavkeysOption();
runDeferredAction();
}
private void runDeferredAction() {
if (mDeferredAction != null) {
mDeferredAction.run();
mDeferredAction = null;
}
}
private void updateDisableNavkeysOption() {
@ -279,28 +262,9 @@ public class CyanogenServicesPage extends SetupPage {
private void launchCyanogenAccountSetup(final Activity activity) {
Bundle bundle = new Bundle();
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
AccountManager
.get(activity).addAccount(SetupWizardApp.ACCOUNT_TYPE_CYANOGEN, null, null, bundle,
activity, new AccountManagerCallback<Bundle>() {
@Override
public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
if (activity == null) return; //There is a chance this activity has been torn down.
Runnable runnable = new Runnable() {
@Override
public void run() {
if (!SetupWizardUtils.accountExists(activity,
SetupWizardApp.ACCOUNT_TYPE_CYANOGEN)) {
mPage.getCallbacks().onNextPage();
}
}
};
if (activity.isResumed()) {
runnable.run();
} else {
mDeferredAction = runnable;
}
}
}, null);
AccountManager.get(activity)
.addAccount(SetupWizardApp.ACCOUNT_TYPE_CYANOGEN, null, null, bundle,
activity, null, null);
}
}

View File

@ -19,14 +19,20 @@ package com.cyanogenmod.setupwizard.setup;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
import android.animation.Animator;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewAnimationUtils;
public class FinishPage extends SetupPage {
public static final String TAG = "FinishPage";
private FinishFragment mFinishFragment;
public FinishPage(Context context, SetupDataCallbacks callbacks) {
super(context, callbacks);
}
@ -36,9 +42,9 @@ public class FinishPage extends SetupPage {
Bundle args = new Bundle();
args.putString(SetupPage.KEY_PAGE_ARGUMENT, getKey());
FinishFragment fragment = new FinishFragment();
fragment.setArguments(args);
return fragment;
mFinishFragment = new FinishFragment();
mFinishFragment.setArguments(args);
return mFinishFragment;
}
@Override
@ -53,7 +59,7 @@ public class FinishPage extends SetupPage {
@Override
public boolean doNextAction() {
getCallbacks().onFinish();
mFinishFragment.animateOut(getCallbacks());
return true;
}
@ -69,18 +75,58 @@ public class FinishPage extends SetupPage {
public static class FinishFragment extends SetupPageFragment {
private View mReveal;
private Handler mHandler;
@Override
protected void initializePage() {}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mHandler = new Handler();
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
}
@Override
protected void initializePage() {
mReveal = mRootView.findViewById(R.id.reveal);
}
private void animateOut(final SetupDataCallbacks callbacks) {
int cx = (mReveal.getLeft() + mReveal.getRight()) / 2;
int cy = (mReveal.getTop() + mReveal.getBottom()) / 2;
int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight());
Animator anim =
ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius);
anim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
mReveal.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
mHandler.post(new Runnable() {
@Override
public void run() {
callbacks.onFinish();
}
});
}
@Override
public void onAnimationCancel(Animator animation) {}
@Override
public void onAnimationRepeat(Animator animation) {}
});
anim.start();
}
@Override
protected int getLayoutResource() {
return R.layout.setup_finished_page;
}
@Override
protected int getHeaderLayoutResource() {
return -1;
}
}
}

View File

@ -127,11 +127,6 @@ public class LocationSettingsPage extends SetupPage {
return R.layout.location_settings;
}
@Override
protected int getHeaderLayoutResource() {
return R.layout.header_condensed;
}
@Override
public void onResume() {
super.onResume();

View File

@ -16,9 +16,6 @@
package com.cyanogenmod.setupwizard.setup;
import android.os.Bundle;
import android.view.LayoutInflater;
public interface SetupDataCallbacks {
void onNextPage();
void onPreviousPage();
@ -27,5 +24,4 @@ public interface SetupDataCallbacks {
void onFinish();
Page getPage(String key);
Page getPage(int key);
void onPageViewCreated(LayoutInflater inflater, Bundle savedInstanceState, int layoutResource);
}

View File

@ -21,10 +21,12 @@ import com.cyanogenmod.setupwizard.R;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.transition.Slide;
import android.transition.Transition;
import android.view.Gravity;
public abstract class SetupPage implements Page {
@ -71,14 +73,19 @@ public abstract class SetupPage implements Page {
public void doLoadAction(Activity context, int action) {
if (context == null || context.isFinishing()) { return; }
final FragmentManager fragmentManager = context.getFragmentManager();
Fragment fragment = getFragment();
if (action == Page.ACTION_NEXT) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.content, getFragment(), getKey());
transaction.commit();
Transition t = new Slide(Gravity.RIGHT);
fragment.setEnterTransition(t);
fragmentManager.beginTransaction()
.replace(R.id.content,fragment, getKey())
.commit();
} else {
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.content, getFragment(), getKey());
transaction.commit();
Transition t = new Slide(Gravity.LEFT);
fragment.setEnterTransition(t);
fragmentManager.beginTransaction()
.replace(R.id.content, fragment, getKey())
.commit();
}
}

View File

@ -96,6 +96,12 @@ public class WelcomePage extends SetupPage {
}
};
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
}
@Override
protected void initializePage() {
mLanguagePicker = (LocalePicker) mRootView.findViewById(R.id.locale_list);
@ -152,10 +158,6 @@ public class WelcomePage extends SetupPage {
return R.layout.setup_welcome_page;
}
@Override
protected int getHeaderLayoutResource() {
return R.layout.logo_header;
}
}
}

View File

@ -585,11 +585,7 @@ public class LocalePicker extends LinearLayout {
mSelectionDivider = context.getDrawable(com.cyanogenmod.setupwizard.R.drawable.divider);
final int defSelectionDividerHeight = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT,
getResources().getDisplayMetrics());
mSelectionDividerHeight = attributesArray.getDimensionPixelSize(
R.styleable.NumberPicker_selectionDividerHeight, defSelectionDividerHeight);
mSelectionDividerHeight = UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT;
final int defSelectionDividerDistance = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE,

View File

@ -22,6 +22,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.setup.Page;
@ -33,6 +34,8 @@ public abstract class SetupPageFragment extends Fragment {
protected String mKey;
protected Page mPage;
protected View mRootView;
protected TextView mTitleView;
protected ViewGroup mHeaderView;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -48,7 +51,9 @@ public abstract class SetupPageFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mRootView = inflater.inflate(getLayoutResource(), container, false);
mCallbacks.onPageViewCreated(inflater, savedInstanceState, getHeaderLayoutResource());
mTitleView = (TextView) mRootView.findViewById(android.R.id.title);
mHeaderView = (ViewGroup ) mRootView.findViewById(R.id.header);
getActivity().startPostponedEnterTransition();
return mRootView;
}
@ -56,9 +61,12 @@ public abstract class SetupPageFragment extends Fragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mPage = mCallbacks.getPage(mKey);
if (mTitleView != null) {
mTitleView.setText(mPage.getTitleResId());
}
initializePage();
mCallbacks.onPageLoaded(mPage);
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.status_bar));
}
@Override
@ -76,10 +84,6 @@ public abstract class SetupPageFragment extends Fragment {
mCallbacks = null;
}
protected int getHeaderLayoutResource() {
return R.layout.header;
}
protected abstract void initializePage();
protected abstract int getLayoutResource();

View File

@ -19,7 +19,9 @@ package com.cyanogenmod.setupwizard.ui;
import android.app.Activity;
import android.app.AppGlobals;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
@ -45,11 +47,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
private static final String TAG = SetupWizardActivity.class.getSimpleName();
private View mRootView;
private View mPageView;
private Button mNextButton;
private Button mPrevButton;
private TextView mTitleView;
private ViewGroup mHeaderView;
private AbstractSetupData mSetupData;
@ -57,13 +56,11 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
super.onCreate(savedInstanceState);
setContentView(R.layout.setup_main);
mRootView = findViewById(R.id.root);
mPageView = findViewById(R.id.page);
((SetupWizardApp)getApplicationContext()).disableStatusBar();
mSetupData = (AbstractSetupData)getLastNonConfigurationInstance();
if (mSetupData == null) {
mSetupData = new CMSetupWizardData(this);
}
mHeaderView = (ViewGroup)findViewById(R.id.header);
mNextButton = (Button) findViewById(R.id.next_button);
mPrevButton = (Button) findViewById(R.id.prev_button);
mSetupData.registerListener(this);
@ -118,24 +115,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
@Override
public void onBackPressed() {
if (!mSetupData.isFirstPage()) {
mSetupData.onPreviousPage();
}
@Override
public void onPageViewCreated(LayoutInflater inflater, Bundle savedInstanceState,
int layoutResource) {
if (layoutResource != -1) {
mHeaderView.setVisibility(View.VISIBLE);
mHeaderView.removeAllViews();
inflater.inflate(layoutResource, mHeaderView, true);
} else {
mHeaderView.setVisibility(View.GONE);
}
mTitleView = (TextView) findViewById(android.R.id.title);
if (mTitleView != null) {
Page page = mSetupData.getCurrentPage();
mTitleView.setText(page.getTitleResId());
}
}
@Override
@ -152,6 +134,14 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
@Override
public void onPageLoaded(Page page) {
if (getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE &&
mSetupData.isFirstPage()) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN);
} else {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
updateButtonBar();
}
@ -179,18 +169,12 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
if (mSetupData.isLastPage()) {
mPrevButton.setVisibility(View.INVISIBLE);
mRootView.setBackgroundColor(resources.getColor(R.color.primary));
mPageView.setBackgroundColor(resources.getColor(R.color.primary));
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
getDrawable(R.drawable.ic_chevron_right_wht), null);
mNextButton.setTextColor(resources.getColor(R.color.white));
} else {
mPrevButton.setVisibility(View.VISIBLE);
mPageView.setBackgroundColor(resources.getColor(R.color.page_background));
if (mSetupData.isFirstPage()) {
mRootView.setBackgroundColor(resources.getColor(R.color.page_background));
} else {
mRootView.setBackgroundColor(resources.getColor(R.color.window_background));
}
mNextButton.setCompoundDrawablesWithIntrinsicBounds(null, null,
getDrawable(R.drawable.ic_chevron_right_dark), null);
mNextButton.setTextColor(resources.getColor(R.color.primary_text));