diff options
-rwxr-xr-x | AndroidManifest.xml | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | res/layout/stk_menu_list.xml | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | res/layout/stk_title.xml | 98 | ||||
-rwxr-xr-x | src/com/android/stk/StkInputActivity.java | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/stk/StkLauncherActivity.java | 7 | ||||
-rwxr-xr-x | src/com/android/stk/StkMenuActivity.java | 31 |
6 files changed, 74 insertions, 86 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2942ec7..aef271d 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -49,7 +49,7 @@ </activity> <activity android:name="StkLauncherActivity" - android:theme="@android:style/Theme.Light.NoTitleBar" + android:theme="@android:style/Theme.Material.Light" android:label="@string/app_name" android:exported="false" android:taskAffinity="android.task.stk.StkLauncherActivity"> @@ -61,7 +61,7 @@ </activity> <activity android:name="StkMenuActivity" - android:theme="@android:style/Theme.Light.NoTitleBar" + android:theme="@android:style/Theme.Material.Light" android:icon="@drawable/ic_launcher_sim_toolkit" android:label="@string/app_name" android:configChanges="orientation|locale|screenSize|keyboardHidden|mnc|mcc" diff --git a/res/layout/stk_menu_list.xml b/res/layout/stk_menu_list.xml index 3872e1f..45e894d 100644..100755 --- a/res/layout/stk_menu_list.xml +++ b/res/layout/stk_menu_list.xml @@ -20,11 +20,6 @@ android:layout_height="wrap_content" android:orientation="vertical" > - <!-- Include stk title layout. --> - <include - android:id="@+id/stk_menu_title" - layout="@layout/stk_title" /> - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/res/layout/stk_title.xml b/res/layout/stk_title.xml index e63a46e..c5ca16c 100644..100755 --- a/res/layout/stk_title.xml +++ b/res/layout/stk_title.xml @@ -17,59 +17,47 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:fitsSystemWindows="true"> - - <LinearLayout android:id="@+id/stk_title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:layout_centerVertical="true" - style="?android:attr/windowTitleBackgroundStyle" > - - <LinearLayout android:id="@+id/left_container" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:layout_weight="1" - android:layout_centerVertical="true"> - <ImageView android:id="@+id/title_icon" - android:layout_width="16dip" - android:layout_height="16dip" - android:layout_marginLeft="2dip" - android:layout_marginRight="9dip" - android:layout_gravity="center_vertical" - android:layout_alignParentLeft="true" - android:scaleType="fitCenter" /> - - <TextView android:id="@+id/title_text" - android:gravity="center_vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@android:style/TextAppearance.WindowTitle" /> - </LinearLayout> - - <LinearLayout android:id="@+id/right_container" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true"> - - <ProgressBar android:id="@+id/progress_bar" - style="?android:attr/progressBarStyleSmallTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="5dip" - android:layout_centerVertical="true" - android:visibility="gone" - android:max="10000" /> - </LinearLayout> - </LinearLayout> - - <FrameLayout android:id="@android:id/content" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" - android:foregroundGravity="fill_horizontal|top" - android:foreground="?android:attr/windowContentOverlay" /> + android:orientation="horizontal" + android:fitsSystemWindows="true"> + + <LinearLayout android:id="@+id/left_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_weight="1" + android:layout_centerVertical="true"> + <ImageView android:id="@+id/title_icon" + android:visibility="gone" + android:layout_width="32dip" + android:layout_height="32dip" + android:layout_marginLeft="2dip" + android:layout_marginRight="9dip" + android:layout_gravity="center_vertical" + android:layout_alignParentLeft="true" + android:scaleType="fitCenter" /> + + <TextView android:id="@+id/title_text" + android:gravity="center_vertical" + android:layout_width="match_parent" + android:layout_height="32dip" + android:ellipsize="end" + android:maxLines="1" + style="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title" /> + </LinearLayout> + + <LinearLayout android:id="@+id/right_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true"> + + <ProgressBar android:id="@+id/progress_bar" + style="?android:attr/progressBarStyleSmallTitle" + android:layout_width="32dip" + android:layout_height="32dip" + android:layout_marginLeft="5dip" + android:layout_centerVertical="true" + android:visibility="gone" + android:max="10000" /> + </LinearLayout> </LinearLayout> diff --git a/src/com/android/stk/StkInputActivity.java b/src/com/android/stk/StkInputActivity.java index 96b7dca..9a066ec 100755 --- a/src/com/android/stk/StkInputActivity.java +++ b/src/com/android/stk/StkInputActivity.java @@ -16,6 +16,7 @@ package com.android.stk; +import android.app.ActionBar; import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -33,6 +34,7 @@ import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.Button; +import android.widget.ImageView; import android.widget.TextView; import android.widget.EditText; import android.widget.TextView.BufferType; @@ -142,8 +144,11 @@ public class StkInputActivity extends Activity implements View.OnClickListener, return; } + ActionBar actionBar = getActionBar(); + actionBar.setCustomView(R.layout.stk_title); + actionBar.setDisplayShowCustomEnabled(true); + // Set the layout for this activity. - requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.stk_input); // Initialize members @@ -381,9 +386,13 @@ public class StkInputActivity extends Activity implements View.OnClickListener, } inTypeView.setText(inTypeId); + TextView textView = (TextView) this.findViewById(R.id.title_text); + textView.setText(R.string.app_name); + if (mStkInput.icon != null) { - setFeatureDrawable(Window.FEATURE_LEFT_ICON, new BitmapDrawable( - mStkInput.icon)); + ImageView imageView = (ImageView) findViewById(R.id.title_icon); + imageView.setImageBitmap(mStkInput.icon); + imageView.setVisibility(View.VISIBLE); } // Handle specific global and text attributes. diff --git a/src/com/android/stk/StkLauncherActivity.java b/src/com/android/stk/StkLauncherActivity.java index 6c5b88c..a5271f6 100644..100755 --- a/src/com/android/stk/StkLauncherActivity.java +++ b/src/com/android/stk/StkLauncherActivity.java @@ -16,6 +16,7 @@ package com.android.stk; +import android.app.ActionBar; import android.app.ListActivity; import android.content.Context; import android.content.Intent; @@ -62,7 +63,11 @@ public class StkLauncherActivity extends ListActivity { mContext = getBaseContext(); mTm = (TelephonyManager) mContext.getSystemService( Context.TELEPHONY_SERVICE); - requestWindowFeature(Window.FEATURE_NO_TITLE); + + ActionBar actionBar = getActionBar(); + actionBar.setCustomView(R.layout.stk_title); + actionBar.setDisplayShowCustomEnabled(true); + setContentView(R.layout.stk_menu_list); mTitleTextView = (TextView) findViewById(R.id.title_text); mTitleIconView = (ImageView) findViewById(R.id.title_icon); diff --git a/src/com/android/stk/StkMenuActivity.java b/src/com/android/stk/StkMenuActivity.java index 42cd60a..09d1ad6 100755 --- a/src/com/android/stk/StkMenuActivity.java +++ b/src/com/android/stk/StkMenuActivity.java @@ -17,6 +17,7 @@ package com.android.stk; import android.app.ListActivity; +import android.app.ActionBar; import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -99,8 +100,11 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex super.onCreate(icicle); CatLog.d(LOG_TAG, "onCreate"); - // Remove the default title, customized one is used. - requestWindowFeature(Window.FEATURE_NO_TITLE); + + ActionBar actionBar = getActionBar(); + actionBar.setCustomView(R.layout.stk_title); + actionBar.setDisplayShowCustomEnabled(true); + // Set the layout for this activity. setContentView(R.layout.stk_menu_list); mInstance = this; @@ -147,6 +151,8 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex mAcceptUsersInput = false; mProgressView.setVisibility(View.VISIBLE); mProgressView.setIndeterminate(true); + + invalidateOptionsMenu(); } @Override @@ -305,25 +311,19 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex public boolean onCreateOptionsMenu(android.view.Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, StkApp.MENU_ID_END_SESSION, 1, R.string.menu_end_session); - menu.add(0, StkApp.MENU_ID_HELP, 2, R.string.help); return true; } @Override public boolean onPrepareOptionsMenu(android.view.Menu menu) { super.onPrepareOptionsMenu(menu); - boolean helpVisible = false; boolean mainVisible = false; - if (mState == STATE_SECONDARY) { + if (mState == STATE_SECONDARY && mAcceptUsersInput) { mainVisible = true; } - if (mStkMenu != null) { - helpVisible = mStkMenu.helpAvailable; - } menu.findItem(StkApp.MENU_ID_END_SESSION).setVisible(mainVisible); - menu.findItem(StkApp.MENU_ID_HELP).setVisible(helpVisible); return true; } @@ -342,17 +342,8 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex cancelTimeOut(); finish(); return true; - case StkApp.MENU_ID_HELP: - cancelTimeOut(); - mAcceptUsersInput = false; - int position = getSelectedItemPosition(); - Item stkItem = getSelectedItem(position); - if (stkItem == null) { - break; - } - // send help needed response. - sendResponse(StkAppService.RES_ID_MENU_SELECTION, stkItem.id, true); - return true; + default: + break; } return super.onOptionsItemSelected(item); } |