Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
755c2f9eac
5 changed files with 45 additions and 79 deletions
|
@ -2,7 +2,9 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/list_item_height">
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_tag"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="plugin_settings">Plugins</string>
|
||||
<string name="routing_attr_avoid_shuttle_train_name">Avoid shuttle train</string>
|
||||
<string name="routing_attr_avoid_shuttle_train_description">Avoid shuttle train</string>
|
||||
<string name="traffic_warning_hazard">Hazard</string>
|
||||
|
|
|
@ -2,8 +2,5 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Preference android:key="general_settings" android:title="@string/general_settings_2" android:summary="@string/general_settings_descr"/>
|
||||
<Preference android:key="routing_settings" android:title="@string/routing_settings_2" android:summary="@string/routing_settings_descr"/>
|
||||
<Preference android:title="@string/shared_string_help" android:summary="@string/tips_and_tricks_descr" android:key="help"
|
||||
/>
|
||||
|
||||
<!-- <Preference android:title="@string/support_new_features" android:summary="@string/support_new_features_descr" android:key="bidforfix"/> -->
|
||||
<PreferenceCategory android:key="plugin_settings" android:title="@string/plugin_settings" />
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
|
@ -30,12 +29,10 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.activities.actions.ShareLocation;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -51,7 +48,6 @@ import android.content.Intent;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -674,6 +670,25 @@ public class MapActivityActions implements DialogProvider {
|
|||
return true;
|
||||
}
|
||||
}).reg();
|
||||
optionsMenuHelper.item(R.string.shared_string_help).iconColor(R.drawable.ic_action_help)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
mapActivity.startActivity(new Intent(mapActivity, HelpActivity.class));
|
||||
// FIXME show ABOUT!
|
||||
// showAboutDialog(getMyApplication());
|
||||
// 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.shared_string_release) + " : \t" + this.getString(R.string.app_edition);
|
||||
// }
|
||||
// tv.setText(vt + version + "\n" +
|
||||
// edition + "\n\n" +
|
||||
// this.getString(R.string.about_content));
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
|
||||
//////////// Others
|
||||
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -13,7 +14,9 @@ import android.graphics.Color;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
|
@ -35,8 +38,6 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
|
||||
private Preference general;
|
||||
private Preference routing;
|
||||
private Preference about;
|
||||
private Preference help;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -49,8 +50,6 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
general.setOnPreferenceClickListener(this);
|
||||
routing = (Preference) screen.findPreference("routing_settings");
|
||||
routing .setOnPreferenceClickListener(this);
|
||||
help = (Preference) screen.findPreference("help");
|
||||
help.setOnPreferenceClickListener(this);
|
||||
|
||||
getToolbar().setTitle(Version.getFullVersion(getMyApplication()));
|
||||
|
||||
|
@ -63,13 +62,24 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
startActivity(new Intent(this, SettingsNavigationActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
about = new Preference(this);
|
||||
about.setOnPreferenceClickListener(this);
|
||||
about.setSummary(R.string.about_settings_descr);
|
||||
about.setTitle(R.string.about_settings);
|
||||
about.setKey("about");
|
||||
screen.addPreference(about);
|
||||
PreferenceCategory plugins = (PreferenceCategory) screen.findPreference("plugin_settings");
|
||||
for(OsmandPlugin op : OsmandPlugin.getEnabledPlugins()) {
|
||||
final Class<? extends Activity> sa = op.getSettingsActivity();
|
||||
if(sa != null) {
|
||||
Preference preference = new Preference(this);
|
||||
preference.setTitle(op.getName());
|
||||
preference.setKey(op.getId());
|
||||
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivity(new Intent(SettingsActivity.this, sa));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
plugins.addPreference(preference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,69 +99,10 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
} else if (preference == routing) {
|
||||
startActivity(new Intent(this, SettingsNavigationActivity.class));
|
||||
return true;
|
||||
} else if (preference == help) {
|
||||
startActivity(new Intent(this, HelpActivity.class));
|
||||
return true;
|
||||
} else if (preference == about) {
|
||||
showAboutDialog(getMyApplication());
|
||||
return true;
|
||||
} else {
|
||||
super.onPreferenceClick(preference);
|
||||
}
|
||||
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 = ((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
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.shared_string_release) + " : \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.shared_string_ok, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue