This commit is contained in:
Alexey Kulish 2015-12-29 11:59:52 +03:00
commit be847edb02
11 changed files with 63 additions and 28 deletions

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android" <inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="71dp"
android:insetLeft="56dp"> android:insetLeft="56dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<size android:height="1dp"/> <size android:height="1dp"/>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_list_text_size"
android:padding="8dp"
tools:text="Test text"/>

View file

@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_scrollFlags="scroll" app:layout_scrollFlags="scroll"
android:background="@color/osmand_orange"/> android:background="?attr/pstsTabBackground"/>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/viewpager" android:id="@+id/viewpager"

View file

@ -7,8 +7,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="125dp"
android:background="@color/color_dialog_buttons" android:background="@color/color_dialog_buttons_light"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:paddingRight="24dp" android:paddingRight="24dp"
@ -18,9 +18,9 @@
android:id="@+id/regionNameTextView" android:id="@+id/regionNameTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="27dp"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:layout_marginBottom="27dp"
tools:text="Flevoland"/> tools:text="Flevoland"/>
<View <View
@ -31,9 +31,9 @@
<TextView <TextView
android:id="@+id/lastMapChangeTextView" android:id="@+id/lastMapChangeTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginTop="20dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="12sp" android:textSize="12sp"
@ -42,8 +42,9 @@
<TextView <TextView
android:id="@+id/lastUpdateTextView" android:id="@+id/lastUpdateTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="12sp" android:textSize="12sp"
@ -57,12 +58,12 @@
android:layout_marginRight="24dp"> android:layout_marginRight="24dp">
<TextView <TextView
android:textColor="?android:attr/textColorPrimary"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/live_update" android:text="@string/live_update"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"/> android:textSize="16sp"/>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat
@ -80,12 +81,12 @@
android:layout_marginRight="24dp"> android:layout_marginRight="24dp">
<TextView <TextView
android:textColor="?android:attr/textColorPrimary"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/only_download_over_wifi" android:text="@string/only_download_over_wifi"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp" android:textSize="16sp"
tools:text="Only download over WiFi long text like really long"/> tools:text="Only download over WiFi long text like really long"/>
@ -105,14 +106,15 @@
android:layout_marginRight="16dp"> android:layout_marginRight="16dp">
<TextView <TextView
android:textColor="?android:attr/textColorPrimary"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/update_every" android:text="@string/update_every"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"/> android:textSize="16sp"/>
<!--style="@style/OsmandLightTheme.Spinner"-->
<Spinner <Spinner
android:id="@+id/updateFrequencySpinner" android:id="@+id/updateFrequencySpinner"
style="@style/OsmandLightTheme.Spinner" style="@style/OsmandLightTheme.Spinner"
@ -123,20 +125,20 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/updateTimesOfDayList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="54dp"
android:layout_marginLeft="24dp" android:layout_marginLeft="24dp"
android:layout_marginRight="16dp"> android:layout_marginRight="16dp">
<TextView <TextView
android:textColor="?android:attr/textColorPrimary"
android:id="@+id/updateTimesOfDayLabel"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="54dp" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/update_time" android:text="@string/update_time"
android:layout_gravity="center_vertical" android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"/> android:textSize="16sp"/>
<Spinner <Spinner
@ -156,12 +158,12 @@
android:layout_marginRight="16dp"> android:layout_marginRight="16dp">
<TextView <TextView
android:textColor="?android:attr/textColorPrimary"
android:id="@+id/sizeTextView" android:id="@+id/sizeTextView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp" android:textSize="16sp"
tools:text="Updates: 65NB"/> tools:text="Updates: 65NB"/>
@ -172,6 +174,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical" android:layout_gravity="right|center_vertical"
android:gravity="center_vertical|right" android:gravity="center_vertical|right"
android:textColor="?attr/color_dialog_buttons"
android:text="@string/shared_string_clear"/> android:text="@string/shared_string_clear"/>
</LinearLayout> </LinearLayout>
@ -179,5 +182,6 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/divider_color"/> android:layout_marginTop="24dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout> </LinearLayout>

