Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-16 16:52:27 +01:00
commit a86fd98c1e
6 changed files with 120 additions and 7 deletions

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/main_fav"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dash_margin"
android:layout_marginLeft="@dimen/dash_margin_h"
android:layout_marginRight="@dimen/dash_margin_h"
android:layout_marginTop="@dimen/dash_margin"
android:background="?attr/bg_card"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="8dp"
android:text="@string/dashboard_or_drawer_title"
android:textColor="?android:textColorPrimary"
android:textSize="20sp"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:id="@+id/subheader"
style="@style/DashboardSubHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/list_content_padding"
android:text="@string/dashboard_or_drawer_description"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:gravity="right"
android:orientation="horizontal">
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/useDashboardButton"
style="@style/DashboardGeneralButton"
android:text="@string/use_dashboard"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/useDrawerButton"
style="@style/DashboardGeneralButton"
android:text="@string/use_drawer"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
</LinearLayout>

View file

@ -2086,5 +2086,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="map_legend">Map legend</string>
<string name="save_poi_without_poi_type_message">Do you really want to save poi without POI type?</string>
<string name="poi_context_menu_modify_osm_change">Modify OSM change</string>
<string name="use_dashboard">Use dashboard</string>
<string name="use_drawer">Use drawer</string>
<string name="dashboard_or_drawer_title">New menu</string>
<string name="dashboard_or_drawer_description">You can choose what to use, Dashboard or Drawer menu. You can change this later in settings.</string>
<!-- string name="map_legend_item_description">Legend for OsmAnd default map style, Internet connectivity needed to display</string -->
</resources>

View file

@ -635,9 +635,9 @@ public class OsmandSettings {
}
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", true).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", true).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", true).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache();

View file

@ -0,0 +1,55 @@
package net.osmand.plus.dashboard;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
public class DashDashboardOrDrawerFragment extends DashBaseFragment {
public static final String TAG = "DASH_DASHBOARD_OR_DRAWER_FRAGMENT";
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashFragmentData.ShouldShowFunction() {
// If settings null. No changes in setting will be made.
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return settings.SHOW_CARD_TO_CHOOSE_DRAWER.get();
}
};
private DismissListener dismissCallback;
@Override
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_dashboard_or_drawer_fragment, container, false);
view.findViewById(R.id.useDashboardButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final OsmandSettings settings = getMyApplication().getSettings();
settings.SHOW_DASHBOARD_ON_START.set(true);
settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(true);
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
dashboard.hideFragmentByTag(TAG);
}
});
view.findViewById(R.id.useDrawerButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final OsmandSettings settings = getMyApplication().getSettings();
settings.SHOW_DASHBOARD_ON_START.set(false);
settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(false);
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
dashboard.hideFragmentByTag(TAG);
}
});
return view;
}
@Override
public void onOpenDash() {
}
}

View file

@ -30,10 +30,6 @@ import net.osmand.plus.helpers.FontCache;
import java.io.File;
import java.text.MessageFormat;
/**
* Created by Denis
* on 02.12.14.
*/
public class DashErrorFragment extends DashBaseFragment {
public static final String TAG = "DASH_ERROR_FRAGMENT";

View file

@ -75,6 +75,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
DashRateUsFragment.SHOULD_SHOW_FUNCTION, 0, null),
new DashFragmentData(DashDashboardOrDrawerFragment.TAG, DashDashboardOrDrawerFragment.class,
DashDashboardOrDrawerFragment.SHOULD_SHOW_FUNCTION, 5, null),
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
DashErrorFragment.SHOULD_SHOW_FUNCTION, 30, null),
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,