Changing default en wiki locale to variable from settings.
parent
ff193fab23
commit
e68c6338f5
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
<string name="upload_date_label">Upload date:</string>
|
||||
<string name="location_label">Location:</string>
|
||||
<string name="panoramio_url">Panoramio url:</string>
|
||||
<string name="def_wikipedia_endpoint_locale">en</string>
|
||||
<string name="pref_wiki_locale">pref_wiki_locale</string>
|
||||
|
||||
<string-array name="google_places_categories">
|
||||
<item>accounting</item>
|
||||
|
@ -285,4 +287,379 @@
|
|||
<item>Veterinary care</item>
|
||||
<item>Zoo</item>
|
||||
</string-array>
|
||||
|
||||
<!-- 639‑2/T https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -->
|
||||
<string-array name="wikipedia_endpoint_locale_values">
|
||||
<item>ab</item>
|
||||
<item>aa</item>
|
||||
<item>af</item>
|
||||
<item>ak</item>
|
||||
<item>sq</item>
|
||||
<item>am</item>
|
||||
<item>ar</item>
|
||||
<item>an</item>
|
||||
<item>hy</item>
|
||||
<item>as</item>
|
||||
<item>av</item>
|
||||
<item>ae</item>
|
||||
<item>ay</item>
|
||||
<item>az</item>
|
||||
<item>bm</item>
|
||||
<item>ba</item>
|
||||
<item>eu</item>
|
||||
<item>be</item>
|
||||
<item>bn</item>
|
||||
<item>bh</item>
|
||||
<item>bi</item>
|
||||
<item>bs</item>
|
||||
<item>br</item>
|
||||
<item>bg</item>
|
||||
<item>my</item>
|
||||
<item>ca</item>
|
||||
<item>ch</item>
|
||||
<item>ce</item>
|
||||
<item>ny</item>
|
||||
<item>zh</item>
|
||||
<item>cv</item>
|
||||
<item>kw</item>
|
||||
<item>co</item>
|
||||
<item>cr</item>
|
||||
<item>hr</item>
|
||||
<item>cs</item>
|
||||
<item>da</item>
|
||||
<item>dv</item>
|
||||
<item>nl</item>
|
||||
<item>dz</item>
|
||||
<item>en</item>
|
||||
<item>eo</item>
|
||||
<item>et</item>
|
||||
<item>ee</item>
|
||||
<item>fo</item>
|
||||
<item>fj</item>
|
||||
<item>fi</item>
|
||||
<item>fr</item>
|
||||
<item>ff</item>
|
||||
<item>gl</item>
|
||||
<item>ka</item>
|
||||
<item>de</item>
|
||||
<item>el</item>
|
||||
<item>gn</item>
|
||||
<item>gu</item>
|
||||
<item>ht</item>
|
||||
<item>ha</item>
|
||||
<item>he</item>
|
||||
<item>hz</item>
|
||||
<item>hi</item>
|
||||
<item>ho</item>
|
||||
<item>hu</item>
|
||||
<item>ia</item>
|
||||
<item>id</item>
|
||||
<item>ie</item>
|
||||
<item>ga</item>
|
||||
<item>ig</item>
|
||||
<item>ik</item>
|
||||
<item>io</item>
|
||||
<item>is</item>
|
||||
<item>it</item>
|
||||
<item>iu</item>
|
||||
<item>ja</item>
|
||||
<item>jv</item>
|
||||
<item>kl</item>
|
||||
<item>kn</item>
|
||||
<item>kr</item>
|
||||
<item>ks</item>
|
||||
<item>kk</item>
|
||||
<item>km</item>
|
||||
<item>ki</item>
|
||||
<item>rw</item>
|
||||
<item>ky</item>
|
||||
<item>kv</item>
|
||||
<item>kg</item>
|
||||
<item>ko</item>
|
||||
<item>ku</item>
|
||||
<item>kj</item>
|
||||
<item>la</item>
|
||||
<item>lb</item>
|
||||
<item>lg</item>
|
||||
<item>li</item>
|
||||
<item>ln</item>
|
||||
<item>lo</item>
|
||||
<item>lt</item>
|
||||
<item>lu</item>
|
||||
<item>lv</item>
|
||||
<item>gv</item>
|
||||
<item>mk</item>
|
||||
<item>mg</item>
|
||||
<item>ms</item>
|
||||
<item>ml</item>
|
||||
<item>mt</item>
|
||||
<item>mi</item>
|
||||
<item>mr</item>
|
||||
<item>mh</item>
|
||||
<item>mn</item>
|
||||
<item>na</item>
|
||||
<item>nv</item>
|
||||
<item>nd</item>
|
||||
<item>ne</item>
|
||||
<item>ng</item>
|
||||
<item>nb</item>
|
||||
<item>nn</item>
|
||||
<item>no</item>
|
||||
<item>ii</item>
|
||||
<item>nr</item>
|
||||
<item>oc</item>
|
||||
<item>oj</item>
|
||||
<item>cu</item>
|
||||
<item>om</item>
|
||||
<item>or</item>
|
||||
<item>os</item>
|
||||
<item>pa</item>
|
||||
<item>pi</item>
|
||||
<item>fa</item>
|
||||
<item>pl</item>
|
||||
<item>ps</item>
|
||||
<item>pt</item>
|
||||
<item>qu</item>
|
||||
<item>rm</item>
|
||||
<item>rn</item>
|
||||
<item>ro</item>
|
||||
<item>ru</item>
|
||||
<item>sa</item>
|
||||
<item>sc</item>
|
||||
<item>sd</item>
|
||||
<item>se</item>
|
||||
<item>sm</item>
|
||||
<item>sg</item>
|
||||
<item>sr</item>
|
||||
<item>gd</item>
|
||||
<item>sn</item>
|
||||
<item>si</item>
|
||||
<item>sk</item>
|
||||
<item>sl</item>
|
||||
<item>so</item>
|
||||
<item>st</item>
|
||||
<item>es</item>
|
||||
<item>su</item>
|
||||
<item>sw</item>
|
||||
<item>ss</item>
|
||||
<item>sv</item>
|
||||
<item>ta</item>
|
||||
<item>te</item>
|
||||
<item>tg</item>
|
||||
<item>th</item>
|
||||
<item>ti</item>
|
||||
<item>bo</item>
|
||||
<item>tk</item>
|
||||
<item>tl</item>
|
||||
<item>tn</item>
|
||||
<item>to</item>
|
||||
<item>tr</item>
|
||||
<item>ts</item>
|
||||
<item>tt</item>
|
||||
<item>tw</item>
|
||||
<item>ty</item>
|
||||
<item>ug</item>
|
||||
<item>uk</item>
|
||||
<item>ur</item>
|
||||
<item>uz</item>
|
||||
<item>ve</item>
|
||||
<item>vi</item>
|
||||
<item>vo</item>
|
||||
<item>wa</item>
|
||||
<item>cy</item>
|
||||
<item>wo</item>
|
||||
<item>fy</item>
|
||||
<item>xh</item>
|
||||
<item>yi</item>
|
||||
<item>yo</item>
|
||||
<item>za</item>
|
||||
<item>zu</item>
|
||||
</string-array>
|
||||
<!-- Native name https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -->
|
||||
<string-array name="wikipedia_endpoint_locale_labels">
|
||||
<item>Abkhaz</item>
|
||||
<item>Afar</item>
|
||||
<item>Afrikaans</item>
|
||||
<item>Akan</item>
|
||||
<item>Albanian</item>
|
||||
<item>Amharic</item>
|
||||
<item>Arabic</item>
|
||||
<item>Aragonese</item>
|
||||
<item>Armenian</item>
|
||||
<item>Assamese</item>
|
||||
<item>Avaric</item>
|
||||
<item>Avestan</item>
|
||||
<item>Aymara</item>
|
||||
<item>Azerbaijani</item>
|
||||
<item>Bambara</item>
|
||||
<item>Bashkir</item>
|
||||
<item>Basque</item>
|
||||
<item>Belarusian</item>
|
||||
<item>Bengali, Bangla</item>
|
||||
<item>Bihari</item>
|
||||
<item>Bislama</item>
|
||||
<item>Bosnian</item>
|
||||
<item>Breton</item>
|
||||
<item>Bulgarian</item>
|
||||
<item>Burmese</item>
|
||||
<item>Catalan</item>
|
||||
<item>Chamorro</item>
|
||||
<item>Chechen</item>
|
||||
<item>Chichewa, Chewa, Nyanja</item>
|
||||
<item>Chinese</item>
|
||||
<item>Chuvash</item>
|
||||
<item>Cornish</item>
|
||||
<item>Corsican</item>
|
||||
<item>Cree</item>
|
||||
<item>Croatian</item>
|
||||
<item>Czech</item>
|
||||
<item>Danish</item>
|
||||
<item>Divehi, Dhivehi, Maldivian</item>
|
||||
<item>Dutch</item>
|
||||
<item>Dzongkha</item>
|
||||
<item>English</item>
|
||||
<item>Esperanto</item>
|
||||
<item>Estonian</item>
|
||||
<item>Ewe</item>
|
||||
<item>Faroese</item>
|
||||
<item>Fijian</item>
|
||||
<item>Finnish</item>
|
||||
<item>French</item>
|
||||
<item>Fula, Fulah, Pulaar, Pular</item>
|
||||
<item>Galician</item>
|
||||
<item>Georgian</item>
|
||||
<item>German</item>
|
||||
<item>Greek (modern)</item>
|
||||
<item>Guaraní</item>
|
||||
<item>Gujarati</item>
|
||||
<item>Haitian, Haitian Creole</item>
|
||||
<item>Hausa</item>
|
||||
<item>Hebrew (modern)</item>
|
||||
<item>Herero</item>
|
||||
<item>Hindi</item>
|
||||
<item>Hiri Motu</item>
|
||||
<item>Hungarian</item>
|
||||
<item>Interlingua</item>
|
||||
<item>Indonesian</item>
|
||||
<item>Interlingue</item>
|
||||
<item>Irish</item>
|
||||
<item>Igbo</item>
|
||||
<item>Inupiaq</item>
|
||||
<item>Ido</item>
|
||||
<item>Icelandic</item>
|
||||
<item>Italian</item>
|
||||
<item>Inuktitut</item>
|
||||
<item>Japanese</item>
|
||||
<item>Javanese</item>
|
||||
<item>Kalaallisut, Greenlandic</item>
|
||||
<item>Kannada</item>
|
||||
<item>Kanuri</item>
|
||||
<item>Kashmiri</item>
|
||||
<item>Kazakh</item>
|
||||
<item>Khmer</item>
|
||||
<item>Kikuyu, Gikuyu</item>
|
||||
<item>Kinyarwanda</item>
|
||||
<item>Kyrgyz</item>
|
||||
<item>Komi</item>
|
||||
<item>Kongo</item>
|
||||
<item>Korean</item>
|
||||
<item>Kurdish</item>
|
||||
<item>Kwanyama, Kuanyama</item>
|
||||
<item>Latin</item>
|
||||
<item>Luxembourgish, Letzeburgesch</item>
|
||||
<item>Ganda</item>
|
||||
<item>Limburgish, Limburgan, Limburger</item>
|
||||
<item>Lingala</item>
|
||||
<item>Lao</item>
|
||||
<item>Lithuanian</item>
|
||||
<item>Luba-Katanga</item>
|
||||
<item>Latvian</item>
|
||||
<item>Manx</item>
|
||||
<item>Macedonian</item>
|
||||
<item>Malagasy</item>
|
||||
<item>Malay</item>
|
||||
<item>Malayalam</item>
|
||||
<item>Maltese</item>
|
||||
<item>Māori</item>
|
||||
<item>Marathi (Marāṭhī)</item>
|
||||
<item>Marshallese</item>
|
||||
<item>Mongolian</item>
|
||||
<item>Nauruan</item>
|
||||
<item>Navajo, Navaho</item>
|
||||
<item>Northern Ndebele</item>
|
||||
<item>Nepali</item>
|
||||
<item>Ndonga</item>
|
||||
<item>Norwegian Bokmål</item>
|
||||
<item>Norwegian Nynorsk</item>
|
||||
<item>Norwegian</item>
|
||||
<item>Nuosu</item>
|
||||
<item>Southern Ndebele</item>
|
||||
<item>Occitan</item>
|
||||
<item>Ojibwe, Ojibwa</item>
|
||||
<item>Old Church Slavonic, Church Slavonic, Old Bulgarian</item>
|
||||
<item>Oromo</item>
|
||||
<item>Oriya</item>
|
||||
<item>Ossetian, Ossetic</item>
|
||||
<item>Eastern Punjabi, Eastern Panjabi</item>
|
||||
<item>Pāli</item>
|
||||
<item>Persian (Farsi)</item>
|
||||
<item>Polish</item>
|
||||
<item>Pashto, Pushto</item>
|
||||
<item>Portuguese</item>
|
||||
<item>Quechua</item>
|
||||
<item>Romansh</item>
|
||||
<item>Kirundi</item>
|
||||
<item>Romanian</item>
|
||||
<item>Russian</item>
|
||||
<item>Sanskrit (Saṁskṛta)</item>
|
||||
<item>Sardinian</item>
|
||||
<item>Sindhi</item>
|
||||
<item>Northern Sami</item>
|
||||
<item>Samoan</item>
|
||||
<item>Sango</item>
|
||||
<item>Serbian</item>
|
||||
<item>Scottish Gaelic, Gaelic</item>
|
||||
<item>Shona</item>
|
||||
<item>Sinhalese, Sinhala</item>
|
||||
<item>Slovak</item>
|
||||
<item>Slovene</item>
|
||||
<item>Somali</item>
|
||||
<item>Southern Sotho</item>
|
||||
<item>Spanish</item>
|
||||
<item>Sundanese</item>
|
||||
<item>Swahili</item>
|
||||
<item>Swati</item>
|
||||
<item>Swedish</item>
|
||||
<item>Tamil</item>
|
||||
<item>Telugu</item>
|
||||
<item>Tajik</item>
|
||||
<item>Thai</item>
|
||||
<item>Tigrinya</item>
|
||||
<item>Tibetan Standard, Tibetan, Central</item>
|
||||
<item>Turkmen</item>
|
||||
<item>Tagalog</item>
|
||||
<item>Tswana</item>
|
||||
<item>Tonga (Tonga Islands)</item>
|
||||
<item>Turkish</item>
|
||||
<item>Tsonga</item>
|
||||
<item>Tatar</item>
|
||||
<item>Twi</item>
|
||||
<item>Tahitian</item>
|
||||
<item>Uyghur</item>
|
||||
<item>Ukrainian</item>
|
||||
<item>Urdu</item>
|
||||
<item>Uzbek</item>
|
||||
<item>Venda</item>
|
||||
<item>Vietnamese</item>
|
||||
<item>Volapük</item>
|
||||
<item>Walloon</item>
|
||||
<item>Welsh</item>
|
||||
<item>Wolof</item>
|
||||
<item>Western Frisian</item>
|
||||
<item>Xhosa</item>
|
||||
<item>Yiddish</item>
|
||||
<item>Yoruba</item>
|
||||
<item>Zhuang, Chuang</item>
|
||||
<item>Zulu</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
android:title="@string/wiki_search_settings"
|
||||
android:key="pref_wiki_settings">
|
||||
|
||||
<ListPreference
|
||||
android:key="@string/pref_wiki_locale"
|
||||
android:title="Wikipedia endpoint locale"
|
||||
android:summary="Wikipedia endpoint localization"
|
||||
android:defaultValue="@string/def_wikipedia_endpoint_locale"
|
||||
android:entryValues="@array/wikipedia_endpoint_locale_values"
|
||||
android:entries="@array/wikipedia_endpoint_locale_labels" />
|
||||
|
||||
<EditTextPreference
|
||||
android:key="pref_wiki_radius"
|
||||
android:title="@string/wiki_search_radius_title"
|
||||
|
|
|
@ -88,7 +88,7 @@ fi
|
|||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -source "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
|
|
|
@ -6,9 +6,9 @@ import android.preference.PreferenceManager;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import pl.tpolgrabia.urbanexplorerutils.R;
|
||||
import pl.tpolgrabia.urbanexplorerutils.constants.UtilConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue