mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
Android Launcher - Language (#1914)
* codepage -> language * Update strings.xml * change mod repo on android
This commit is contained in:
parent
e2d0cd37e4
commit
94d339ca22
@ -18,7 +18,7 @@ import java.util.List;
|
||||
|
||||
import eu.vcmi.vcmi.content.AsyncLauncherInitialization;
|
||||
import eu.vcmi.vcmi.settings.AdventureAiController;
|
||||
import eu.vcmi.vcmi.settings.CodepageSettingController;
|
||||
import eu.vcmi.vcmi.settings.LanguageSettingController;
|
||||
import eu.vcmi.vcmi.settings.CopyDataController;
|
||||
import eu.vcmi.vcmi.settings.ExportDataController;
|
||||
import eu.vcmi.vcmi.settings.LauncherSettingController;
|
||||
@ -45,7 +45,7 @@ public class ActivityLauncher extends ActivityWithToolbar
|
||||
private TextView mErrorMessage;
|
||||
private Config mConfig;
|
||||
private LauncherSettingController<ScreenResSettingController.ScreenRes, Config> mCtrlScreenRes;
|
||||
private LauncherSettingController<String, Config> mCtrlCodepage;
|
||||
private LauncherSettingController<String, Config> mCtrlLanguage;
|
||||
private LauncherSettingController<PointerModeSettingController.PointerMode, Config> mCtrlPointerMode;
|
||||
private LauncherSettingController<Void, Void> mCtrlStart;
|
||||
private LauncherSettingController<Float, Config> mCtrlPointerMulti;
|
||||
@ -203,7 +203,7 @@ public class ActivityLauncher extends ActivityWithToolbar
|
||||
(mCtrlExport = new ExportDataController(this)).init(R.id.launcher_btn_export);
|
||||
new ModsBtnController(this, v -> startActivity(new Intent(ActivityLauncher.this, ActivityMods.class))).init(R.id.launcher_btn_mods);
|
||||
mCtrlScreenRes = new ScreenResSettingController(this).init(R.id.launcher_btn_res, mConfig);
|
||||
mCtrlCodepage = new CodepageSettingController(this).init(R.id.launcher_btn_cp, mConfig);
|
||||
mCtrlLanguage = new LanguageSettingController(this).init(R.id.launcher_btn_cp, mConfig);
|
||||
mCtrlPointerMode = new PointerModeSettingController(this).init(R.id.launcher_btn_pointer_mode, mConfig);
|
||||
mCtrlPointerMulti = new PointerMultiplierSettingController(this).init(R.id.launcher_btn_pointer_multi, mConfig);
|
||||
mCtrlSoundVol = new SoundSettingController(this).init(R.id.launcher_btn_volume_sound, mConfig);
|
||||
@ -211,7 +211,7 @@ public class ActivityLauncher extends ActivityWithToolbar
|
||||
mAiController = new AdventureAiController(this).init(R.id.launcher_btn_adventure_ai, mConfig);
|
||||
|
||||
mActualSettings.clear();
|
||||
mActualSettings.add(mCtrlCodepage);
|
||||
mActualSettings.add(mCtrlLanguage);
|
||||
mActualSettings.add(mCtrlScreenRes);
|
||||
mActualSettings.add(mCtrlPointerMode);
|
||||
mActualSettings.add(mCtrlPointerMulti);
|
||||
@ -267,7 +267,7 @@ public class ActivityLauncher extends ActivityWithToolbar
|
||||
private void onConfigUpdated()
|
||||
{
|
||||
updateCtrlConfig(mCtrlScreenRes, mConfig);
|
||||
updateCtrlConfig(mCtrlCodepage, mConfig);
|
||||
updateCtrlConfig(mCtrlLanguage, mConfig);
|
||||
updateCtrlConfig(mCtrlPointerMode, mConfig);
|
||||
updateCtrlConfig(mCtrlPointerMulti, mConfig);
|
||||
updateCtrlConfig(mCtrlSoundVol, mConfig);
|
||||
|
@ -50,7 +50,7 @@ import eu.vcmi.vcmi.util.ServerResponse;
|
||||
public class ActivityMods extends ActivityWithToolbar
|
||||
{
|
||||
private static final boolean ENABLE_REPO_DOWNLOADING = true;
|
||||
private static final String REPO_URL = "https://raw.githubusercontent.com/vcmi/vcmi-mods-repository/develop/github.json";
|
||||
private static final String REPO_URL = "https://raw.githubusercontent.com/vcmi/vcmi-mods-repository/develop/vcmi-1.2.json";
|
||||
private VCMIModsRepo mRepo;
|
||||
private RecyclerView mRecycler;
|
||||
|
||||
|
@ -14,13 +14,13 @@ import eu.vcmi.vcmi.util.Log;
|
||||
*/
|
||||
public class Config
|
||||
{
|
||||
public static final String DEFAULT_CODEPAGE = "CP1250";
|
||||
public static final String DEFAULT_LANGUAGE = "english";
|
||||
public static final int DEFAULT_MUSIC_VALUE = 5;
|
||||
public static final int DEFAULT_SOUND_VALUE = 5;
|
||||
public static final int DEFAULT_SCREEN_RES_W = 800;
|
||||
public static final int DEFAULT_SCREEN_RES_H = 600;
|
||||
|
||||
public String mCodepage;
|
||||
public String mLanguage;
|
||||
public int mResolutionWidth;
|
||||
public int mResolutionHeight;
|
||||
public boolean mSwipeEnabled;
|
||||
@ -85,7 +85,7 @@ public class Config
|
||||
final Config config = new Config();
|
||||
final JSONObject general = accessNode(obj, "general");
|
||||
final JSONObject server = accessNode(obj, "server");
|
||||
config.mCodepage = loadEntry(general, "encoding", DEFAULT_CODEPAGE);
|
||||
config.mLanguage = loadEntry(general, "language", DEFAULT_LANGUAGE);
|
||||
config.mVolumeSound = loadEntry(general, "sound", DEFAULT_SOUND_VALUE);
|
||||
config.mVolumeMusic = loadEntry(general, "music", DEFAULT_MUSIC_VALUE);
|
||||
config.mSwipeEnabled = loadEntry(general, "swipe", true);
|
||||
@ -101,9 +101,9 @@ public class Config
|
||||
return config;
|
||||
}
|
||||
|
||||
public void updateCodepage(final String s)
|
||||
public void updateLanguage(final String s)
|
||||
{
|
||||
mCodepage = s;
|
||||
mLanguage = s;
|
||||
mIsModified = true;
|
||||
}
|
||||
|
||||
@ -202,9 +202,9 @@ public class Config
|
||||
final JSONObject screenRes = screenResNode == null ? new JSONObject() : screenResNode;
|
||||
final JSONObject server = serverNode == null ? new JSONObject() : serverNode;
|
||||
|
||||
if (mCodepage != null)
|
||||
if (mLanguage != null)
|
||||
{
|
||||
general.put("encoding", mCodepage);
|
||||
general.put("language", mLanguage);
|
||||
}
|
||||
|
||||
general.put("swipe", mSwipeEnabled);
|
||||
@ -230,4 +230,4 @@ public class Config
|
||||
|
||||
return root.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
package eu.vcmi.vcmi.settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import eu.vcmi.vcmi.R;
|
||||
|
||||
/**
|
||||
* @author F
|
||||
*/
|
||||
public class CodepageSettingDialog extends LauncherSettingDialog<String>
|
||||
{
|
||||
private static final List<String> AVAILABLE_CODEPAGES = new ArrayList<>();
|
||||
|
||||
static
|
||||
{
|
||||
AVAILABLE_CODEPAGES.add("CP1250");
|
||||
AVAILABLE_CODEPAGES.add("CP1251");
|
||||
AVAILABLE_CODEPAGES.add("CP1252");
|
||||
AVAILABLE_CODEPAGES.add("GBK");
|
||||
AVAILABLE_CODEPAGES.add("GB2312");
|
||||
}
|
||||
|
||||
public CodepageSettingDialog()
|
||||
{
|
||||
super(AVAILABLE_CODEPAGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int dialogTitleResId()
|
||||
{
|
||||
return R.string.launcher_btn_cp_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CharSequence itemName(final String item)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
@ -8,9 +8,9 @@ import eu.vcmi.vcmi.R;
|
||||
/**
|
||||
* @author F
|
||||
*/
|
||||
public class CodepageSettingController extends LauncherSettingWithDialogController<String, Config>
|
||||
public class LanguageSettingController extends LauncherSettingWithDialogController<String, Config>
|
||||
{
|
||||
public CodepageSettingController(final AppCompatActivity activity)
|
||||
public LanguageSettingController(final AppCompatActivity activity)
|
||||
{
|
||||
super(activity);
|
||||
}
|
||||
@ -18,20 +18,20 @@ public class CodepageSettingController extends LauncherSettingWithDialogControll
|
||||
@Override
|
||||
protected LauncherSettingDialog<String> dialog()
|
||||
{
|
||||
return new CodepageSettingDialog();
|
||||
return new LanguageSettingDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemChosen(final String item)
|
||||
{
|
||||
mConfig.updateCodepage(item);
|
||||
mConfig.updateLanguage(item);
|
||||
updateContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String mainText()
|
||||
{
|
||||
return mActivity.getString(R.string.launcher_btn_cp_title);
|
||||
return mActivity.getString(R.string.launcher_btn_language_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,8 +41,8 @@ public class CodepageSettingController extends LauncherSettingWithDialogControll
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return mConfig.mCodepage == null || mConfig.mCodepage.isEmpty()
|
||||
? mActivity.getString(R.string.launcher_btn_cp_subtitle_unknown)
|
||||
: mActivity.getString(R.string.launcher_btn_cp_subtitle, mConfig.mCodepage);
|
||||
return mConfig.mLanguage == null || mConfig.mLanguage.isEmpty()
|
||||
? mActivity.getString(R.string.launcher_btn_language_subtitle_unknown)
|
||||
: mActivity.getString(R.string.launcher_btn_language_subtitle, mConfig.mLanguage);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package eu.vcmi.vcmi.settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import eu.vcmi.vcmi.R;
|
||||
|
||||
/**
|
||||
* @author F
|
||||
*/
|
||||
public class LanguageSettingDialog extends LauncherSettingDialog<String>
|
||||
{
|
||||
private static final List<String> AVAILABLE_LANGUAGES = new ArrayList<>();
|
||||
|
||||
static
|
||||
{
|
||||
AVAILABLE_LANGUAGES.add("english");
|
||||
AVAILABLE_LANGUAGES.add("chinese");
|
||||
AVAILABLE_LANGUAGES.add("french");
|
||||
AVAILABLE_LANGUAGES.add("german");
|
||||
AVAILABLE_LANGUAGES.add("korean");
|
||||
AVAILABLE_LANGUAGES.add("polish");
|
||||
AVAILABLE_LANGUAGES.add("russian");
|
||||
AVAILABLE_LANGUAGES.add("spanish");
|
||||
AVAILABLE_LANGUAGES.add("ukrainian");
|
||||
AVAILABLE_LANGUAGES.add("other_cp1250");
|
||||
AVAILABLE_LANGUAGES.add("other_cp1251");
|
||||
AVAILABLE_LANGUAGES.add("other_cp1252");
|
||||
}
|
||||
|
||||
public LanguageSettingDialog()
|
||||
{
|
||||
super(AVAILABLE_LANGUAGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int dialogTitleResId()
|
||||
{
|
||||
return R.string.launcher_btn_language_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CharSequence itemName(final String item)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
@ -10,9 +10,9 @@
|
||||
<string name="launcher_btn_start_subtitle">Aktuelle VCMI-Version: %1$s</string>
|
||||
<string name="launcher_btn_mods_title">Mods</string>
|
||||
<string name="launcher_btn_mods_subtitle">Neue Burgen, Kreaturen, Objekte und Erweiterungen hinzufügen</string>
|
||||
<string name="launcher_btn_cp_title">Zeichensatz</string>
|
||||
<string name="launcher_btn_cp_subtitle_unknown">Aktuell: unbekannt</string>
|
||||
<string name="launcher_btn_cp_subtitle">Aktuell: %1$s</string>
|
||||
<string name="launcher_btn_language_title">Sprache</string>
|
||||
<string name="launcher_btn_language_subtitle_unknown">Aktuell: unbekannt</string>
|
||||
<string name="launcher_btn_language_subtitle">Aktuell: %1$s</string>
|
||||
<string name="launcher_btn_pointermode_title">Zeigermodus ändern</string>
|
||||
<string name="launcher_btn_pointermode_subtitle">Aktuell: %1$s</string>
|
||||
<string name="launcher_btn_pointermulti_subtitle">Aktuell: %1$s</string>
|
||||
|
@ -10,9 +10,9 @@
|
||||
<string name="launcher_btn_start_subtitle">Obecna wersja VCMI: %1$s</string>
|
||||
<string name="launcher_btn_mods_title">Mody</string>
|
||||
<string name="launcher_btn_mods_subtitle">Zainstaluj nowe frakcje, obiekty, dodatki</string>
|
||||
<string name="launcher_btn_cp_title">Strona kodowa</string>
|
||||
<string name="launcher_btn_cp_subtitle_unknown">Obecnie: nieznane</string>
|
||||
<string name="launcher_btn_cp_subtitle">Obecnie: %1$s</string>
|
||||
<string name="launcher_btn_language_title">Język</string>
|
||||
<string name="launcher_btn_language_subtitle_unknown">Obecnie: nieznane</string>
|
||||
<string name="launcher_btn_language_subtitle">Obecnie: %1$s</string>
|
||||
<string name="launcher_btn_pointermode_title">Zmień tryb kursora</string>
|
||||
<string name="launcher_btn_pointermode_subtitle">Obecnie: %1$s</string>
|
||||
<string name="launcher_btn_pointermulti_title">Mnożnik prędkości kursora</string>
|
||||
|
@ -10,9 +10,9 @@
|
||||
<string name="launcher_btn_start_subtitle">Текущая версия VCMI: %1$s</string>
|
||||
<string name="launcher_btn_mods_title">Моды</string>
|
||||
<string name="launcher_btn_mods_subtitle">Добавить новые замки, существа, объекты, расширения</string>
|
||||
<string name="launcher_btn_cp_title">Кодовая страница</string>
|
||||
<string name="launcher_btn_cp_subtitle_unknown">Текущая: неизвестно</string>
|
||||
<string name="launcher_btn_cp_subtitle">Текущая: %1$s</string>
|
||||
<string name="launcher_btn_language_title">Язык</string>
|
||||
<string name="launcher_btn_language_subtitle_unknown">Текущая: неизвестно</string>
|
||||
<string name="launcher_btn_language_subtitle">Текущая: %1$s</string>
|
||||
<string name="launcher_btn_pointermode_title">Изменить режим управления указателем</string>
|
||||
<string name="launcher_btn_pointermode_subtitle">Currently: %1$s</string>
|
||||
<string name="launcher_btn_pointermulti_subtitle">Текущая: %1$s</string>
|
||||
@ -60,4 +60,4 @@
|
||||
<string name="launcher_btn_import_title">Загрузить данные VCMI во внутреннее хранилище</string>
|
||||
<string name="launcher_btn_import_description">Скопировать данные VCMI во внутреннее хранилище. Вы можете загрузить старую папку vcmi-data от версии 0.99 или файлы Героев</string>
|
||||
<string name="launcher_progress_copy">Копируем %1$s</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -10,9 +10,9 @@
|
||||
<string name="launcher_btn_start_subtitle">Поточна версія VCMI: %1$s</string>
|
||||
<string name="launcher_btn_mods_title">Моди</string>
|
||||
<string name="launcher_btn_mods_subtitle">Додати нові замки, істот, об’єкти, розширення</string>
|
||||
<string name="launcher_btn_cp_title">Кодова сторінка</string>
|
||||
<string name="launcher_btn_cp_subtitle_unknown">Поточна: невідомо</string>
|
||||
<string name="launcher_btn_cp_subtitle">Поточна: %1$s</string>
|
||||
<string name="launcher_btn_language_title">Мова</string>
|
||||
<string name="launcher_btn_language_subtitle_unknown">Поточна: невідомо</string>
|
||||
<string name="launcher_btn_language_subtitle">Поточна: %1$s</string>
|
||||
<string name="launcher_btn_pointermode_title">Змінити режим керування курсором</string>
|
||||
<string name="launcher_btn_pointermode_subtitle">Поточна: %1$s</string>
|
||||
<string name="launcher_btn_pointermulti_subtitle">Поточна: %1$s</string>
|
||||
@ -60,4 +60,4 @@
|
||||
<string name="launcher_btn_import_title">Завантажити дані VCMI у внутрішнє сховище</string>
|
||||
<string name="launcher_btn_import_description">Копіювати дані VCMI у внутрішнє сховище. Ви можете завантажити стару папку vcmi-data від версії 0.99 чи файли героїв</string>
|
||||
<string name="launcher_progress_copy">Копіюємо %1$s</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -15,9 +15,9 @@
|
||||
<string name="launcher_btn_start_subtitle">Current VCMI version: %1$s</string>
|
||||
<string name="launcher_btn_mods_title">Mods</string>
|
||||
<string name="launcher_btn_mods_subtitle">Install new factions, objects, extras</string>
|
||||
<string name="launcher_btn_cp_title">Codepage</string>
|
||||
<string name="launcher_btn_cp_subtitle_unknown">Currently: unknown</string>
|
||||
<string name="launcher_btn_cp_subtitle">Currently: %1$s</string>
|
||||
<string name="launcher_btn_language_title">Language</string>
|
||||
<string name="launcher_btn_language_subtitle_unknown">Currently: unknown</string>
|
||||
<string name="launcher_btn_language_subtitle">Currently: %1$s</string>
|
||||
<string name="launcher_btn_pointermode_title">Change pointer mode</string>
|
||||
<string name="launcher_btn_pointermode_subtitle">Currently: %1$s</string>
|
||||
<string name="launcher_btn_pointermulti_title">Relative pointer speed multiplier</string>
|
||||
|
Loading…
Reference in New Issue
Block a user