summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWileen Chiu <wileenc@codeaurora.org>2016-05-26 10:35:43 -0700
committerLinux Build Service Account <lnxbuild@localhost>2016-08-24 08:17:55 -0600
commitc31c57b747f791d7e397d33211ffa95f27bf1365 (patch)
tree45c24fbf11c2335c66f328bf698c63655dbbc31c
parent1b858b07ab8d3bd757eca265acceb587247987fa (diff)
downloadandroid_packages_apps_Stk-c31c57b747f791d7e397d33211ffa95f27bf1365.tar.gz
android_packages_apps_Stk-c31c57b747f791d7e397d33211ffa95f27bf1365.tar.bz2
android_packages_apps_Stk-c31c57b747f791d7e397d33211ffa95f27bf1365.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 CRs-Fixed: 823505 Add content information to the stk menu item's icon. Add appropriate content description to the icon displayed along with the Stk menu item. Change-Id: Ic03422e261b896eff4c3d8783194b592bacc444a CRs-Fixed: 917936 Change-Id: Ib9eeea7169f1f66bbb9bc1ec3081927ae998b3a2
-rw-r--r--res/layout/stk_input.xml46
-rwxr-xr-xsrc/com/android/stk/StkAppService.java5
-rw-r--r--src/com/android/stk/StkDialogActivity.java10
-rw-r--r--src/com/android/stk/StkInputActivity.java10
-rw-r--r--src/com/android/stk/StkMenuActivity.java1
-rw-r--r--src/com/android/stk/StkMenuAdapter.java2
6 files changed, 54 insertions, 20 deletions
diff --git a/res/layout/stk_input.xml b/res/layout/stk_input.xml
index 9c3807e..009b8e0 100644
--- a/res/layout/stk_input.xml
+++ b/res/layout/stk_input.xml
@@ -13,24 +13,39 @@
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: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="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:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="20dip"
- android:layout_gravity="center_horizontal">
- <TextView
- android:id="@+id/prompt"
+ android:layoutDirection="locale"
+ android:layout_height="wrap_content">
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textStyle="bold"
- android:gravity="center_horizontal"
- android:paddingBottom="30dip" />
+ 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:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -96,5 +111,6 @@
android:text="@string/button_no" />
</LinearLayout>
</LinearLayout>
- </LinearLayout>
-</ScrollView>
+ </LinearLayout>
+ </ScrollView>
+</LinearLayout>
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 99edae3..d410669 100755
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -281,6 +281,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()+");
@@ -1520,6 +1524,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..9cd44ef 100644
--- a/src/com/android/stk/StkDialogActivity.java
+++ b/src/com/android/stk/StkDialogActivity.java
@@ -140,8 +140,14 @@ public class StkDialogActivity extends Activity implements View.OnClickListener
setTitle(mTextMsg.title);
- if (!(mTextMsg.iconSelfExplanatory && mTextMsg.icon != null)) {
- mMessageView.setText(mTextMsg.text);
+ if (mTextMsg.icon != null) {
+ if (mTextMsg.iconSelfExplanatory) {
+ mMessageView.setText(mTextMsg.text);
+ }
+ mMessageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND + ": "
+ + mTextMsg.text);
+ } else {
+ mMessageView.setContentDescription(StkAppService.TEXT_DEFAULT_ICON);
}
if (mTextMsg.icon == null) {
diff --git a/src/com/android/stk/StkInputActivity.java b/src/com/android/stk/StkInputActivity.java
index 3152efd..e8d6a4d 100644
--- a/src/com/android/stk/StkInputActivity.java
+++ b/src/com/android/stk/StkInputActivity.java
@@ -34,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;
@@ -136,7 +137,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
@@ -367,9 +369,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) {
diff --git a/src/com/android/stk/StkMenuAdapter.java b/src/com/android/stk/StkMenuAdapter.java
index c53b3ac..4398280 100644
--- a/src/com/android/stk/StkMenuAdapter.java
+++ b/src/com/android/stk/StkMenuAdapter.java
@@ -60,6 +60,8 @@ public class StkMenuAdapter extends ArrayAdapter<Item> {
} else {
imageView.setImageBitmap(item.icon);
imageView.setVisibility(View.VISIBLE);
+ // Add content description for the icon.
+ imageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND);
}
return convertView;