Commit e602df51 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'feature/account_color' into develop

parents cfacbc7e f510b01c
......@@ -14,12 +14,6 @@
*/
package com.xabber.android.data.account;
import java.security.KeyPair;
import java.util.Date;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Type;
import com.xabber.android.data.NetworkException;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.connection.ConnectionItem;
......@@ -29,6 +23,12 @@ import com.xabber.android.data.connection.ProxyType;
import com.xabber.android.data.connection.TLSMode;
import com.xabber.androiddev.R;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Type;
import java.security.KeyPair;
import java.util.Date;
/**
* Represent account settings and status.
*
......@@ -51,7 +51,7 @@ public class AccountItem extends ConnectionItem {
*/
private final String account;
private final int colorIndex;
private int colorIndex;
/**
* Whether account is enabled.
......@@ -436,4 +436,7 @@ public class AccountItem extends ConnectionItem {
return Math.min(128, Math.max(-128, priority));
}
public void setColorIndex(int colorIndex) {
this.colorIndex = colorIndex;
}
}
......@@ -67,7 +67,6 @@ public class AccountEditor extends ManagedActivity implements
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new AccountEditorFragment()).commit();
} else {
token = savedInstanceState.getString(SAVED_TOKEN);
}
......@@ -92,11 +91,11 @@ public class AccountEditor extends ManagedActivity implements
token = INVALIDATED_TOKEN;
} else {
String value = OAuthActivity.getToken(data);
if (value == null)
Application.getInstance().onError(
R.string.AUTHENTICATION_FAILED);
else
if (value == null) {
Application.getInstance().onError(R.string.AUTHENTICATION_FAILED);
} else {
token = value;
}
}
((AccountEditorFragment) getFragmentManager().findFragmentById(
......@@ -109,9 +108,8 @@ public class AccountEditor extends ManagedActivity implements
@Override
public boolean onPreferenceClick(Preference preference) {
if (getString(R.string.account_oauth_key).equals(preference.getKey())) {
startActivityForResult(OAuthActivity.createIntent(this, accountItem
.getConnectionSettings().getProtocol()),
OAUTH_WML_REQUEST_CODE);
startActivityForResult(OAuthActivity.createIntent(this,
accountItem.getConnectionSettings().getProtocol()), OAUTH_WML_REQUEST_CODE);
return true;
}
return false;
......@@ -120,8 +118,7 @@ public class AccountEditor extends ManagedActivity implements
@Override
protected Dialog onCreateDialog(int id) {
if (id == ORBOT_DIALOG_ID) {
return new OrbotInstallerDialogBuilder(this, ORBOT_DIALOG_ID)
.create();
return new OrbotInstallerDialogBuilder(this, ORBOT_DIALOG_ID).create();
}
return super.onCreateDialog(id);
}
......@@ -131,8 +128,7 @@ public class AccountEditor extends ManagedActivity implements
}
public static Intent createIntent(Context context, String account) {
return new AccountIntentBuilder(context, AccountEditor.class)
.setAccount(account).build();
return new AccountIntentBuilder(context, AccountEditor.class).setAccount(account).build();
}
@Override
......@@ -152,9 +148,8 @@ public class AccountEditor extends ManagedActivity implements
@Override
public void onOAuthClick() {
startActivityForResult(OAuthActivity.createIntent(this, accountItem
.getConnectionSettings().getProtocol()),
OAUTH_WML_REQUEST_CODE);
startActivityForResult(OAuthActivity.createIntent(this,
accountItem.getConnectionSettings().getProtocol()), OAUTH_WML_REQUEST_CODE);
}
@Override
......
......@@ -162,4 +162,10 @@
<string name="orbot_required_message">Для использования TOR необходимо установить приложение Orbot и активировать в нём передачу данных. Вы хотите установить его из Google Play?</string>
<string name="orbot_required_title">Установить Orbot?</string>
<string name="ACCOUNT_REGISTER_FAILED">Не удалось зарегистрировать аккаунт на сервере.</string>
<string name="account_color_name_green">Зеленый</string>
<string name="account_color_name_orange">Оранжевый</string>
<string name="account_color_name_red">Красный</string>
<string name="account_color_name_blue">Синий</string>
<string name="account_color">Цвет учётной записи</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/account_editor_02.png -->
<string name="account_compression">Use compression</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/account_editor_01.png -->
......@@ -162,4 +162,10 @@
<string name="orbot_required_message">In order to process using TOR you must have Orbot installed and activated to proxy traffic through it. Would you like to install it from Google Play?</string>
<string name="orbot_required_title">Install Orbot?</string>
<string name="ACCOUNT_REGISTER_FAILED">Failed to register account on the server.</string>
<string name="account_color_name_green">Green</string>
<string name="account_color_name_orange">Orange</string>
<string name="account_color_name_red">Red</string>
<string name="account_color_name_blue">Blue</string>
<string name="account_color">Account color</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="account_color_names">
<item>@string/account_color_name_green</item>
<item>@string/account_color_name_orange</item>
<item>@string/account_color_name_red</item>
<item>@string/account_color_name_blue</item>
</array>
<array name="account_action_bar">
<item>@color/teal_500</item>
<item>@color/deep_orange_500</item>
......
......@@ -397,6 +397,7 @@
<string name="account_proxy_password_key">account_proxy_password</string>
<string name="account_custom_key">account_custom</string>
<string name="account_archive_mode_key">account_archive_mode</string>
<string name="account_color_key">account_color_key</string>
<string-array name="account_tls_entries">
<item>@string/account_tls_enable</item>
......
......@@ -19,6 +19,12 @@
android:summary="@string/account_enabled_summary"
android:key="@string/account_enabled_key"
/>
<ListPreference
android:title="@string/account_color"
android:key="@string/account_color_key"
android:entries="@array/account_color_names"
android:entryValues="@array/account_color_names"
/>
<CheckBoxPreference
android:title="@string/account_syncable"
android:summary="@string/account_syncable_summary"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment