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"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="71dp"
android:insetLeft="56dp">
<shape android:shape="rectangle">
<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_height="wrap_content"
app:layout_scrollFlags="scroll"
android:background="@color/osmand_orange"/>
android:background="?attr/pstsTabBackground"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"

View file

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

View file

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

View file

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

View file

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

View file

@ -177,7 +177,9 @@
<color name="osmand_orange_dark">#e68200</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>
<!-- DownloadedRegionsLayer -->

View file

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

View file

@ -41,11 +41,13 @@ import java.util.HashSet;
import java.util.List;
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.UpdateFrequency;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
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.preferenceTimeOfDayToUpdate;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
@ -343,8 +345,10 @@ public class LiveUpdatesFragment extends Fragment {
view.setLayoutParams(layoutParams);
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
String formattedDate = formatDateTime(fragment.getActivity(), timestamp);
descriptionTextView.setText(context.getString(R.string.last_update, formattedDate));
final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get();
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() {
@Override

View file

@ -13,6 +13,7 @@ import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Spinner;
@ -64,7 +65,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final CheckBox downloadOverWiFiCheckBox = (CheckBox) view.findViewById(R.id.downloadOverWiFiSwitch);
final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner);
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 Button removeUpdatesButton = (Button) view.findViewById(R.id.removeUpdatesButton);
@ -75,10 +76,10 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension);
String lastUpdateDate = formatDateTime(getActivity(), timestamp);
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);
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 =
preferenceForLocalIndex(localIndexInfo, getSettings());
@ -93,6 +94,13 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
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.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@ -100,13 +108,11 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
UpdateFrequency updateFrequency = UpdateFrequency.values()[position];
switch (updateFrequency) {
case HOURLY:
updateTimesOfDaySpinner.setVisibility(View.GONE);
updateTimesOfDayTextView.setVisibility(View.GONE);
updateTimesOfDayList.setVisibility(View.GONE);
break;
case DAILY:
case WEEKLY:
updateTimesOfDaySpinner.setVisibility(View.VISIBLE);
updateTimesOfDayTextView.setVisibility(View.VISIBLE);
updateTimesOfDayList.setVisibility(View.VISIBLE);
break;
}
}