Commit a8914c67 authored by Grigory Fedorov's avatar Grigory Fedorov

New package preferences. PreferenceEditor split to activity and...

 New package preferences. PreferenceEditor split to activity and PreferencesFragment used for main settings screen.
AboutViewer, AccountList and PhraseList are called via intent, described in preference_editor.xml.
parent 323f6072
......@@ -81,34 +81,34 @@
/>
<activity
android:label="@string/about_viewer"
android:name="com.xabber.android.ui.AboutViewer"
android:parentActivityName="com.xabber.android.ui.PreferenceEditor"
android:name="com.xabber.android.ui.preferences.AboutViewer"
android:parentActivityName="com.xabber.android.ui.preferences.PreferenceEditor"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.PreferenceEditor" />
android:value="com.xabber.android.ui.preferences.PreferenceEditor" />
</activity>
<activity
android:label="@string/preference_accounts"
android:name="com.xabber.android.ui.AccountList"
android:parentActivityName="com.xabber.android.ui.PreferenceEditor"
android:name="com.xabber.android.ui.preferences.AccountList"
android:parentActivityName="com.xabber.android.ui.preferences.PreferenceEditor"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.PreferenceEditor" />
android:value="com.xabber.android.ui.preferences.PreferenceEditor" />
</activity>
<activity
android:label="@string/account_editor"
android:name="com.xabber.android.ui.AccountEditor"
android:parentActivityName="com.xabber.android.ui.AccountList"
android:name="com.xabber.android.ui.preferences.AccountEditor"
android:parentActivityName="com.xabber.android.ui.preferences.AccountList"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.AccountList" />
android:value="com.xabber.android.ui.preferences.AccountList" />
</activity>
<activity
android:label="@string/chat_list"
......@@ -155,22 +155,22 @@
<activity
android:label="@string/contact_add"
android:name="com.xabber.android.ui.ContactAdd"
android:parentActivityName="com.xabber.android.ui.AccountList"
android:parentActivityName="com.xabber.android.ui.preferences.AccountList"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.AccountList" />
android:value="com.xabber.android.ui.preferences.AccountList" />
</activity>
<activity
android:label="@string/account_add"
android:name="com.xabber.android.ui.AccountAdd"
android:parentActivityName="com.xabber.android.ui.AccountList"
android:parentActivityName="com.xabber.android.ui.preferences.AccountList"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.AccountList" />
android:value="com.xabber.android.ui.preferences.AccountList" />
</activity>
<activity
android:label="@string/account_oauth"
......@@ -198,7 +198,7 @@
</activity>
<activity
android:label="@string/preference_editor"
android:name="com.xabber.android.ui.PreferenceEditor"
android:name="com.xabber.android.ui.preferences.PreferenceEditor"
android:parentActivityName="com.xabber.android.ui.ContactList"
>
......@@ -277,11 +277,11 @@
android:name="com.xabber.android.ui.ArchiveRequest"
/>
<activity
android:name="com.xabber.android.ui.PhraseList"
android:name="com.xabber.android.ui.preferences.PhraseList"
android:label="@string/events_phrases_title"
/>
<activity
android:name="com.xabber.android.ui.PhraseEditor"
android:name="com.xabber.android.ui.preferences.PhraseEditor"
/>
<activity
android:name="com.xabber.android.ui.ReconnectionActivity"
......
......@@ -29,7 +29,7 @@ import android.widget.Toast;
import com.xabber.android.data.SettingsManager.InterfaceTheme;
import com.xabber.android.ui.ContactList;
import com.xabber.android.ui.LoadActivity;
import com.xabber.android.ui.PreferenceEditor;
import com.xabber.android.ui.preferences.PreferenceEditor;
import com.xabber.androiddev.R;
/**
......
......@@ -19,7 +19,7 @@ import android.content.Intent;
import com.xabber.android.data.Application;
import com.xabber.android.data.entity.AccountRelated;
import com.xabber.android.data.notification.AccountNotificationItem;
import com.xabber.android.ui.AccountEditor;
import com.xabber.android.ui.preferences.AccountEditor;
import com.xabber.androiddev.R;
public class AccountAuthorizationError extends AccountRelated implements
......
......@@ -24,7 +24,6 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentTransaction;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
......@@ -55,6 +54,7 @@ import com.xabber.android.ui.dialog.AccountChooseDialogFragment.OnChoosedListene
import com.xabber.android.ui.dialog.ContactIntegrationDialogFragment;
import com.xabber.android.ui.dialog.StartAtBootDialogFragment;
import com.xabber.android.ui.helper.ManagedActivity;
import com.xabber.android.ui.preferences.PreferenceEditor;
import com.xabber.androiddev.R;
import com.xabber.xmpp.address.Jid;
import com.xabber.xmpp.uri.XMPPUri;
......
......@@ -39,6 +39,7 @@ import com.xabber.android.ui.adapter.ContactListState;
import com.xabber.android.ui.adapter.GroupConfiguration;
import com.xabber.android.ui.adapter.UpdatableAdapter;
import com.xabber.android.ui.helper.ContextMenuHelper;
import com.xabber.android.ui.preferences.AccountList;
import com.xabber.androiddev.R;
public class ContactListFragment extends Fragment implements
......
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import com.xabber.android.data.ActivityManager;
import com.xabber.android.data.Application;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.StatusMode;
import com.xabber.android.data.connection.CertificateManager;
import com.xabber.android.data.connection.ConnectionManager;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.ui.dialog.ConfirmDialogBuilder;
import com.xabber.android.ui.dialog.ConfirmDialogListener;
import com.xabber.android.ui.dialog.DialogBuilder;
import com.xabber.android.ui.helper.ManagedPreferenceActivity;
import com.xabber.android.ui.helper.PreferenceSummaryHelper;
import com.xabber.androiddev.R;
public class PreferenceEditor extends ManagedPreferenceActivity implements
OnPreferenceClickListener, OnSharedPreferenceChangeListener,
ConfirmDialogListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing())
return;
getActionBar().setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preference_editor);
getPreferenceScreen().findPreference(
getString(R.string.preference_accounts_key)).setIntent(
AccountList.createIntent(this));
getPreferenceScreen()
.findPreference(getString(R.string.events_phrases)).setIntent(
PhraseList.createIntent(this));
getPreferenceScreen().findPreference(
getString(R.string.cache_clear_key))
.setOnPreferenceClickListener(this);
getPreferenceScreen().findPreference(
getString(R.string.security_clear_certificate_key))
.setOnPreferenceClickListener(this);
getPreferenceScreen().findPreference(
getString(R.string.contacts_reset_offline_key))
.setOnPreferenceClickListener(this);
getPreferenceScreen().findPreference(getString(R.string.debug_log_key))
.setEnabled(LogManager.isDebugable());
// Force request sound. This will set default value if not specified.
SettingsManager.eventsSound();
SettingsManager.chatsAttentionSound();
PreferenceScreen about = (PreferenceScreen) getPreferenceScreen()
.findPreference(getString(R.string.preference_about_key));
about.setSummary(getString(R.string.application_name) + "\n" + getVersionName());
about.setIntent(AboutViewer.createIntent(this));
PreferenceSummaryHelper.updateSummary(getPreferenceScreen());
}
private String getVersionName() {
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
return pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this);
}
private void changeGrouping() {
boolean grouped = SettingsManager.contactsShowAccounts()
|| SettingsManager.contactsShowGroups();
((CheckBoxPreference) getPreferenceScreen().findPreference(
getString(R.string.contacts_stay_active_chats_key)))
.setChecked(grouped);
((CheckBoxPreference) getPreferenceScreen().findPreference(
getString(R.string.contacts_show_empty_groups_key)))
.setEnabled(grouped);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(getString(R.string.contacts_show_accounts_key))) {
changeGrouping();
} else if (key.equals(getString(R.string.contacts_show_groups_key))) {
changeGrouping();
} else if (key.equals(getString(R.string.interface_theme_key))) {
ActivityManager.getInstance().clearStack(true);
startActivity(ContactList.createIntent(this));
}
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(getString(R.string.cache_clear_key))) {
showDialog(R.string.cache_clear_warning);
} else if (preference.getKey().equals(
getString(R.string.security_clear_certificate_key))) {
showDialog(R.string.security_clear_certificate_warning);
} else if (preference.getKey().equals(
getString(R.string.contacts_reset_offline_key))) {
showDialog(R.string.contacts_reset_offline_warning);
}
return false;
}
@Override
protected Dialog onCreateDialog(int id) {
super.onCreateDialog(id);
switch (id) {
case R.string.cache_clear_warning:
return new ConfirmDialogBuilder(this, R.string.cache_clear_warning,
this).setMessage(R.string.cache_clear_warning).create();
case R.string.security_clear_certificate_warning:
return new ConfirmDialogBuilder(this,
R.string.security_clear_certificate_warning, this)
.setMessage(R.string.security_clear_certificate_warning)
.create();
case R.string.contacts_reset_offline_warning:
return new ConfirmDialogBuilder(this,
R.string.contacts_reset_offline_warning, this).setMessage(
R.string.contacts_reset_offline_warning).create();
case R.string.application_state_closing:
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog
.setMessage(getString(R.string.application_state_closing));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
return progressDialog;
default:
return null;
}
}
@Override
public void onAccept(DialogBuilder dialogBuilder) {
switch (dialogBuilder.getDialogId()) {
case R.string.cache_clear_warning:
AccountManager.getInstance()
.setStatus(StatusMode.unavailable, null);
((Application) getApplication()).requestToClear();
Application.getInstance().requestToClose();
showDialog(R.string.application_state_closing);
break;
case R.string.security_clear_certificate_warning:
CertificateManager.getInstance().removeCertificates();
ConnectionManager.getInstance().updateConnections(true);
break;
case R.string.contacts_reset_offline_warning:
GroupManager.getInstance().resetShowOfflineModes();
break;
}
}
@Override
public void onDecline(DialogBuilder dialogBuilder) {
}
@Override
public void onCancel(DialogBuilder dialogBuilder) {
}
public static Intent createIntent(Context context) {
return new Intent(context, PreferenceEditor.class);
}
}
......@@ -29,7 +29,7 @@ import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.connection.ConnectionState;
import com.xabber.android.data.extension.avatar.AvatarManager;
import com.xabber.android.ui.AccountList;
import com.xabber.android.ui.preferences.AccountList;
import com.xabber.androiddev.R;
/**
......
......@@ -33,7 +33,7 @@ import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.PresenceManager;
import com.xabber.android.data.roster.ShowOfflineMode;
import com.xabber.android.ui.AccountEditor;
import com.xabber.android.ui.preferences.AccountEditor;
import com.xabber.android.ui.ChatViewer;
import com.xabber.android.ui.ContactAdd;
import com.xabber.android.ui.ContactEditor;
......
......@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
package com.xabber.android.ui.preferences;
import android.content.Context;
import android.content.Intent;
......
......@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
package com.xabber.android.ui.preferences;
import java.util.HashMap;
import java.util.Map;
......@@ -33,6 +33,7 @@ import com.xabber.android.data.account.ArchiveMode;
import com.xabber.android.data.connection.ProxyType;
import com.xabber.android.data.connection.TLSMode;
import com.xabber.android.data.intent.AccountIntentBuilder;
import com.xabber.android.ui.OAuthActivity;
import com.xabber.android.ui.dialog.OrbotInstallerDialogBuilder;
import com.xabber.android.ui.helper.BaseSettingsActivity;
import com.xabber.android.ui.helper.OrbotHelper;
......@@ -43,9 +44,9 @@ public class AccountEditor extends BaseSettingsActivity implements
private static final int OAUTH_WML_REQUEST_CODE = 1;
private static final String SAVED_TOKEN = "com.xabber.android.ui.AccountEditor.TOKEN";
private static final String SAVED_TOKEN = "com.xabber.android.ui.preferences.AccountEditor.TOKEN";
private static final String INVALIDATED_TOKEN = "com.xabber.android.ui.AccountEditor.INVALIDATED";
private static final String INVALIDATED_TOKEN = "com.xabber.android.ui.preferences.AccountEditor.INVALIDATED";
private static final int ORBOT_DIALOG_ID = 9050;
......
......@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
package com.xabber.android.ui.preferences;
import java.util.Collection;
......@@ -26,6 +26,8 @@ import com.xabber.android.data.Application;
import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.OnAccountChangedListener;
import com.xabber.android.ui.AccountAdd;
import com.xabber.android.ui.StatusEditor;
import com.xabber.android.ui.adapter.AccountListAdapter;
import com.xabber.android.ui.adapter.BaseListEditorAdapter;
import com.xabber.android.ui.helper.BaseListEditor;
......
......@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
package com.xabber.android.ui.preferences;
import java.util.HashMap;
import java.util.Map;
......
......@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
package com.xabber.android.ui.preferences;
import android.content.Context;
import android.content.Intent;
......
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui.preferences;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import com.xabber.android.data.Application;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.StatusMode;
import com.xabber.android.data.connection.CertificateManager;
import com.xabber.android.data.connection.ConnectionManager;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.ui.dialog.ConfirmDialogBuilder;
import com.xabber.android.ui.dialog.ConfirmDialogListener;
import com.xabber.android.ui.dialog.DialogBuilder;
import com.xabber.androiddev.R;
public class PreferenceEditor extends Activity
implements PreferencesFragment.OnPreferencesFragmentInteractionListener,
Preference.OnPreferenceClickListener, ConfirmDialogListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new PreferencesFragment()).commit();
}
getActionBar().setDisplayHomeAsUpEnabled(true);
// Force request sound. This will set default value if not specified.
SettingsManager.eventsSound();
SettingsManager.chatsAttentionSound();
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(getString(R.string.cache_clear_key))) {
showDialog(R.string.cache_clear_warning);
} else if (preference.getKey().equals(
getString(R.string.security_clear_certificate_key))) {
showDialog(R.string.security_clear_certificate_warning);
} else if (preference.getKey().equals(
getString(R.string.contacts_reset_offline_key))) {
showDialog(R.string.contacts_reset_offline_warning);
}
return false;
}
@Override
protected Dialog onCreateDialog(int id) {
super.onCreateDialog(id);
switch (id) {
case R.string.cache_clear_warning:
return new ConfirmDialogBuilder(this, R.string.cache_clear_warning,
this).setMessage(R.string.cache_clear_warning).create();
case R.string.security_clear_certificate_warning:
return new ConfirmDialogBuilder(this,
R.string.security_clear_certificate_warning, this)
.setMessage(R.string.security_clear_certificate_warning)
.create();
case R.string.contacts_reset_offline_warning:
return new ConfirmDialogBuilder(this,
R.string.contacts_reset_offline_warning, this).setMessage(
R.string.contacts_reset_offline_warning).create();
case R.string.application_state_closing:
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog
.setMessage(getString(R.string.application_state_closing));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
return progressDialog;
default:
return null;
}
}
@Override
public void onAccept(DialogBuilder dialogBuilder) {
switch (dialogBuilder.getDialogId()) {
case R.string.cache_clear_warning:
AccountManager.getInstance()
.setStatus(StatusMode.unavailable, null);
((Application) getApplication()).requestToClear();
Application.getInstance().requestToClose();
showDialog(R.string.application_state_closing);
break;
case R.string.security_clear_certificate_warning:
CertificateManager.getInstance().removeCertificates();
ConnectionManager.getInstance().updateConnections(true);
break;
case R.string.contacts_reset_offline_warning:
GroupManager.getInstance().resetShowOfflineModes();
break;
}
}
@Override
public void onDecline(DialogBuilder dialogBuilder) {
}
@Override
public void onCancel(DialogBuilder dialogBuilder) {
}
public static Intent createIntent(Context context) {
return new Intent(context, PreferenceEditor.class);
}
@Override
public Preference.OnPreferenceClickListener getOnPreferenceClickListener() {
return this;
}
}
package com.xabber.android.ui.preferences;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceManager;
import com.xabber.android.data.ActivityManager;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.ui.ContactList;
import com.xabber.android.ui.helper.PreferenceSummaryHelper;
import com.xabber.androiddev.R;
public class PreferencesFragment extends android.preference.PreferenceFragment
implements SharedPreferences.OnSharedPreferenceChangeListener {
private OnPreferencesFragmentInteractionListener mListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference_editor);
Preference about = getPreferenceScreen().findPreference(getString(R.string.preference_about_key));
about.setSummary(getString(R.string.application_name) + "\n" + getVersionName());
getPreferenceScreen().findPreference(getString(R.string.cache_clear_key))
.setOnPreferenceClickListener(mListener.getOnPreferenceClickListener());
getPreferenceScreen().findPreference(getString(R.string.security_clear_certificate_key))
.setOnPreferenceClickListener(mListener.getOnPreferenceClickListener());
getPreferenceScreen().findPreference(getString(R.string.contacts_reset_offline_key))
.setOnPreferenceClickListener(mListener.getOnPreferenceClickListener());
getPreferenceScreen().findPreference(getString(R.string.debug_log_key))
.setEnabled(LogManager.isDebugable());
PreferenceSummaryHelper.updateSummary(getPreferenceScreen());
}
private String getVersionName() {
try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
return pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
@Override
public void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(getActivity())
.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(getActivity())
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(getString(R.string.contacts_show_accounts_key))) {
changeGrouping();
} else if (key.equals(getString(R.string.contacts_show_groups_key))) {
changeGrouping();
} else if (key.equals(getString(R.string.interface_theme_key))) {
ActivityManager.getInstance().clearStack(true);
startActivity(ContactList.createIntent(getActivity()));
}
}
private void changeGrouping() {
boolean grouped = SettingsManager.contactsShowAccounts()
|| SettingsManager.contactsShowGroups();
((CheckBoxPreference) getPreferenceScreen().findPreference(
getString(R.string.contacts_stay_active_chats_key)))
.setChecked(grouped);
getPreferenceScreen().findPreference(getString(R.string.contacts_show_empty_groups_key))
.setEnabled(grouped);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnPreferencesFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnPreferencesFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnPreferencesFragmentInteractionListener {
Preference.OnPreferenceClickListener getOnPreferenceClickListener();
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/preferences_activity_container"
>
</RelativeLayout>
\ No newline at end of file
......@@ -14,10 +14,13 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
<Preference
android:title="@string/preference_accounts"
android:key="@string/preference_accounts_key"
/>
android:key="@string/preference_accounts_key">
<intent
android:targetPackage="@string/application_package"
android:targetClass="com.xabber.android.ui.preferences.AccountList"/>
</Preference>
<PreferenceScreen
android:title="@string/preference_interface"
android:key="@string/preference_interface"
......@@ -212,10 +215,14 @@
android:key="@string/events_first_only_key"
android:defaultValue="@bool/events_first_only_default"
/>
<PreferenceScreen
<Preference
android:title="@string/events_phrases"
android:key="@string/events_phrases"
/>
android:key="@string/events_phrases">
<intent
android:targetPackage="@string/application_package"
android:targetClass="com.xabber.android.ui.preferences.PhraseList"/>
</Preference>
</PreferenceScreen>
<PreferenceScreen
android:title="@string/preference_connection"
......@@ -340,8 +347,11 @@
android:key="@string/cache_clear_key"
/>
</PreferenceScreen>
<PreferenceScreen
<Preference
android:title="@string/preference_about"
android:key="@string/preference_about_key"
/>
android:key="@string/preference_about_key">
<intent
android:targetPackage="@string/application_package"
android:targetClass="com.xabber.android.ui.preferences.AboutViewer"/>
</Preference>
</PreferenceScreen>
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