Skip to content

Commit

Permalink
Add 'Holo' lockscreen style (1/3)
Browse files Browse the repository at this point in the history
Adds a ICS-inspired ring lockscreen style. Actually, the drawables were
taken from ICS.
TODO: Review the vibrate icon (style doesn't exactly match the sound
on/off icons) and the LDPI drawables (especially the answer/decline
icons).
  • Loading branch information
maniac103 committed Jan 10, 2012
1 parent 0ef5bab commit 0598a9a
Show file tree
Hide file tree
Showing 48 changed files with 101 additions and 50 deletions.
7 changes: 6 additions & 1 deletion core/java/android/provider/CmSystem.java
Expand Up @@ -184,14 +184,17 @@ static public int getIdByStyle(RotaryStyle style) {

public enum RinglockStyle {
Bubble,
Revamped;
Revamped,
Holo;

static public RinglockStyle getStyleById(int id) {
switch (id) {
case 1:
return Bubble;
case 2:
return Revamped;
case 3:
return Holo;
default:
return Bubble;
}
Expand All @@ -207,6 +210,8 @@ static public int getIdByStyle(RinglockStyle style) {
return 1;
case Revamped:
return 2;
case Holo:
return 3;
default:
return 1;
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/jog_tab_target_holo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-ldpi/jog_tab_target_holo.png
Binary file added core/res/res/drawable-mdpi/jog_tab_target_holo.png
28 changes: 28 additions & 0 deletions core/res/res/drawable/jog_ring_holo_ring.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source 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.
-->

<!-- StateListDrawable used for buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/jog_ring_holo_ring_pressed" />

<item android:state_enabled="true"
android:drawable="@drawable/jog_ring_holo_ring_normal" />

<item android:state_active="true"
android:drawable="@drawable/jog_ring_holo_ring_pressed" />

</selector>
116 changes: 67 additions & 49 deletions policy/src/com/android/internal/policy/impl/LockScreen.java
Expand Up @@ -540,15 +540,33 @@ public void onClick(View v) {
int ringlockStyle = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.RINGLOCK_STYLE_PREF, RinglockStyle.getIdByStyle(RinglockStyle.Bubble));
int resSecNorm, resRingGreen, resRingHighlight;

if (ringlockStyle == RinglockStyle.getIdByStyle(RinglockStyle.Revamped)) {
resSecNorm = R.drawable.jog_ring_rev_secback_normal;
resRingGreen = R.drawable.jog_ring_rev_ring_green;
resRingHighlight = R.drawable.jog_ring_rev_ring_pressed_red;
} else {
resSecNorm = R.drawable.jog_ring_secback_normal;
resRingGreen = R.drawable.jog_ring_ring_green;
resRingHighlight = R.drawable.jog_ring_ring_pressed_red;
int resUnlock, resCustom, resTarget;

switch (RinglockStyle.getStyleById(ringlockStyle)) {
case Revamped:
resSecNorm = R.drawable.jog_ring_rev_secback_normal;
resRingGreen = R.drawable.jog_ring_rev_ring_green;
resRingHighlight = R.drawable.jog_ring_rev_ring_pressed_red;
resUnlock = R.drawable.ic_jog_dial_unlock;
resCustom = R.drawable.ic_jog_dial_custom;
resTarget = R.drawable.jog_tab_target_green;
break;
case Holo:
resSecNorm = R.drawable.jog_ring_holo_secback_normal;
resRingGreen = R.drawable.jog_ring_holo_ring;
resRingHighlight = R.drawable.jog_ring_holo_ring_pressed;
resUnlock = R.drawable.ic_jog_dial_holo_unlock;
resCustom = R.drawable.ic_jog_dial_holo_custom;
resTarget = R.drawable.jog_tab_target_holo;
break;
default:
resSecNorm = R.drawable.jog_ring_secback_normal;
resRingGreen = R.drawable.jog_ring_ring_green;
resRingHighlight = R.drawable.jog_ring_ring_pressed_red;
resUnlock = R.drawable.ic_jog_dial_unlock;
resCustom = R.drawable.ic_jog_dial_custom;
resTarget = R.drawable.jog_tab_target_green;
break;
}

mRingSelector.setHighlightBackgroundResource(resRingHighlight);
Expand Down Expand Up @@ -578,40 +596,22 @@ public void onClick(View v) {
if (mRingMinimal) {
mRingSelector.enableRingMinimal(mRingMinimal);
//unlock with middle - left and right are hidden
mRingSelector.setMiddleRingResources(
R.drawable.ic_jog_dial_unlock,
R.drawable.jog_tab_target_green,
resRingGreen);
}else if(mCustomAppToggle) {
mRingSelector.setMiddleRingResources(resUnlock, resTarget, resRingGreen);
} else if (mCustomAppToggle) {
mRingSelector.enableMiddleRing(mCustomAppToggle);
if(mRingUnlockMiddle) {
if (mRingUnlockMiddle) {
mRingSelector.enableMiddlePrimary(mRingUnlockMiddle);
mRingSelector.setLeftRingResources(
R.drawable.ic_jog_dial_custom,
R.drawable.jog_tab_target_green,
resRingGreen);
mRingSelector.setLeftRingResources(resCustom, resTarget, resRingGreen);
//unlock with middle
mRingSelector.setMiddleRingResources(
R.drawable.ic_jog_dial_unlock,
R.drawable.jog_tab_target_green,
resRingGreen);
}else{
mRingSelector.setMiddleRingResources(resUnlock, resTarget, resRingGreen);
} else {
//unlock on left
mRingSelector.setLeftRingResources(
R.drawable.ic_jog_dial_unlock,
R.drawable.jog_tab_target_green,
resRingGreen);
mRingSelector.setMiddleRingResources(
R.drawable.ic_jog_dial_custom,
R.drawable.jog_tab_target_green,
resRingGreen);
}
}else{
mRingSelector.setLeftRingResources(resUnlock, resTarget, resRingGreen);
mRingSelector.setMiddleRingResources(resCustom, resTarget, resRingGreen);
}
} else {
//no middle ring
mRingSelector.setLeftRingResources(
R.drawable.ic_jog_dial_unlock,
R.drawable.jog_tab_target_green,
resRingGreen);
mRingSelector.setLeftRingResources(resUnlock, resTarget, resRingGreen);
mRingSelector.enableRingMinimal(false);
}

Expand Down Expand Up @@ -770,14 +770,6 @@ private void updateRightTabResources() {
int targetId = mSilentMode ? R.drawable.jog_tab_target_yellow
: R.drawable.jog_tab_target_gray;

//Ringlock resource setup
int mRinglockStyle = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.RINGLOCK_STYLE_PREF, RinglockStyle.getIdByStyle(RinglockStyle.Bubble));
int resRingGray=(mRinglockStyle == RinglockStyle.getIdByStyle(RinglockStyle.Bubble) ?
R.drawable.jog_ring_ring_gray : R.drawable.jog_ring_rev_ring_gray);
int resRingYellow=(mRinglockStyle == RinglockStyle.getIdByStyle(RinglockStyle.Bubble) ?
R.drawable.jog_ring_ring_yellow : R.drawable.jog_ring_rev_ring_yellow);

mRotarySelector.setRightHandleResource(iconId);

mTabSelector.setRightTabResources(iconId, targetId,
Expand All @@ -786,9 +778,35 @@ private void updateRightTabResources() {
mSilentMode ? R.drawable.jog_tab_right_sound_on
: R.drawable.jog_tab_right_sound_off);

mRingSelector.setRightRingResources(iconId, targetId,
mSilentMode ? resRingYellow
: resRingGray);
//Ringlock resource setup
int ringlockStyle = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.RINGLOCK_STYLE_PREF, RinglockStyle.getIdByStyle(RinglockStyle.Bubble));

int ringResource;

switch (RinglockStyle.getStyleById(ringlockStyle)) {
case Revamped:
ringResource = mSilentMode ? R.drawable.jog_ring_rev_ring_yellow :
R.drawable.jog_ring_rev_ring_gray;
break;
case Holo:
ringResource = R.drawable.jog_ring_holo_ring;
targetId = R.drawable.jog_tab_target_holo;
if (mSilentMode && vibe) {
iconId = R.drawable.ic_jog_dial_holo_vibrate_on;
} else if (mSilentMode) {
iconId = R.drawable.ic_jog_dial_holo_sound_off;
} else {
iconId = R.drawable.ic_jog_dial_holo_sound_on;
}
break;
default:
ringResource = mSilentMode ? R.drawable.jog_ring_ring_yellow :
R.drawable.jog_ring_ring_gray;
break;
}

mRingSelector.setRightRingResources(iconId, targetId, ringResource);
}

private void resetStatusInfo(KeyguardUpdateMonitor updateMonitor) {
Expand Down

0 comments on commit 0598a9a

Please sign in to comment.