Change AppPicker theme from dialog to full screen

AppPicker used in devceloper options, it will show apps list with
package name in a dialog.
But sometimes it will mis-alignment with package name.
So we change theme from dialog to full screen and set widget_frame
visibility to GONE.

Bug: 151150544
Test: manual
Change-Id: I8f04ab7967288801e5e13ecccf037d6ed09ec71c
This commit is contained in:
Edgar Wang
2020-05-05 06:19:14 +08:00
parent 1e0789355e
commit 3c03f0a8a8
3 changed files with 24 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@@ -54,6 +55,7 @@ public class AppPicker extends ListActivity {
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getActionBar().setDisplayHomeAsUpEnabled(true);
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
@@ -67,6 +69,15 @@ public class AppPicker extends ListActivity {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
handleBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
MyApplicationInfo app = mAdapter.getItem(position);
@@ -76,6 +87,15 @@ public class AppPicker extends ListActivity {
finish();
}
private void handleBackPressed() {
if (getFragmentManager().getBackStackEntryCount() > 1) {
super.onBackPressed();
} else {
setResult(RESULT_CANCELED);
finish();
}
}
class MyApplicationInfo {
ApplicationInfo info;
CharSequence label;
@@ -162,6 +182,7 @@ public class AppPicker extends ListActivity {
holder.summary.setText("");
}
holder.disabled.setVisibility(View.GONE);
holder.widget.setVisibility(View.GONE);
return convertView;
}
}