Design for dialog fix.
This commit is contained in:
parent
f65de68c68
commit
eeb2ee6345
4 changed files with 28 additions and 13 deletions
|
@ -7,12 +7,12 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="125dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/color_dialog_buttons"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="24dp">
|
||||
android:paddingTop="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/regionNameTextView"
|
||||
|
@ -20,6 +20,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="@color/color_white"
|
||||
android:layout_marginBottom="27dp"
|
||||
tools:text="Flevoland"/>
|
||||
|
||||
<View
|
||||
|
@ -30,7 +31,8 @@
|
|||
<TextView
|
||||
android:id="@+id/lastMapChangeTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_white"
|
||||
|
@ -55,6 +57,7 @@
|
|||
android:layout_marginRight="24dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -77,6 +80,7 @@
|
|||
android:layout_marginRight="24dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -101,6 +105,7 @@
|
|||
android:layout_marginRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
@ -124,6 +129,7 @@
|
|||
android:layout_marginRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:id="@+id/updateTimesOfDayLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="54dp"
|
||||
|
@ -150,6 +156,7 @@
|
|||
android:layout_marginRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:id="@+id/sizeTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -39,10 +39,12 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
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.preferenceLiveUpdatesOn;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
|
||||
|
||||
public class LiveUpdatesFragment extends Fragment {
|
||||
|
@ -68,12 +70,12 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||
// View header = inflater.inflate(R.layout.live_updates_header, listView, false);
|
||||
|
||||
adapter = new LocalIndexesAdapter(this);
|
||||
listView.setAdapter(adapter);
|
||||
View topShadowView = inflater.inflate(R.layout.shadow_top, listView, false);
|
||||
listView.addHeaderView(topShadowView);
|
||||
View bottomShadowView = inflater.inflate(R.layout.shadow_bottom, listView, false);
|
||||
listView.addFooterView(bottomShadowView);
|
||||
adapter = new LocalIndexesAdapter(this);
|
||||
listView.setAdapter(adapter);
|
||||
new LoadLocalIndexTask(adapter, this).execute();
|
||||
return view;
|
||||
}
|
||||
|
@ -306,9 +308,15 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
AbsListView.LayoutParams layoutParams = (AbsListView.LayoutParams) view.getLayoutParams();
|
||||
if (shouldUpdatePreference.get()) {
|
||||
final Integer frequencyId = preferenceUpdateFrequency(item, fragment.getSettings()).get();
|
||||
final Integer timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(item, fragment.getSettings()).get();
|
||||
final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId];
|
||||
final TimeOfDay timeOfDay = TimeOfDay.values()[timeOfDateToUpdateId];
|
||||
subheaderTextView.setVisibility(View.VISIBLE);
|
||||
subheaderTextView.setText(frequency.toString());
|
||||
String subheaderText = frequency.toString();
|
||||
if (frequency != UpdateFrequency.HOURLY) {
|
||||
subheaderText += " • " + timeOfDay.toString();
|
||||
}
|
||||
subheaderTextView.setText(subheaderText);
|
||||
subheaderTextView.setTextColor(fragment.getActivity().getResources()
|
||||
.getColor(R.color.osmand_orange));
|
||||
icon.setImageDrawable(context.getIconsCache().getIcon(R.drawable.ic_map, R.color.osmand_orange));
|
||||
|
|
|
@ -42,7 +42,7 @@ public class LiveUpdatesHelper {
|
|||
public static OsmandSettings.CommonPreference<Integer> preferenceTimeOfDayToUpdate(
|
||||
LocalIndexInfo item, OsmandSettings settings) {
|
||||
final String settingId = item.getFileName() + TIME_OF_DAY_TO_UPDATE_POSTFIX;
|
||||
return settings.registerIntPreference(settingId, TimesOfDay.NIGHT.ordinal());
|
||||
return settings.registerIntPreference(settingId, TimeOfDay.NIGHT.ordinal());
|
||||
}
|
||||
|
||||
public static OsmandSettings.CommonPreference<Long> preferenceLastCheck(
|
||||
|
@ -64,7 +64,7 @@ public class LiveUpdatesHelper {
|
|||
return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime);
|
||||
}
|
||||
|
||||
public static enum TimesOfDay {
|
||||
public static enum TimeOfDay {
|
||||
MORNING,
|
||||
NIGHT
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.commons.logging.Log;
|
|||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimesOfDay;
|
||||
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;
|
||||
|
@ -146,7 +146,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
|
||||
final int timeOfDayInt = updateTimesOfDaySpinner.getSelectedItemPosition();
|
||||
timeOfDayPreference.set(timeOfDayInt);
|
||||
TimesOfDay timeOfDayToUpdate = TimesOfDay.values()[timeOfDayInt];
|
||||
TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayInt];
|
||||
long timeOfFirstUpdate;
|
||||
long updateInterval;
|
||||
switch (updateFrequency) {
|
||||
|
@ -207,12 +207,12 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
sizeTextView.setText(getString(R.string.updates_size_pattern, size));
|
||||
}
|
||||
|
||||
private long getNextUpdateTime(TimesOfDay timeOfDayToUpdate) {
|
||||
private long getNextUpdateTime(TimeOfDay timeOfDayToUpdate) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
if (timeOfDayToUpdate == TimesOfDay.MORNING) {
|
||||
if (timeOfDayToUpdate == TimeOfDay.MORNING) {
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, MORNING_UPDATE_TIME);
|
||||
} else if (timeOfDayToUpdate == TimesOfDay.NIGHT) {
|
||||
} else if (timeOfDayToUpdate == TimeOfDay.NIGHT) {
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, NIGHT_UPDATE_TIME);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue