OSDN Git Service

Move application icon to left in InstalledAppDetails.
authorSuchi Amalapurapu <asuchitra@google.com>
Tue, 2 Mar 2010 19:15:30 +0000 (11:15 -0800)
committerSuchi Amalapurapu <asuchitra@google.com>
Thu, 4 Mar 2010 20:30:11 +0000 (12:30 -0800)
Fix text overlapping icon issue.
Add new icons for filter options

23 files changed:
res/drawable-hdpi/ic_tab_selected_all.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_selected_download.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_selected_running.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_selected_sdcard.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_unselected_all.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_unselected_download.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_unselected_running.png [new file with mode: 0644]
res/drawable-hdpi/ic_tab_unselected_sdcard.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_selected_all.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_selected_download.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_selected_running.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_selected_sdcard.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_unselected_all.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_unselected_download.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_unselected_running.png [new file with mode: 0644]
res/drawable-mdpi/ic_tab_unselected_sdcard.png [new file with mode: 0644]
res/drawable/ic_tab_all.xml [new file with mode: 0644]
res/drawable/ic_tab_download.xml [new file with mode: 0644]
res/drawable/ic_tab_running.xml [new file with mode: 0644]
res/drawable/ic_tab_sdcard.xml [new file with mode: 0644]
res/layout/installed_app_details.xml
src/com/android/settings/InstalledAppDetails.java
src/com/android/settings/ManageApplications.java

diff --git a/res/drawable-hdpi/ic_tab_selected_all.png b/res/drawable-hdpi/ic_tab_selected_all.png
new file mode 100644 (file)
index 0000000..d5a7878
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_selected_all.png differ
diff --git a/res/drawable-hdpi/ic_tab_selected_download.png b/res/drawable-hdpi/ic_tab_selected_download.png
new file mode 100644 (file)
index 0000000..d316c10
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_selected_download.png differ
diff --git a/res/drawable-hdpi/ic_tab_selected_running.png b/res/drawable-hdpi/ic_tab_selected_running.png
new file mode 100644 (file)
index 0000000..56849f8
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_selected_running.png differ
diff --git a/res/drawable-hdpi/ic_tab_selected_sdcard.png b/res/drawable-hdpi/ic_tab_selected_sdcard.png
new file mode 100644 (file)
index 0000000..f4bd7d1
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_selected_sdcard.png differ
diff --git a/res/drawable-hdpi/ic_tab_unselected_all.png b/res/drawable-hdpi/ic_tab_unselected_all.png
new file mode 100644 (file)
index 0000000..2ef5115
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_unselected_all.png differ
diff --git a/res/drawable-hdpi/ic_tab_unselected_download.png b/res/drawable-hdpi/ic_tab_unselected_download.png
new file mode 100644 (file)
index 0000000..bd74ee9
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_unselected_download.png differ
diff --git a/res/drawable-hdpi/ic_tab_unselected_running.png b/res/drawable-hdpi/ic_tab_unselected_running.png
new file mode 100644 (file)
index 0000000..f27cb93
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_unselected_running.png differ
diff --git a/res/drawable-hdpi/ic_tab_unselected_sdcard.png b/res/drawable-hdpi/ic_tab_unselected_sdcard.png
new file mode 100644 (file)
index 0000000..b73b939
Binary files /dev/null and b/res/drawable-hdpi/ic_tab_unselected_sdcard.png differ
diff --git a/res/drawable-mdpi/ic_tab_selected_all.png b/res/drawable-mdpi/ic_tab_selected_all.png
new file mode 100644 (file)
index 0000000..bdcfc16
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_selected_all.png differ
diff --git a/res/drawable-mdpi/ic_tab_selected_download.png b/res/drawable-mdpi/ic_tab_selected_download.png
new file mode 100644 (file)
index 0000000..e9d02c8
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_selected_download.png differ
diff --git a/res/drawable-mdpi/ic_tab_selected_running.png b/res/drawable-mdpi/ic_tab_selected_running.png
new file mode 100644 (file)
index 0000000..5f07d4b
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_selected_running.png differ
diff --git a/res/drawable-mdpi/ic_tab_selected_sdcard.png b/res/drawable-mdpi/ic_tab_selected_sdcard.png
new file mode 100644 (file)
index 0000000..f90c7ea
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_selected_sdcard.png differ
diff --git a/res/drawable-mdpi/ic_tab_unselected_all.png b/res/drawable-mdpi/ic_tab_unselected_all.png
new file mode 100644 (file)
index 0000000..dfd81cc
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_unselected_all.png differ
diff --git a/res/drawable-mdpi/ic_tab_unselected_download.png b/res/drawable-mdpi/ic_tab_unselected_download.png
new file mode 100644 (file)
index 0000000..b7e56d4
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_unselected_download.png differ
diff --git a/res/drawable-mdpi/ic_tab_unselected_running.png b/res/drawable-mdpi/ic_tab_unselected_running.png
new file mode 100644 (file)
index 0000000..6a72513
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_unselected_running.png differ
diff --git a/res/drawable-mdpi/ic_tab_unselected_sdcard.png b/res/drawable-mdpi/ic_tab_unselected_sdcard.png
new file mode 100644 (file)
index 0000000..59af3a2
Binary files /dev/null and b/res/drawable-mdpi/ic_tab_unselected_sdcard.png differ
diff --git a/res/drawable/ic_tab_all.xml b/res/drawable/ic_tab_all.xml
new file mode 100644 (file)
index 0000000..9e5756b
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/ic_tab_selected_all" />
+    <item android:drawable="@drawable/ic_tab_unselected_all" />
+</selector>
+
diff --git a/res/drawable/ic_tab_download.xml b/res/drawable/ic_tab_download.xml
new file mode 100644 (file)
index 0000000..d126f5b
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/ic_tab_selected_download" />
+    <item android:drawable="@drawable/ic_tab_unselected_download" />
+</selector>
+
diff --git a/res/drawable/ic_tab_running.xml b/res/drawable/ic_tab_running.xml
new file mode 100644 (file)
index 0000000..1044acc
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/ic_tab_selected_running" />
+    <item android:drawable="@drawable/ic_tab_unselected_running" />
+</selector>
+
diff --git a/res/drawable/ic_tab_sdcard.xml b/res/drawable/ic_tab_sdcard.xml
new file mode 100644 (file)
index 0000000..2088f93
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/ic_tab_selected_sdcard" />
+    <item android:drawable="@drawable/ic_tab_unselected_sdcard" />
+</selector>
+
index 423e3c1..3243672 100644 (file)
         android:paddingBottom="5dip"
         android:orientation="vertical">
 
