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

Commit e38652aa authored by Michael Bestas's avatar Michael Bestas
Browse files

Settings: Add CM PlatLogo & CMCaseView (1/2)

* Based on Danesh M commit from 10.1
* Always use "K" letter for android version easter egg since
  some devices override BUILD_ID and the letter "J" appears instead of "K"
* Add some padding (left & right) to the PlatLogo if the width of the
  PlatLogo is bigger tham the actual device width
* Added CM mascot drawables

Screenshot:
http://goo.gl/Q9q0kR

Change-Id: I04f7728248854623b364cf54d2e48f461e84b3de
parent 6df4db04
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 * Copyright (C) 2013-2014 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.
@@ -25,6 +26,7 @@ import android.provider.Settings;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemProperties;
import android.text.method.AllCapsTransformationMethod;
import android.text.method.TransformationMethod;
import android.util.DisplayMetrics;
@@ -44,12 +46,14 @@ public class PlatLogoActivity extends Activity {
    FrameLayout mContent;
    int mCount;
    final Handler mHandler = new Handler();
    private boolean mIsCM;
    static final int BGCOLOR = 0xffed1d24;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mIsCM = getIntent().hasExtra("is_cm");
        DisplayMetrics metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);

@@ -64,8 +68,15 @@ public class PlatLogoActivity extends Activity {
                FrameLayout.LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER;

        // Add some padding to the platlogo for devices where the
        // width of the logo is bigger than the device width
        int p = (int) (20 * metrics.density);

        final ImageView logo = new ImageView(this);
        logo.setImageResource(com.android.internal.R.drawable.platlogo);
        logo.setImageResource(mIsCM
                ? com.android.internal.R.drawable.cm_platlogo
                : com.android.internal.R.drawable.platlogo);
        logo.setPadding(p, 0, p, 0);
        logo.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        logo.setVisibility(View.INVISIBLE);

@@ -76,21 +87,25 @@ public class PlatLogoActivity extends Activity {
        final TextView letter = new TextView(this);

        letter.setTypeface(bold);
        letter.setTextSize(300);
        letter.setTextSize(mIsCM ? 150 : 300);
        letter.setTextColor(0xFFFFFFFF);
        letter.setGravity(Gravity.CENTER);
        letter.setText(String.valueOf(Build.ID).substring(0, 1));
        letter.setText(mIsCM ? "CM" : "K");

        String cmVersion = SystemProperties.get("ro.cm.version");
        if (cmVersion != null) {
            cmVersion = cmVersion.replaceAll("([0-9\\.]+?)-.*", "$1");
        }

        final int p = (int)(4 * metrics.density);
        p = (int) (4 * metrics.density);

        final TextView tv = new TextView(this);
        if (light != null) tv.setTypeface(light);
        tv.setTypeface(light);
        tv.setTextSize(30);
        tv.setPadding(p, p, p, p);
        tv.setTextColor(0xFFFFFFFF);
        tv.setGravity(Gravity.CENTER);
        tv.setTransformationMethod(new AllCapsTransformationMethod(this));
        tv.setText("Android " + Build.VERSION.RELEASE);
        tv.setText(mIsCM ? "CyanogenMod " + cmVersion : "ANDROID " + Build.VERSION.RELEASE);
        tv.setVisibility(View.INVISIBLE);

        mContent.addView(bg);
@@ -164,6 +179,7 @@ public class PlatLogoActivity extends Activity {
                        .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                            | Intent.FLAG_ACTIVITY_CLEAR_TASK
                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
                        .putExtra("is_cm", mIsCM)
                        .addCategory("com.android.internal.category.PLATLOGO"));
                } catch (ActivityNotFoundException ex) {
                    android.util.Log.e("PlatLogoActivity", "Couldn't catch a break.");
+95.1 KiB
Loading image diff...
+1 −0
Original line number Diff line number Diff line
@@ -1070,6 +1070,7 @@
  <java-symbol type="drawable" name="jog_tab_target_gray" />
  <java-symbol type="drawable" name="picture_emergency" />
  <java-symbol type="drawable" name="platlogo" />
  <java-symbol type="drawable" name="cm_platlogo" />
  <java-symbol type="drawable" name="stat_notify_sync_error" />
  <java-symbol type="drawable" name="stat_notify_wifi_in_range" />
  <java-symbol type="drawable" name="stat_notify_rssi_in_range" />
+13 −0
Original line number Diff line number Diff line
@@ -239,8 +239,21 @@
                <action android:name="android.service.dreams.DreamService" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data
                android:name="android.service.dream"
                android:resource="@xml/dream_info" />
        </service>

        <activity android:name=".DessertCaseDreamSettings"
            android:process=":sweetsweetdesserts"
            android:taskAffinity=""
            android:excludeFromRecents="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

        <activity android:name=".Somnambulator"
            android:label="@string/start_dreams"
            android:icon="@mipmap/ic_launcher_dreams"
+3.84 KiB
Loading image diff...
Loading