Add an icon to the left of the settings at the top level.
Add a new attribute for the icon. Add place holder icons.
BIN
res/drawable/ic_settings_about.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_accessibility.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_applications.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_call.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_date_time.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_language.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_search.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_security.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_sound_display.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_speech.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_storage.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_sync.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable/ic_settings_wireless.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
63
res/layout/preference_icon.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2006 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.
|
||||
-->
|
||||
|
||||
<!-- Layout for a Preference in a PreferenceActivity. The
|
||||
Preference is able to place a specific widget for its particular
|
||||
type in the "widget_frame" layout. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+android:id/widget_frame"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="?android:attr/scrollbarSize">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:id="@+android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<TextView android:id="@+android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:maxLines="2" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -18,4 +18,7 @@
|
||||
<declare-styleable name="WifiEncryptionState">
|
||||
<attr name="state_encrypted" format="boolean" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="IconPreferenceScreen">
|
||||
<attr name="icon" format="reference" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
@@ -16,64 +16,71 @@
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/settings_label"
|
||||
android:key="parent">
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
android:title="@string/radio_controls_title"
|
||||
settings:icon="@drawable/ic_settings_wireless"
|
||||
android:summary="@string/radio_controls_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.WirelessSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
android:key="call_settings"
|
||||
settings:icon="@drawable/ic_settings_call"
|
||||
android:title="@string/call_settings_title"
|
||||
android:summary="@string/call_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.phone"
|
||||
android:targetClass="com.android.phone.CallFeaturesSetting" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Sound and Display -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_sound_display"
|
||||
android:title="@string/sound_and_display_settings"
|
||||
android:summary="@string/sound_and_display_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.SoundAndDisplaySettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Data Sync. The settings activity will ensure this is resolved to an
|
||||
activity on the system image, otherwise it will remove this
|
||||
preference. -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_sync"
|
||||
android:title="@string/sync_settings"
|
||||
android:summary="@string/sync_settings_summary"
|
||||
android:key="sync_settings">
|
||||
<intent android:action="android.settings.SYNC_SETTINGS" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Security & Privacy -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_security"
|
||||
android:title="@string/security_settings_title"
|
||||
android:summary="@string/security_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.SecuritySettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Application Settings -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_applications"
|
||||
android:title="@string/applications_settings"
|
||||
android:summary="@string/applications_settings_summary"
|
||||
android:key="applications_settings">
|
||||
@@ -81,39 +88,42 @@
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.ApplicationSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Storage -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_storage"
|
||||
android:title="@string/storage_settings_title"
|
||||
android:summary="@string/storage_settings_summary">
|
||||
<intent android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.deviceinfo.Memory" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Date & Time -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_date_time"
|
||||
android:title="@string/date_and_time_settings_title"
|
||||
android:summary="@string/date_and_time_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.DateTimeSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Language -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_language"
|
||||
android:title="@string/language_settings"
|
||||
android:summary="@string/language_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.LanguageSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Search.
|
||||
The settings activity will ensure that this is resolved to an
|
||||
@@ -123,44 +133,48 @@
|
||||
android.app.SearchManager.INTENT_ACTION_SEARCH_SETTINGS.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_search"
|
||||
android:title="@string/search_settings"
|
||||
android:summary="@string/search_settings_summary"
|
||||
android:key="search_settings">
|
||||
<intent android:action="android.search.action.SEARCH_SETTINGS" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Accessibility feedback -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_accessibility"
|
||||
android:title="@string/accessibility_settings_title"
|
||||
android:summary="@string/accessibility_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.AccessibilitySettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- Text-To-Speech -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_speech"
|
||||
android:title="@string/tts_settings"
|
||||
android:summary="@string/tts_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.TextToSpeechSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
<!-- About Device -->
|
||||
|
||||
<PreferenceScreen
|
||||
<com.android.settings.IconPreferenceScreen
|
||||
settings:icon="@drawable/ic_settings_about"
|
||||
android:title="@string/about_settings"
|
||||
android:summary="@string/about_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.DeviceInfoSettings" />
|
||||
</PreferenceScreen>
|
||||
</com.android.settings.IconPreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
51
src/com/android/settings/IconPreferenceScreen.java
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class IconPreferenceScreen extends Preference {
|
||||
|
||||
private Drawable mIcon;
|
||||
|
||||
public IconPreferenceScreen(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public IconPreferenceScreen(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setLayoutResource(R.layout.preference_icon);
|
||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.IconPreferenceScreen, defStyle, 0);
|
||||
mIcon = a.getDrawable(R.styleable.IconPreferenceScreen_icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindView(View view) {
|
||||
super.onBindView(view);
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
|
||||
if (imageView != null && mIcon != null) {
|
||||
imageView.setImageDrawable(mIcon);
|
||||
}
|
||||
}
|
||||
}
|