mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Merge pull request #33 from Ansa89/language_chooser
Add language chooser
This commit is contained in:
commit
82cabce86e
@ -13,6 +13,7 @@ import com.limelight.grid.AppGridAdapter;
|
|||||||
import com.limelight.nvstream.http.GfeHttpResponseException;
|
import com.limelight.nvstream.http.GfeHttpResponseException;
|
||||||
import com.limelight.nvstream.http.NvApp;
|
import com.limelight.nvstream.http.NvApp;
|
||||||
import com.limelight.nvstream.http.NvHTTP;
|
import com.limelight.nvstream.http.NvHTTP;
|
||||||
|
import com.limelight.preferences.PreferenceConfiguration;
|
||||||
import com.limelight.utils.Dialog;
|
import com.limelight.utils.Dialog;
|
||||||
import com.limelight.utils.SpinnerDialog;
|
import com.limelight.utils.SpinnerDialog;
|
||||||
import com.limelight.utils.UiHelper;
|
import com.limelight.utils.UiHelper;
|
||||||
@ -51,6 +52,16 @@ public class AppView extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String locale = prefs.getString(PreferenceConfiguration.LANGUAGE_PREF_STRING,
|
||||||
|
PreferenceConfiguration.DEFAULT_LANGUAGE);
|
||||||
|
if (!locale.equals(PreferenceConfiguration.DEFAULT_LANGUAGE)) {
|
||||||
|
Configuration config = new Configuration(getResources().getConfiguration());
|
||||||
|
config.locale = new Locale(locale);
|
||||||
|
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_app_view);
|
setContentView(R.layout.activity_app_view);
|
||||||
|
|
||||||
UiHelper.notifyNewRootView(this);
|
UiHelper.notifyNewRootView(this);
|
||||||
|
@ -87,6 +87,15 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String locale = prefs.getString(PreferenceConfiguration.LANGUAGE_PREF_STRING,
|
||||||
|
PreferenceConfiguration.DEFAULT_LANGUAGE);
|
||||||
|
if (!locale.equals(PreferenceConfiguration.DEFAULT_LANGUAGE)) {
|
||||||
|
Configuration config = new Configuration(getResources().getConfiguration());
|
||||||
|
config.locale = new Locale(locale);
|
||||||
|
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
// We don't want a title bar
|
// We don't want a title bar
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import com.limelight.nvstream.http.PairingManager;
|
|||||||
import com.limelight.nvstream.http.PairingManager.PairState;
|
import com.limelight.nvstream.http.PairingManager.PairState;
|
||||||
import com.limelight.nvstream.wol.WakeOnLanSender;
|
import com.limelight.nvstream.wol.WakeOnLanSender;
|
||||||
import com.limelight.preferences.AddComputerManually;
|
import com.limelight.preferences.AddComputerManually;
|
||||||
|
import com.limelight.preferences.PreferenceConfiguration;
|
||||||
import com.limelight.preferences.StreamSettings;
|
import com.limelight.preferences.StreamSettings;
|
||||||
import com.limelight.utils.Dialog;
|
import com.limelight.utils.Dialog;
|
||||||
import com.limelight.utils.UiHelper;
|
import com.limelight.utils.UiHelper;
|
||||||
@ -151,6 +152,15 @@ public class PcView extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String locale = prefs.getString(PreferenceConfiguration.LANGUAGE_PREF_STRING,
|
||||||
|
PreferenceConfiguration.DEFAULT_LANGUAGE);
|
||||||
|
if (!locale.equals(PreferenceConfiguration.DEFAULT_LANGUAGE)) {
|
||||||
|
Configuration config = new Configuration(getResources().getConfiguration());
|
||||||
|
config.locale = new Locale(locale);
|
||||||
|
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
// Bind to the computer manager service
|
// Bind to the computer manager service
|
||||||
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
||||||
Service.BIND_AUTO_CREATE);
|
Service.BIND_AUTO_CREATE);
|
||||||
|
@ -132,6 +132,15 @@ public class AddComputerManually extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String locale = prefs.getString(PreferenceConfiguration.LANGUAGE_PREF_STRING,
|
||||||
|
PreferenceConfiguration.DEFAULT_LANGUAGE);
|
||||||
|
if (!locale.equals(PreferenceConfiguration.DEFAULT_LANGUAGE)) {
|
||||||
|
Configuration config = new Configuration(getResources().getConfiguration());
|
||||||
|
config.locale = new Locale(locale);
|
||||||
|
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_add_computer_manually);
|
setContentView(R.layout.activity_add_computer_manually);
|
||||||
|
|
||||||
UiHelper.notifyNewRootView(this);
|
UiHelper.notifyNewRootView(this);
|
||||||
|
@ -13,6 +13,7 @@ public class PreferenceConfiguration {
|
|||||||
private static final String DISABLE_TOASTS_PREF_STRING = "checkbox_disable_warnings";
|
private static final String DISABLE_TOASTS_PREF_STRING = "checkbox_disable_warnings";
|
||||||
private static final String HOST_AUDIO_PREF_STRING = "checkbox_host_audio";
|
private static final String HOST_AUDIO_PREF_STRING = "checkbox_host_audio";
|
||||||
private static final String DEADZONE_PREF_STRING = "seekbar_deadzone";
|
private static final String DEADZONE_PREF_STRING = "seekbar_deadzone";
|
||||||
|
public static final String LANGUAGE_PREF_STRING = "list_languages";
|
||||||
|
|
||||||
private static final int BITRATE_DEFAULT_720_30 = 5;
|
private static final int BITRATE_DEFAULT_720_30 = 5;
|
||||||
private static final int BITRATE_DEFAULT_720_60 = 10;
|
private static final int BITRATE_DEFAULT_720_60 = 10;
|
||||||
@ -27,6 +28,7 @@ public class PreferenceConfiguration {
|
|||||||
private static final boolean DEFAULT_DISABLE_TOASTS = false;
|
private static final boolean DEFAULT_DISABLE_TOASTS = false;
|
||||||
private static final boolean DEFAULT_HOST_AUDIO = false;
|
private static final boolean DEFAULT_HOST_AUDIO = false;
|
||||||
private static final int DEFAULT_DEADZONE = 15;
|
private static final int DEFAULT_DEADZONE = 15;
|
||||||
|
public static final String DEFAULT_LANGUAGE = "default";
|
||||||
|
|
||||||
public static final int FORCE_HARDWARE_DECODER = -1;
|
public static final int FORCE_HARDWARE_DECODER = -1;
|
||||||
public static final int AUTOSELECT_DECODER = 0;
|
public static final int AUTOSELECT_DECODER = 0;
|
||||||
@ -37,6 +39,7 @@ public class PreferenceConfiguration {
|
|||||||
public int decoder;
|
public int decoder;
|
||||||
public int deadzonePercentage;
|
public int deadzonePercentage;
|
||||||
public boolean stretchVideo, enableSops, playHostAudio, disableWarnings;
|
public boolean stretchVideo, enableSops, playHostAudio, disableWarnings;
|
||||||
|
public String language;
|
||||||
|
|
||||||
public static int getDefaultBitrate(String resFpsString) {
|
public static int getDefaultBitrate(String resFpsString) {
|
||||||
if (resFpsString.equals("720p30")) {
|
if (resFpsString.equals("720p30")) {
|
||||||
@ -135,6 +138,8 @@ public class PreferenceConfiguration {
|
|||||||
|
|
||||||
config.deadzonePercentage = prefs.getInt(DEADZONE_PREF_STRING, DEFAULT_DEADZONE);
|
config.deadzonePercentage = prefs.getInt(DEADZONE_PREF_STRING, DEFAULT_DEADZONE);
|
||||||
|
|
||||||
|
config.language = prefs.getString(LANGUAGE_PREF_STRING, DEFAULT_LANGUAGE);
|
||||||
|
|
||||||
// Checkbox preferences
|
// Checkbox preferences
|
||||||
config.disableWarnings = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS);
|
config.disableWarnings = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS);
|
||||||
config.enableSops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
config.enableSops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
||||||
|
@ -15,6 +15,15 @@ public class StreamSettings extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String locale = prefs.getString(PreferenceConfigration.LANGUAGE_PREF_STRING,
|
||||||
|
PreferenceConfiguration.DEFAULT_LANGUAGE);
|
||||||
|
if (!locale.equals(PreferenceConfiguration.DEFAULT_LANGUAGE)) {
|
||||||
|
Configuration config = new Configuration(getResources().getConfiguration());
|
||||||
|
config.locale = new Locale(locale);
|
||||||
|
getResources().updateConfiguration(config, getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_stream_settings);
|
setContentView(R.layout.activity_stream_settings);
|
||||||
getFragmentManager().beginTransaction().replace(
|
getFragmentManager().beginTransaction().replace(
|
||||||
R.id.stream_settings, new SettingsFragment()
|
R.id.stream_settings, new SettingsFragment()
|
||||||
|
@ -89,6 +89,8 @@
|
|||||||
<string name="title_checkbox_stretch_video">Forza video in full-screen</string>
|
<string name="title_checkbox_stretch_video">Forza video in full-screen</string>
|
||||||
<string name="title_checkbox_disable_warnings">Disabilita messaggi di warning</string>
|
<string name="title_checkbox_disable_warnings">Disabilita messaggi di warning</string>
|
||||||
<string name="summary_checkbox_disable_warnings">Disabilita i messaggi di warning sullo schermo durante lo streaming</string>
|
<string name="summary_checkbox_disable_warnings">Disabilita i messaggi di warning sullo schermo durante lo streaming</string>
|
||||||
|
<string name="title_language_list">Lingua</string>
|
||||||
|
<string name="summary_language_list">Lingua da usare in Limelight</string>
|
||||||
|
|
||||||
<string name="category_gamepad_settings">Impostazioni Gamepad</string>
|
<string name="category_gamepad_settings">Impostazioni Gamepad</string>
|
||||||
<string name="title_seekbar_deadzone">Aggiusta deadzone degli stick analogici</string>
|
<string name="title_seekbar_deadzone">Aggiusta deadzone degli stick analogici</string>
|
||||||
|
@ -13,6 +13,17 @@
|
|||||||
<item>1080p60</item>
|
<item>1080p60</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="language_names" translatable="false">
|
||||||
|
<item>Default</item>
|
||||||
|
<item>English</item>
|
||||||
|
<item>Italiano</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="language_values" translatable="false">
|
||||||
|
<item>default</item>
|
||||||
|
<item>en</item>
|
||||||
|
<item>it</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="decoder_names">
|
<string-array name="decoder_names">
|
||||||
<item>Auto-select Decoder</item>
|
<item>Auto-select Decoder</item>
|
||||||
<item>Force Software Decoding</item>
|
<item>Force Software Decoding</item>
|
||||||
|
@ -89,6 +89,8 @@
|
|||||||
<string name="title_checkbox_stretch_video">Stretch video to full-screen</string>
|
<string name="title_checkbox_stretch_video">Stretch video to full-screen</string>
|
||||||
<string name="title_checkbox_disable_warnings">Disable warning messages</string>
|
<string name="title_checkbox_disable_warnings">Disable warning messages</string>
|
||||||
<string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string>
|
<string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string>
|
||||||
|
<string name="title_language_list">Language</string>
|
||||||
|
<string name="summary_language_list">Language to use for Limelight</string>
|
||||||
|
|
||||||
<string name="category_gamepad_settings">Gamepad Settings</string>
|
<string name="category_gamepad_settings">Gamepad Settings</string>
|
||||||
<string name="title_seekbar_deadzone">Adjust analog stick deadzone</string>
|
<string name="title_seekbar_deadzone">Adjust analog stick deadzone</string>
|
||||||
|
@ -25,6 +25,13 @@
|
|||||||
android:title="@string/title_checkbox_disable_warnings"
|
android:title="@string/title_checkbox_disable_warnings"
|
||||||
android:summary="@string/summary_checkbox_disable_warnings"
|
android:summary="@string/summary_checkbox_disable_warnings"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
<ListPreference
|
||||||
|
android:key="list_languages"
|
||||||
|
android:title="@string/title_language_list"
|
||||||
|
android:entries="@array/language_names"
|
||||||
|
android:entryvalues="@array/language_values"
|
||||||
|
android:summary="@string/summary_language_list"
|
||||||
|
android:defaultvalue="default" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<!--PreferenceCategory android:title="@string/category_gamepad_settings">
|
<!--PreferenceCategory android:title="@string/category_gamepad_settings">
|
||||||
<com.limelight.preferences.SeekBarPreference
|
<com.limelight.preferences.SeekBarPreference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user