Move application icon to left in InstalledAppDetails.

Fix text overlapping icon issue.
Add new icons for filter options
This commit is contained in:
Suchi Amalapurapu
2010-03-02 11:15:30 -08:00
parent 0382a49615
commit f4c4b59f13
23 changed files with 122 additions and 64 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -29,53 +29,27 @@
android:paddingBottom="5dip" android:paddingBottom="5dip"
android:orientation="vertical"> android:orientation="vertical">
<!-- App snippet --> <!-- App snippet with buttons -->
<RelativeLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <!-- Application snippet label, version and icon -->
android:orientation="vertical" <include
android:layout_alignParentLeft="true" layout="@layout/manage_applications_item"
android:layout_width="match_parent" android:id="@+id/app_snippet"/>
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 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 --> <!-- Force stop and uninstall buttons -->
<include <include
layout="@layout/two_buttons_panel" layout="@layout/two_buttons_panel"
android:id="@+id/control_buttons_panel"/> android:id="@+id/control_buttons_panel"/>
</LinearLayout>
<TextView <TextView
style="?android:attr/listSeparatorTextViewStyle" style="?android:attr/listSeparatorTextViewStyle"

View File

@@ -314,38 +314,32 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene
} }
private void refreshAppAttributes(PackageInfo pkgInfo) { private void refreshAppAttributes(PackageInfo pkgInfo) {
setAppLabelAndIcon(); setAppLabelAndIcon(pkgInfo);
initControlButtons(); initControlButtons();
initDataButtons(); initDataButtons();
// Version number of application
setAppVersion(pkgInfo);
// Refresh size info // Refresh size info
if (mAppInfo != null && mAppInfo.packageName != null) { if (mAppInfo != null && mAppInfo.packageName != null) {
mPm.getPackageSizeInfo(mAppInfo.packageName, mSizeObserver); mPm.getPackageSizeInfo(mAppInfo.packageName, mSizeObserver);
} }
} }
// Utility method to set applicaiton label and icon. // Utility method to set applicaiton label and icon.
private void setAppLabelAndIcon() { private void setAppLabelAndIcon(PackageInfo pkgInfo) {
((ImageView)findViewById(R.id.app_icon)).setImageDrawable(mAppInfo.loadIcon(mPm)); View appSnippet = findViewById(R.id.app_snippet);
//set application name TODO version ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
CharSequence appName = mAppInfo.loadLabel(mPm); icon.setImageDrawable(mAppInfo.loadIcon(mPm));
if(appName == null) { // Set application name.
appName = getString(_UNKNOWN_APP); TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
} label.setText(mAppInfo.loadLabel(mPm));
((TextView)findViewById(R.id.app_name)).setText(appName);
}
// Utility method to set application version
private void setAppVersion(PackageInfo pkgInfo) {
// Version number of application // Version number of application
mAppVersion = ((TextView)findViewById(R.id.app_version)); mAppVersion = (TextView) appSnippet.findViewById(R.id.app_size);
if (pkgInfo != null) {
if (pkgInfo != null && pkgInfo.versionName != null) {
mAppVersion.setVisibility(View.VISIBLE); mAppVersion.setVisibility(View.VISIBLE);
mAppVersion.setText(getString(R.string.version_text, mAppVersion.setText(getString(R.string.version_text,
String.valueOf(pkgInfo.versionName))); String.valueOf(pkgInfo.versionName)));
} else { } else {
mAppVersion.setVisibility(View.GONE); mAppVersion.setVisibility(View.INVISIBLE);
} }
} }

View File

@@ -37,6 +37,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -1664,24 +1665,29 @@ public class ManageApplications extends TabActivity implements
if (DEBUG_TIME) { if (DEBUG_TIME) {
Log.i(TAG, "Took " + (SystemClock.elapsedRealtime()-sStart) + " ms to init cache"); Log.i(TAG, "Took " + (SystemClock.elapsedRealtime()-sStart) + " ms to init cache");
} }
final TabHost tabHost = getTabHost(); final TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec(TAB_DOWNLOADED) 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)); .setContent(this));
tabHost.addTab(tabHost.newTabSpec(TAB_RUNNING) 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)); .setContent(this));
tabHost.addTab(tabHost.newTabSpec(TAB_ALL) 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)); .setContent(this));
tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD) 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)); .setContent(this));
tabHost.setCurrentTabByTag(defaultTabTag); tabHost.setCurrentTabByTag(defaultTabTag);
tabHost.setOnTabChangedListener(this); tabHost.setOnTabChangedListener(this);
} }
@Override
protected void onDestroy() { protected void onDestroy() {
// Persist values in cache // Persist values in cache
mCache.updateCache(); mCache.updateCache();
@@ -1689,7 +1695,7 @@ public class ManageApplications extends TabActivity implements
} }
@Override @Override
public Dialog onCreateDialog(int id) { public Dialog onCreateDialog(int id, Bundle args) {
if (id == DLG_LOADING) { if (id == DLG_LOADING) {
ProgressDialog dlg = new ProgressDialog(this); ProgressDialog dlg = new ProgressDialog(this);
dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER); dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);