-        <!-- App snippet -->
-        <RelativeLayout
+        <!-- App snippet with buttons -->
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical">
+            android:layout_gravity="center_vertical"
+            android:orientation="vertical"
+            android:paddingRight="6dip"
+            android:paddingLeft="6dip"
+            android:paddingTop="5dip"
+            android:paddingBottom="5dip" >
 
-            <LinearLayout
-                android:orientation="vertical"
-                android:layout_alignParentLeft="true"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="6dip"
-                android:paddingBottom="6dip"
-                android:paddingRight="6dip"
-                android:paddingLeft="6dip" >
-                <!-- application name -->
-                <TextView android:id="@+id/app_name"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textStyle="bold"
-                    android:singleLine="true"
-                    android:ellipsize="marquee"
-                    android:layout_marginBottom="2dip" />
-                <!-- application version -->
-                <TextView android:id="@+id/app_version"
-                    android:layout_marginTop="-4dip"
-                    android:layout_gravity="center_vertical"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="?android:attr/textAppearanceSmall" />
-            </LinearLayout>
+        <!-- Application snippet label, version and icon -->
+        <include
+            layout="@layout/manage_applications_item"
+            android:id="@+id/app_snippet"/>
 
-            <!-- application icon -->
-            <ImageView android:id="@+id/app_icon"
-                android:layout_width="@android:dimen/app_icon_size"
-                android:layout_height="@android:dimen/app_icon_size"
-                android:layout_alignParentRight="true"
-                android:paddingTop="6dip"
-                android:paddingBottom="6dip"
-                android:paddingRight="6dip"
-                android:scaleType="fitCenter" />
-        </RelativeLayout>
         <!-- Force stop and uninstall buttons -->
         <include
             layout="@layout/two_buttons_panel"
             android:id="@+id/control_buttons_panel"/>
