Refactored application settings, added client hostname (#1343)
This commit is contained in:
parent
91c6d0db20
commit
70e43e682e
@ -7,6 +7,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -23,4 +24,6 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.2.0'
|
||||
compile 'com.android.support:support-v4:25.2.0'
|
||||
compile 'com.android.support:support-vector-drawable:25.2.0'
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.freerdp.freerdpcore"
|
||||
android:installLocation="auto"
|
||||
@ -30,6 +29,7 @@
|
||||
android:theme="@style/Theme.Main">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
@ -40,10 +40,12 @@
|
||||
<activity-alias
|
||||
android:name=".presentation.CreateShortcuts"
|
||||
android:label="@string/title_create_shortcut"
|
||||
android:targetActivity="com.freerdp.freerdpcore.presentation.ShortcutsActivity">
|
||||
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
|
||||
android:targetActivity=".presentation.ShortcutsActivity">
|
||||
|
||||
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@ -54,7 +56,9 @@
|
||||
android:theme="@style/Theme.Settings">
|
||||
<intent-filter>
|
||||
<action android:name="freerdp.intent.action.BOOKMARK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="preferences" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
@ -62,7 +66,7 @@
|
||||
android:name=".presentation.ApplicationSettingsActivity"
|
||||
android:label="@string/title_application_settings"
|
||||
android:theme="@style/Theme.Settings"
|
||||
android:windowSoftInputMode="stateHidden"></activity>
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".presentation.SessionActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|keyboard"
|
||||
@ -82,11 +86,11 @@
|
||||
<activity
|
||||
android:name=".presentation.AboutActivity"
|
||||
android:label="@string/title_about"
|
||||
android:theme="@style/Theme.Main"></activity>
|
||||
android:theme="@style/Theme.Main" />
|
||||
<activity
|
||||
android:name=".presentation.HelpActivity"
|
||||
android:label="@string/title_help"
|
||||
android:theme="@style/Theme.Main"></activity>
|
||||
android:theme="@style/Theme.Main" />
|
||||
|
||||
<receiver
|
||||
android:name=".application.NetworkStateReceiver"
|
||||
@ -95,6 +99,7 @@
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -17,6 +17,7 @@ import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.freerdp.freerdpcore.domain.BookmarkBase;
|
||||
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
|
||||
import com.freerdp.freerdpcore.services.BookmarkDB;
|
||||
import com.freerdp.freerdpcore.services.HistoryDB;
|
||||
import com.freerdp.freerdpcore.services.LibFreeRDP;
|
||||
@ -68,8 +69,8 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener {
|
||||
}
|
||||
|
||||
// Disconnect handling for Screen on/off events
|
||||
static public void startDisconnectTimer() {
|
||||
int timeoutMinutes = GlobalSettings.getDisconnectTimeout();
|
||||
public void startDisconnectTimer() {
|
||||
final int timeoutMinutes = ApplicationSettingsActivity.getDisconnectTimeout(this);
|
||||
if (timeoutMinutes > 0) {
|
||||
// start disconnect timeout...
|
||||
disconnectTimer = new Timer();
|
||||
@ -119,6 +120,9 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
/* Initialize preferences. */
|
||||
ApplicationSettingsActivity.get(this);
|
||||
|
||||
bookmarkDB = new BookmarkDB(this);
|
||||
|
||||
manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB);
|
||||
@ -126,7 +130,6 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener {
|
||||
historyDB = new HistoryDB(this);
|
||||
quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB);
|
||||
|
||||
GlobalSettings.init(this);
|
||||
ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this);
|
||||
|
||||
// init screen receiver here (this can't be declared in AndroidManifest - refer to:
|
||||
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
Global Settings helper class
|
||||
|
||||
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.freerdp.freerdpcore.application;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class GlobalSettings {
|
||||
|
||||
private static final String PREF_UI_ASKONEXIT = "ui.ask_on_exit";
|
||||
private static final String PREF_UI_HIDESTATUSBAR = "ui.hide_status_bar";
|
||||
private static final String PREF_UI_INVERTSCROLLING = "ui.invert_scrolling";
|
||||
private static final String PREF_UI_SWAPMOUSEBUTTONS = "ui.swap_mouse_buttons";
|
||||
private static final String PREF_UI_HIDEZOOMCONTROLS = "ui.hide_zoom_controls";
|
||||
private static final String PREF_UI_AUTOSCROLLTOUCHPOINTER = "ui.auto_scroll_touchpointer";
|
||||
|
||||
private static final String PREF_POWER_DISCONNECTTIMEOUT = "power.disconnect_timeout";
|
||||
|
||||
private static final String PREF_SECURITY_ACCEPTALLCERTIFICATES = "security.accept_certificates";
|
||||
|
||||
private static SharedPreferences settings;
|
||||
|
||||
public static void init(Context context) {
|
||||
settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
initValues();
|
||||
}
|
||||
|
||||
private static void initValues() {
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
|
||||
if (!settings.contains(PREF_UI_HIDESTATUSBAR))
|
||||
editor.putBoolean(PREF_UI_HIDESTATUSBAR, false);
|
||||
if (!settings.contains(PREF_UI_HIDEZOOMCONTROLS))
|
||||
editor.putBoolean(PREF_UI_HIDEZOOMCONTROLS, true);
|
||||
if (!settings.contains(PREF_UI_SWAPMOUSEBUTTONS))
|
||||
editor.putBoolean(PREF_UI_SWAPMOUSEBUTTONS, false);
|
||||
if (!settings.contains(PREF_UI_INVERTSCROLLING))
|
||||
editor.putBoolean(PREF_UI_INVERTSCROLLING, false);
|
||||
if (!settings.contains(PREF_UI_ASKONEXIT))
|
||||
editor.putBoolean(PREF_UI_ASKONEXIT, true);
|
||||
if (!settings.contains(PREF_UI_AUTOSCROLLTOUCHPOINTER))
|
||||
editor.putBoolean(PREF_UI_AUTOSCROLLTOUCHPOINTER, true);
|
||||
if (!settings.contains(PREF_POWER_DISCONNECTTIMEOUT))
|
||||
editor.putInt(PREF_POWER_DISCONNECTTIMEOUT, 5);
|
||||
if (!settings.contains(PREF_SECURITY_ACCEPTALLCERTIFICATES))
|
||||
editor.putBoolean(PREF_SECURITY_ACCEPTALLCERTIFICATES, false);
|
||||
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static boolean getHideStatusBar() {
|
||||
return settings.getBoolean(PREF_UI_HIDESTATUSBAR, false);
|
||||
}
|
||||
|
||||
public static void setHideStatusBar(boolean hide) {
|
||||
settings.edit().putBoolean(PREF_UI_HIDESTATUSBAR, hide).commit();
|
||||
}
|
||||
|
||||
public static boolean getHideZoomControls() {
|
||||
return settings.getBoolean(PREF_UI_HIDEZOOMCONTROLS, true);
|
||||
}
|
||||
|
||||
public static void setHideZoomControls(boolean hide) {
|
||||
settings.edit().putBoolean(PREF_UI_HIDEZOOMCONTROLS, hide).commit();
|
||||
}
|
||||
|
||||
public static boolean getSwapMouseButtons() {
|
||||
return settings.getBoolean(PREF_UI_SWAPMOUSEBUTTONS, false);
|
||||
}
|
||||
|
||||
public static void setSwapMouseButtons(boolean swap) {
|
||||
settings.edit().putBoolean(PREF_UI_SWAPMOUSEBUTTONS, swap).commit();
|
||||
}
|
||||
|
||||
public static boolean getInvertScrolling() {
|
||||
return settings.getBoolean(PREF_UI_INVERTSCROLLING, false);
|
||||
}
|
||||
|
||||
public static void setInvertScrolling(boolean invert) {
|
||||
settings.edit().putBoolean(PREF_UI_INVERTSCROLLING, invert).commit();
|
||||
}
|
||||
|
||||
public static boolean getAskOnExit() {
|
||||
return settings.getBoolean(PREF_UI_ASKONEXIT, true);
|
||||
}
|
||||
|
||||
public static void setAskOnExit(boolean ask) {
|
||||
settings.edit().putBoolean(PREF_UI_ASKONEXIT, ask).commit();
|
||||
}
|
||||
|
||||
public static boolean getAutoScrollTouchPointer() {
|
||||
return settings.getBoolean(PREF_UI_AUTOSCROLLTOUCHPOINTER, true);
|
||||
}
|
||||
|
||||
public static void setAutoScrollTouchPointer(boolean scroll) {
|
||||
settings.edit().putBoolean(PREF_UI_AUTOSCROLLTOUCHPOINTER, scroll).commit();
|
||||
}
|
||||
|
||||
public static boolean getAcceptAllCertificates() {
|
||||
return settings.getBoolean(PREF_SECURITY_ACCEPTALLCERTIFICATES, false);
|
||||
}
|
||||
|
||||
public static void setAcceptAllCertificates(boolean accept) {
|
||||
settings.edit().putBoolean(PREF_SECURITY_ACCEPTALLCERTIFICATES, accept).commit();
|
||||
}
|
||||
|
||||
public static int getDisconnectTimeout() {
|
||||
return settings.getInt(PREF_POWER_DISCONNECTTIMEOUT, 5);
|
||||
}
|
||||
|
||||
public static void setDisconnectTimeout(int timeoutMinutes) {
|
||||
settings.edit().putInt(PREF_POWER_DISCONNECTTIMEOUT, timeoutMinutes).commit();
|
||||
}
|
||||
|
||||
}
|
@ -18,11 +18,12 @@ public class ScreenReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
GlobalApp app = (GlobalApp) context.getApplicationContext();
|
||||
Log.v("ScreenReceiver", "Received action: " + intent.getAction());
|
||||
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
|
||||
GlobalApp.startDisconnectTimer();
|
||||
app.startDisconnectTimer();
|
||||
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
|
||||
GlobalApp.cancelDisconnectTimer();
|
||||
app.cancelDisconnectTimer();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
package com.freerdp.freerdpcore.application;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
@ -58,11 +59,11 @@ public class SessionState implements Parcelable {
|
||||
this.uiEventListener = null;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
public void connect(Context context) {
|
||||
if (bookmark != null) {
|
||||
LibFreeRDP.setConnectionInfo(instance, bookmark);
|
||||
LibFreeRDP.setConnectionInfo(context, instance, bookmark);
|
||||
} else {
|
||||
LibFreeRDP.setConnectionInfo(instance, openUri);
|
||||
LibFreeRDP.setConnectionInfo(context, instance, openUri);
|
||||
}
|
||||
LibFreeRDP.connect(instance);
|
||||
}
|
||||
|
@ -9,93 +9,218 @@
|
||||
|
||||
package com.freerdp.freerdpcore.presentation;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.freerdp.freerdpcore.R;
|
||||
import com.freerdp.freerdpcore.utils.AppCompatPreferenceActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ApplicationSettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
|
||||
|
||||
private Preference prefEraseAllCertificates;
|
||||
public class ApplicationSettingsActivity extends AppCompatPreferenceActivity {
|
||||
private static boolean isXLargeTablet(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Log.v("SettingsActivity", "onCreate");
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.application_settings);
|
||||
setupActionBar();
|
||||
}
|
||||
|
||||
prefEraseAllCertificates = (Preference) findPreference("security.clear_certificate_cache");
|
||||
|
||||
// erase certificate cache button
|
||||
prefEraseAllCertificates.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(preference.getContext());
|
||||
builder.setTitle(R.string.dlg_title_clear_cert_cache)
|
||||
.setMessage(R.string.dlg_msg_clear_cert_cache)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
clearCertificateCache();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// register for preferences changed notification
|
||||
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
onSharedPreferenceChanged(getPreferenceManager().getSharedPreferences(), "power.disconnect_timeout");
|
||||
private void setupActionBar() {
|
||||
android.app.ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals("power.disconnect_timeout")) {
|
||||
int val = sharedPreferences.getInt(key, 5);
|
||||
Preference pref = findPreference(key);
|
||||
if (pref != null) {
|
||||
if (val == 0)
|
||||
pref.setSummary(getResources().getString(R.string.settings_description_disabled));
|
||||
public boolean onIsMultiPane() {
|
||||
return isXLargeTablet(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.settings_app_headers, target);
|
||||
}
|
||||
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return PreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| ClientPreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| UiPreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| PowerPreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| SecurityPreferenceFragment.class.getName().equals(fragmentName);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class ClientPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings_app_client);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class UiPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings_app_ui);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class PowerPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings_app_power);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class SecurityPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings_app_security);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
final String clear = getString(R.string.preference_key_security_clear_certificate_cache);
|
||||
if (preference.getKey().equals(clear)) {
|
||||
showDialog();
|
||||
return true;
|
||||
} else {
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.dlg_title_clear_cert_cache)
|
||||
.setMessage(R.string.dlg_msg_clear_cert_cache)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
clearCertificateCache();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_delete)
|
||||
.show();
|
||||
}
|
||||
|
||||
private boolean deleteDirectory(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (String file : children) {
|
||||
if (!deleteDirectory(new File(dir, file)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
private void clearCertificateCache() {
|
||||
Context context = getActivity();
|
||||
if ((new File(context.getFilesDir() + "/.freerdp")).exists()) {
|
||||
if (deleteDirectory(new File(context.getFilesDir() + "/.freerdp")))
|
||||
Toast.makeText(context, R.string.info_reset_success, Toast.LENGTH_LONG).show();
|
||||
else
|
||||
pref.setSummary(String.format(getResources().getString(R.string.settings_description_after_minutes), val));
|
||||
}
|
||||
Toast.makeText(context, R.string.info_reset_failed, Toast.LENGTH_LONG).show();
|
||||
} else
|
||||
Toast.makeText(context, R.string.info_reset_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean deleteDirectory(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (String file : children) {
|
||||
if (!deleteDirectory(new File(dir, file)))
|
||||
return false;
|
||||
}
|
||||
public static SharedPreferences get(Context context) {
|
||||
Context appContext = context.getApplicationContext();
|
||||
PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_client, false);
|
||||
PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_power, false);
|
||||
PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_security, false);
|
||||
PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_ui, false);
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(appContext);
|
||||
|
||||
final String key = context.getString(R.string.preference_key_client_name);
|
||||
final String value = preferences.getString(key, "");
|
||||
if (value.isEmpty()) {
|
||||
final String android_id = UUID.randomUUID().toString();
|
||||
final String defaultValue = context.getString(R.string.preference_default_client_name);
|
||||
final String name = defaultValue + "-" + android_id;
|
||||
preferences.edit().putString(key, name.substring(0, 31)).apply();
|
||||
}
|
||||
return dir.delete();
|
||||
|
||||
return preferences;
|
||||
}
|
||||
|
||||
private void clearCertificateCache() {
|
||||
if ((new File(getFilesDir() + "/.freerdp")).exists()) {
|
||||
if (deleteDirectory(new File(getFilesDir() + "/.freerdp")))
|
||||
Toast.makeText(this, R.string.info_reset_success, Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toast.makeText(this, R.string.info_reset_failed, Toast.LENGTH_LONG).show();
|
||||
} else
|
||||
Toast.makeText(this, R.string.info_reset_success, Toast.LENGTH_LONG).show();
|
||||
public static int getDisconnectTimeout(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getInt(context.getString(R.string.preference_key_power_disconnect_timeout), 0);
|
||||
}
|
||||
|
||||
public static boolean getHideStatusBar(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_hide_status_bar), false);
|
||||
}
|
||||
|
||||
public static boolean getAcceptAllCertificates(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_accept_certificates), false);
|
||||
}
|
||||
|
||||
public static boolean getHideZoomControls(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_hide_zoom_controls), false);
|
||||
}
|
||||
|
||||
public static boolean getSwapMouseButtons(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_swap_mouse_buttons), false);
|
||||
}
|
||||
|
||||
public static boolean getInvertScrolling(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_invert_scrolling), false);
|
||||
}
|
||||
|
||||
public static boolean getAskOnExit(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_ask_on_exit), false);
|
||||
}
|
||||
|
||||
public static boolean getAutoScrollTouchPointer(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getBoolean(context.getString(R.string.preference_key_ui_auto_scroll_touchpointer), false);
|
||||
}
|
||||
|
||||
public static String getClientName(Context context) {
|
||||
SharedPreferences preferences = get(context);
|
||||
return preferences.getString(context.getString(R.string.preference_key_client_name), "");
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
package com.freerdp.freerdpcore.presentation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@ -36,7 +35,6 @@ import android.widget.ListView;
|
||||
|
||||
import com.freerdp.freerdpcore.R;
|
||||
import com.freerdp.freerdpcore.application.GlobalApp;
|
||||
import com.freerdp.freerdpcore.application.GlobalSettings;
|
||||
import com.freerdp.freerdpcore.domain.BookmarkBase;
|
||||
import com.freerdp.freerdpcore.domain.ConnectionReference;
|
||||
import com.freerdp.freerdpcore.domain.PlaceholderBookmark;
|
||||
@ -236,9 +234,9 @@ public class HomeActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// if back was pressed - ask the user if he really wants to exit
|
||||
if (GlobalSettings.getAskOnExit()) {
|
||||
if (ApplicationSettingsActivity.getAskOnExit(this)) {
|
||||
final CheckBox cb = new CheckBox(this);
|
||||
cb.setChecked(!GlobalSettings.getAskOnExit());
|
||||
cb.setChecked(!ApplicationSettingsActivity.getAskOnExit(this));
|
||||
cb.setText(R.string.dlg_dont_show_again);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
@ -247,13 +245,11 @@ public class HomeActivity extends AppCompatActivity {
|
||||
.setView(cb)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
GlobalSettings.setAskOnExit(!cb.isChecked());
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
GlobalSettings.setAskOnExit(!cb.isChecked());
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
|
@ -30,7 +30,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@ -48,7 +47,6 @@ import android.widget.ZoomControls;
|
||||
|
||||
import com.freerdp.freerdpcore.R;
|
||||
import com.freerdp.freerdpcore.application.GlobalApp;
|
||||
import com.freerdp.freerdpcore.application.GlobalSettings;
|
||||
import com.freerdp.freerdpcore.application.SessionState;
|
||||
import com.freerdp.freerdpcore.domain.BookmarkBase;
|
||||
import com.freerdp.freerdpcore.domain.ConnectionReference;
|
||||
@ -104,8 +102,6 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
private int screen_width;
|
||||
private int screen_height;
|
||||
|
||||
private boolean autoScrollTouchPointer = GlobalSettings
|
||||
.getAutoScrollTouchPointer();
|
||||
private boolean connectCancelledByUser = false;
|
||||
private boolean sessionRunning = false;
|
||||
private boolean toggleMouseButtons = false;
|
||||
@ -197,7 +193,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// show status bar or make fullscreen?
|
||||
if (GlobalSettings.getHideStatusBar()) {
|
||||
if (ApplicationSettingsActivity.getHideStatusBar(this)) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
@ -472,7 +468,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
session.connect();
|
||||
session.connect(getApplicationContext());
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
@ -894,7 +890,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public int OnVerifiyCertificate(String commonName, String subject, String issuer, String fingerprint, boolean mismatch) {
|
||||
// see if global settings says accept all
|
||||
if (GlobalSettings.getAcceptAllCertificates())
|
||||
if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
|
||||
return 0;
|
||||
|
||||
// this is where the return code of our dialog will be stored
|
||||
@ -925,7 +921,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public int OnVerifyChangedCertificate(String commonName, String subject, String issuer, String fingerprint, String oldSubject, String oldIssuer, String oldFingerprint) {
|
||||
// see if global settings says accept all
|
||||
if (GlobalSettings.getAcceptAllCertificates())
|
||||
if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
|
||||
return 0;
|
||||
|
||||
// this is where the return code of our dialog will be stored
|
||||
@ -972,7 +968,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
int oldx, int oldy) {
|
||||
zoomControls.setIsZoomInEnabled(!sessionView.isAtMaxZoom());
|
||||
zoomControls.setIsZoomOutEnabled(!sessionView.isAtMinZoom());
|
||||
if (!GlobalSettings.getHideZoomControls()
|
||||
if (!ApplicationSettingsActivity.getHideZoomControls(this)
|
||||
&& zoomControls.getVisibility() != View.VISIBLE)
|
||||
zoomControls.show();
|
||||
resetZoomControlsAutoHideTimeout();
|
||||
@ -999,8 +995,8 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
session.getInstance(),
|
||||
x,
|
||||
y,
|
||||
toggleMouseButtons ? Mouse.getRightButtonEvent(down) : Mouse
|
||||
.getLeftButtonEvent(down));
|
||||
toggleMouseButtons ? Mouse.getRightButtonEvent(this, down) : Mouse
|
||||
.getLeftButtonEvent(this, down));
|
||||
|
||||
if (!down)
|
||||
toggleMouseButtons = false;
|
||||
@ -1019,7 +1015,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onSessionViewScroll(boolean down) {
|
||||
LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0,
|
||||
Mouse.getScrollEvent(down));
|
||||
Mouse.getScrollEvent(this, down));
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
@ -1046,14 +1042,14 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
public void onTouchPointerLeftClick(int x, int y, boolean down) {
|
||||
Point p = mapScreenCoordToSessionCoord(x, y);
|
||||
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
|
||||
Mouse.getLeftButtonEvent(down));
|
||||
Mouse.getLeftButtonEvent(this, down));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchPointerRightClick(int x, int y, boolean down) {
|
||||
Point p = mapScreenCoordToSessionCoord(x, y);
|
||||
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
|
||||
Mouse.getRightButtonEvent(down));
|
||||
Mouse.getRightButtonEvent(this, down));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1062,7 +1058,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
|
||||
Mouse.getMoveEvent());
|
||||
|
||||
if (autoScrollTouchPointer
|
||||
if (ApplicationSettingsActivity.getAutoScrollTouchPointer(this)
|
||||
&& !uiHandler.hasMessages(UIHandler.SCROLLING_REQUESTED)) {
|
||||
Log.v(TAG, "Starting auto-scroll");
|
||||
uiHandler.sendEmptyMessageDelayed(UIHandler.SCROLLING_REQUESTED,
|
||||
@ -1073,7 +1069,7 @@ public class SessionActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onTouchPointerScroll(boolean down) {
|
||||
LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0,
|
||||
Mouse.getScrollEvent(down));
|
||||
Mouse.getScrollEvent(this, down));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@ import com.freerdp.freerdpcore.application.GlobalApp;
|
||||
import com.freerdp.freerdpcore.application.SessionState;
|
||||
import com.freerdp.freerdpcore.domain.BookmarkBase;
|
||||
import com.freerdp.freerdpcore.domain.ManualBookmark;
|
||||
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -104,7 +105,7 @@ public class LibFreeRDP {
|
||||
return "-" + name;
|
||||
}
|
||||
|
||||
public static boolean setConnectionInfo(long inst, BookmarkBase bookmark) {
|
||||
public static boolean setConnectionInfo(Context context, long inst, BookmarkBase bookmark) {
|
||||
BookmarkBase.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
|
||||
BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings();
|
||||
BookmarkBase.DebugSettings debug = bookmark.getDebugSettings();
|
||||
@ -115,6 +116,10 @@ public class LibFreeRDP {
|
||||
args.add(TAG);
|
||||
args.add("/gdi:sw");
|
||||
|
||||
final String clientName = ApplicationSettingsActivity.getClientName(context);
|
||||
if (!clientName.isEmpty()) {
|
||||
args.add("/client-hostname:\""+clientName+"\"");
|
||||
}
|
||||
String certName = "";
|
||||
if (bookmark.getType() != BookmarkBase.TYPE_MANUAL) {
|
||||
return false;
|
||||
@ -243,8 +248,8 @@ public class LibFreeRDP {
|
||||
return freerdp_parse_arguments(inst, arrayArgs);
|
||||
}
|
||||
|
||||
public static boolean setConnectionInfo(long inst, Uri openUri) {
|
||||
ArrayList<String> args = new ArrayList<String>();
|
||||
public static boolean setConnectionInfo(Context context, long inst, Uri openUri) {
|
||||
ArrayList<String> args = new ArrayList<>();
|
||||
|
||||
// Parse URI from query string. Same key overwrite previous one
|
||||
// freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
|
||||
@ -253,6 +258,11 @@ public class LibFreeRDP {
|
||||
args.add(TAG);
|
||||
args.add("/gdi:sw");
|
||||
|
||||
final String clientName = ApplicationSettingsActivity.getClientName(context);
|
||||
if (!clientName.isEmpty()) {
|
||||
args.add("/client-hostname:\""+clientName+"\"");
|
||||
}
|
||||
|
||||
// Parse hostname and port. Set to 'v' argument
|
||||
String hostname = openUri.getHost();
|
||||
int port = openUri.getPort();
|
||||
|
@ -0,0 +1,107 @@
|
||||
package com.freerdp.freerdpcore.utils;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return mDelegate;
|
||||
}
|
||||
}
|
@ -9,7 +9,9 @@
|
||||
|
||||
package com.freerdp.freerdpcore.utils;
|
||||
|
||||
import com.freerdp.freerdpcore.application.GlobalSettings;
|
||||
import android.content.Context;
|
||||
|
||||
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
|
||||
|
||||
public class Mouse {
|
||||
|
||||
@ -22,15 +24,15 @@ public class Mouse {
|
||||
private final static int PTRFLAGS_WHEEL = 0x0200;
|
||||
private final static int PTRFLAGS_WHEEL_NEGATIVE = 0x0100;
|
||||
|
||||
public static int getLeftButtonEvent(boolean down) {
|
||||
if (GlobalSettings.getSwapMouseButtons())
|
||||
public static int getLeftButtonEvent(Context context, boolean down) {
|
||||
if (ApplicationSettingsActivity.getSwapMouseButtons(context))
|
||||
return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0));
|
||||
else
|
||||
return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0));
|
||||
}
|
||||
|
||||
public static int getRightButtonEvent(boolean down) {
|
||||
if (GlobalSettings.getSwapMouseButtons())
|
||||
public static int getRightButtonEvent(Context context, boolean down) {
|
||||
if (ApplicationSettingsActivity.getSwapMouseButtons(context))
|
||||
return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0));
|
||||
else
|
||||
return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0));
|
||||
@ -40,11 +42,11 @@ public class Mouse {
|
||||
return PTRFLAGS_MOVE;
|
||||
}
|
||||
|
||||
public static int getScrollEvent(boolean down) {
|
||||
public static int getScrollEvent(Context context, boolean down) {
|
||||
int flags = PTRFLAGS_WHEEL;
|
||||
|
||||
// invert scrolling?
|
||||
if (GlobalSettings.getInvertScrolling())
|
||||
if (ApplicationSettingsActivity.getInvertScrolling(context))
|
||||
down = !down;
|
||||
|
||||
if (down)
|
||||
|
@ -170,6 +170,7 @@
|
||||
<string name="settings_ui_auto_scroll_touchpointer">Touch Pointer Auto Scroll</string>
|
||||
<string name="settings_ui_ask_on_exit">Show Dialog on Exit</string>
|
||||
<string name="settings_cat_power">Power Saving</string>
|
||||
<string name="settings_cat_client">Client</string>
|
||||
<string name="settings_power_disconnect_timeout">Close idle Connections</string>
|
||||
<string name="settings_cat_security">Security</string>
|
||||
<string name="settings_security_accept_certificates">Accept all Certificates</string>
|
||||
@ -211,6 +212,19 @@
|
||||
<string name="dlg_msg_clear_cert_cache">Are you sure you want to delete all your cached Certificates?</string>
|
||||
<string name="debug_level">Debug Level</string>
|
||||
<string name="settings_debug">Debug Settings</string>
|
||||
<string name="preference_title_client">Client</string>
|
||||
<string name="preference_key_client_name" translatable="false">preference_key_client_name</string>
|
||||
<string name="preference_title_client_name">Client Name</string>
|
||||
<string name="preference_default_client_name">aFreeRDP</string>
|
||||
<string name="preference_key_accept_certificates" translatable="false">security.accept_certificates</string>
|
||||
<string name="preference_key_security_clear_certificate_cache" translatable="false">security.clear_certificate_cache</string>
|
||||
<string name="preference_key_power_disconnect_timeout" translatable="false">power.disconnect_timeout</string>
|
||||
<string name="preference_key_ui_hide_status_bar" translatable="false">ui.hide_status_bar</string>
|
||||
<string name="preference_key_ui_ask_on_exit" translatable="false">ui.ask_on_exit</string>
|
||||
<string name="preference_key_ui_auto_scroll_touchpointer" translatable="false">ui.auto_scroll_touchpointer</string>
|
||||
<string name="preference_key_ui_invert_scrolling" translatable="false">ui.invert_scrolling</string>
|
||||
<string name="preference_key_ui_swap_mouse_buttons" translatable="false">ui.swap_mouse_buttons</string>
|
||||
<string name="preference_key_ui_hide_zoom_controls" translatable="false">ui.hide_zoom_controls</string>
|
||||
<string-array name="debug_array">
|
||||
<item>OFF</item>
|
||||
<item>FATAL</item>
|
||||
@ -231,4 +245,77 @@
|
||||
<item>DEBUG</item>
|
||||
<item>TRACE</item>
|
||||
</string-array>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">General</string>
|
||||
|
||||
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||
<string name="pref_description_social_recommendations">Recommendations for people to contact
|
||||
based on your message history
|
||||
</string>
|
||||
|
||||
<string name="pref_title_display_name">Display name</string>
|
||||
<string name="pref_default_display_name">John Smith</string>
|
||||
|
||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||
<string-array name="pref_example_list_titles">
|
||||
<item>Always</item>
|
||||
<item>When possible</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_example_list_values">
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Example settings for Data & Sync -->
|
||||
<string name="pref_header_data_sync">Data & sync</string>
|
||||
|
||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
<string-array name="pref_sync_frequency_titles">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
<item>1 hour</item>
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_sync_frequency_values">
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>180</item>
|
||||
<item>360</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="list_preference_entries">
|
||||
<item>Entry 1</item>
|
||||
<item>Entry 2</item>
|
||||
<item>Entry 3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="list_preference_entry_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="multi_select_list_preference_default_value" />
|
||||
|
||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||
|
||||
<!-- Example settings for Notifications -->
|
||||
<string name="pref_header_notifications">Notifications</string>
|
||||
|
||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
<string name="pref_ringtone_silent">Silent</string>
|
||||
|
||||
<string name="pref_title_vibrate">Vibrate</string>
|
||||
</resources>
|
||||
|
@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
/*
|
||||
Application Settings Layout
|
||||
|
||||
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:freerdp="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_cat_ui">
|
||||
<CheckBoxPreference
|
||||
android:key="ui.hide_status_bar"
|
||||
android:title="@string/settings_ui_hide_status_bar" />
|
||||
<CheckBoxPreference
|
||||
android:key="ui.hide_zoom_controls"
|
||||
android:title="@string/settings_ui_hide_zoom_controls" />
|
||||
<CheckBoxPreference
|
||||
android:key="ui.swap_mouse_buttons"
|
||||
android:title="@string/settings_ui_swap_mouse_buttons" />
|
||||
<CheckBoxPreference
|
||||
android:key="ui.invert_scrolling"
|
||||
android:title="@string/settings_ui_invert_scrolling" />
|
||||
<CheckBoxPreference
|
||||
android:key="ui.auto_scroll_touchpointer"
|
||||
android:title="@string/settings_ui_auto_scroll_touchpointer" />
|
||||
<CheckBoxPreference
|
||||
android:key="ui.ask_on_exit"
|
||||
android:title="@string/settings_ui_ask_on_exit" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_cat_power">
|
||||
<com.freerdp.freerdpcore.utils.IntEditTextPreference
|
||||
android:inputType="number"
|
||||
android:key="power.disconnect_timeout"
|
||||
android:numeric="integer"
|
||||
android:title="@string/settings_power_disconnect_timeout"
|
||||
freerdp:bounds_default="5"
|
||||
freerdp:bounds_max="30"
|
||||
freerdp:bounds_min="0" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_cat_security">
|
||||
<CheckBoxPreference
|
||||
android:key="security.accept_certificates"
|
||||
android:title="@string/settings_security_accept_certificates" />
|
||||
<Preference
|
||||
android:key="security.clear_certificate_cache"
|
||||
android:title="@string/settings_security_clear_certificate_cache" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<EditTextPreference
|
||||
android:key="@string/preference_key_client_name"
|
||||
android:title="@string/preference_title_client_name" />
|
||||
</PreferenceScreen>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<header
|
||||
android:fragment="com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity$ClientPreferenceFragment"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/settings_cat_client" />
|
||||
|
||||
<header
|
||||
android:fragment="com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity$UiPreferenceFragment"
|
||||
android:icon="@android:drawable/ic_menu_view"
|
||||
android:title="@string/settings_cat_ui" />
|
||||
|
||||
<header
|
||||
android:fragment="com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity$PowerPreferenceFragment"
|
||||
android:icon="@android:drawable/ic_menu_manage"
|
||||
android:title="@string/settings_cat_power" />
|
||||
|
||||
<header
|
||||
android:fragment="com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity$SecurityPreferenceFragment"
|
||||
android:icon="@android:drawable/ic_secure"
|
||||
android:title="@string/settings_cat_security" />
|
||||
</preference-headers>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:freerdp="http://schemas.android.com/apk/res-auto">
|
||||
<com.freerdp.freerdpcore.utils.IntEditTextPreference
|
||||
android:inputType="number"
|
||||
android:key="@string/preference_key_power_disconnect_timeout"
|
||||
android:numeric="integer"
|
||||
android:title="@string/settings_power_disconnect_timeout"
|
||||
freerdp:bounds_default="5"
|
||||
freerdp:bounds_max="30"
|
||||
freerdp:bounds_min="0" />
|
||||
</PreferenceScreen>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_accept_certificates"
|
||||
android:title="@string/settings_security_accept_certificates" />
|
||||
<Preference
|
||||
android:key="@string/preference_key_security_clear_certificate_cache"
|
||||
android:title="@string/settings_security_clear_certificate_cache"/>
|
||||
</PreferenceScreen>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_hide_status_bar"
|
||||
android:title="@string/settings_ui_hide_status_bar" />
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_hide_zoom_controls"
|
||||
android:title="@string/settings_ui_hide_zoom_controls" />
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_swap_mouse_buttons"
|
||||
android:title="@string/settings_ui_swap_mouse_buttons" />
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_invert_scrolling"
|
||||
android:title="@string/settings_ui_invert_scrolling" />
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_auto_scroll_touchpointer"
|
||||
android:title="@string/settings_ui_auto_scroll_touchpointer" />
|
||||
<CheckBoxPreference
|
||||
android:key="@string/preference_key_ui_ask_on_exit"
|
||||
android:title="@string/settings_ui_ask_on_exit" />
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user