Made category Spinner style correctly.
Signed-off-by: Nico Alt <nicoalt@posteo.org>
This commit is contained in:
parent
03c5a224de
commit
d94e8a4ad2
21
F-Droid/res/layout/available_app_list.xml
Normal file
21
F-Droid/res/layout/available_app_list.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/category_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</Spinner>
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:fastScrollEnabled="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
@ -18,6 +18,7 @@
|
||||
android:text="@string/swap_start"
|
||||
style="@style/SwapTheme.StartSwap.StartButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/text_description"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item type="id" name="categorySpinner" />
|
||||
<item type="id" name="category_spinner" />
|
||||
<item type="id" name="appDetailsSummaryHeader" />
|
||||
</resources>
|
@ -17,7 +17,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
@ -124,28 +123,25 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void styleSpinner(Spinner spinner) {
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
Drawable menuButton = getResources().getDrawable(android.R.drawable.btn_dropdown);
|
||||
if (FDroidApp.getCurTheme() == FDroidApp.Theme.dark) {
|
||||
menuButton.setAlpha(32); // make it darker via alpha
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
spinner.setBackground(menuButton);
|
||||
} else {
|
||||
spinner.setBackgroundDrawable(menuButton);
|
||||
}
|
||||
|
||||
Drawable menuButton = getResources().getDrawable(android.R.drawable.btn_dropdown);
|
||||
if (FDroidApp.getCurTheme() == FDroidApp.Theme.dark) {
|
||||
menuButton.setAlpha(32); // make it darker via alpha
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
spinner.setBackground(menuButton);
|
||||
} else {
|
||||
spinner.setBackgroundDrawable(menuButton);
|
||||
}
|
||||
}
|
||||
|
||||
private Spinner createCategorySpinner() {
|
||||
private Spinner setupCategorySpinner(Spinner spinner) {
|
||||
|
||||
categorySpinner = spinner;
|
||||
categorySpinner.setId(R.id.category_spinner);
|
||||
|
||||
categories = AppProvider.Helper.categories(getActivity());
|
||||
|
||||
categorySpinner = new Spinner(getActivity());
|
||||
|
||||
// Giving it an ID lets the default save/restore state functionality do its stuff.
|
||||
categorySpinner.setId(R.id.categorySpinner);
|
||||
|
||||
styleSpinner(categorySpinner);
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
||||
@ -173,24 +169,11 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
LinearLayout view = new LinearLayout(getActivity());
|
||||
view.setOrientation(LinearLayout.VERTICAL);
|
||||
View view = inflater.inflate(R.layout.available_app_list, container, false);
|
||||
|
||||
view.addView(
|
||||
createCategorySpinner(),
|
||||
new ViewGroup.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
setupCategorySpinner((Spinner)view.findViewById(R.id.category_spinner));
|
||||
|
||||
ListView list = new ListView(getActivity());
|
||||
list.setId(android.R.id.list);
|
||||
list.setFastScrollEnabled(true);
|
||||
list.setOnItemClickListener(this);
|
||||
view.addView(
|
||||
list,
|
||||
new ViewGroup.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
((ListView)view.findViewById(android.R.id.list)).setOnItemClickListener(this);
|
||||
|
||||
// R.string.category_whatsnew is the default set in AppListManager
|
||||
DEFAULT_CATEGORY = getActivity().getString(R.string.category_whatsnew);
|
||||
|
Loading…
x
Reference in New Issue
Block a user