release-request-18270495-77c6-4d95-8968-eb22e3d2fe8b-for-git_oc-release-4057656 snap-temp-L93200000069424216

Change-Id: I66e9ffb1b02e3f0714826538fbcf8968f28f77d4
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
old mode 100644
new mode 100755
index 3872e1f..45e894d
--- 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
old mode 100644
new mode 100755
index e63a46e..c5ca16c
--- 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">
+    android:orientation="horizontal"
+    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: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" />
 
-        <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="32dip"
+            android:ellipsize="end"
+            android:maxLines="1"
+            style="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title" />
+    </LinearLayout>
 
-			<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">
 
-        <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" />
+        <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.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 @@
             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 @@
         }
         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
old mode 100644
new mode 100755
index 6c5b88c..a5271f6
--- 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 @@
         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 @@
         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 @@
         mAcceptUsersInput = false;
         mProgressView.setVisibility(View.VISIBLE);
         mProgressView.setIndeterminate(true);
+
+        invalidateOptionsMenu();
     }
 
     @Override
@@ -305,25 +311,19 @@
     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 @@
             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);
     }