diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java
index ce7e970..cba394f 100644
--- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java
+++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java
@@ -20,4 +20,5 @@ public class AppConstants {
static final String SAVED_CONFIG_KEY = "SAVED_CONFIG_KEY";
public static final String GOOGLE_API_KEY = "AIzaSyBAJoK-pu_qnQ0U8EGjM1Zkz_g8oJV4w2g";
public static final String DEF_WIKI_COUNTRY_CODE = "en";
+ public static final String DEAD_BEAF = "DEAD_BEAF";
}
diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java
index ec6d817..2b3c1e8 100644
--- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java
+++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java
@@ -20,6 +20,7 @@ import pl.tpolgrabia.urbanexplorer.activities.SettingsActivity;
import pl.tpolgrabia.urbanexplorer.callbacks.StandardLocationListener;
import pl.tpolgrabia.urbanexplorer.dto.MainActivityState;
import pl.tpolgrabia.panoramiobindings.dto.PanoramioImageInfo;
+import pl.tpolgrabia.urbanexplorer.events.RefreshSettingsEvent;
import pl.tpolgrabia.urbanexplorer.fragments.*;
import pl.tpolgrabia.urbanexplorer.handlers.*;
import pl.tpolgrabia.urbanexplorerutils.events.DataLoadingFinishEvent;
@@ -353,6 +354,7 @@ public class MainActivity extends ActionBarActivity {
break;
case AppConstants.SETTINGS_ID_INTENT_REQUEST_ID:
NetUtils.setGlobalProxyAuth(this);
+ refreshAppSettings();
refreshFragment();
break;
default:
@@ -360,6 +362,10 @@ public class MainActivity extends ActionBarActivity {
}
}
+ private void refreshAppSettings() {
+ EventBus.getDefault().post(new RefreshSettingsEvent(this));
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/events/RefreshSettingsEvent.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/events/RefreshSettingsEvent.java
new file mode 100644
index 0000000..7b2a111
--- /dev/null
+++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/events/RefreshSettingsEvent.java
@@ -0,0 +1,23 @@
+package pl.tpolgrabia.urbanexplorer.events;
+
+/**
+ * Created by tpolgrabia on 08.10.16.
+ */
+public class RefreshSettingsEvent {
+ private final Object source;
+
+ public Object getSource() {
+ return source;
+ }
+
+ public RefreshSettingsEvent(Object source) {
+ this.source = source;
+ }
+
+ @Override
+ public String toString() {
+ return "RefreshSettingsEvent{" +
+ "source=" + source +
+ '}';
+ }
+}
diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java
index cbe6820..ce921e1 100644
--- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java
+++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java
@@ -1,8 +1,11 @@
package pl.tpolgrabia.urbanexplorer.fragments;
+import android.content.Context;
+import android.content.SharedPreferences;
import android.location.LocationManager;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
@@ -17,10 +20,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.tpolgrabia.googleutils.utils.GeocoderUtils;
import pl.tpolgrabia.urbanexplorer.AppConstants;
-import pl.tpolgrabia.urbanexplorer.MainActivity;
import pl.tpolgrabia.urbanexplorer.R;
import pl.tpolgrabia.urbanexplorer.adapters.WikiLocationsAdapter;
import pl.tpolgrabia.urbanexplorer.callbacks.wiki.*;
+import pl.tpolgrabia.urbanexplorer.events.RefreshSettingsEvent;
import pl.tpolgrabia.wikibinding.dto.app.WikiAppObject;
import pl.tpolgrabia.urbanexplorerutils.events.DataLoadingFinishEvent;
import pl.tpolgrabia.urbanexplorerutils.events.RefreshEvent;
@@ -65,8 +68,12 @@ public class WikiLocationsFragment extends Fragment {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
appObjects = WikiCacheUtils.loadWikiObjectsFromCache(getActivity(), savedInstanceState);
+ refreshSettings();
+ }
+
+ private void refreshSettings() {
geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY);
- wikiUtils = new WikiUtils(getActivity(), AppConstants.DEF_WIKI_COUNTRY_CODE);
+ wikiUtils = new WikiUtils(getActivity(), getWikiLocale(getActivity()));
}
@Override
@@ -183,4 +190,17 @@ public class WikiLocationsFragment extends Fragment {
public void setCurrentGeocodedLocation(String currentGeocodedLocation) {
this.currentGeocodedLocation = currentGeocodedLocation;
}
+
+ public static String getWikiLocale(Context ctx) {
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+ return sharedPrefs.getString(
+ ctx.getResources().getString(R.string.pref_wiki_locale),
+ ctx.getResources().getString(R.string.def_wikipedia_endpoint_locale));
+ }
+
+ @Subscribe
+ public void handleRefreshSettings(RefreshSettingsEvent event) {
+ lg.debug("Refreshing settings {}", event);
+ refreshSettings();
+ }
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index adfb6ff..15570c7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -54,6 +54,8 @@
Upload date:
Location:
Panoramio url:
+ en
+ pref_wiki_locale
- accounting
@@ -285,4 +287,379 @@
- Veterinary care
- Zoo
+
+
+
+ - ab
+ - aa
+ - af
+ - ak
+ - sq
+ - am
+ - ar
+ - an
+ - hy
+ - as
+ - av
+ - ae
+ - ay
+ - az
+ - bm
+ - ba
+ - eu
+ - be
+ - bn
+ - bh
+ - bi
+ - bs
+ - br
+ - bg
+ - my
+ - ca
+ - ch
+ - ce
+ - ny
+ - zh
+ - cv
+ - kw
+ - co
+ - cr
+ - hr
+ - cs
+ - da
+ - dv
+ - nl
+ - dz
+ - en
+ - eo
+ - et
+ - ee
+ - fo
+ - fj
+ - fi
+ - fr
+ - ff
+ - gl
+ - ka
+ - de
+ - el
+ - gn
+ - gu
+ - ht
+ - ha
+ - he
+ - hz
+ - hi
+ - ho
+ - hu
+ - ia
+ - id
+ - ie
+ - ga
+ - ig
+ - ik
+ - io
+ - is
+ - it
+ - iu
+ - ja
+ - jv
+ - kl
+ - kn
+ - kr
+ - ks
+ - kk
+ - km
+ - ki
+ - rw
+ - ky
+ - kv
+ - kg
+ - ko
+ - ku
+ - kj
+ - la
+ - lb
+ - lg
+ - li
+ - ln
+ - lo
+ - lt
+ - lu
+ - lv
+ - gv
+ - mk
+ - mg
+ - ms
+ - ml
+ - mt
+ - mi
+ - mr
+ - mh
+ - mn
+ - na
+ - nv
+ - nd
+ - ne
+ - ng
+ - nb
+ - nn
+ - no
+ - ii
+ - nr
+ - oc
+ - oj
+ - cu
+ - om
+ - or
+ - os
+ - pa
+ - pi
+ - fa
+ - pl
+ - ps
+ - pt
+ - qu
+ - rm
+ - rn
+ - ro
+ - ru
+ - sa
+ - sc
+ - sd
+ - se
+ - sm
+ - sg
+ - sr
+ - gd
+ - sn
+ - si
+ - sk
+ - sl
+ - so
+ - st
+ - es
+ - su
+ - sw
+ - ss
+ - sv
+ - ta
+ - te
+ - tg
+ - th
+ - ti
+ - bo
+ - tk
+ - tl
+ - tn
+ - to
+ - tr
+ - ts
+ - tt
+ - tw
+ - ty
+ - ug
+ - uk
+ - ur
+ - uz
+ - ve
+ - vi
+ - vo
+ - wa
+ - cy
+ - wo
+ - fy
+ - xh
+ - yi
+ - yo
+ - za
+ - zu
+
+
+
+ - Abkhaz
+ - Afar
+ - Afrikaans
+ - Akan
+ - Albanian
+ - Amharic
+ - Arabic
+ - Aragonese
+ - Armenian
+ - Assamese
+ - Avaric
+ - Avestan
+ - Aymara
+ - Azerbaijani
+ - Bambara
+ - Bashkir
+ - Basque
+ - Belarusian
+ - Bengali, Bangla
+ - Bihari
+ - Bislama
+ - Bosnian
+ - Breton
+ - Bulgarian
+ - Burmese
+ - Catalan
+ - Chamorro
+ - Chechen
+ - Chichewa, Chewa, Nyanja
+ - Chinese
+ - Chuvash
+ - Cornish
+ - Corsican
+ - Cree
+ - Croatian
+ - Czech
+ - Danish
+ - Divehi, Dhivehi, Maldivian
+ - Dutch
+ - Dzongkha
+ - English
+ - Esperanto
+ - Estonian
+ - Ewe
+ - Faroese
+ - Fijian
+ - Finnish
+ - French
+ - Fula, Fulah, Pulaar, Pular
+ - Galician
+ - Georgian
+ - German
+ - Greek (modern)
+ - Guaraní
+ - Gujarati
+ - Haitian, Haitian Creole
+ - Hausa
+ - Hebrew (modern)
+ - Herero
+ - Hindi
+ - Hiri Motu
+ - Hungarian
+ - Interlingua
+ - Indonesian
+ - Interlingue
+ - Irish
+ - Igbo
+ - Inupiaq
+ - Ido
+ - Icelandic
+ - Italian
+ - Inuktitut
+ - Japanese
+ - Javanese
+ - Kalaallisut, Greenlandic
+ - Kannada
+ - Kanuri
+ - Kashmiri
+ - Kazakh
+ - Khmer
+ - Kikuyu, Gikuyu
+ - Kinyarwanda
+ - Kyrgyz
+ - Komi
+ - Kongo
+ - Korean
+ - Kurdish
+ - Kwanyama, Kuanyama
+ - Latin
+ - Luxembourgish, Letzeburgesch
+ - Ganda
+ - Limburgish, Limburgan, Limburger
+ - Lingala
+ - Lao
+ - Lithuanian
+ - Luba-Katanga
+ - Latvian
+ - Manx
+ - Macedonian
+ - Malagasy
+ - Malay
+ - Malayalam
+ - Maltese
+ - Māori
+ - Marathi (Marāṭhī)
+ - Marshallese
+ - Mongolian
+ - Nauruan
+ - Navajo, Navaho
+ - Northern Ndebele
+ - Nepali
+ - Ndonga
+ - Norwegian Bokmål
+ - Norwegian Nynorsk
+ - Norwegian
+ - Nuosu
+ - Southern Ndebele
+ - Occitan
+ - Ojibwe, Ojibwa
+ - Old Church Slavonic, Church Slavonic, Old Bulgarian
+ - Oromo
+ - Oriya
+ - Ossetian, Ossetic
+ - Eastern Punjabi, Eastern Panjabi
+ - Pāli
+ - Persian (Farsi)
+ - Polish
+ - Pashto, Pushto
+ - Portuguese
+ - Quechua
+ - Romansh
+ - Kirundi
+ - Romanian
+ - Russian
+ - Sanskrit (Saṁskṛta)
+ - Sardinian
+ - Sindhi
+ - Northern Sami
+ - Samoan
+ - Sango
+ - Serbian
+ - Scottish Gaelic, Gaelic
+ - Shona
+ - Sinhalese, Sinhala
+ - Slovak
+ - Slovene
+ - Somali
+ - Southern Sotho
+ - Spanish
+ - Sundanese
+ - Swahili
+ - Swati
+ - Swedish
+ - Tamil
+ - Telugu
+ - Tajik
+ - Thai
+ - Tigrinya
+ - Tibetan Standard, Tibetan, Central
+ - Turkmen
+ - Tagalog
+ - Tswana
+ - Tonga (Tonga Islands)
+ - Turkish
+ - Tsonga
+ - Tatar
+ - Twi
+ - Tahitian
+ - Uyghur
+ - Ukrainian
+ - Urdu
+ - Uzbek
+ - Venda
+ - Vietnamese
+ - Volapük
+ - Walloon
+ - Welsh
+ - Wolof
+ - Western Frisian
+ - Xhosa
+ - Yiddish
+ - Yoruba
+ - Zhuang, Chuang
+ - Zulu
+
diff --git a/app/src/main/res/xml/urban_expl_settings.xml b/app/src/main/res/xml/urban_expl_settings.xml
index 87665c1..e2a893d 100644
--- a/app/src/main/res/xml/urban_expl_settings.xml
+++ b/app/src/main/res/xml/urban_expl_settings.xml
@@ -32,6 +32,14 @@
android:title="@string/wiki_search_settings"
android:key="pref_wiki_settings">
+
+