Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f45642c997
5 changed files with 34 additions and 5 deletions
|
@ -2133,5 +2133,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="last_update">Last update: %s</string>
|
||||
<string name="update_date_pattern">"Update: %s"</string>
|
||||
<string name="update_time">Update time</string>
|
||||
<string name="size_pattern">"Size: %s"</string>
|
||||
<string name="updates_size_pattern">"Updates: %s"</string>
|
||||
</resources>
|
|
@ -8,10 +8,17 @@ import android.support.v4.app.FragmentPagerAdapter;
|
|||
import android.support.v4.view.ViewPager;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
|
||||
public class LiveUpdatesActivity extends AbstractDownloadActivity {
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class LiveUpdatesActivity extends AbstractDownloadActivity
|
||||
implements DownloadIndexesThread.DownloadEvents{
|
||||
private final static Log LOG = PlatformUtil.getLog(LiveUpdatesActivity.class);
|
||||
private LiveUpdatesFragmentPagerAdapter pagerAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -20,8 +27,7 @@ public class LiveUpdatesActivity extends AbstractDownloadActivity {
|
|||
setContentView(R.layout.activity_livie_updates);
|
||||
|
||||
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||
final LiveUpdatesFragmentPagerAdapter pagerAdapter =
|
||||
new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager());
|
||||
pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager());
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
final TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
||||
|
@ -40,6 +46,21 @@ public class LiveUpdatesActivity extends AbstractDownloadActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadInProgress() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadHasFinished() {
|
||||
((LiveUpdatesFragment) pagerAdapter.fragments[0]).notifyLiveUpdatesChanged();
|
||||
}
|
||||
|
||||
public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter {
|
||||
private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment()};
|
||||
private final String[] titles = new String[]{LiveUpdatesFragment.TITILE};
|
||||
|
|
|
@ -307,6 +307,7 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
if (shouldUpdatePreference.get()) {
|
||||
final Integer frequencyId = preferenceUpdateFrequency(item, fragment.getSettings()).get();
|
||||
final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId];
|
||||
subheaderTextView.setVisibility(View.VISIBLE);
|
||||
subheaderTextView.setText(frequency.toString());
|
||||
subheaderTextView.setTextColor(fragment.getActivity().getResources()
|
||||
.getColor(R.color.osmand_orange));
|
||||
|
|
|
@ -207,7 +207,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
} else {
|
||||
size = updatesSize + " KB";
|
||||
}
|
||||
sizeTextView.setText(getString(R.string.size_pattern, size));
|
||||
sizeTextView.setText(getString(R.string.updates_size_pattern, size));
|
||||
}
|
||||
|
||||
private long getNextUpdateTime(TimesOfDay timeOfDayToUpdate) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
import net.osmand.plus.download.DownloadValidationManager;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
|
@ -33,6 +34,7 @@ public class PerformLiveUpdateAsyncTask
|
|||
this.localIndexInfo = localIndexInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
if (context instanceof AbstractDownloadActivity) {
|
||||
AbstractDownloadActivity activity = (AbstractDownloadActivity) context;
|
||||
|
@ -52,6 +54,7 @@ public class PerformLiveUpdateAsyncTask
|
|||
return cm.getUpdatesByMonth(params[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(IncrementalChangesManager.IncrementalUpdateList result) {
|
||||
if (context instanceof AbstractDownloadActivity) {
|
||||
AbstractDownloadActivity activity = (AbstractDownloadActivity) context;
|
||||
|
@ -78,6 +81,10 @@ public class PerformLiveUpdateAsyncTask
|
|||
}
|
||||
DownloadValidationManager downloadValidationManager =
|
||||
new DownloadValidationManager(application);
|
||||
if (context instanceof DownloadIndexesThread.DownloadEvents) {
|
||||
downloadValidationManager.getDownloadThread()
|
||||
.setUiActivity((DownloadIndexesThread.DownloadEvents) context);
|
||||
}
|
||||
downloadValidationManager.startDownload(context, is);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue