Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01f21da1 authored by cretin45's avatar cretin45
Browse files

SetupWizard: Add option to apply default theme if one exists

* A bunch of code cleanup/refactoring to make this work

Change-Id: I059fb5fa5bcd7dd8821e993218a320554f10a314
parent 1d54e520
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@
                  android:launchMode="singleInstance"
                  android:excludeFromRecents="true"
                  android:uiOptions="none"
                  android:configChanges="themeChange|mcc|mnc"
                  android:immersive="true">

            <intent-filter android:priority="9">
+36 −0
Original line number Diff line number Diff line
@@ -86,6 +86,42 @@

                </LinearLayout>

                <!-- Whether or not to enable default theme -->
                <LinearLayout
                    android:id="@+id/theme"
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/location_margin_left"
                    android:paddingRight="@dimen/content_margin_right"
                    android:background="?android:attr/selectableItemBackground"
                    android:clickable="true">


                    <CheckBox
                        android:id="@+id/enable_theme_checkbox"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="top"
                        android:layout_marginTop="5dp"
                        android:duplicateParentState="true"
                        android:clickable="false"/>

                    <TextView
                        android:id="@+id/enable_theme_summary"
                        android:layout_width="0px"
                        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"
                        android:paddingBottom="@dimen/content_margin_bottom"
                        android:text="@string/services_metrics_label"/>

                </LinearLayout>

                <!-- Checkbox for using on-screen nav keys -->
                <LinearLayout
                    android:id="@+id/nav_keys"
+8 −0
Original line number Diff line number Diff line
@@ -45,5 +45,13 @@
               android:background="@drawable/reveal"
               android:visibility="invisible"/>

    <ProgressBar
        android:id="@+id/finishing_bar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="8dp"
        android:layout_gravity="bottom"
        android:visibility="gone"/>

</com.cyanogenmod.setupwizard.ui.widget.ScrimInsetsFrameLayout>
+6 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
    <string name="app_name">Setup Wizard</string>
    <string name="product_name" translatable="false">cyanogenmod</string>
    <string name="os_name" translatable="false">CyanogenMod</string>
    <string name="default_theme_name" translatable="false">Material</string>

    <string name="cm_account_type" translatable="false">com.cyanogenmod.account</string>

@@ -67,12 +68,14 @@

    <string name="emergency_call">Emergency call</string>

    <string name="setup_services">Cyanogen services</string>
    <string name="services_explanation" product="tablet">These services work for you to extend the capabilities of your tablet. You can turn them off at anytime. Data will be used in accordance with Cyanogen\'s <xliff:g id="name" example="Privacy Policy">%s</xliff:g>.</string>
    <string name="services_explanation" product="default">These services work for you to extend the capabilities of your phone. You can turn them off at anytime. Data will be used in accordance with Cyanogen\'s <xliff:g id="name" example="Privacy Policy">%s</xliff:g>.</string>
    <string name="setup_services">Cyanogen features</string>
    <string name="services_explanation" product="tablet">These services work for you to extend the capabilities of your tablet. Data will be used in accordance with Cyanogen\'s <xliff:g id="name" example="Privacy Policy">%s</xliff:g>.</string>
    <string name="services_explanation" product="default">These services work for you to extend the capabilities of your phone. Data will be used in accordance with Cyanogen\'s <xliff:g id="name" example="Privacy Policy">%s</xliff:g>.</string>
    <string name="services_privacy_policy">Privacy Policy</string>
    <string name="services_help_improve_cm">Help improve <xliff:g id="name" example="CyanogenMod">%s</xliff:g></string>
    <string name="services_metrics_label"><xliff:g id="name" example="Help improve CyanogenMod">%s</xliff:g> by automatically sending diagnostic and usage data to Cyanogen. This information can’t be used to identify you and lends a hand to teams working on things like battery life, app performance, and new <xliff:g id="name" example="CyanogenMod">%s</xliff:g> features.</string>
    <string name="services_apply_theme">Apply the <xliff:g id="name" example="Material">%s</xliff:g> theme</string>
    <string name="services_apply_theme_label"><xliff:g id="name" example="Apply the Material theme">%s</xliff:g> enabling unique icons, wallpapers, and fonts.</string>
    <string name="services_os_nav_keys_label"><b>Use on screen navigation keys</b> instead of hardware keys.</string>
    <string name="services_use_secure_sms">Use secure SMS</string>
    <string name="services_secure_sms_label"><xliff:g id="name" example="Use secure SMS">%s</xliff:g> to encrypt SMS conversations with other users using secure SMS on a <xliff:g id="name" example="CyanogenMod">%s</xliff:g> device.</string>
+18 −9
Original line number Diff line number Diff line
@@ -17,33 +17,30 @@
package com.cyanogenmod.setupwizard.setup;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.os.Bundle;

import com.cyanogenmod.setupwizard.ui.SetupWizardActivity;

import java.util.ArrayList;

public abstract class AbstractSetupData extends BroadcastReceiver implements SetupDataCallbacks {

    private static final String TAG = AbstractSetupData.class.getSimpleName();

    protected SetupWizardActivity mContext;
    protected final Context mContext;
    private ArrayList<SetupDataCallbacks> mListeners = new ArrayList<SetupDataCallbacks>();
    private PageList mPageList;

    private int mCurrentPageIndex = 0;

    private boolean mIsResumed = false;

    private OnResumeRunnable mOnResumeRunnable;

    public AbstractSetupData(SetupWizardActivity context) {
    public AbstractSetupData(Context context) {
        mContext = context;
        mPageList = onNewPageList();
    }

    public void setContext(SetupWizardActivity context) {
        mContext = context;
    }

    protected abstract PageList onNewPageList();

    @Override
@@ -67,6 +64,13 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
        }
    }

    @Override
    public void finishSetup() {
        for (int i = 0; i < mListeners.size(); i++) {
            mListeners.get(i).finishSetup();
        }
    }

    @Override
    public Page getPage(String key) {
        return mPageList.getPage(key);
@@ -159,7 +163,7 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
    }

    private void doPreviousNext(Runnable runnable) {
        if (mContext.isResumed()) {
        if (mIsResumed) {
            runnable.run();
        } else {
            mOnResumeRunnable = new OnResumeRunnable(runnable, this);
@@ -170,7 +174,12 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
        mOnResumeRunnable = null;
    }

    public void onPause() {
        mIsResumed = false;
    }

    public void onResume() {
        mIsResumed = true;
        if (mOnResumeRunnable != null) {
            mOnResumeRunnable.run();
        }
Loading