summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanket Padawe <sanketpadawe@google.com>2017-04-19 18:30:09 -0700
committerSanket Padawe <sanketpadawe@google.com>2017-04-20 17:19:12 +0000
commit3350188abe8b3629ec4b291e3e2aab0edce17810 (patch)
tree94706ad8ac577264e4125aa383bed6e7e7beecf9
parent8436d9bf7bcfda7edb9fe5078a0e1e4a949e82f7 (diff)
downloadStk-3350188abe8b3629ec4b291e3e2aab0edce17810.tar.gz
Fix crash in stk app.
Use alertdialog recommended by Material design and remove old dialog for ToneDialog activity style. Test: manual Bug: 37198947 Change-Id: I07da028fb606b3b3af817ca26e03c344aabcd449
-rwxr-xr-xsrc/com/android/stk/ToneDialog.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java
index 834d575..fa6e9d3 100755
--- a/src/com/android/stk/ToneDialog.java
+++ b/src/com/android/stk/ToneDialog.java
@@ -17,12 +17,14 @@
package com.android.stk;
import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.view.KeyEvent;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
@@ -73,14 +75,13 @@ public class ToneDialog extends Activity {
initFromIntent(getIntent());
- // remove window title
- View title = findViewById(com.android.internal.R.id.title);
- title.setVisibility(View.GONE);
- // set customized content view
- setContentView(R.layout.stk_tone_dialog);
+ AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
+ LayoutInflater inflater = this.getLayoutInflater();
+ View dialogView = inflater.inflate(R.layout.stk_tone_dialog, null);
+ alertDialogBuilder.setView(dialogView);
- TextView tv = (TextView) findViewById(R.id.message);
- ImageView iv = (ImageView) findViewById(R.id.icon);
+ TextView tv = (TextView) dialogView.findViewById(R.id.message);
+ ImageView iv = (ImageView) dialogView.findViewById(R.id.icon);
// set text and icon
if ((null == toneMsg) || (null == toneMsg.text) || (toneMsg.text.equals(""))) {
@@ -116,6 +117,8 @@ public class ToneDialog extends Activity {
if (settings.vibrate && mVibrator != null) {
mVibrator.vibrate(timeout);
}
+
+ alertDialogBuilder.create().show();
}
@Override