commit
20c2dd9d54
2 changed files with 55 additions and 5 deletions
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
@ -19,12 +22,19 @@ import net.osmand.plus.inapp.InAppHelper;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class OsmLiveActivity extends AbstractDownloadActivity implements DownloadIndexesThread.DownloadEvents {
|
||||
private final static Log LOG = PlatformUtil.getLog(OsmLiveActivity.class);
|
||||
public final static String OPEN_SUBSCRIPTION_INTENT_PARAM = "open_subscription_intent_param";
|
||||
private LiveUpdatesFragmentPagerAdapter pagerAdapter;
|
||||
private InAppHelper inAppHelper;
|
||||
private boolean openSubscription;
|
||||
private static final String URL = "https://osmand.net/api/osmlive_status";
|
||||
|
||||
public InAppHelper getInAppHelper() {
|
||||
return inAppHelper;
|
||||
|
@ -43,6 +53,42 @@ 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) {
|
||||
SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
source.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
dest.setTimeZone(TimeZone.getDefault());
|
||||
try {
|
||||
Date parsed = source.parse(response);
|
||||
actionBar.setSubtitle(dest.format(parsed));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null && intent.getExtras() != null) {
|
||||
openSubscription = intent.getExtras().getBoolean(OPEN_SUBSCRIPTION_INTENT_PARAM, false);
|
||||
|
|
Loading…
Reference in a new issue