Change dialog appearance, smaller (wraps content)

This commit is contained in:
Matthew Wong 2015-07-28 11:48:42 -04:00
parent 690155391c
commit 485b621b04
2 changed files with 12 additions and 25 deletions

View file

@ -5,6 +5,7 @@ import android.app.PendingIntent;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
@ -14,11 +15,9 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.zeapo.pwdstore.utils.PasswordItem; import com.zeapo.pwdstore.utils.PasswordItem;
@ -96,24 +95,24 @@ public class AutofillService extends AccessibilityService {
} }
if (dialog == null) { if (dialog == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Theme_AppCompat_Light_Dialog_Alert); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Theme_AppCompat_Dialog);
builder.setNegativeButton("Cancel", null); builder.setNegativeButton("Cancel", null);
builder.setView(R.layout.autofill_layout); builder.setPositiveButton("Fill", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
decryptAndVerify();
}
});
dialog = builder.create(); dialog = builder.create();
dialog.setTitle("Fill with Password Store"); dialog.setIcon(R.drawable.ic_launcher);
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
} }
dialog.setTitle(items.get(0).getName());
dialog.show(); dialog.show();
((Button) dialog.findViewById(R.id.button)).setText(items.get(0).getName()); dialog.getWindow().setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
dialog.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
decryptAndVerify();
dialog.dismiss();
}
});
} }
private ArrayList<PasswordItem> recursiveFilter(String filter, File dir) { private ArrayList<PasswordItem> recursiveFilter(String filter, File dir) {

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:layout_gravity="center"/>
</LinearLayout>