From 147764422ba773a285b5a2aef8b12e0d9539ed7e Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Thu, 10 Mar 2016 12:23:47 +0200 Subject: [PATCH] Extracted tab names to resources. Fixes #2320. --- OsmAnd/res/values/strings.xml | 3 ++- .../osmand/plus/liveupdates/LiveUpdatesFragment.java | 3 ++- .../net/osmand/plus/liveupdates/OsmLiveActivity.java | 12 +++++++++--- .../net/osmand/plus/liveupdates/ReportsFragment.java | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 1fd9a34452..e79c9cdb82 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,4 +1,4 @@ - + + Report Tracker ID Group ID Join diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 0154994c3a..f14180473f 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -33,6 +33,7 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; + import net.osmand.map.WorldRegion; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; @@ -69,7 +70,7 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFreq import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppListener { - public static final String TITLE = "Live Updates"; + public static final int TITLE = R.string.live_updates; private static final int SUBSCRIPTION_SETTINGS = 5; public static final Comparator LOCAL_INDEX_INFO_COMPARATOR = new Comparator() { @Override diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java index c582f3d424..2def186d4d 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java @@ -1,6 +1,7 @@ package net.osmand.plus.liveupdates; import android.content.Intent; +import android.content.res.Resources; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; @@ -40,7 +41,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); - pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager()); + pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager(), getResources()); viewPager.setAdapter(pagerAdapter); final TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); @@ -96,11 +97,16 @@ public class OsmLiveActivity extends AbstractDownloadActivity public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter { private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment(), new ReportsFragment()}; - private final String[] titles = new String[]{LiveUpdatesFragment.TITLE, + private static final int[] titleIds = new int[]{LiveUpdatesFragment.TITLE, ReportsFragment.TITLE}; + private final String[] titles; - public LiveUpdatesFragmentPagerAdapter(FragmentManager fm) { + public LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res) { super(fm); + titles = new String[titleIds.length]; + for (int i = 0; i < titleIds.length; i++) { + titles[i] = res.getString(titleIds[i]); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java index ed9ab20108..d005fbf6f8 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java @@ -40,7 +40,7 @@ import java.util.Calendar; import java.util.Locale; public class ReportsFragment extends BaseOsmAndFragment implements CountrySelectionFragment.OnFragmentInteractionListener { - public static final String TITLE = "Report"; + public static final int TITLE = R.string.report; public static final String DOMAIN = "http://download.osmand.net/"; public static final String TOTAL_CHANGES_BY_MONTH_URL_PATTERN = DOMAIN + "reports/query_report.php?report=total_changes_by_month&month=%s®ion=%s";