Fixes
This commit is contained in:
parent
9824d5c631
commit
f3dbfcd64f
6 changed files with 94 additions and 42 deletions
|
@ -96,6 +96,10 @@
|
|||
<item name="windowActionBarOverlay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="SpinnerItemLight" parent="@android:style/Widget.TextView.SpinnerItem">
|
||||
<item name="android:textColor">#FFFFFF</item>
|
||||
</style>
|
||||
|
||||
<style name="SettingsLightTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
|
||||
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
|
||||
|
@ -124,9 +128,11 @@
|
|||
<item name="bottomToolBarColor">@color/tool_bar_color_light</item>
|
||||
<item name="downloadButtonBackground">@drawable/download_light</item>
|
||||
<item name="pstsTabBackground">@color/actionbar_light_color</item>
|
||||
|
||||
<item name="pstsUnderlineColor">@color/actionbar_light_color</item>
|
||||
<item name="pstsIndicatorColor">@color/color_white</item>
|
||||
<item name="pstsTextColor">@color/color_white</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:actionModeBackground">@color/actionbar_light_color</item>
|
||||
<item name="actionModeBackground">@color/actionbar_light_color</item>
|
||||
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
|
||||
|
@ -202,6 +208,7 @@
|
|||
<style name="Widget.Styled.ActionBarLight" parent="Widget.AppCompat.Light.ActionBar.Solid">
|
||||
<item name="background">@color/actionbar_light_color</item>
|
||||
<item name="android:background">@color/actionbar_light_color</item>
|
||||
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItemLight</item>
|
||||
<item name="android:titleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
|
||||
<item name="titleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
|
||||
<item name="android:subtitleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
|
||||
|
|
|
@ -18,11 +18,11 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
|
||||
public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
|
||||
private Toolbar toolbar;
|
||||
private Toolbar tb;
|
||||
private View shadowView;
|
||||
|
||||
public Toolbar getToolbar() {
|
||||
return toolbar;
|
||||
return tb;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -39,20 +39,20 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
|
|||
setTheme(t);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.preference_activity);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
tb = (Toolbar) findViewById(R.id.toolbar);
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
shadowView = findViewById(R.id.shadowView);
|
||||
final ViewGroup parent = (ViewGroup) shadowView.getParent();
|
||||
parent.removeView(shadowView);
|
||||
shadowView = null;
|
||||
}
|
||||
toolbar.setClickable(true);
|
||||
tb.setClickable(true);
|
||||
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
|
||||
toolbar.setNavigationIcon(back);
|
||||
toolbar.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
toolbar.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
tb.setNavigationIcon(back);
|
||||
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
tb.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));
|
||||
tb.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
finish();
|
||||
|
@ -63,7 +63,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
|
|||
setProgressVisibility(false);
|
||||
}
|
||||
|
||||
private static int getResIdFromAttribute(final Activity activity, final int attr) {
|
||||
static int getResIdFromAttribute(final Activity activity, final int attr) {
|
||||
if (attr == 0)
|
||||
return 0;
|
||||
final TypedValue typedvalueattr = new TypedValue();
|
||||
|
@ -73,7 +73,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
|
|||
|
||||
protected void setEnabledActionBarShadow(final boolean enable) {
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
ViewCompat.setElevation(toolbar, enable ? 4 : 0);
|
||||
ViewCompat.setElevation(tb, enable ? 4 : 0);
|
||||
} else {
|
||||
if (shadowView == null)
|
||||
shadowView = findViewById(R.id.shadowView);
|
||||
|
|
|
@ -330,6 +330,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
favouritesAdapter.setFilterResults(null);
|
||||
favouritesAdapter.synchronizeGroups();
|
||||
favouritesAdapter.notifyDataSetChanged();
|
||||
hideProgressBar();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -238,34 +238,6 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
}
|
||||
}
|
||||
|
||||
public static void showAboutDialog(final Activity activity, final OsmandApplication app) {
|
||||
Builder bld = new AlertDialog.Builder(activity);
|
||||
bld.setTitle(R.string.about_settings);
|
||||
ScrollView sv = new ScrollView(activity);
|
||||
TextView tv = new TextView(activity);
|
||||
sv.addView(tv);
|
||||
String version = Version.getFullVersion(app);
|
||||
String vt = activity.getString(R.string.about_version) + "\t";
|
||||
int st = vt.length();
|
||||
String edition = "";
|
||||
if (!activity.getString(R.string.app_edition).equals("")) {
|
||||
edition = activity.getString(R.string.local_index_installed) + " : \t" + activity.getString(R.string.app_edition);
|
||||
}
|
||||
SharedPreferences prefs = app.getSharedPreferences("net.osmand.settings", MODE_WORLD_READABLE);
|
||||
|
||||
tv.setText(vt + version + "\n" +
|
||||
edition + "\n\n" +
|
||||
activity.getString(R.string.about_content));
|
||||
|
||||
tv.setPadding(5, 0, 5, 5);
|
||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
bld.setView(sv);
|
||||
bld.setPositiveButton(R.string.default_buttons_ok, null);
|
||||
bld.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected boolean initApp(final Activity activity, OsmandApplication app) {
|
||||
final OsmAndAppCustomization appCustomization = app.getAppCustomization();
|
||||
|
|
|
@ -7,12 +7,31 @@ import net.osmand.IndexConstants;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceScreen;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SettingsActivity extends SettingsBaseActivity {
|
||||
|
||||
|
@ -108,7 +127,7 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
startActivity(new Intent(this, SettingsNavigationActivity.class));
|
||||
return true;
|
||||
} else if (preference == about) {
|
||||
MainMenuActivity.showAboutDialog(this, getMyApplication());
|
||||
showAboutDialog(getMyApplication());
|
||||
return true;
|
||||
} else if (preference == plugins) {
|
||||
startActivityForResult(new Intent(this, getMyApplication().getAppCustomization().getPluginsActivity()), PLUGINS_SELECTION_REQUEST);
|
||||
|
@ -122,6 +141,58 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void showAboutDialog(final OsmandApplication app) {
|
||||
final Dialog dialog = new Dialog(this,
|
||||
app.getSettings().isLightContent() ?
|
||||
R.style.OsmandLightTheme:
|
||||
R.style.OsmandDarkTheme);
|
||||
LinearLayout ll = new LinearLayout(this);
|
||||
ll.setOrientation(LinearLayout.VERTICAL);
|
||||
Toolbar tb = new Toolbar(this);
|
||||
tb.setClickable(true);
|
||||
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
|
||||
tb.setNavigationIcon(back);
|
||||
tb.setTitle(R.string.about_settings);
|
||||
tb.setBackgroundColor(getResources().getColor( getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
tb.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));
|
||||
tb.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
ScrollView sv = new ScrollView(this);
|
||||
TextView tv = new TextView(this);
|
||||
sv.addView(tv);
|
||||
String version = Version.getFullVersion(app);
|
||||
String vt = this.getString(R.string.about_version) + "\t";
|
||||
String edition = "";
|
||||
if (!this.getString(R.string.app_edition).equals("")) {
|
||||
edition = this.getString(R.string.local_index_installed) + " : \t" + this.getString(R.string.app_edition);
|
||||
}
|
||||
tv.setText(vt + version + "\n" +
|
||||
edition + "\n\n" +
|
||||
this.getString(R.string.about_content));
|
||||
|
||||
DisplayMetrics m = new DisplayMetrics();
|
||||
|
||||
WindowManager mgr = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
mgr.getDefaultDisplay().getMetrics(m);
|
||||
int dp = (int) (5 * m.density);
|
||||
tv.setPadding(3 * dp , dp, 3 * dp, dp);
|
||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
|
||||
if(app.getSettings().isLightContent() ) {
|
||||
tv.setTextColor(Color.BLACK);
|
||||
}
|
||||
// tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
ll.addView(tb);
|
||||
ll.addView(sv);
|
||||
dialog.setContentView(ll);
|
||||
dialog.show();
|
||||
// bld.setPositiveButton(R.string.default_buttons_ok, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
|
@ -135,7 +136,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
|||
final List<DownloadActivityType> downloadTypes = getDownloadActivity().getDownloadTypes();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_spinner_item,
|
||||
toString(downloadTypes));
|
||||
toString(downloadTypes)) ;
|
||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
actionBar.setListNavigationCallbacks(spinnerAdapter, new ActionBar.OnNavigationListener() {
|
||||
|
||||
|
|
Loading…
Reference in a new issue