Merge branch 'materialize-category-filter' into 'master'
Make category filter look Material Get rid of Gingerbred legacy. Before and after (note the glitch below the spinner):   See merge request !159
This commit is contained in:
commit
b4560fc217
@ -8,14 +8,21 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/category_spinner"
|
android:id="@+id/category_spinner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
</Spinner>
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:background="@color/fdroid_green" />
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:fastScrollEnabled="true"
|
android:fastScrollEnabled="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent" />
|
||||||
</ListView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -6,9 +6,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -122,29 +120,6 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
return translatedCategories;
|
return translatedCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* With holo, the menu gets lost since it looks the same as an app list item.
|
|
||||||
* Suppress deprecation warnings because:
|
|
||||||
* * setBackgroundDrawable(Drawable) -> setBackground(Drawable) was only in API 16
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void styleSpinner(Spinner spinner) {
|
|
||||||
|
|
||||||
Drawable menuButton = getResources().getDrawable(android.R.drawable.btn_dropdown);
|
|
||||||
switch (FDroidApp.getCurTheme()) {
|
|
||||||
case dark:
|
|
||||||
// fallthrough
|
|
||||||
case night:
|
|
||||||
menuButton.setAlpha(32); // make it darker via alpha
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= 16) {
|
|
||||||
spinner.setBackground(menuButton);
|
|
||||||
} else {
|
|
||||||
spinner.setBackgroundDrawable(menuButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Spinner setupCategorySpinner(Spinner spinner) {
|
private Spinner setupCategorySpinner(Spinner spinner) {
|
||||||
|
|
||||||
categorySpinner = spinner;
|
categorySpinner = spinner;
|
||||||
@ -152,8 +127,6 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
|
|
||||||
categories = AppProvider.Helper.categories(getActivity());
|
categories = AppProvider.Helper.categories(getActivity());
|
||||||
|
|
||||||
styleSpinner(categorySpinner);
|
|
||||||
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
||||||
getActivity(), android.R.layout.simple_spinner_item, translateCategories(categories));
|
getActivity(), android.R.layout.simple_spinner_item, translateCategories(categories));
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user