View file

@ -4,9 +4,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:divider="@null"
android:footerDividersEnabled="false" android:footerDividersEnabled="false"
android:groupIndicator="@null" android:groupIndicator="@null"
android:headerDividersEnabled="false" android:headerDividersEnabled="false"
android:orientation="vertical" android:orientation="vertical"
tools:context=".liveupdates.LiveUpdatesFragment"/> tools:context=".liveupdates.LiveUpdatesFragment"/>
<!--android:childDivider="@drawable/live_updates_expendable_list_divider"-->

View file

@ -30,6 +30,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textColor="?android:attr/textColorPrimary"
tools:text="Live updates"/> tools:text="Live updates"/>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat

View file

@ -45,6 +45,8 @@
<attr name="divider_color" format="reference" /> <attr name="divider_color" format="reference" />
<attr name="contextMenuButtonColor" format="reference" /> <attr name="contextMenuButtonColor" format="reference" />
<attr name="color_dialog_buttons" format="color"/>
</declare-styleable> </declare-styleable>
<declare-styleable name="PagerSlidingTabStrip"> <declare-styleable name="PagerSlidingTabStrip">

View file

@ -177,7 +177,9 @@
<color name="osmand_orange_dark">#e68200</color> <color name="osmand_orange_dark">#e68200</color>
<color name="divider_color">#ccc</color> <color name="divider_color">#ccc</color>
<color name="color_dialog_buttons">#2f7af5</color> <color name="color_dialog_buttons_light">#2f7af5</color>
<color name="color_dialog_buttons_dark">#ff8800</color>
<color name="dialog_inactive_text_color_dark">#78909c</color> <color name="dialog_inactive_text_color_dark">#78909c</color>
<!-- DownloadedRegionsLayer --> <!-- DownloadedRegionsLayer -->

View file

@ -117,6 +117,7 @@
<item name="android:textColorSecondary">@color/icon_color</item> <item name="android:textColorSecondary">@color/icon_color</item>
<item name="contextMenuButtonColor">@color/map_widget_blue</item> <item name="contextMenuButtonColor">@color/map_widget_blue</item>
<item name="color_dialog_buttons">@color/color_dialog_buttons_light</item>
</style> </style>
<style name="OsmandLightTheme.NoActionbar"> <style name="OsmandLightTheme.NoActionbar">
@ -151,6 +152,7 @@
<item name="android:dropDownSelector">?android:selectableItemBackground</item> <item name="android:dropDownSelector">?android:selectableItemBackground</item>
<item name="android:divider">@null</item> <item name="android:divider">@null</item>
<item name="overlapAnchor">true</item> <item name="overlapAnchor">true</item>
<item name="android:textColorPrimary">@color/color_dialog_buttons_light</item>
</style> </style>
<style name="OsmandDarkTheme.DarkActionbar"> <style name="OsmandDarkTheme.DarkActionbar">
@ -235,6 +237,7 @@
<item name="android:textColorSecondary">@color/dash_search_icon_dark</item> <item name="android:textColorSecondary">@color/dash_search_icon_dark</item>
<item name="contextMenuButtonColor">@color/osmand_orange</item> <item name="contextMenuButtonColor">@color/osmand_orange</item>
<item name="color_dialog_buttons">@color/color_dialog_buttons_dark</item>
</style> </style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme"> <style name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