+        </LinearLayout>
 
         <TextView
             style="?android:attr/listSeparatorTextViewStyle"
index 128d1cd..c2141f6 100644 (file)
@@ -314,38 +314,32 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene
     }
     
     private void refreshAppAttributes(PackageInfo pkgInfo) {
-        setAppLabelAndIcon();
+        setAppLabelAndIcon(pkgInfo);
         initControlButtons();
         initDataButtons();
-        // Version number of application
-        setAppVersion(pkgInfo);
         // Refresh size info
         if (mAppInfo != null && mAppInfo.packageName != null) {
             mPm.getPackageSizeInfo(mAppInfo.packageName, mSizeObserver);
         }
     }
-    
+
     // Utility method to set applicaiton label and icon.
-    private void setAppLabelAndIcon() {
-        ((ImageView)findViewById(R.id.app_icon)).setImageDrawable(mAppInfo.loadIcon(mPm));
-        //set application name TODO version
-        CharSequence appName = mAppInfo.loadLabel(mPm);
-        if(appName == null) {
-            appName = getString(_UNKNOWN_APP);
-        }
-        ((TextView)findViewById(R.id.app_name)).setText(appName);
-    }
-    
-    // Utility method to set application version
-    private void setAppVersion(PackageInfo pkgInfo) {
+    private void setAppLabelAndIcon(PackageInfo pkgInfo) {
+        View appSnippet = findViewById(R.id.app_snippet);
+        ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
+        icon.setImageDrawable(mAppInfo.loadIcon(mPm));
+        // Set application name.
+        TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
+        label.setText(mAppInfo.loadLabel(mPm));
         // Version number of application
-        mAppVersion = ((TextView)findViewById(R.id.app_version));
-        if (pkgInfo != null) {
+        mAppVersion = (TextView) appSnippet.findViewById(R.id.app_size);
+
+        if (pkgInfo != null && pkgInfo.versionName != null) {
             mAppVersion.setVisibility(View.VISIBLE);
             mAppVersion.setText(getString(R.string.version_text,
                     String.valueOf(pkgInfo.versionName)));
         } else {
-            mAppVersion.setVisibility(View.GONE);
+            mAppVersion.setVisibility(View.INVISIBLE);
         }
     }
 
index 6de6c9c..f562f10 100644 (file)
@@ -37,6 +37,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -1664,24 +1665,29 @@ public class ManageApplications extends TabActivity implements
         if (DEBUG_TIME) {
             Log.i(TAG, "Took " + (SystemClock.elapsedRealtime()-sStart) + " ms to init cache");
         }
+
         final TabHost tabHost = getTabHost();
         tabHost.addTab(tabHost.newTabSpec(TAB_DOWNLOADED)
-                .setIndicator(getString(R.string.filter_apps_third_party))
+                .setIndicator(getString(R.string.filter_apps_third_party),
+                        getResources().getDrawable(R.drawable.ic_tab_download))
                 .setContent(this));
         tabHost.addTab(tabHost.newTabSpec(TAB_RUNNING)
-                .setIndicator(getString(R.string.filter_apps_running))
+                .setIndicator(getString(R.string.filter_apps_running),
+                        getResources().getDrawable(R.drawable.ic_tab_running))
                 .setContent(this));
         tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
-                .setIndicator(getString(R.string.filter_apps_all))
+                .setIndicator(getString(R.string.filter_apps_all),
+                        getResources().getDrawable(R.drawable.ic_tab_all))
                 .setContent(this));
         tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD)
-                .setIndicator(getString(R.string.filter_apps_onsdcard))
+                .setIndicator(getString(R.string.filter_apps_onsdcard),
+                        getResources().getDrawable(R.drawable.ic_tab_sdcard))
                 .setContent(this));
-
         tabHost.setCurrentTabByTag(defaultTabTag);
         tabHost.setOnTabChangedListener(this);
     }
     
+    @Override
     protected void onDestroy() {
         // Persist values in cache
         mCache.updateCache();
@@ -1689,7 +1695,7 @@ public class ManageApplications extends TabActivity implements
     }
 
     @Override
-    public Dialog onCreateDialog(int id) {
+    public Dialog onCreateDialog(int id, Bundle args) {
         if (id == DLG_LOADING) {
             ProgressDialog dlg = new ProgressDialog(this);
             dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);