SetupWizard: Add Mod disovery language for mod ready devices

Issue-id: CYNGNOS-2566

Change-Id: If88d2d62b5d2175ffe857d45dd9f6ce132129f2a
This commit is contained in:
cretin45 2016-04-27 12:38:53 -07:00
parent 8109277755
commit 635504813a
5 changed files with 103 additions and 4 deletions

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2016 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="256dp"
android:height="114dp"
android:viewportWidth="256"
android:viewportHeight="114">
<path android:fillColor="@color/white"
android:pathData="M40,113.7V77.1h14.3c7.5,0,12.3,4,12.3,11.1c0,6.2-3,9.4-8.6,10.6l8,14.9h-5.8l-7.7-14.5h-7.4v14.5H40z
M45.2,94.6h8.7 c4.6,0,7.5-1.9,7.5-6.3c0-4.2-2.5-6.4-7.5-6.4h-8.6v12.7H45.2z
M78.7,113.7V77.1h22.4V82H84v10.6h15.7v4.7H84V109h17.2v4.8
L78.7,113.7L78.7,113.7z
M136.5,113.7L134,107h-15.7l-2.4,6.7h-5.4l13.2-36.6h5l13.2,36.6H136.5z
M126.1,84.7l-6.2,17.8h12.6 l-6.2-17.8H126.1z
M152.7,113.7V77.1h11.7c8.1,0,15.9,5.6,15.9,18.3c0,13.6-7.6,18.4-16.2,18.4L152.7,113.7L152.7,113.7z
M158,108.9 h5.9c6.9,0,10.8-3.8,10.8-13.6c0-8.8-4-13.4-10.5-13.4H158V108.9z
M198.8,113.7V98.3l-12-21.2h5.7l8.8,16.4h0.1l8.9-16.4h5.7
l-12,21.2v15.4C204,113.7,198.8,113.7,198.8,113.7z
M73.1,20.8c0-11.3-9.2-20.5-20.6-20.5H0.2v58.1h9.3V9.5H32v48.8h9.3V9.5h11.3
c6.2,0,11.3,5.1,11.3,11.3v37.5h9.3L73.1,20.8L73.1,20.8z
M164.5,26.6v-3.4v-2.4c0-11.3-9.2-20.5-20.6-20.5h-26.7
c-11.3,0-20.5,9.2-20.5,20.5v4.6v1.2V32v1.7v4.2c0,11.3,9.2,20.5,20.5,20.5h26.7c11.3,0,20.6-9.2,20.6-20.5v-2.3V32V26.6z
M155.2,37.8c0,6.2-5.1,11.3-11.3,11.3h-26.7c-6.2,0-11.3-5.1-11.3-11.3v-17c0-6.2,5.1-11.3,11.3-11.3h26.7
c6.2,0,11.3,5.1,11.3,11.3V37.8z
M235.2,0.3H188v58.1h47.2c11.3,0,20.6-9.2,20.6-20.5v-17C255.8,9.5,246.6,0.3,235.2,0.3z
M246.5,37.8c0,6.2-5.1,11.3-11.3,11.3h-38V9.5h38c6.2,0,11.3,5.1,11.3,11.3V37.8z" />
</vector>

View File

@ -20,12 +20,46 @@
android:layout_height="match_parent"
android:background="@color/primary">
<Space android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"/>
<ImageView
android:id="@+id/brand_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/brand_finish"
android:scaleType="centerInside"
android:padding="@dimen/content_margin_left"/>
<TextView android:id="@+id/mod_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginTop="105dp"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
android:text="@string/mod_welcome"
android:fontFamily="sans-serif-medium"
android:textColor="@color/white"
android:visibility="gone"/>
<TextView android:id="@+id/mod_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginTop="16dp"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/content_margin_right"
android:text="@string/mod_description"
android:textColor="@color/white"
android:visibility="gone"/>
<Space android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"/>
</LinearLayout>

View File

@ -95,4 +95,8 @@
<string name="fingerprint_setup_add_fingerprint">Add your fingerprint</string>
<string name="fingerprint_setup_screen_lock_setup">Setup screen lock</string>
<string name="sim_locale_changed">%1$s SIM detected</string>
<!-- MOD stuff -->
<string name="mod_welcome">Welcome to the Post-App Era</string>
<string name="mod_description">Mods are intelligent, aware, and lightweight experiences built directly into the OS. When MOD thinks it can help, it will offer to activate them for you.</string>
</resources>

View File

@ -16,13 +16,17 @@
package com.cyanogenmod.setupwizard.setup;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
public class FinishPage extends SetupPage {
@ -71,7 +75,15 @@ public class FinishPage extends SetupPage {
public static class FinishFragment extends SetupPageFragment {
@Override
protected void initializePage() {}
protected void initializePage() {
final Activity activity = getActivity();
if (activity != null && SetupWizardUtils.canHasModMOD(activity)) {
ImageView imageView = (ImageView) mRootView.findViewById(R.id.brand_logo);
imageView.setImageResource(R.drawable.mod_ready);
mRootView.findViewById(R.id.mod_welcome).setVisibility(View.VISIBLE);
mRootView.findViewById(R.id.mod_desc).setVisibility(View.VISIBLE);
}
}
@Override
protected int getLayoutResource() {

View File

@ -27,8 +27,6 @@ import android.hardware.fingerprint.FingerprintManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.persistentdata.PersistentDataBlockManager;
@ -52,6 +50,7 @@ public class SetupWizardUtils {
private static final String TAG = SetupWizardUtils.class.getSimpleName();
public static final String GOOGLE_SETUPWIZARD_PACKAGE = "com.google.android.setupwizard";
private static final String MODMOD_PACKAGE = "com.cyanogen.ambient.core";
private SetupWizardUtils(){}
@ -199,6 +198,14 @@ public class SetupWizardUtils {
ConnectionResult.SERVICE_MISSING;
}
/**
* The assumption here is that if ambient core is present, we have MODs.
* In the future we will link against the SDK and use the util there.
*/
public static boolean canHasModMOD(Context context) {
return isPackageInstalled(context, MODMOD_PACKAGE);
}
public static boolean accountExists(Context context, String accountType) {
return AccountManager.get(context).getAccountsByType(accountType).length > 0;
}