Refactored application settings, added client hostname (#1343)

This commit is contained in:
Armin Novak 2017-02-22 17:55:22 +01:00
parent 91c6d0db20
commit 70e43e682e
19 changed files with 517 additions and 289 deletions

View File

@ -7,6 +7,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 25 targetSdkVersion 25
vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {
@ -23,4 +24,6 @@ android {
dependencies { dependencies {
compile 'com.android.support:appcompat-v7:25.2.0' 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'
} }

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.freerdp.freerdpcore" package="com.freerdp.freerdpcore"
android:installLocation="auto" android:installLocation="auto"
@ -30,6 +29,7 @@
android:theme="@style/Theme.Main"> android:theme="@style/Theme.Main">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
@ -40,10 +40,12 @@
<activity-alias <activity-alias
android:name=".presentation.CreateShortcuts" android:name=".presentation.CreateShortcuts"
android:label="@string/title_create_shortcut" android:label="@string/title_create_shortcut"
android:targetActivity="com.freerdp.freerdpcore.presentation.ShortcutsActivity"> android:targetActivity=".presentation.ShortcutsActivity">
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" /> <action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
@ -54,7 +56,9 @@
android:theme="@style/Theme.Settings"> android:theme="@style/Theme.Settings">
<intent-filter> <intent-filter>
<action android:name="freerdp.intent.action.BOOKMARK" /> <action android:name="freerdp.intent.action.BOOKMARK" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="preferences" /> <data android:scheme="preferences" />
</intent-filter> </intent-filter>
</activity> </activity>
@ -62,7 +66,7 @@
android:name=".presentation.ApplicationSettingsActivity" android:name=".presentation.ApplicationSettingsActivity"
android:label="@string/title_application_settings" android:label="@string/title_application_settings"
android:theme="@style/Theme.Settings" android:theme="@style/Theme.Settings"
android:windowSoftInputMode="stateHidden"></activity> android:windowSoftInputMode="stateHidden" />
<activity <activity
android:name=".presentation.SessionActivity" android:name=".presentation.SessionActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard" android:configChanges="orientation|keyboardHidden|screenSize|keyboard"
@ -82,11 +86,11 @@
<activity <activity
android:name=".presentation.AboutActivity" android:name=".presentation.AboutActivity"
android:label="@string/title_about" android:label="@string/title_about"
android:theme="@style/Theme.Main"></activity> android:theme="@style/Theme.Main" />
<activity <activity
android:name=".presentation.HelpActivity" android:name=".presentation.HelpActivity"
android:label="@string/title_help" android:label="@string/title_help"
android:theme="@style/Theme.Main"></activity> android:theme="@style/Theme.Main" />
<receiver <receiver
android:name=".application.NetworkStateReceiver" android:name=".application.NetworkStateReceiver"
@ -95,6 +99,7 @@
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter> </intent-filter>
</receiver> </receiver>
</application>
</manifest>
</application>
</manifest>

View File

@ -17,6 +17,7 @@ import android.net.Uri;
import android.util.Log; import android.util.Log;
import com.freerdp.freerdpcore.domain.BookmarkBase; import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
import com.freerdp.freerdpcore.services.BookmarkDB; import com.freerdp.freerdpcore.services.BookmarkDB;
import com.freerdp.freerdpcore.services.HistoryDB; import com.freerdp.freerdpcore.services.HistoryDB;
import com.freerdp.freerdpcore.services.LibFreeRDP; 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 // Disconnect handling for Screen on/off events
static public void startDisconnectTimer() { public void startDisconnectTimer() {
int timeoutMinutes = GlobalSettings.getDisconnectTimeout(); final int timeoutMinutes = ApplicationSettingsActivity.getDisconnectTimeout(this);
if (timeoutMinutes > 0) { if (timeoutMinutes > 0) {
// start disconnect timeout... // start disconnect timeout...
disconnectTimer = new Timer(); disconnectTimer = new Timer();
@ -119,6 +120,9 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
/* Initialize preferences. */
ApplicationSettingsActivity.get(this);
bookmarkDB = new BookmarkDB(this); bookmarkDB = new BookmarkDB(this);
manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB); manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB);
@ -126,7 +130,6 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener {
historyDB = new HistoryDB(this); historyDB = new HistoryDB(this);
quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB); quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB);
GlobalSettings.init(this);
ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this); ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this);
// init screen receiver here (this can't be declared in AndroidManifest - refer to: // init screen receiver here (this can't be declared in AndroidManifest - refer to:

View File

@ -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();
}
}

