Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
8f2b80f5
Commit
8f2b80f5
authored
Jan 13, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Contact list settings moved to separate preferences activity, fragment and dialog.
parent
9606bf63
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
104 deletions
+177
-104
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+9
-0
ContactListSettings.java
...om/xabber/android/ui/preferences/ContactListSettings.java
+26
-0
ContactListSettingsFragment.java
...r/android/ui/preferences/ContactListSettingsFragment.java
+56
-0
ContactResetOfflineSettingsDialog.java
...oid/ui/preferences/ContactResetOfflineSettingsDialog.java
+23
-0
PreferenceEditor.java
...a/com/xabber/android/ui/preferences/PreferenceEditor.java
+0
-10
PreferencesFragment.java
...om/xabber/android/ui/preferences/PreferencesFragment.java
+1
-40
preference_editor.xml
app/src/main/res/xml/preference_editor.xml
+5
-54
preferences_contact_list.xml
app/src/main/res/xml/preferences_contact_list.xml
+57
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
8f2b80f5
...
...
@@ -316,6 +316,15 @@
android:value=
"com.xabber.android.ui.preferences.PreferenceEditor"
/>
</activity>
<activity
android:name=
"com.xabber.android.ui.preferences.ContactListSettings"
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.preferences.PreferenceEditor"
/>
</activity>
<service
android:name=
"com.xabber.android.service.XabberService"
/>
<service
android:name=
"com.xabber.android.service.SyncAdapterService"
...
...
app/src/main/java/com/xabber/android/ui/preferences/ContactListSettings.java
0 → 100644
View file @
8f2b80f5
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
com.xabber.androiddev.R
;
public
class
ContactListSettings
extends
Activity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
if
(
isFinishing
())
return
;
setContentView
(
R
.
layout
.
activity_preferences
);
getActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
if
(
savedInstanceState
==
null
)
{
getFragmentManager
().
beginTransaction
()
.
add
(
R
.
id
.
preferences_activity_container
,
new
ContactListSettingsFragment
()).
commit
();
}
}
}
app/src/main/java/com/xabber/android/ui/preferences/ContactListSettingsFragment.java
0 → 100644
View file @
8f2b80f5
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.preference.CheckBoxPreference
;
import
android.preference.PreferenceFragment
;
import
android.preference.PreferenceManager
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.ui.helper.PreferenceSummaryHelper
;
import
com.xabber.androiddev.R
;
public
class
ContactListSettingsFragment
extends
PreferenceFragment
implements
SharedPreferences
.
OnSharedPreferenceChangeListener
{
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
addPreferencesFromResource
(
R
.
xml
.
preferences_contact_list
);
PreferenceSummaryHelper
.
updateSummary
(
getPreferenceScreen
());
}
@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
))
||
key
.
equals
(
getString
(
R
.
string
.
contacts_show_groups_key
)))
{
changeGrouping
();
}
}
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
);
}
}
app/src/main/java/com/xabber/android/ui/preferences/ContactResetOfflineSettingsDialog.java
0 → 100644
View file @
8f2b80f5
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.content.Context
;
import
android.preference.DialogPreference
;
import
android.util.AttributeSet
;
import
com.xabber.android.data.roster.GroupManager
;
public
class
ContactResetOfflineSettingsDialog
extends
DialogPreference
{
public
ContactResetOfflineSettingsDialog
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
@Override
protected
void
onDialogClosed
(
boolean
positiveResult
)
{
super
.
onDialogClosed
(
positiveResult
);
if
(
positiveResult
)
{
GroupManager
.
getInstance
().
resetShowOfflineModes
();
}
}
}
app/src/main/java/com/xabber/android/ui/preferences/PreferenceEditor.java
View file @
8f2b80f5
...
...
@@ -65,9 +65,6 @@ public class PreferenceEditor extends Activity
}
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
;
}
...
...
@@ -84,10 +81,6 @@ public class PreferenceEditor extends Activity
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
...
...
@@ -114,9 +107,6 @@ public class PreferenceEditor extends Activity
CertificateManager
.
getInstance
().
removeCertificates
();
ConnectionManager
.
getInstance
().
updateConnections
(
true
);
break
;
case
R
.
string
.
contacts_reset_offline_warning
:
GroupManager
.
getInstance
().
resetShowOfflineModes
();
break
;
}
}
...
...
app/src/main/java/com/xabber/android/ui/preferences/PreferencesFragment.java
View file @
8f2b80f5
...
...
@@ -2,21 +2,16 @@ 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.LogManager
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.ui.helper.PreferenceSummaryHelper
;
import
com.xabber.androiddev.R
;
public
class
PreferencesFragment
extends
android
.
preference
.
PreferenceFragment
implements
SharedPreferences
.
OnSharedPreferenceChangeListener
{
public
class
PreferencesFragment
extends
android
.
preference
.
PreferenceFragment
{
private
OnPreferencesFragmentInteractionListener
mListener
;
...
...
@@ -33,8 +28,6 @@ public class PreferencesFragment extends android.preference.PreferenceFragment
.
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
());
...
...
@@ -51,38 +44,6 @@ public class PreferencesFragment extends android.preference.PreferenceFragment
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
();
}
}
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
...
...
app/src/main/res/xml/preference_editor.xml
View file @
8f2b80f5
...
...
@@ -30,63 +30,14 @@
android:targetPackage=
"@string/application_package"
android:targetClass=
"com.xabber.android.ui.preferences.ThemeSettings"
/>
</Preference>
<Preference
Screen
<Preference
android:title=
"@string/preference_contacts"
android:key=
"@string/preference_contacts"
>
<CheckBoxPreference
android:title=
"@string/contacts_show_panel"
android:key=
"@string/contacts_show_panel_key"
android:defaultValue=
"@bool/contacts_show_panel_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_avatars"
android:key=
"@string/contacts_show_avatars_key"
android:defaultValue=
"@bool/contacts_show_avatars_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_offline"
android:key=
"@string/contacts_show_offline_key"
android:defaultValue=
"@bool/contacts_show_offline_default"
/>
<PreferenceScreen
android:title=
"@string/contacts_reset_offline"
android:key=
"@string/contacts_reset_offline_key"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_groups"
android:key=
"@string/contacts_show_groups_key"
android:defaultValue=
"@bool/contacts_show_groups_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_accounts"
android:key=
"@string/contacts_show_accounts_key"
android:defaultValue=
"@bool/contacts_show_accounts_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_active_chats"
android:key=
"@string/contacts_show_active_chats_key"
android:defaultValue=
"@bool/contacts_show_active_chats_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_stay_active_chats"
android:key=
"@string/contacts_stay_active_chats_key"
android:defaultValue=
"@bool/contacts_stay_active_chats_default"
android:dependency=
"@string/contacts_show_active_chats_key"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_empty_groups"
android:key=
"@string/contacts_show_empty_groups_key"
android:defaultValue=
"@bool/contacts_show_empty_groups_default"
/>
<ListPreference
android:title=
"@string/contacts_order"
android:key=
"@string/contacts_order_key"
android:entries=
"@array/contacts_order_entries"
android:entryValues=
"@array/contacts_order_entryvalues"
android:defaultValue=
"@string/contacts_order_default"
/>
</PreferenceScreen>
<intent
android:targetPackage=
"@string/application_package"
android:targetClass=
"com.xabber.android.ui.preferences.ContactListSettings"
/>
</Preference>
<PreferenceScreen
android:title=
"@string/preference_chats"
android:key=
"@string/preference_chats"
...
...
app/src/main/res/xml/preferences_contact_list.xml
0 → 100644
View file @
8f2b80f5
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<CheckBoxPreference
android:title=
"@string/contacts_show_panel"
android:key=
"@string/contacts_show_panel_key"
android:defaultValue=
"@bool/contacts_show_panel_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_avatars"
android:key=
"@string/contacts_show_avatars_key"
android:defaultValue=
"@bool/contacts_show_avatars_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_offline"
android:key=
"@string/contacts_show_offline_key"
android:defaultValue=
"@bool/contacts_show_offline_default"
/>
<com.xabber.android.ui.preferences.ContactResetOfflineSettingsDialog
android:title=
"@string/contacts_reset_offline"
android:key=
"@string/contacts_reset_offline_key"
android:dialogMessage=
"@string/contacts_reset_offline_warning"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_groups"
android:key=
"@string/contacts_show_groups_key"
android:defaultValue=
"@bool/contacts_show_groups_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_accounts"
android:key=
"@string/contacts_show_accounts_key"
android:defaultValue=
"@bool/contacts_show_accounts_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_active_chats"
android:key=
"@string/contacts_show_active_chats_key"
android:defaultValue=
"@bool/contacts_show_active_chats_default"
/>
<CheckBoxPreference
android:title=
"@string/contacts_stay_active_chats"
android:key=
"@string/contacts_stay_active_chats_key"
android:defaultValue=
"@bool/contacts_stay_active_chats_default"
android:dependency=
"@string/contacts_show_active_chats_key"
/>
<CheckBoxPreference
android:title=
"@string/contacts_show_empty_groups"
android:key=
"@string/contacts_show_empty_groups_key"
android:defaultValue=
"@bool/contacts_show_empty_groups_default"
/>
<ListPreference
android:title=
"@string/contacts_order"
android:key=
"@string/contacts_order_key"
android:entries=
"@array/contacts_order_entries"
android:entryValues=
"@array/contacts_order_entryvalues"
android:defaultValue=
"@string/contacts_order_default"
/>
</PreferenceScreen>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment