Updated settings styles

This commit is contained in:
Denis 2015-01-30 16:16:00 +02:00
parent c72280f55e
commit 9a6c277457
2 changed files with 21 additions and 15 deletions

View file

@ -142,20 +142,6 @@
<item name="android:textColor">@color/color_white</item>
</style>
<style name="Widget.DarkSpinner" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">@color/actionbar_dark_color</item>
<item name="android:textColor">@color/color_white</item>
</style>
<style name="Widget.DarkActionSpinner" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">@color/actionbar_dark_color</item>
</style>
<style name="Widget.LightSpinner" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">@color/actionbar_light_color</item>
<item name="android:textColor">@color/color_white</item>
</style>
<style name="WhiteActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="android:titleTextStyle">@style/WhiteActionModeTitleTextStyle</item>
<item name="titleTextStyle">@style/WhiteActionModeTitleTextStyle</item>

View file

@ -13,7 +13,9 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.preference.*;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.TextView;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
@ -320,8 +322,9 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
s.add(a.toHumanString(getMyApplication()));
}
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this,
SpinnerAdapter spinnerAdapter = new SpinnerAdapter(this,
android.R.layout.simple_spinner_item, s);
spinnerAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
getSpinner().setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@ -343,6 +346,23 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
}
class SpinnerAdapter extends ArrayAdapter<String>{
public SpinnerAdapter(Context context, int resource, List<String> objects) {
super(context, resource, objects);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
if (!settings.isLightActionBar()){
TextView textView = (TextView) view.findViewById(android.R.id.text1);
textView.setBackgroundColor(getResources().getColor(R.color.actionbar_dark_color));
}
return view;
}
}