certs: ditch selection spinner from certs view

This commit is contained in:
Vincent Breitmoser 2014-04-06 01:57:28 +02:00
parent 84857df703
commit 120e1eada7
2 changed files with 1 additions and 50 deletions

View File

@ -71,8 +71,6 @@ public class ViewKeyCertsFragment extends Fragment
public static final String ARG_DATA_URI = "data_uri";
private StickyListHeadersListView mStickyList;
private Spinner mSpinner;
private CertListAdapter mAdapter;
private Uri mDataUri;
@ -84,46 +82,10 @@ public class ViewKeyCertsFragment extends Fragment
return view;
}
private void changeShowState(int type) {
switch(type) {
case 0:
mDataUri = mBaseUri.buildUpon().appendPath("has_secret").build();
break;
case 1:
mDataUri = mBaseUri;
break;
case 2:
mDataUri = mBaseUri.buildUpon().appendPath("all").build();
break;
}
getLoaderManager().restartLoader(0, null, this);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mSpinner = (Spinner) getActivity().findViewById(R.id.spinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_spinner_item, new String[] {
getResources().getString(R.string.certs_list_known_secret),
getResources().getString(R.string.certs_list_known),
getResources().getString(R.string.certs_list_all)
} );
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinner.setAdapter(adapter);
mSpinner.setSelection(1);
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
changeShowState(i);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
mStickyList = (StickyListHeadersListView) getActivity().findViewById(R.id.list);
if (!getArguments().containsKey(ARG_DATA_URI)) {

View File

@ -1,5 +1,4 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -9,16 +8,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinner"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp" />
<view
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -28,7 +17,7 @@
android:paddingLeft="16dp"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_below="@+id/spinner" />
android:layout_below="@+id/list" />
<TextView
android:layout_width="wrap_content"