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