diff options
-rw-r--r-- | res/layout/list_item_checkable.xml | 26 | ||||
-rw-r--r-- | res/values/preferences_defaults.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/AppsCustomizePagedView.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/Folder.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/FolderIcon.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherAppState.java | 14 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 34 | ||||
-rw-r--r-- | src/com/android/launcher3/settings/FontStylePreference.java | 142 | ||||
-rw-r--r-- | src/com/android/launcher3/settings/SettingsProvider.java | 2 |
10 files changed, 9 insertions, 215 deletions
diff --git a/res/layout/list_item_checkable.xml b/res/layout/list_item_checkable.xml deleted file mode 100644 index 86d6b1a4c..000000000 --- a/res/layout/list_item_checkable.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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. ---> -<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="?android:attr/textColorAlertDialogListItem" - android:gravity="center_vertical" - android:paddingStart="16dip" - android:paddingEnd="16dip" - android:checkMark="?android:attr/listChoiceIndicatorSingle" - android:ellipsize="marquee" /> diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml index b6ae9a6e6..64d904a0f 100644 --- a/res/values/preferences_defaults.xml +++ b/res/values/preferences_defaults.xml @@ -13,6 +13,4 @@ <bool name="preferences_interface_drawer_remove_hidden_apps_widgets_default">true</bool> <bool name="preferences_interface_drawer_hide_icon_labels_default">false</bool> <bool name="preferences_interface_general_icons_large_default">@bool/config_largeIcons</bool> - <string name="preferences_interface_general_icons_text_font_family_default">sans-serif-condensed</string> - <integer name="preferences_interface_general_icons_text_font_style_default">0</integer> </resources> diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 6015de624..f2c08a3e1 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -1176,7 +1176,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen icon.setOnLongClickListener(this); icon.setOnTouchListener(this); icon.setOnKeyListener(this); - Utilities.applyTypeface(icon); int index = i - startIndex; int x = index % mCellCountX; diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index ef9791d52..c8047d03b 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -664,7 +664,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList textView.setTag(item); textView.setTextColor(getResources().getColor(R.color.folder_items_text_color)); textView.setShadowsEnabled(false); - Utilities.applyTypeface(textView); textView.setGlowColor(getResources().getColor(R.color.folder_items_glow_color)); textView.setOnClickListener(this); diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java index 51517548c..464b35da9 100644 --- a/src/com/android/launcher3/FolderIcon.java +++ b/src/com/android/launcher3/FolderIcon.java @@ -149,7 +149,6 @@ public class FolderIcon extends FrameLayout implements FolderListener { icon.setClipToPadding(false); icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name); icon.mFolderName.setText(folderInfo.title); - Utilities.applyTypeface(icon.mFolderName); icon.mFolderName.setCompoundDrawablePadding(0); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams(); lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 8fa5cfdd6..d58170a2a 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1619,7 +1619,6 @@ public class Launcher extends Activity favorite.setCompoundDrawables(null, d, null, null); favorite.setOnTouchListener(getHapticFeedbackTouchListener()); } - Utilities.applyTypeface(favorite); return favorite; } diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 50ff612e9..11e18b186 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -24,8 +24,6 @@ import android.database.ContentObserver; import android.os.Handler; import android.util.Log; -import com.android.launcher3.settings.SettingsProvider; - import java.lang.ref.WeakReference; public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { @@ -116,18 +114,6 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { ContentResolver resolver = sContext.getContentResolver(); resolver.registerContentObserver(LauncherSettings.Favorites.CONTENT_URI, true, mFavoritesObserver); - - // Generate default typeface - String fontFamily = SettingsProvider.getString(sContext, - SettingsProvider.SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_FAMILY, - R.string.preferences_interface_general_icons_text_font_family_default); - - // TODO: Implement font styles - int fontStyle = SettingsProvider.getInt(sContext, - SettingsProvider.SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_STYLE, - R.integer.preferences_interface_general_icons_text_font_style_default); - - Utilities.generateTypeface(fontFamily, fontStyle); } public void recreateWidgetPreviewDb() { diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index fc6496d00..cbc978585 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -21,14 +21,21 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.graphics.*; +import android.graphics.Bitmap; +import android.graphics.BlurMaskFilter; +import android.graphics.Canvas; +import android.graphics.ColorMatrix; +import android.graphics.ColorMatrixColorFilter; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.PaintFlagsDrawFilter; +import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.util.DisplayMetrics; import android.util.Log; import android.view.View; -import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; @@ -51,8 +58,6 @@ public final class Utilities { private static final Rect sOldBounds = new Rect(); private static final Canvas sCanvas = new Canvas(); - private static Typeface sTypeface; - static { sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG, Paint.FILTER_BITMAP_FLAG)); @@ -213,27 +218,6 @@ public final class Utilities { } /** - * Generates the default icon typeface for use in icons. - * - * @param familyName May be null. The name of the font family. - * @param style The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC - */ - static void generateTypeface(String familyName, int style) { - sTypeface = Typeface.create(familyName, style); - } - - /** - * Applies the default icon typeface to a textview. - * - * @param textView View to apply typeface to. - */ - static void applyTypeface(TextView textView) { - if (sTypeface != null) { - textView.setTypeface(sTypeface); - } - } - - /** * Given a coordinate relative to the descendant, find the coordinate in a parent view's * coordinates. * diff --git a/src/com/android/launcher3/settings/FontStylePreference.java b/src/com/android/launcher3/settings/FontStylePreference.java deleted file mode 100644 index 50df4b280..000000000 --- a/src/com/android/launcher3/settings/FontStylePreference.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.android.launcher3.settings; - -import android.app.AlertDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Typeface; -import android.preference.ListPreference; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.*; -import com.android.launcher3.R; - -import java.util.Arrays; -import java.util.List; - -public class FontStylePreference extends ListPreference { - private String mValue; - public int mClickedDialogEntryIndex; - private boolean mValueSet; - - public FontStylePreference(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { - if (getEntries() == null || getEntryValues() == null) { - throw new IllegalStateException( - "ListPreference requires an entries array and an entryValues array."); - } - - mClickedDialogEntryIndex = getValueIndex(); - builder.setSingleChoiceItems(new FontStyleAdapter(getContext()), mClickedDialogEntryIndex, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - mClickedDialogEntryIndex = which; - - /* - * Clicking on an item simulates the positive button - * click, and dismisses the dialog. - */ - FontStylePreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE); - dialog.dismiss(); - } - }); - - /* - * The typical interaction for list-based dialogs is to have - * click-on-an-item dismiss the dialog instead of the user having to - * press 'Ok'. - */ - builder.setPositiveButton(null, null); - } - - @Override - protected void onDialogClosed(boolean positiveResult) { - super.onDialogClosed(positiveResult); - - if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { - String value = getEntryValues()[mClickedDialogEntryIndex].toString(); - if (callChangeListener(value)) { - setValue(value); - } - } - } - - @Override - protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { - setValue(restoreValue ? getPersistedString(mValue) : (String) defaultValue); - } - - /** - * Sets the value of the key. This should be one of the entries in - * {@link #getEntryValues()}. - * - * @param value The value to set for the key. - */ - @Override - public void setValue(String value) { - // Always persist/notify the first time. - final boolean changed = !TextUtils.equals(mValue, value); - if (changed || !mValueSet) { - mValue = value; - mValueSet = true; - persistString(value); - if (changed) { - notifyChanged(); - } - } - } - - /** - * Returns the value of the key. This should be one of the entries in - * {@link #getEntryValues()}. - * - * @return The value of the key. - */ - @Override - public String getValue() { - return mValue; - } - - private int getValueIndex() { - return findIndexOfValue(mValue); - } - - private class FontStyleAdapter extends ArrayAdapter<CharSequence> { - private LayoutInflater mInflater; - private List<CharSequence> mEntries; - private List<CharSequence> mValues; - - public FontStyleAdapter(Context context) { - super(context, -1, getEntryValues()); - - mInflater = LayoutInflater.from(context); - mEntries = Arrays.asList(getEntries()); - mValues = Arrays.asList(getEntryValues()); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - CheckedTextView textView; - - if (convertView == null) { - textView = (CheckedTextView) mInflater.inflate(R.layout.list_item_checkable, parent, false); - } else { - textView = (CheckedTextView) convertView; - } - - if (textView != null) { - textView.setText(mEntries.get(position)); - textView.setTag(mValues.get(position)); - textView.setTypeface(Typeface.create((String) mValues.get(position), Typeface.NORMAL)); - } - - return textView; - } - } -} diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java index c827ae478..52c30440e 100644 --- a/src/com/android/launcher3/settings/SettingsProvider.java +++ b/src/com/android/launcher3/settings/SettingsProvider.java @@ -38,8 +38,6 @@ public final class SettingsProvider { public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_WIDGETS = "ui_drawer_remove_hidden_apps_widgets"; public static final String SETTINGS_UI_DRAWER_HIDE_ICON_LABELS = "ui_drawer_hide_icon_labels"; public static final String SETTINGS_UI_GENERAL_ICONS_LARGE = "ui_general_icons_large"; - public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_FAMILY = "ui_general_icons_text_font"; - public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_STYLE = "ui_general_icons_text_font_style"; public static final String SETTINGS_UI_DRAWER_SORT_MODE = "ui_drawer_sort_mode"; public static SharedPreferences get(Context context) { |