View File

@ -18,11 +18,12 @@ public class ScreenReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
GlobalApp app = (GlobalApp) context.getApplicationContext();
Log.v("ScreenReceiver", "Received action: " + intent.getAction()); Log.v("ScreenReceiver", "Received action: " + intent.getAction());
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
GlobalApp.startDisconnectTimer(); app.startDisconnectTimer();
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
GlobalApp.cancelDisconnectTimer(); app.cancelDisconnectTimer();
} }
} }

View File

@ -9,6 +9,7 @@
package com.freerdp.freerdpcore.application; package com.freerdp.freerdpcore.application;
import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.net.Uri; import android.net.Uri;
@ -58,11 +59,11 @@ public class SessionState implements Parcelable {
this.uiEventListener = null; this.uiEventListener = null;
} }
public void connect() { public void connect(Context context) {
if (bookmark != null) { if (bookmark != null) {
LibFreeRDP.setConnectionInfo(instance, bookmark); LibFreeRDP.setConnectionInfo(context, instance, bookmark);
} else { } else {
LibFreeRDP.setConnectionInfo(instance, openUri); LibFreeRDP.setConnectionInfo(context, instance, openUri);
} }
LibFreeRDP.connect(instance); LibFreeRDP.connect(instance);
} }

View File

@ -9,93 +9,218 @@
package com.freerdp.freerdpcore.presentation; package com.freerdp.freerdpcore.presentation;
import android.app.AlertDialog; import android.annotation.TargetApi;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceFragment;
import android.preference.PreferenceActivity; import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.support.v7.app.AlertDialog;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.freerdp.freerdpcore.R; import com.freerdp.freerdpcore.R;
import com.freerdp.freerdpcore.utils.AppCompatPreferenceActivity;
import java.io.File; import java.io.File;
import java.util.List;
import java.util.UUID;
public class ApplicationSettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { public class ApplicationSettingsActivity extends AppCompatPreferenceActivity {
private static boolean isXLargeTablet(Context context) {
private Preference prefEraseAllCertificates; return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
Log.v("SettingsActivity", "onCreate");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.application_settings); setupActionBar();
}
prefEraseAllCertificates = (Preference) findPreference("security.clear_certificate_cache"); private void setupActionBar() {
android.app.ActionBar actionBar = getActionBar();
// erase certificate cache button if (actionBar != null) {
prefEraseAllCertificates.setOnPreferenceClickListener(new OnPreferenceClickListener() { actionBar.setDisplayHomeAsUpEnabled(true);
@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");
} }
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public boolean onIsMultiPane() {
if (key.equals("power.disconnect_timeout")) { return isXLargeTablet(this);
int val = sharedPreferences.getInt(key, 5); }
Preference pref = findPreference(key);
if (pref != null) { @Override
if (val == 0) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
pref.setSummary(getResources().getString(R.string.settings_description_disabled)); 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 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) { public static SharedPreferences get(Context context) {
if (dir.isDirectory()) { Context appContext = context.getApplicationContext();
String[] children = dir.list(); PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_client, false);
for (String file : children) { PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_power, false);
if (!deleteDirectory(new File(dir, file))) PreferenceManager.setDefaultValues(appContext, R.xml.settings_app_security, false);
return 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() { public static int getDisconnectTimeout(Context context) {
if ((new File(getFilesDir() + "/.freerdp")).exists()) { SharedPreferences preferences = get(context);
if (deleteDirectory(new File(getFilesDir() + "/.freerdp"))) return preferences.getInt(context.getString(R.string.preference_key_power_disconnect_timeout), 0);
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(); public static boolean getHideStatusBar(Context context) {
} else SharedPreferences preferences = get(context);
Toast.makeText(this, R.string.info_reset_success, Toast.LENGTH_LONG).show(); 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), "");
} }
} }

View File

@ -9,7 +9,6 @@
package com.freerdp.freerdpcore.presentation; package com.freerdp.freerdpcore.presentation;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -36,7 +35,6 @@ import android.widget.ListView;
import com.freerdp.freerdpcore.R; import com.freerdp.freerdpcore.R;
import com.freerdp.freerdpcore.application.GlobalApp; import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.GlobalSettings;
import com.freerdp.freerdpcore.domain.BookmarkBase; import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ConnectionReference; import com.freerdp.freerdpcore.domain.ConnectionReference;
import com.freerdp.freerdpcore.domain.PlaceholderBookmark; import com.freerdp.freerdpcore.domain.PlaceholderBookmark;
@ -236,9 +234,9 @@ public class HomeActivity extends AppCompatActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// if back was pressed - ask the user if he really wants to exit // 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); final CheckBox cb = new CheckBox(this);
cb.setChecked(!GlobalSettings.getAskOnExit()); cb.setChecked(!ApplicationSettingsActivity.getAskOnExit(this));
cb.setText(R.string.dlg_dont_show_again); cb.setText(R.string.dlg_dont_show_again);
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
@ -247,13 +245,11 @@ public class HomeActivity extends AppCompatActivity {
.setView(cb) .setView(cb)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
GlobalSettings.setAskOnExit(!cb.isChecked());
finish(); finish();
} }
}) })
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
GlobalSettings.setAskOnExit(!cb.isChecked());
dialog.dismiss(); dialog.dismiss();
} }
}) })

