diff options
author | Preeti Ahuja <preetia@codeaurora.org> | 2015-06-15 17:20:05 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:29:33 -0600 |
commit | 92d4b4144df44401f3420398ad30abaab7dac93e (patch) | |
tree | 796c267fa748d7049deb4d2ea9c276ea24e68452 | |
parent | 21081ba07df1c46f8f16ae380d9e5bbe36407f7c (diff) | |
download | android_packages_apps_Stk-92d4b4144df44401f3420398ad30abaab7dac93e.tar.gz android_packages_apps_Stk-92d4b4144df44401f3420398ad30abaab7dac93e.tar.bz2 android_packages_apps_Stk-92d4b4144df44401f3420398ad30abaab7dac93e.zip |
STK: Add content information to the icon that is displayed.
Add an image view to the layout of the activities( if not already present)
which displays the Stk activity's icon. An appropriate content
description is added to the icon's image view . The icon's content
information helps in testing various icon related stk test cases using the
UI Automator.
Support has been added for following commands:
1. Display Text
2. Get Inkey
3. Get Input
4. Set Up Menu
5. Send Short Message
6. Send SS
7. Send USSD
8. Set Up Call
9. Send DTMF
Change-Id: Ib9eeea7169f1f66bbb9bc1ec3081927ae998b3a2
CRs-Fixed: 823505
-rw-r--r-- | res/layout/stk_input.xml | 153 | ||||
-rw-r--r-- | res/layout/stk_msg_dialog.xml | 18 | ||||
-rwxr-xr-x | src/com/android/stk/StkAppService.java | 5 | ||||
-rw-r--r-- | src/com/android/stk/StkDialogActivity.java | 18 | ||||
-rw-r--r-- | src/com/android/stk/StkInputActivity.java | 10 | ||||
-rw-r--r-- | src/com/android/stk/StkMenuActivity.java | 1 |
6 files changed, 126 insertions, 79 deletions
diff --git a/res/layout/stk_input.xml b/res/layout/stk_input.xml index 746ddcf..ba151b0 100644 --- a/res/layout/stk_input.xml +++ b/res/layout/stk_input.xml @@ -13,89 +13,104 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<ScrollView +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layoutDirection="locale" - android:layout_height="wrap_content"> - <LinearLayout + android:layout_height="wrap_content" + android:orientation="vertical" > + <LinearLayout android:id="@+id/titleBar" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="20dip" - android:layout_gravity="center_horizontal"> - <TextView - android:id="@+id/prompt" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textStyle="bold" - android:gravity="center_horizontal" - android:paddingBottom="30dip" /> + android:layout_height="50dp" + android:orientation="horizontal"> + <ImageView android:id="@+id/icon" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_marginLeft="8dp"/> + </LinearLayout> + <ScrollView + android:layout_width="match_parent" + android:layoutDirection="locale" + android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="20dip" + android:layout_gravity="center_horizontal"> + <TextView + android:id="@+id/prompt" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textStyle="bold" + android:gravity="center_horizontal" + android:paddingBottom="30dip" /> <LinearLayout - android:id="@+id/normal_layout" - android:visibility="visible" - android:orientation="vertical" android:layout_width="match_parent" - android:layout_marginStart="10dip" - android:layout_marginEnd="10dip" android:layout_height="wrap_content"> <LinearLayout - android:id="@+id/input_restriction_info" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="4dip" - android:orientation="horizontal"> - <TextView - android:id="@+id/input_type" - android:gravity="start" - android:textColor="@color/ltgrey" + android:id="@+id/normal_layout" + android:visibility="visible" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_marginStart="10dip" + android:layout_marginEnd="10dip" + android:layout_height="wrap_content"> + <LinearLayout + android:id="@+id/input_restriction_info" android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dip" + android:orientation="horizontal"> + <TextView + android:id="@+id/input_type" + android:gravity="start" + android:textColor="@color/ltgrey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <TextView + android:id="@+id/num_of_chars" + android:textColor="@color/ltgrey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dip" /> + </LinearLayout> + <EditText + android:id="@+id/in_text" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="20dip" + android:layout_width="match_parent" android:layout_height="wrap_content" /> - <TextView - android:id="@+id/num_of_chars" - android:textColor="@color/ltgrey" - android:layout_width="wrap_content" + <Button + android:id="@+id/button_ok" + android:layout_gravity="center_horizontal" + android:layout_width="100sp" android:layout_height="wrap_content" - android:layout_marginStart="4dip" /> + android:textStyle="bold" + android:text="@string/button_ok" /> </LinearLayout> - <EditText - android:id="@+id/in_text" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="20dip" + <LinearLayout + android:id="@+id/yes_no_layout" + android:visibility="gone" android:layout_width="match_parent" - android:layout_height="wrap_content" /> - <Button - android:id="@+id/button_ok" - android:layout_gravity="center_horizontal" - android:layout_width="100sp" - android:layout_height="wrap_content" - android:textStyle="bold" - android:text="@string/button_ok" /> - </LinearLayout> - <LinearLayout - android:id="@+id/yes_no_layout" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_horizontal"> - <Button - android:id="@+id/button_yes" - android:layout_width="100sp" android:layout_height="wrap_content" - android:textStyle="bold" - android:text="@string/button_yes" /> - <Button - android:id="@+id/button_no" - android:layout_marginStart="10dip" - android:layout_width="100sp" - android:layout_height="wrap_content" - android:textStyle="bold" - android:text="@string/button_no" /> + android:gravity="center_horizontal"> + <Button + android:id="@+id/button_yes" + android:layout_width="100sp" + android:layout_height="wrap_content" + android:textStyle="bold" + android:text="@string/button_yes" /> + <Button + android:id="@+id/button_no" + android:layout_marginStart="10dip" + android:layout_width="100sp" + android:layout_height="wrap_content" + android:textStyle="bold" + android:text="@string/button_no" /> + </LinearLayout> </LinearLayout> </LinearLayout> - </LinearLayout> -</ScrollView> + </ScrollView> +</LinearLayout> diff --git a/res/layout/stk_msg_dialog.xml b/res/layout/stk_msg_dialog.xml index 356fa1a..0959217 100644 --- a/res/layout/stk_msg_dialog.xml +++ b/res/layout/stk_msg_dialog.xml @@ -21,6 +21,24 @@ android:layoutDirection="locale" android:orientation="vertical" > + <LinearLayout android:id="@+id/titleBar" + android:layout_width="match_parent" + android:layout_height="50dp" + android:orientation="horizontal"> + <ImageView android:id="@+id/icon" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_marginLeft="8dp"/> + <TextView + android:id="@+id/title" + android:layout_width="match_parent" + style="?android:attr/textAppearanceMedium" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:padding="5dip"/> + </LinearLayout> <LinearLayout android:id="@+id/messagePanel" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index 3162c1e..66013d8 100755 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -255,6 +255,10 @@ public class StkAppService extends Service implements Runnable { // system property to set the STK specific default url for launch browser proactive cmds private static final String STK_BROWSER_DEFAULT_URL_SYSPROP = "persist.radio.stk.default_url"; + // Description of the Icon that is being dispalyed in a Stk activity. + public static final String TEXT_DEFAULT_ICON = "Stk Default Icon"; + public static final String TEXT_ICON_FROM_COMMAND="Stk Icon from Command"; + @Override public void onCreate() { CatLog.d(LOG_TAG, "onCreate()+"); @@ -1440,6 +1444,7 @@ public class StkAppService extends Service implements Runnable { ImageView iv = (ImageView) v .findViewById(com.android.internal.R.id.icon); if (msg.icon != null) { + iv.setContentDescription(TEXT_ICON_FROM_COMMAND); iv.setImageBitmap(msg.icon); } else { iv.setVisibility(View.GONE); diff --git a/src/com/android/stk/StkDialogActivity.java b/src/com/android/stk/StkDialogActivity.java index 24e1068..2b7cfee 100644 --- a/src/com/android/stk/StkDialogActivity.java +++ b/src/com/android/stk/StkDialogActivity.java @@ -34,6 +34,7 @@ import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.widget.Button; +import android.widget.ImageView; import android.widget.TextView; /** @@ -73,8 +74,8 @@ public class StkDialogActivity extends Activity implements View.OnClickListener // New Dialog is created - set to no response sent mIsResponseSent = false; - requestWindowFeature(Window.FEATURE_LEFT_ICON); - + // Disable the title for Window. We will set the title later in the layout. + requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.stk_msg_dialog); Button okButton = (Button) findViewById(R.id.button_ok); @@ -138,18 +139,21 @@ public class StkDialogActivity extends Activity implements View.OnClickListener TextView mMessageView = (TextView) window .findViewById(R.id.dialog_message); - setTitle(mTextMsg.title); + TextView titleView = (TextView) window.findViewById(R.id.title); + titleView.setText(mTextMsg.title); if (!(mTextMsg.iconSelfExplanatory && mTextMsg.icon != null)) { mMessageView.setText(mTextMsg.text); } + ImageView imageView = (ImageView) findViewById(R.id.icon); if (mTextMsg.icon == null) { - window.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, - com.android.internal.R.drawable.stat_notify_sim_toolkit); + imageView.setContentDescription(StkAppService.TEXT_DEFAULT_ICON); + imageView.setImageResource(com.android.internal.R.drawable.stat_notify_sim_toolkit); } else { - window.setFeatureDrawable(Window.FEATURE_LEFT_ICON, - new BitmapDrawable(mTextMsg.icon)); + imageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND + ": " + + mTextMsg.text); + imageView.setImageBitmap(mTextMsg.icon); } /* diff --git a/src/com/android/stk/StkInputActivity.java b/src/com/android/stk/StkInputActivity.java index 618fb7b..021c832 100644 --- a/src/com/android/stk/StkInputActivity.java +++ b/src/com/android/stk/StkInputActivity.java @@ -33,6 +33,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; @@ -135,7 +136,8 @@ public class StkInputActivity extends Activity implements View.OnClickListener, CatLog.d(LOG_TAG, "onCreate - mIsResponseSent[" + mIsResponseSent + "]"); // Set the layout for this activity. - requestWindowFeature(Window.FEATURE_LEFT_ICON); + // Disable the title for Window. We will set the title later in the layout. + requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.stk_input); // Initialize members @@ -366,9 +368,11 @@ public class StkInputActivity extends Activity implements View.OnClickListener, } inTypeView.setText(inTypeId); + ImageView imageView = (ImageView) findViewById(R.id.icon); if (mStkInput.icon != null) { - setFeatureDrawable(Window.FEATURE_LEFT_ICON, new BitmapDrawable( - mStkInput.icon)); + imageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND + ": " + + mStkInput.text); + imageView.setImageBitmap(mStkInput.icon); } // Handle specific global and text attributes. diff --git a/src/com/android/stk/StkMenuActivity.java b/src/com/android/stk/StkMenuActivity.java index 2d2f004..d58daa1 100644 --- a/src/com/android/stk/StkMenuActivity.java +++ b/src/com/android/stk/StkMenuActivity.java @@ -422,6 +422,7 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex // Display title & title icon if (mStkMenu.titleIcon != null) { mTitleIconView.setImageBitmap(mStkMenu.titleIcon); + mTitleIconView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND); mTitleIconView.setVisibility(View.VISIBLE); mTitleTextView.setVisibility(View.INVISIBLE); if (!mStkMenu.titleIconSelfExplanatory) { |