@ -41,11 +41,13 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.DEFAULT_LAST_CHECK;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
@ -343,8 +345,10 @@ public class LiveUpdatesFragment extends Fragment {
view.setLayoutParams(layoutParams); view.setLayoutParams(layoutParams);
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension); final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
String formattedDate = formatDateTime(fragment.getActivity(), timestamp); final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get();
descriptionTextView.setText(context.getString(R.string.last_update, formattedDate)); String lastCheckString = formatDateTime(fragment.getActivity(),
lastCheck != DEFAULT_LAST_CHECK ? lastCheck : timestamp);
descriptionTextView.setText(context.getString(R.string.last_update, lastCheckString));
final View.OnClickListener clickListener = new View.OnClickListener() { final View.OnClickListener clickListener = new View.OnClickListener() {
@Override @Override

View file

@ -13,6 +13,7 @@ import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.Spinner; import android.widget.Spinner;
@ -64,7 +65,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final CheckBox downloadOverWiFiCheckBox = (CheckBox) view.findViewById(R.id.downloadOverWiFiSwitch); final CheckBox downloadOverWiFiCheckBox = (CheckBox) view.findViewById(R.id.downloadOverWiFiSwitch);
final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner); final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner);
final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner); final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner);
final TextView updateTimesOfDayTextView = (TextView) view.findViewById(R.id.updateTimesOfDayLabel); final View updateTimesOfDayList = view.findViewById(R.id.updateTimesOfDayList);
final TextView sizeTextView = (TextView) view.findViewById(R.id.sizeTextView); final TextView sizeTextView = (TextView) view.findViewById(R.id.sizeTextView);
final Button removeUpdatesButton = (Button) view.findViewById(R.id.removeUpdatesButton); final Button removeUpdatesButton = (Button) view.findViewById(R.id.removeUpdatesButton);
@ -75,10 +76,10 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension); final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
String lastUpdateDate = formatDateTime(getActivity(), timestamp); String lastUpdateDate = formatDateTime(getActivity(), timestamp);
final long lastCheck = preferenceLastCheck(localIndexInfo, getSettings()).get(); final long lastCheck = preferenceLastCheck(localIndexInfo, getSettings()).get();
String lastCheckDate = formatDateTime(getActivity(), lastCheck != DEFAULT_LAST_CHECK String lastCheckString = formatDateTime(getActivity(), lastCheck != DEFAULT_LAST_CHECK
? lastCheck : timestamp); ? lastCheck : timestamp);
lastMapChangeTextView.setText(getString(R.string.last_map_change, lastUpdateDate)); lastMapChangeTextView.setText(getString(R.string.last_map_change, lastUpdateDate));
lastUpdateTextView.setText(getString(R.string.last_update, lastCheckDate)); lastUpdateTextView.setText(getString(R.string.last_update, lastCheckString));
final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference = final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference =
preferenceForLocalIndex(localIndexInfo, getSettings()); preferenceForLocalIndex(localIndexInfo, getSettings());
@ -93,6 +94,13 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
updateSize(fileNameWithoutExtension, changesManager, sizeTextView); updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
updateTimesOfDaySpinner.setAdapter(new ArrayAdapter<String>(getActivity(),
R.layout.action_spinner_item,
getResources().getStringArray(R.array.update_times_of_day)));
updateFrequencySpinner.setAdapter(new ArrayAdapter<String>(getActivity(),
R.layout.action_spinner_item,
getResources().getStringArray(R.array.update_frequencies_array)));
updateFrequencySpinner.setSelection(updateFrequencyPreference.get()); updateFrequencySpinner.setSelection(updateFrequencyPreference.get());
updateFrequencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { updateFrequencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
@ -100,13 +108,11 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
UpdateFrequency updateFrequency = UpdateFrequency.values()[position]; UpdateFrequency updateFrequency = UpdateFrequency.values()[position];
switch (updateFrequency) { switch (updateFrequency) {
case HOURLY: case HOURLY:
updateTimesOfDaySpinner.setVisibility(View.GONE); updateTimesOfDayList.setVisibility(View.GONE);
updateTimesOfDayTextView.setVisibility(View.GONE);
break; break;
case DAILY: case DAILY:
case WEEKLY: case WEEKLY:
updateTimesOfDaySpinner.setVisibility(View.VISIBLE); updateTimesOfDayList.setVisibility(View.VISIBLE);
updateTimesOfDayTextView.setVisibility(View.VISIBLE);
break; break;
} }
} }