Added action bar functionality for some menus in dashboard(not fully implemented yet)
This commit is contained in:
parent
d491e0ac0e
commit
d6524260a7
11 changed files with 98 additions and 20 deletions
8
OsmAnd/res/drawable/gradient_toolbar.xml
Normal file
8
OsmAnd/res/drawable/gradient_toolbar.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:endColor="#BB000000"
|
||||||
|
android:startColor="#00000000"
|
||||||
|
/>
|
||||||
|
</shape>
|
|
@ -10,7 +10,7 @@
|
||||||
android:id="@+id/header_layout"
|
android:id="@+id/header_layout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="@dimen/dashHeaderHeight"
|
android:layout_height="@dimen/dashHeaderHeight"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/fav_text"
|
android:id="@+id/fav_text"
|
||||||
|
@ -18,10 +18,12 @@
|
||||||
android:text="@string/osmo"
|
android:text="@string/osmo"
|
||||||
osmand:typeface="@string/font_roboto_medium" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
|
<include layout="@layout/check_item_rel"/>
|
||||||
|
|
||||||
<net.osmand.plus.widgets.ButtonEx
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
android:id="@+id/manage"
|
android:id="@+id/manage"
|
||||||
style="?attr/dashboardGeneralButtonStyle"
|
style="?attr/dashboardGeneralButtonStyle"
|
||||||
android:text="@string/shared_string_show_all"
|
android:text="@string/dash_download_manage"
|
||||||
osmand:textAllCapsCompat="true"
|
osmand:textAllCapsCompat="true"
|
||||||
osmand:typeface="@string/font_roboto_medium" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -32,7 +34,7 @@
|
||||||
android:background="?attr/dashboard_divider" />
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout android:id="@+id/card_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -49,8 +51,9 @@
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/share"
|
android:id="@+id/share"
|
||||||
style="?attr/dashboardGeneralButtonStyle"
|
android:layout_width="@dimen/dashListItemHeight"
|
||||||
android:text="@string/shared_string_show_all"/>
|
android:layout_height="@dimen/dashListItemHeight"
|
||||||
|
style="?attr/dashboardGeneralButtonStyle"/>
|
||||||
|
|
||||||
<include layout="@layout/check_item_rel"/>
|
<include layout="@layout/check_item_rel"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -68,13 +68,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fadeScrollbars="true" >
|
android:fadeScrollbars="true" >
|
||||||
</com.github.ksoichiro.android.observablescrollview.ObservableListView>
|
</com.github.ksoichiro.android.observablescrollview.ObservableListView>
|
||||||
<!--
|
|
||||||
<android.support.v7.widget.Toolbar android:id="@+id/dash_toolbar"
|
|
||||||
android:background="@color/actionbar_light_color"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
></android.support.v7.widget.Toolbar>
|
|
||||||
-->
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
@ -86,6 +79,13 @@
|
||||||
android:layout_marginTop="@dimen/map_button_margin"
|
android:layout_marginTop="@dimen/map_button_margin"
|
||||||
android:background="@drawable/btn_inset_circle"
|
android:background="@drawable/btn_inset_circle"
|
||||||
android:src="@drawable/ic_action_remove_light" />
|
android:src="@drawable/ic_action_remove_light" />
|
||||||
|
|
||||||
|
<net.osmand.plus.activities.search.toolbar.SplitToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:background="@drawable/gradient_toolbar"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="65dp"/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -49,6 +49,5 @@ public class ActionBarProgressActivity extends OsmandActionBarActivity {
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
toolbar.setVisibility(visible? View.VISIBLE : View.GONE);
|
toolbar.setVisibility(visible? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -134,6 +135,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
// Full screen is not used here
|
// Full screen is not used here
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
mapView = new OsmandMapTileView(this);
|
mapView = new OsmandMapTileView(this);
|
||||||
mapActions = new MapActivityActions(this);
|
mapActions = new MapActivityActions(this);
|
||||||
mapLayers = new MapActivityLayers(this);
|
mapLayers = new MapActivityLayers(this);
|
||||||
|
@ -141,6 +143,8 @@ public class MapActivity extends AccessibleActivity {
|
||||||
mapViewTrackingUtilities = new MapViewTrackingUtilities(app);
|
mapViewTrackingUtilities = new MapViewTrackingUtilities(app);
|
||||||
}
|
}
|
||||||
dashboardOnMap.createDashboardView();
|
dashboardOnMap.createDashboardView();
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
toolbar.setVisibility(View.GONE);
|
||||||
checkAppInitialization();
|
checkAppInitialization();
|
||||||
parseLaunchIntentLocation();
|
parseLaunchIntentLocation();
|
||||||
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener() {
|
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener() {
|
||||||
|
@ -232,7 +236,15 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Toolbar getClearToolbar(boolean visible){
|
||||||
|
return dashboardOnMap.getClearToolbar(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToolbarVisibility(boolean visible){
|
||||||
|
dashboardOnMap.setToolbarVisibility(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setupOpenGLView(boolean init) {
|
private void setupOpenGLView(boolean init) {
|
||||||
if (settings.USE_OPENGL_RENDER.get() && NativeCoreContext.isInit()) {
|
if (settings.USE_OPENGL_RENDER.get() && NativeCoreContext.isInit()) {
|
||||||
ViewStub stub = (ViewStub) findViewById(R.id.atlasMapRendererViewStub);
|
ViewStub stub = (ViewStub) findViewById(R.id.atlasMapRendererViewStub);
|
||||||
|
|
|
@ -631,6 +631,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
public void prepareConfigureMap() {
|
public void prepareConfigureMap() {
|
||||||
currentDrawer = DrawerType.CONFIGURE_MAP;
|
currentDrawer = DrawerType.CONFIGURE_MAP;
|
||||||
|
//mapActivity.getClearToolbar(true);
|
||||||
prepareOptionsMenu(new ConfigureMapMenu().createListAdapter(mapActivity, true));
|
prepareOptionsMenu(new ConfigureMapMenu().createListAdapter(mapActivity, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,13 +92,33 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
this.mapActivity = ma;
|
this.mapActivity = ma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Toolbar getClearToolbar(boolean visible) {
|
||||||
|
final Toolbar tb = (Toolbar) dashboardView.findViewById(R.id.toolbar);
|
||||||
|
if (tb == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
tb.setTitle(null);
|
||||||
|
tb.getMenu().clear();
|
||||||
|
setToolbarVisibility(visible);
|
||||||
|
return tb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToolbarVisibility(boolean visible){
|
||||||
|
int visibility = visible? View.VISIBLE : View.GONE;
|
||||||
|
View toolbar = dashboardView.findViewById(R.id.toolbar);
|
||||||
|
if (toolbar != null) {
|
||||||
|
toolbar.setVisibility(visibility);
|
||||||
|
}
|
||||||
|
View buttons = dashboardView.findViewById(R.id.map_menu_button);
|
||||||
|
if (buttons != null) {
|
||||||
|
buttons.setVisibility(visibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
actionButton.setVisibility(visibility);
|
||||||
|
}
|
||||||
|
|
||||||
public void createDashboardView() {
|
public void createDashboardView() {
|
||||||
landscape = !ScreenOrientationHelper.isOrientationPortrait(mapActivity);
|
landscape = !ScreenOrientationHelper.isOrientationPortrait(mapActivity);
|
||||||
// dashboardView = (FrameLayout) mapActivity.getLayoutInflater().inflate(R.layout.dashboard_over_map, null, false);
|
|
||||||
// dashboardView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
// ViewGroup.LayoutParams.MATCH_PARENT));
|
|
||||||
// ((FrameLayout) mapActivity.findViewById(R.id.MapHudButtonsOverlay)).addView(dashboardView);
|
|
||||||
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
||||||
View.OnClickListener listener = new View.OnClickListener() {
|
View.OnClickListener listener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
@ -129,12 +130,24 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
|
||||||
ScrollView sv = new ScrollView(this);
|
ScrollView sv = new ScrollView(this);
|
||||||
TextView tv = new TextView(this);
|
TextView tv = new TextView(this);
|
||||||
sv.addView(tv);
|
sv.addView(tv);
|
||||||
tv.setText(bs.toString());
|
final String log = bs.toString();
|
||||||
|
tv.setText(log);
|
||||||
tv.setPadding(5, 0, 5, 5);
|
tv.setPadding(5, 0, 5, 5);
|
||||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
|
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
|
||||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
bld.setView(sv);
|
bld.setView(sv);
|
||||||
bld.setPositiveButton(R.string.shared_string_ok, null);
|
bld.setNegativeButton(R.string.shared_string_ok, null);
|
||||||
|
bld.setPositiveButton(R.string.shared_string_share, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
final Intent sendIntent = new Intent();
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, log);
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(sendIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
bld.show();
|
bld.show();
|
||||||
return true;
|
return true;
|
||||||
} else if(preference == trackerId) {
|
} else if(preference == trackerId) {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*___Generated_by_IDEA___*/
|
||||||
|
|
||||||
|
package net.osmand.addressPlugin;
|
||||||
|
|
||||||
|
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
|
||||||
|
public final class BuildConfig {
|
||||||
|
public final static boolean DEBUG = Boolean.parseBoolean(null);
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*___Generated_by_IDEA___*/
|
||||||
|
|
||||||
|
package net.osmand.addressPlugin;
|
||||||
|
|
||||||
|
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
|
||||||
|
public final class Manifest {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*___Generated_by_IDEA___*/
|
||||||
|
|
||||||
|
package net.osmand.addressPlugin;
|
||||||
|
|
||||||
|
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
|
||||||
|
public final class R {
|
||||||
|
}
|
Loading…
Reference in a new issue