Commit b67909d5 authored by Grigory Fedorov's avatar Grigory Fedorov

New ConnectionSettings activity and ConnectionSettingsFragment.

parent f3eb8195
...@@ -343,6 +343,15 @@ ...@@ -343,6 +343,15 @@
android:value="com.xabber.android.ui.preferences.PreferenceEditor" /> android:value="com.xabber.android.ui.preferences.PreferenceEditor" />
</activity> </activity>
<activity
android:name="com.xabber.android.ui.preferences.ConnectionSettings"
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.XabberService" />
<service <service
android:name="com.xabber.android.service.SyncAdapterService" android:name="com.xabber.android.service.SyncAdapterService"
......
package com.xabber.android.ui.preferences;
import android.os.Bundle;
import com.xabber.android.ui.helper.ManagedActivity;
import com.xabber.androiddev.R;
public class ConnectionSettings extends ManagedActivity {
@Override
protected void onCreate(Bundle 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 ConnectionSettingsFragment()).commit();
}
}
}
package com.xabber.android.ui.preferences;
import android.os.Bundle;
import com.xabber.android.ui.helper.PreferenceSummaryHelper;
import com.xabber.androiddev.R;
public class ConnectionSettingsFragment extends android.preference.PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference_connection);
PreferenceSummaryHelper.updateSummary(getPreferenceScreen());
}
}
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:title="@string/connection_start_at_boot"
android:key="@string/connection_start_at_boot_key"
android:defaultValue="@bool/connection_start_at_boot_default"
/>
<ListPreference
android:title="@string/connection_go_away"
android:key="@string/connection_go_away_key"
android:entries="@array/connection_go_away_entries"
android:entryValues="@array/connection_go_away_entryvalues"
android:defaultValue="@string/connection_go_away_default"
/>
<ListPreference
android:title="@string/connection_go_xa"
android:key="@string/connection_go_xa_key"
android:entries="@array/connection_go_xa_entries"
android:entryValues="@array/connection_go_xa_entryvalues"
android:defaultValue="@string/connection_go_xa_default"
/>
<CheckBoxPreference
android:title="@string/connection_wifi_lock"
android:key="@string/connection_wifi_lock_key"
android:defaultValue="@bool/connection_wifi_lock_default"
/>
<CheckBoxPreference
android:title="@string/connection_wake_lock"
android:key="@string/connection_wake_lock_key"
android:defaultValue="@bool/connection_wake_lock_default"
/>
<CheckBoxPreference
android:title="@string/connection_load_vcard"
android:key="@string/connection_load_vcard_key"
android:defaultValue="@bool/connection_load_vcard_default"
/>
<PreferenceCategory
android:title="@string/connection_priority"
>
<CheckBoxPreference
android:title="@string/connection_adjust_priority"
android:key="@string/connection_adjust_priority_key"
android:defaultValue="@bool/connection_adjust_priority_default"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_chat_key"
android:defaultValue="@string/connection_priority_chat_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/chat"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_available_key"
android:defaultValue="@string/connection_priority_available_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/available"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_away_key"
android:defaultValue="@string/connection_priority_away_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/away"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_xa_key"
android:defaultValue="@string/connection_priority_xa_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/xa"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_dnd_key"
android:defaultValue="@string/connection_priority_dnd_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/dnd"
android:singleLine="true"
/>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
...@@ -54,89 +54,14 @@ ...@@ -54,89 +54,14 @@
android:targetPackage="@string/application_package" android:targetPackage="@string/application_package"
android:targetClass="com.xabber.android.ui.preferences.NotificationsSettings"/> android:targetClass="com.xabber.android.ui.preferences.NotificationsSettings"/>
</Preference> </Preference>
<PreferenceScreen <Preference
android:title="@string/preference_connection" android:title="@string/preference_connection"
android:key="@string/preference_connection" android:key="@string/preference_connection"
> >
<CheckBoxPreference <intent
android:title="@string/connection_start_at_boot" android:targetPackage="@string/application_package"
android:key="@string/connection_start_at_boot_key" android:targetClass="com.xabber.android.ui.preferences.ConnectionSettings"/>
android:defaultValue="@bool/connection_start_at_boot_default" </Preference>
/>
<ListPreference
android:title="@string/connection_go_away"
android:key="@string/connection_go_away_key"
android:entries="@array/connection_go_away_entries"
android:entryValues="@array/connection_go_away_entryvalues"
android:defaultValue="@string/connection_go_away_default"
/>
<ListPreference
android:title="@string/connection_go_xa"
android:key="@string/connection_go_xa_key"
android:entries="@array/connection_go_xa_entries"
android:entryValues="@array/connection_go_xa_entryvalues"
android:defaultValue="@string/connection_go_xa_default"
/>
<CheckBoxPreference
android:title="@string/connection_wifi_lock"
android:key="@string/connection_wifi_lock_key"
android:defaultValue="@bool/connection_wifi_lock_default"
/>
<CheckBoxPreference
android:title="@string/connection_wake_lock"
android:key="@string/connection_wake_lock_key"
android:defaultValue="@bool/connection_wake_lock_default"
/>
<CheckBoxPreference
android:title="@string/connection_load_vcard"
android:key="@string/connection_load_vcard_key"
android:defaultValue="@bool/connection_load_vcard_default"
/>
<PreferenceCategory
android:title="@string/connection_priority"
>
<CheckBoxPreference
android:title="@string/connection_adjust_priority"
android:key="@string/connection_adjust_priority_key"
android:defaultValue="@bool/connection_adjust_priority_default"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_chat_key"
android:defaultValue="@string/connection_priority_chat_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/chat"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_available_key"
android:defaultValue="@string/connection_priority_available_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/available"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_away_key"
android:defaultValue="@string/connection_priority_away_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/away"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_xa_key"
android:defaultValue="@string/connection_priority_xa_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/xa"
android:singleLine="true"
/>
<com.xabber.android.ui.widget.PriorityPreference
android:key="@string/connection_priority_dnd_key"
android:defaultValue="@string/connection_priority_dnd_default"
android:dependency="@string/connection_adjust_priority_key"
android:title="@string/dnd"
android:singleLine="true"
/>
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen <PreferenceScreen
android:title="@string/preference_security" android:title="@string/preference_security"
android:key="@string/preference_security" android:key="@string/preference_security"
......
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