Add last update in osm live

This commit is contained in:
PavelRatushny 2017-09-05 18:59:05 +03:00
parent 7418bcb2dd
commit cd805ab6f8
2 changed files with 40 additions and 5 deletions

View file

@ -365,20 +365,24 @@
<style name="Widget.Styled.ActionBarLight" parent="Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">@color/actionbar_light_color</item>
<item name="android:background">@color/actionbar_light_color</item>
<item name="titleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
<item name="subtitleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
<item name="titleTextStyle">@style/Widget.Styled.LightActionBarTitle</item>
<item name="subtitleTextStyle">@style/Widget.Styled.LightActionBarSubtitle</item>
<item name="actionBarWidgetTheme">@style/Theme.AppCompat</item>
<item name="android:titleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
<item name="android:subtitleTextStyle">@style/Widget.Styled.LightActionBarHeader</item>
<item name="android:titleTextStyle">@style/Widget.Styled.LightActionBarTitle</item>
<item name="android:subtitleTextStyle">@style/Widget.Styled.LightActionBarSubtitle</item>
<item name="android:actionBarWidgetTheme">@style/Theme.AppCompat</item>
<item name="elevation">0dp</item>
</style>
<style name="Widget.Styled.LightActionBarHeader" parent="@android:style/TextAppearance">
<style name="Widget.Styled.LightActionBarTitle" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/color_white</item>
</style>
<style name="Widget.Styled.LightActionBarSubtitle" parent="TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/white_80_transparent</item>
</style>
<style name="WhiteActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="titleTextStyle">@style/WhiteActionModeTitleTextStyle</item>
<item name="android:titleTextStyle">@style/WhiteActionModeTitleTextStyle</item>

View file

@ -2,14 +2,17 @@ package net.osmand.plus.liveupdates;
import android.content.Intent;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.view.MenuItem;
import net.osmand.AndroidNetworkUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.R;
import net.osmand.plus.Version;
@ -25,6 +28,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
private LiveUpdatesFragmentPagerAdapter pagerAdapter;
private InAppHelper inAppHelper;
private boolean openSubscription;
private static final String URL = "http://builder.osmand.net/osmlive/.proc_timestamp";
public InAppHelper getInAppHelper() {
return inAppHelper;
@ -43,6 +47,33 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
inAppHelper = null;
}
new AsyncTask<Void, Void, String>() {
@Override
protected void onPreExecute() {
}
@Override
protected String doInBackground(Void... params) {
try {
return AndroidNetworkUtils.sendRequest(getMyApplication(), URL, null, "Requesting map updates info...", false, false);
} catch (Exception e) {
LOG.error("Error: " + "Requesting map updates info error", e);
return null;
}
}
@Override
protected void onPostExecute(String response) {
if (response != null) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setSubtitle(response);
}
}
}
}.execute();
Intent intent = getIntent();
if (intent != null && intent.getExtras() != null) {
openSubscription = intent.getExtras().getBoolean(OPEN_SUBSCRIPTION_INTENT_PARAM, false);