View File

@ -30,7 +30,6 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -48,7 +47,6 @@ import android.widget.ZoomControls;
import com.freerdp.freerdpcore.R; import com.freerdp.freerdpcore.R;
import com.freerdp.freerdpcore.application.GlobalApp; import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.GlobalSettings;
import com.freerdp.freerdpcore.application.SessionState; import com.freerdp.freerdpcore.application.SessionState;
import com.freerdp.freerdpcore.domain.BookmarkBase; import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ConnectionReference; import com.freerdp.freerdpcore.domain.ConnectionReference;
@ -104,8 +102,6 @@ public class SessionActivity extends AppCompatActivity implements
private int screen_width; private int screen_width;
private int screen_height; private int screen_height;
private boolean autoScrollTouchPointer = GlobalSettings
.getAutoScrollTouchPointer();
private boolean connectCancelledByUser = false; private boolean connectCancelledByUser = false;
private boolean sessionRunning = false; private boolean sessionRunning = false;
private boolean toggleMouseButtons = false; private boolean toggleMouseButtons = false;
@ -197,7 +193,7 @@ public class SessionActivity extends AppCompatActivity implements
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// show status bar or make fullscreen? // show status bar or make fullscreen?
if (GlobalSettings.getHideStatusBar()) { if (ApplicationSettingsActivity.getHideStatusBar(this)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
} }
@ -472,7 +468,7 @@ public class SessionActivity extends AppCompatActivity implements
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
public void run() { public void run() {
session.connect(); session.connect(getApplicationContext());
} }
}); });
thread.start(); thread.start();
@ -894,7 +890,7 @@ public class SessionActivity extends AppCompatActivity implements
@Override @Override
public int OnVerifiyCertificate(String commonName, String subject, String issuer, String fingerprint, boolean mismatch) { public int OnVerifiyCertificate(String commonName, String subject, String issuer, String fingerprint, boolean mismatch) {
// see if global settings says accept all // see if global settings says accept all
if (GlobalSettings.getAcceptAllCertificates()) if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
return 0; return 0;
// this is where the return code of our dialog will be stored // this is where the return code of our dialog will be stored
@ -925,7 +921,7 @@ public class SessionActivity extends AppCompatActivity implements
@Override @Override
public int OnVerifyChangedCertificate(String commonName, String subject, String issuer, String fingerprint, String oldSubject, String oldIssuer, String oldFingerprint) { public int OnVerifyChangedCertificate(String commonName, String subject, String issuer, String fingerprint, String oldSubject, String oldIssuer, String oldFingerprint) {
// see if global settings says accept all // see if global settings says accept all
if (GlobalSettings.getAcceptAllCertificates()) if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
return 0; return 0;
// this is where the return code of our dialog will be stored // 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) { int oldx, int oldy) {
zoomControls.setIsZoomInEnabled(!sessionView.isAtMaxZoom()); zoomControls.setIsZoomInEnabled(!sessionView.isAtMaxZoom());
zoomControls.setIsZoomOutEnabled(!sessionView.isAtMinZoom()); zoomControls.setIsZoomOutEnabled(!sessionView.isAtMinZoom());
if (!GlobalSettings.getHideZoomControls() if (!ApplicationSettingsActivity.getHideZoomControls(this)
&& zoomControls.getVisibility() != View.VISIBLE) && zoomControls.getVisibility() != View.VISIBLE)
zoomControls.show(); zoomControls.show();
resetZoomControlsAutoHideTimeout(); resetZoomControlsAutoHideTimeout();
@ -999,8 +995,8 @@ public class SessionActivity extends AppCompatActivity implements
session.getInstance(), session.getInstance(),
x, x,
y, y,
toggleMouseButtons ? Mouse.getRightButtonEvent(down) : Mouse toggleMouseButtons ? Mouse.getRightButtonEvent(this, down) : Mouse
.getLeftButtonEvent(down)); .getLeftButtonEvent(this, down));
if (!down) if (!down)
toggleMouseButtons = false; toggleMouseButtons = false;
@ -1019,7 +1015,7 @@ public class SessionActivity extends AppCompatActivity implements
@Override @Override
public void onSessionViewScroll(boolean down) { public void onSessionViewScroll(boolean down) {
LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0, 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) { public void onTouchPointerLeftClick(int x, int y, boolean down) {
Point p = mapScreenCoordToSessionCoord(x, y); Point p = mapScreenCoordToSessionCoord(x, y);
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y, LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
Mouse.getLeftButtonEvent(down)); Mouse.getLeftButtonEvent(this, down));
} }
@Override @Override
public void onTouchPointerRightClick(int x, int y, boolean down) { public void onTouchPointerRightClick(int x, int y, boolean down) {
Point p = mapScreenCoordToSessionCoord(x, y); Point p = mapScreenCoordToSessionCoord(x, y);
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y, LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
Mouse.getRightButtonEvent(down)); Mouse.getRightButtonEvent(this, down));
} }
@Override @Override
@ -1062,7 +1058,7 @@ public class SessionActivity extends AppCompatActivity implements
LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y, LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y,
Mouse.getMoveEvent()); Mouse.getMoveEvent());
if (autoScrollTouchPointer if (ApplicationSettingsActivity.getAutoScrollTouchPointer(this)
&& !uiHandler.hasMessages(UIHandler.SCROLLING_REQUESTED)) { && !uiHandler.hasMessages(UIHandler.SCROLLING_REQUESTED)) {
Log.v(TAG, "Starting auto-scroll"); Log.v(TAG, "Starting auto-scroll");
uiHandler.sendEmptyMessageDelayed(UIHandler.SCROLLING_REQUESTED, uiHandler.sendEmptyMessageDelayed(UIHandler.SCROLLING_REQUESTED,
@ -1073,7 +1069,7 @@ public class SessionActivity extends AppCompatActivity implements
@Override @Override
public void onTouchPointerScroll(boolean down) { public void onTouchPointerScroll(boolean down) {
LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0, LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0,
Mouse.getScrollEvent(down)); Mouse.getScrollEvent(this, down));
} }
@Override @Override

View File

@ -19,6 +19,7 @@ import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.SessionState; import com.freerdp.freerdpcore.application.SessionState;
import com.freerdp.freerdpcore.domain.BookmarkBase; import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ManualBookmark; import com.freerdp.freerdpcore.domain.ManualBookmark;
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
import java.util.ArrayList; import java.util.ArrayList;
@ -104,7 +105,7 @@ public class LibFreeRDP {
return "-" + name; 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.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings(); BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings();
BookmarkBase.DebugSettings debug = bookmark.getDebugSettings(); BookmarkBase.DebugSettings debug = bookmark.getDebugSettings();
@ -115,6 +116,10 @@ public class LibFreeRDP {
args.add(TAG); args.add(TAG);
args.add("/gdi:sw"); args.add("/gdi:sw");
final String clientName = ApplicationSettingsActivity.getClientName(context);
if (!clientName.isEmpty()) {
args.add("/client-hostname:\""+clientName+"\"");
}
String certName = ""; String certName = "";
if (bookmark.getType() != BookmarkBase.TYPE_MANUAL) { if (bookmark.getType() != BookmarkBase.TYPE_MANUAL) {
return false; return false;
@ -243,8 +248,8 @@ public class LibFreeRDP {
return freerdp_parse_arguments(inst, arrayArgs); return freerdp_parse_arguments(inst, arrayArgs);
} }
public static boolean setConnectionInfo(long inst, Uri openUri) { public static boolean setConnectionInfo(Context context, long inst, Uri openUri) {
ArrayList<String> args = new ArrayList<String>(); ArrayList<String> args = new ArrayList<>();
// Parse URI from query string. Same key overwrite previous one // Parse URI from query string. Same key overwrite previous one
// freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=- // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
@ -253,6 +258,11 @@ public class LibFreeRDP {
args.add(TAG); args.add(TAG);
args.add("/gdi:sw"); 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 // Parse hostname and port. Set to 'v' argument
String hostname = openUri.getHost(); String hostname = openUri.getHost();
int port = openUri.getPort(); int port = openUri.getPort();

View File

@ -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;
}
}

View File

@ -9,7 +9,9 @@
package com.freerdp.freerdpcore.utils; package com.freerdp.freerdpcore.utils;
import com.freerdp.freerdpcore.application.GlobalSettings; import android.content.Context;
import com.freerdp.freerdpcore.presentation.ApplicationSettingsActivity;
public class Mouse { public class Mouse {
@ -22,15 +24,15 @@ public class Mouse {
private final static int PTRFLAGS_WHEEL = 0x0200; private final static int PTRFLAGS_WHEEL = 0x0200;
private final static int PTRFLAGS_WHEEL_NEGATIVE = 0x0100; private final static int PTRFLAGS_WHEEL_NEGATIVE = 0x0100;
public static int getLeftButtonEvent(boolean down) { public static int getLeftButtonEvent(Context context, boolean down) {
if (GlobalSettings.getSwapMouseButtons()) if (ApplicationSettingsActivity.getSwapMouseButtons(context))
return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0)); return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0));
else else
return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0)); return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0));
} }
public static int getRightButtonEvent(boolean down) { public static int getRightButtonEvent(Context context, boolean down) {
if (GlobalSettings.getSwapMouseButtons()) if (ApplicationSettingsActivity.getSwapMouseButtons(context))
return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0)); return (PTRFLAGS_LBUTTON | (down ? PTRFLAGS_DOWN : 0));
else else
return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0)); return (PTRFLAGS_RBUTTON | (down ? PTRFLAGS_DOWN : 0));
@ -40,11 +42,11 @@ public class Mouse {
return PTRFLAGS_MOVE; return PTRFLAGS_MOVE;
} }
public static int getScrollEvent(boolean down) { public static int getScrollEvent(Context context, boolean down) {
int flags = PTRFLAGS_WHEEL; int flags = PTRFLAGS_WHEEL;
// invert scrolling? // invert scrolling?
if (GlobalSettings.getInvertScrolling()) if (ApplicationSettingsActivity.getInvertScrolling(context))
down = !down; down = !down;
if (down) if (down)

View File

@ -170,6 +170,7 @@
<string name="settings_ui_auto_scroll_touchpointer">Touch Pointer Auto Scroll</string> <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_ui_ask_on_exit">Show Dialog on Exit</string>
<string name="settings_cat_power">Power Saving</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_power_disconnect_timeout">Close idle Connections</string>
<string name="settings_cat_security">Security</string> <string name="settings_cat_security">Security</string>
<string name="settings_security_accept_certificates">Accept all Certificates</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="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="debug_level">Debug Level</string>
<string name="settings_debug">Debug Settings</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"> <string-array name="debug_array">
<item>OFF</item> <item>OFF</item>
<item>FATAL</item> <item>FATAL</item>
@ -231,4 +245,77 @@
<item>DEBUG</item> <item>DEBUG</item>
<item>TRACE</item> <item>TRACE</item>
</string-array> </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 &amp; 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> </resources>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>