Move builds to drawer

This commit is contained in:
Victor Shcherb 2015-08-24 14:44:29 +03:00
parent b5d7d0e677
commit 88a6865f06
3 changed files with 30 additions and 16 deletions

View file

@ -30,10 +30,12 @@ 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;
@ -49,6 +51,7 @@ 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 +677,7 @@ public class MapActivityActions implements DialogProvider {
//////////// Others
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
// optionsMenuHelper.item(R.string.shared_string_exit).iconColor(R.drawable.ic_action_quit_dark )
// .listen(new OnContextMenuClick() {
// @Override

View file

@ -36,7 +36,6 @@ public class SettingsActivity extends SettingsBaseActivity {
private Preference general;
private Preference routing;
private Preference about;
private Preference version;
private Preference help;
@ -64,15 +63,7 @@ public class SettingsActivity extends SettingsBaseActivity {
startActivity(new Intent(this, SettingsNavigationActivity.class));
}
}
if ((Version.isDeveloperVersion(getMyApplication())) &&
OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) != null){
version = new Preference(this);
version.setOnPreferenceClickListener(this);
version.setSummary(R.string.version_settings_descr);
version.setTitle(R.string.version_settings);
version.setKey("version");
screen.addPreference(version);
}
about = new Preference(this);
about.setOnPreferenceClickListener(this);
about.setSummary(R.string.about_settings_descr);
@ -95,18 +86,15 @@ public class SettingsActivity extends SettingsBaseActivity {
if (preference == general) {
startActivity(new Intent(this, SettingsGeneralActivity.class));
return true;
} else if (preference == help) {
startActivity(new Intent(this, HelpActivity.class));
return true;
} 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 if (preference == version){
final Intent mapIntent = new Intent(this, ContributionVersionActivity.class);
this.startActivityForResult(mapIntent, 0);
} else {
super.onPreferenceClick(preference);
}

View file

@ -1,14 +1,20 @@
package net.osmand.plus.development;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.activities.ContributionVersionActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import android.app.Activity;
import android.content.Intent;
import android.widget.ArrayAdapter;
public class OsmandDevelopmentPlugin extends OsmandPlugin {
private static final String ID = "osmand.development";
@ -38,6 +44,22 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
registerWidget(activity);
}
@Override
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
if (Version.isDeveloperVersion(mapActivity.getMyApplication())) {
helper.item(R.string.version_settings).iconColor(R.drawable.ic_action_gabout_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
final Intent mapIntent = new Intent(mapActivity, ContributionVersionActivity.class);
mapActivity.startActivityForResult(mapIntent, 0);
return true;
}
}).reg();
}
}
@Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
if(isActive()) {