Design fixes
This commit is contained in:
parent
51887b97e6
commit
d6e9b1e291
5 changed files with 17 additions and 12 deletions
|
@ -127,7 +127,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/updateTimesOfDayList"
|
||||
android:id="@+id/updateTimesOfDayLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</string-array>
|
||||
<string-array name="update_times_of_day">
|
||||
<item>Morning</item>
|
||||
<item>Evening</item>
|
||||
<item>Night</item>
|
||||
</string-array>
|
||||
<string name="rendering_attr_horseRoutes_name">Horse routes</string>
|
||||
<string name="no_address_found">No address determined</string>
|
||||
|
|
|
@ -28,7 +28,7 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver {
|
|||
final OsmandSettings settings = application.getSettings();
|
||||
|
||||
if (!preferenceDownloadViaWiFi(localIndexInfo, settings).get() || wifi.isWifiEnabled()) {
|
||||
new PerformLiveUpdateAsyncTask(context, localIndexInfo).execute(fileName);
|
||||
new PerformLiveUpdateAsyncTask(context, localIndexInfo, false).execute(fileName);
|
||||
} else {
|
||||
PerformLiveUpdateAsyncTask.tryRescheduleDownload(context, settings, localIndexInfo);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,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 View updateTimesOfDayList = view.findViewById(R.id.updateTimesOfDayList);
|
||||
final View updateTimesOfDayLayout = view.findViewById(R.id.updateTimesOfDayLayout);
|
||||
final TextView sizeTextView = (TextView) view.findViewById(R.id.sizeTextView);
|
||||
// final Button removeUpdatesButton = (Button) view.findViewById(R.id.removeUpdatesButton);
|
||||
|
||||
|
@ -96,6 +96,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
updateTimesOfDaySpinner.setAdapter(new ArrayAdapter<String>(getActivity(),
|
||||
R.layout.action_spinner_item,
|
||||
getResources().getStringArray(R.array.update_times_of_day)));
|
||||
updateTimesOfDaySpinner.setSelection(timeOfDayPreference.get());
|
||||
|
||||
updateFrequencySpinner.setAdapter(new ArrayAdapter<String>(getActivity(),
|
||||
R.layout.action_spinner_item,
|
||||
|
@ -107,11 +108,11 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
UpdateFrequency updateFrequency = UpdateFrequency.values()[position];
|
||||
switch (updateFrequency) {
|
||||
case HOURLY:
|
||||
updateTimesOfDayList.setVisibility(View.GONE);
|
||||
updateTimesOfDayLayout.setVisibility(View.GONE);
|
||||
break;
|
||||
case DAILY:
|
||||
case WEEKLY:
|
||||
updateTimesOfDayList.setVisibility(View.VISIBLE);
|
||||
updateTimesOfDayLayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +127,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
// public void onClick(View v) {
|
||||
// changesManager.deleteUpdates(fileNameWithoutExtension);
|
||||
// getLiveUpdatesFragment().notifyLiveUpdatesChanged();
|
||||
// preferenceLastCheck(localIndexInfo, getSettings()).resetToDefault();
|
||||
// updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
|
||||
// }
|
||||
// });
|
||||
|
@ -137,7 +139,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
if (liveUpdatePreference.get() != liveUpdatesSwitch.isChecked()) {
|
||||
liveUpdatePreference.set(liveUpdatesSwitch.isChecked());
|
||||
if (liveUpdatesSwitch.isChecked()) {
|
||||
runLiveUpdate(localIndexInfo);
|
||||
runLiveUpdate(localIndexInfo, false);
|
||||
}
|
||||
}
|
||||
downloadViaWiFiPreference.set(downloadOverWiFiCheckBox.isChecked());
|
||||
|
@ -166,16 +168,16 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
.setNeutralButton(R.string.update_now, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
runLiveUpdate(localIndexInfo);
|
||||
runLiveUpdate(localIndexInfo, true);
|
||||
updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
void runLiveUpdate(final LocalIndexInfo info) {
|
||||
void runLiveUpdate(final LocalIndexInfo info, boolean forceUpdate) {
|
||||
final String fnExt = Algorithms.getFileNameWithoutExtension(new File(info.getFileName()));
|
||||
new PerformLiveUpdateAsyncTask(getActivity(), info).execute(new String[]{fnExt});
|
||||
new PerformLiveUpdateAsyncTask(getActivity(), info, forceUpdate).execute(new String[]{fnExt});
|
||||
}
|
||||
|
||||
private void updateSize(String fileNameWithoutExtension,
|
||||
|
|
|
@ -28,10 +28,13 @@ public class PerformLiveUpdateAsyncTask
|
|||
extends AsyncTask<String, Object, IncrementalChangesManager.IncrementalUpdateList> {
|
||||
private final Context context;
|
||||
private final LocalIndexInfo localIndexInfo;
|
||||
private final boolean forceUpdate;
|
||||
|
||||
public PerformLiveUpdateAsyncTask(Context context, LocalIndexInfo localIndexInfo) {
|
||||
public PerformLiveUpdateAsyncTask(Context context, LocalIndexInfo localIndexInfo,
|
||||
boolean forceUpdate) {
|
||||
this.context = context;
|
||||
this.localIndexInfo = localIndexInfo;
|
||||
this.forceUpdate = forceUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,7 +92,7 @@ public class PerformLiveUpdateAsyncTask
|
|||
boolean downloadViaWiFi =
|
||||
LiveUpdatesHelper.preferenceDownloadViaWiFi(localIndexInfo, settings).get();
|
||||
if (getMyApplication().getSettings().isInternetConnectionAvailable()) {
|
||||
if (settings.isWifiConnected() || !downloadViaWiFi) {
|
||||
if (forceUpdate || settings.isWifiConnected() || !downloadViaWiFi) {
|
||||
long szLong = 0;
|
||||
int i = 0;
|
||||
for (IndexItem es : downloadThread.getCurrentDownloadingItems()) {
|
||||
|
|
Loading…
Reference in a new issue