summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-07-16 17:45:04 -0700
committerRomain Guy <romainguy@android.com>2009-07-16 17:46:19 -0700
commit6b3f51d373f19711a7fac44f2f6df9dc89110eb1 (patch)
treea61168dd605a59f954e9bf1ec5d243b3be8b3ca6
parent1dd3a077a293bf3ac4e61e91dcc3dfc99487acd4 (diff)
downloadpackages_apps_trebuchet-6b3f51d373f19711a7fac44f2f6df9dc89110eb1.zip
packages_apps_trebuchet-6b3f51d373f19711a7fac44f2f6df9dc89110eb1.tar.gz
packages_apps_trebuchet-6b3f51d373f19711a7fac44f2f6df9dc89110eb1.tar.bz2
More new gestures UI. Adds a back button at the bottom of the settings activity.
-rw-r--r--res/drawable/g_background.9.pngbin0 -> 392 bytes
-rw-r--r--res/drawable/g_bar_background.xml19
-rw-r--r--res/drawable/gestures_frame.9.pngbin6582 -> 3882 bytes
-rw-r--r--res/drawable/mirrored_shadow.9.pngbin0 -> 165 bytes
-rw-r--r--res/layout/gestures_settings.xml44
-rw-r--r--src/com/android/launcher/GesturesActivity.java30
-rw-r--r--src/com/android/launcher/GesturesConstants.java2
-rw-r--r--src/com/android/launcher/Launcher.java4
8 files changed, 66 insertions, 33 deletions
diff --git a/res/drawable/g_background.9.png b/res/drawable/g_background.9.png
new file mode 100644
index 0000000..a4bf817
--- /dev/null
+++ b/res/drawable/g_background.9.png
Binary files differ
diff --git a/res/drawable/g_bar_background.xml b/res/drawable/g_bar_background.xml
new file mode 100644
index 0000000..b9f6694
--- /dev/null
+++ b/res/drawable/g_bar_background.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/g_background"
+ android:dither="true" />
diff --git a/res/drawable/gestures_frame.9.png b/res/drawable/gestures_frame.9.png
index c5f5640..3119a81 100644
--- a/res/drawable/gestures_frame.9.png
+++ b/res/drawable/gestures_frame.9.png
Binary files differ
diff --git a/res/drawable/mirrored_shadow.9.png b/res/drawable/mirrored_shadow.9.png
new file mode 100644
index 0000000..84516dd
--- /dev/null
+++ b/res/drawable/mirrored_shadow.9.png
Binary files differ
diff --git a/res/layout/gestures_settings.xml b/res/layout/gestures_settings.xml
index d32b3ec..712cb22 100644
--- a/res/layout/gestures_settings.xml
+++ b/res/layout/gestures_settings.xml
@@ -14,22 +14,46 @@
limitations under the License.
-->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
<ListView
android:id="@android:id/list"
+
+ android:layout_width="fill_parent"
+ android:layout_height="0dip"
+ android:layout_alignParentTop="true"
+ android:layout_above="@+id/bottom_bar" />
+
+ <View
android:layout_width="fill_parent"
- android:layout_height="fill_parent" />
+ android:layout_height="6dip"
+ android:layout_alignParentTop="false"
+ android:layout_above="@+id/bottom_bar"
+
+ android:background="@drawable/mirrored_shadow" />
+
+ <RelativeLayout
+ android:id="@id/bottom_bar"
- <TextView
- android:id="@android:id/empty"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
+ android:layout_height="60dip"
+ android:layout_alignParentBottom="true"
+
+ android:background="@drawable/g_bar_background">
+
+ <ImageButton
+ android:onClick="back"
+
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="13dip"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
- android:gravity="center_horizontal"
+ android:background="@drawable/btn_g" />
- android:text="@string/gestures_loading"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ </RelativeLayout>
-</merge>
+</RelativeLayout>
diff --git a/src/com/android/launcher/GesturesActivity.java b/src/com/android/launcher/GesturesActivity.java
index 24775ff..0b66ae1 100644
--- a/src/com/android/launcher/GesturesActivity.java
+++ b/src/com/android/launcher/GesturesActivity.java
@@ -56,9 +56,6 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
private static final int DIALOG_RENAME_GESTURE = 1;
- static final String PREFERENCES_NAME = "gestures";
- static final String PREFERENCES_HOME_KEY = "gestures.home";
-
// Type: long (id)
private static final String GESTURES_INFO_ID = "gestures.info_id";
@@ -68,7 +65,6 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
private GesturesAdapter mAdapter;
private GestureLibrary mStore;
private GesturesLoadTask mTask;
- private TextView mEmpty;
private Dialog mRenameDialog;
private EditText mInput;
@@ -86,12 +82,16 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
getListView().setOnItemClickListener(this);
mStore = Launcher.getGestureLibrary();
- mEmpty = (TextView) findViewById(android.R.id.empty);
mTask = (GesturesLoadTask) new GesturesLoadTask().execute();
registerForContextMenu(getListView());
- mPreferences = getSharedPreferences(PREFERENCES_NAME, MODE_PRIVATE);
+ mPreferences = getSharedPreferences(GesturesConstants.PREFERENCES_NAME, MODE_PRIVATE);
+ }
+
+ @SuppressWarnings({ "UnusedDeclaration" })
+ public void back(View v) {
+ finish();
}
@Override
@@ -106,12 +106,6 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
cleanupRenameDialog();
}
- private void checkForEmpty() {
- if (mAdapter.getCount() == 0) {
- mEmpty.setText(R.string.gestures_empty);
- }
- }
-
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
@@ -257,7 +251,6 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
adapter.setNotifyOnChange(false);
adapter.remove(info);
adapter.sort(mSorter);
- checkForEmpty();
adapter.notifyDataSetChanged();
LauncherModel.deleteGestureFromDatabase(this, info);
@@ -269,7 +262,8 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
if (position == 1) {
final CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
checkBox.toggle();
- mPreferences.edit().putBoolean(PREFERENCES_HOME_KEY, checkBox.isChecked()).commit();
+ mPreferences.edit().putBoolean(GesturesConstants.PREFERENCES_HOME_KEY,
+ checkBox.isChecked()).commit();
}
}
@@ -328,12 +322,6 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
adapter.sort(mSorter);
adapter.notifyDataSetChanged();
}
-
- @Override
- protected void onPostExecute(Boolean aBoolean) {
- super.onPostExecute(aBoolean);
- checkForEmpty();
- }
}
private class GesturesAdapter extends ArrayAdapter<ApplicationInfo> {
@@ -471,7 +459,7 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
((TextView) convertView.findViewById(R.id.title)).setText(title);
((TextView) convertView.findViewById(R.id.summary)).setText(summary);
((CheckBox) convertView.findViewById(R.id.checkbox)).setChecked(
- mPreferences.getBoolean(PREFERENCES_HOME_KEY, false));
+ mPreferences.getBoolean(GesturesConstants.PREFERENCES_HOME_KEY, false));
return convertView;
}
diff --git a/src/com/android/launcher/GesturesConstants.java b/src/com/android/launcher/GesturesConstants.java
index 3151ea3..93a1f10 100644
--- a/src/com/android/launcher/GesturesConstants.java
+++ b/src/com/android/launcher/GesturesConstants.java
@@ -22,4 +22,6 @@ interface GesturesConstants {
final long MATCH_DELAY = 370;
final float LENGTH_THRESHOLD = 120.0f;
int PATH_SAMPLE_COUNT = 10;
+ String PREFERENCES_NAME = "gestures";
+ String PREFERENCES_HOME_KEY = "gestures.home";
}
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 21b6949..be013eb 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -984,9 +984,9 @@ public final class Launcher extends Activity implements View.OnClickListener, On
// TODO: This really should not be done here every time
final SharedPreferences preferences =
- getSharedPreferences(GesturesActivity.PREFERENCES_NAME, MODE_PRIVATE);
+ getSharedPreferences(GesturesConstants.PREFERENCES_NAME, MODE_PRIVATE);
final boolean homeKey = preferences.getBoolean(
- GesturesActivity.PREFERENCES_HOME_KEY, false);
+ GesturesConstants.PREFERENCES_HOME_KEY, false);
if (!homeKey) {
if (!mWorkspace.isDefaultScreenShowing()) {