summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-27 17:34:01 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-27 17:34:44 +0000
commit5ffcd2b98cad37a08338f6e1677b6ba0b6eee0be (patch)
treef4bf7468b0a1a8a3fc221a4fe1af0a4ab5e301ef /src
parent16e27563f01f95ed7ded10f2a2ba76d2ea4e65b4 (diff)
downloadandroid_packages_apps_Trebuchet-5ffcd2b98cad37a08338f6e1677b6ba0b6eee0be.tar.gz
android_packages_apps_Trebuchet-5ffcd2b98cad37a08338f6e1677b6ba0b6eee0be.tar.bz2
android_packages_apps_Trebuchet-5ffcd2b98cad37a08338f6e1677b6ba0b6eee0be.zip
Hotseat: Icon scale
Change-Id: I6cae71283c164fe576dfd8338097f74d5d025b4a
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java21
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java3
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/SeekBarDialogPreference.java82
4 files changed, 97 insertions, 15 deletions
diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java
index 0521ef7c7..4029ed119 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -138,8 +138,7 @@ public class CellLayout extends ViewGroup {
private TimeInterpolator mEaseOutInterpolator;
private ShortcutAndWidgetContainer mShortcutsAndWidgets;
- private boolean mIsHotseat = false;
- private float mHotseatScale = 1f;
+ private float mChildrenScale = 1f;
public static final int MODE_DRAG_OVER = 0;
public static final int MODE_ON_DROP = 1;
@@ -202,8 +201,6 @@ public class CellLayout extends ViewGroup {
setAlwaysDrawnWithCacheEnabled(false);
final Resources res = getResources();
- mHotseatScale = (res.getInteger(R.integer.hotseat_item_scale_percentage) / 100f);
-
mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo);
mActiveGlowBackground = res.getDrawable(R.drawable.homescreen_blue_strong_holo);
@@ -326,8 +323,12 @@ public class CellLayout extends ViewGroup {
mShortcutsAndWidgets.buildLayer();
}
+ public void setChildrenScale(float childrenScale) {
+ mChildrenScale = childrenScale;
+ }
+
public float getChildrenScale() {
- return mIsHotseat ? mHotseatScale : 1.0f;
+ return mChildrenScale;
}
public void setGridSize(int x, int y) {
@@ -609,10 +610,6 @@ public class CellLayout extends ViewGroup {
return mCountY;
}
- public void setIsHotseat(boolean isHotseat) {
- mIsHotseat = isHotseat;
- }
-
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
boolean markCells) {
final LayoutParams lp = params;
@@ -622,11 +619,7 @@ public class CellLayout extends ViewGroup {
BubbleTextView bubbleChild = (BubbleTextView) child;
Resources res = getResources();
- if (mIsHotseat) {
- bubbleChild.setTextColor(res.getColor(android.R.color.transparent));
- } else {
- bubbleChild.setTextColor(res.getColor(R.color.workspace_icon_text_color));
- }
+ bubbleChild.setTextColor(res.getColor(R.color.workspace_icon_text_color));
}
child.setScaleX(getChildrenScale());
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index 38a826eed..77ec2cc88 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -74,11 +74,15 @@ public class Hotseat extends PagedView {
mVertical = hasVerticalHotseat();
+
+ float childrenScale = PreferencesProvider.Interface.Dock.getIconScale(
+ getResources().getInteger(R.integer.hotseat_item_scale_percentage)) / 100f;
+
LayoutInflater inflater =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < hotseatPages; i++) {
CellLayout cl = (CellLayout) inflater.inflate(R.layout.hotseat_page, null);
- cl.setIsHotseat(true);
+ cl.setChildrenScale(childrenScale);
cl.setGridSize((!hasVerticalHotseat() ? mCellCount : 1), (hasVerticalHotseat() ? mCellCount : 1));
addView(cl);
}
diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
index 8d747ce0f..224f99228 100644
--- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
+++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
@@ -188,6 +188,9 @@ public final class PreferencesProvider {
public static int getNumberIcons(int def) {
return getInt("ui_dock_icons", def);
}
+ public static int getIconScale(int def) {
+ return getInt("ui_dock_icon_scale", def);
+ }
public static boolean getShowDivider() {
return getBoolean("ui_dock_divider", true);
}
diff --git a/src/com/cyanogenmod/trebuchet/preference/SeekBarDialogPreference.java b/src/com/cyanogenmod/trebuchet/preference/SeekBarDialogPreference.java
new file mode 100644
index 000000000..5d2c8d022
--- /dev/null
+++ b/src/com/cyanogenmod/trebuchet/preference/SeekBarDialogPreference.java
@@ -0,0 +1,82 @@
+package com.cyanogenmod.trebuchet.preference;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.preference.DialogPreference;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import com.cyanogenmod.trebuchet.R;
+
+/**
+ * @author nebkat
+ */
+public class SeekBarDialogPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener {
+ private int mMax, mMin, mDefault;
+
+ private String mPrefix, mSuffix;
+
+ private TextView mValueText;
+ private SeekBar mSeekBar;
+
+ public SeekBarDialogPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ TypedArray dialogType = context.obtainStyledAttributes(attrs,
+ com.android.internal.R.styleable.DialogPreference, 0, 0);
+ TypedArray seekBarType = context.obtainStyledAttributes(attrs,
+ R.styleable.SeekBarDialogPreference, 0, 0);
+
+ mMax = seekBarType.getInt(R.styleable.SeekBarDialogPreference_max, 100);
+ mMin = seekBarType.getInt(R.styleable.SeekBarDialogPreference_min, 0);
+
+ mDefault = dialogType.getInt(com.android.internal.R.styleable.Preference_defaultValue, mMin);
+
+ mPrefix = seekBarType.getString(R.styleable.SeekBarDialogPreference_prefix);
+ mSuffix = seekBarType.getString(R.styleable.SeekBarDialogPreference_suffix);
+ if (mPrefix == null) {
+ mPrefix = "";
+ }
+ if (mSuffix == null) {
+ mSuffix = "%";
+ }
+
+ dialogType.recycle();
+ seekBarType.recycle();
+ }
+
+ @Override
+ protected View onCreateDialogView() {
+ LayoutInflater inflater =
+ (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View view = inflater.inflate(R.layout.seekbar_dialog, null);
+
+ mValueText = (TextView) view.findViewById(R.id.value);
+
+ mSeekBar = (SeekBar) view.findViewById(R.id.seekbar);
+ mSeekBar.setOnSeekBarChangeListener(this);
+ mSeekBar.setMax(mMax - mMin);
+ mSeekBar.setProgress(getPersistedInt(mDefault) - mMin);
+
+ mValueText.setText(mPrefix + getPersistedInt(mDefault) + mSuffix);
+
+ return view;
+ }
+
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ mValueText.setText(mPrefix + (progress + mMin) + mSuffix);
+ }
+
+ public void onStartTrackingTouch(SeekBar seekBar) {}
+ public void onStopTrackingTouch(SeekBar seekBar) {}
+
+ @Override
+ protected void onDialogClosed(boolean positiveResult) {
+ if (positiveResult) {
+ persistInt(mSeekBar.getProgress() + mMin);
+ }
+ }
+
+} \ No newline at end of file