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
9606bf63
Commit
9606bf63
authored
Jan 13, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New activity ThemeSettings and ThemeSettingsFragment for "Theme settings" preferences screen.
parent
2e2dfb1c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
21 deletions
+134
-21
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+8
-0
PreferencesFragment.java
...om/xabber/android/ui/preferences/PreferencesFragment.java
+0
-5
ThemeSettings.java
...java/com/xabber/android/ui/preferences/ThemeSettings.java
+35
-0
ThemeSettingsFragment.java
.../xabber/android/ui/preferences/ThemeSettingsFragment.java
+67
-0
preference_editor.xml
app/src/main/res/xml/preference_editor.xml
+6
-16
preference_theme.xml
app/src/main/res/xml/preference_theme.xml
+18
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
9606bf63
...
...
@@ -307,6 +307,14 @@
android:excludeFromRecents=
"true"
/>
<activity
android:name=
"com.xabber.android.ui.preferences.ThemeSettings"
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
...
...
app/src/main/java/com/xabber/android/ui/preferences/PreferencesFragment.java
View file @
9606bf63
...
...
@@ -10,10 +10,8 @@ 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
;
...
...
@@ -73,9 +71,6 @@ public class PreferencesFragment extends android.preference.PreferenceFragment
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
()));
}
}
...
...
app/src/main/java/com/xabber/android/ui/preferences/ThemeSettings.java
0 → 100644
View file @
9606bf63
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
com.xabber.android.data.ActivityManager
;
import
com.xabber.android.ui.ContactList
;
import
com.xabber.androiddev.R
;
public
class
ThemeSettings
extends
Activity
implements
ThemeSettingsFragment
.
OnThemeSettingsFragmentInteractionListener
{
@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
ThemeSettingsFragment
()).
commit
();
}
}
@Override
public
void
onThemeChanged
()
{
ActivityManager
.
getInstance
().
clearStack
(
true
);
startActivity
(
ContactList
.
createIntent
(
this
));
}
}
app/src/main/java/com/xabber/android/ui/preferences/ThemeSettingsFragment.java
0 → 100644
View file @
9606bf63
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.app.Activity
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
com.xabber.android.ui.helper.PreferenceSummaryHelper
;
import
com.xabber.androiddev.R
;
public
class
ThemeSettingsFragment
extends
android
.
preference
.
PreferenceFragment
implements
SharedPreferences
.
OnSharedPreferenceChangeListener
{
private
OnThemeSettingsFragmentInteractionListener
mListener
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
addPreferencesFromResource
(
R
.
xml
.
preference_theme
);
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
.
interface_theme_key
)))
{
mListener
.
onThemeChanged
();
}
}
@Override
public
void
onAttach
(
Activity
activity
)
{
super
.
onAttach
(
activity
);
try
{
mListener
=
(
OnThemeSettingsFragmentInteractionListener
)
activity
;
}
catch
(
ClassCastException
e
)
{
throw
new
ClassCastException
(
activity
.
toString
()
+
" must implement OnThemeSettingsFragmentInteractionListener"
);
}
}
@Override
public
void
onDetach
()
{
super
.
onDetach
();
mListener
=
null
;
}
public
interface
OnThemeSettingsFragmentInteractionListener
{
public
void
onThemeChanged
();
}
}
app/src/main/res/xml/preference_editor.xml
View file @
9606bf63
...
...
@@ -21,25 +21,15 @@
android:targetPackage=
"@string/application_package"
android:targetClass=
"com.xabber.android.ui.preferences.AccountList"
/>
</Preference>
<PreferenceScreen
<Preference
android:title=
"@string/preference_interface"
android:key=
"@string/preference_interface"
>
<ListPreference
android:title=
"@string/interface_theme"
android:key=
"@string/interface_theme_key"
android:entries=
"@array/interface_theme_entries"
android:entryValues=
"@array/interface_theme_entryvalues"
android:defaultValue=
"@string/interface_theme_default"
/>
<ListPreference
android:title=
"@string/interface_smiles"
android:key=
"@string/interface_smiles_key"
android:entries=
"@array/interface_smiles_entries"
android:entryValues=
"@array/interface_smiles_entryvalues"
android:defaultValue=
"@string/interface_smiles_default"
/>
</PreferenceScreen>
<intent
android:targetPackage=
"@string/application_package"
android:targetClass=
"com.xabber.android.ui.preferences.ThemeSettings"
/>
</Preference>
<PreferenceScreen
android:title=
"@string/preference_contacts"
android:key=
"@string/preference_contacts"
...
...
app/src/main/res/xml/preference_theme.xml
0 → 100644
View file @
9606bf63
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<ListPreference
android:title=
"@string/interface_theme"
android:key=
"@string/interface_theme_key"
android:entries=
"@array/interface_theme_entries"
android:entryValues=
"@array/interface_theme_entryvalues"
android:defaultValue=
"@string/interface_theme_default"
/>
<ListPreference
android:title=
"@string/interface_smiles"
android:key=
"@string/interface_smiles_key"
android:entries=
"@array/interface_smiles_entries"
android:entryValues=
"@array/interface_smiles_entryvalues"
android:defaultValue=
"@string/interface_smiles_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