Loading AndroidManifest.xml +11 −1 Original line number Diff line number Diff line Loading @@ -1366,6 +1366,7 @@ <activity android:name="Settings$AccountSyncSettingsActivity" android:label="@string/account_sync_settings_title" android:parentActivityName="Settings" android:uiOptions="none"> <intent-filter> <action android:name="android.intent.action.MAIN" /> Loading @@ -1378,6 +1379,16 @@ android:resource="@id/account_settings" /> </activity> <activity android:name=".accounts.SyncSettingsActivity" android:label="@string/account_sync_settings_title" android:theme="@android:style/Theme.Holo.Dialog"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="android.settings.SYNC_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name="com.android.settings.accounts.AddAccountSettings" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|keyboardHidden|screenSize" Loading Loading @@ -1441,7 +1452,6 @@ android:parentActivityName="Settings"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="android.settings.SYNC_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="com.android.settings.SHORTCUT" /> </intent-filter> Loading res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ <dimen name="divider_margin_bottom">7dip</dimen> <!-- Size of icons in the top-level of settings --> <dimen name="header_icon_width">32dp</dimen> <dimen name="header_icon_width">28dp</dimen> <dimen name="appwidget_min_width">260dip</dimen> <dimen name="appwidget_min_height">40dip</dimen> </resources> res/xml/sync_settings.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <CheckBoxPreference android:key="sync_switch" android:title="@string/sync_automatically" /> </PreferenceScreen> src/com/android/settings/AccountPreference.java +24 −10 Original line number Diff line number Diff line Loading @@ -39,16 +39,24 @@ public class AccountPreference extends Preference { private int mStatus; private Account mAccount; private ArrayList<String> mAuthorities; private ImageView mSyncStatusIcon; private boolean mShowTypeIcon; public AccountPreference(Context context, Account account, Drawable icon, ArrayList<String> authorities) { ArrayList<String> authorities, boolean showTypeIcon) { super(context); mAccount = account; mAuthorities = authorities; mShowTypeIcon = showTypeIcon; if (showTypeIcon) { setIcon(icon); } else { setIcon(getSyncStatusIcon(SYNC_DISABLED)); } setTitle(mAccount.name); setSummary(""); setPersistent(false); setSyncStatus(SYNC_DISABLED); setSyncStatus(SYNC_DISABLED, false); } public Account getAccount() { Loading @@ -62,17 +70,23 @@ public class AccountPreference extends Preference { @Override protected void onBindView(View view) { super.onBindView(view); setSummary(getSyncStatusMessage(mStatus)); ImageView iconView = (ImageView) view.findViewById(android.R.id.icon); iconView.setImageResource(getSyncStatusIcon(mStatus)); iconView.setContentDescription(getSyncContentDescription(mStatus)); if (!mShowTypeIcon) { mSyncStatusIcon = (ImageView) view.findViewById(android.R.id.icon); mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus)); mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus)); } } public void setSyncStatus(int status) { public void setSyncStatus(int status, boolean updateSummary) { mStatus = status; setIcon(getSyncStatusIcon(status)); if (!mShowTypeIcon && mSyncStatusIcon != null) { mSyncStatusIcon.setImageResource(getSyncStatusIcon(status)); mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus)); } if (updateSummary) { setSummary(getSyncStatusMessage(status)); } } private int getSyncStatusMessage(int status) { int res; Loading Loading @@ -109,7 +123,7 @@ public class AccountPreference extends Preference { res = R.drawable.ic_sync_red_holo; break; case SYNC_IN_PROGRESS: res = R.drawable.ic_sync_grey_holo; res = R.drawable.ic_sync_green_holo; break; default: res = R.drawable.ic_sync_red_holo; Loading src/com/android/settings/Settings.java +12 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public class Settings extends PreferenceActivity private AuthenticatorHelper mAuthenticatorHelper; private Header mLastHeader; private boolean mListeningToAccountUpdates; @Override protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -187,7 +188,6 @@ public class Settings extends PreferenceActivity ListAdapter listAdapter = getListAdapter(); if (listAdapter instanceof HeaderAdapter) { ((HeaderAdapter) listAdapter).resume(); AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true); } } Loading @@ -198,6 +198,13 @@ public class Settings extends PreferenceActivity ListAdapter listAdapter = getListAdapter(); if (listAdapter instanceof HeaderAdapter) { ((HeaderAdapter) listAdapter).pause(); } } @Override public void onDestroy() { super.onDestroy(); if (mListeningToAccountUpdates) { AccountManager.get(this).removeOnAccountsUpdatedListener(this); } } Loading Loading @@ -462,6 +469,10 @@ public class Settings extends PreferenceActivity for (Header header : accountHeaders) { target.add(headerIndex++, header); } if (!mListeningToAccountUpdates) { AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true); mListeningToAccountUpdates = true; } return headerIndex; } Loading Loading
AndroidManifest.xml +11 −1 Original line number Diff line number Diff line Loading @@ -1366,6 +1366,7 @@ <activity android:name="Settings$AccountSyncSettingsActivity" android:label="@string/account_sync_settings_title" android:parentActivityName="Settings" android:uiOptions="none"> <intent-filter> <action android:name="android.intent.action.MAIN" /> Loading @@ -1378,6 +1379,16 @@ android:resource="@id/account_settings" /> </activity> <activity android:name=".accounts.SyncSettingsActivity" android:label="@string/account_sync_settings_title" android:theme="@android:style/Theme.Holo.Dialog"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="android.settings.SYNC_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name="com.android.settings.accounts.AddAccountSettings" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|keyboardHidden|screenSize" Loading Loading @@ -1441,7 +1452,6 @@ android:parentActivityName="Settings"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="android.settings.SYNC_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="com.android.settings.SHORTCUT" /> </intent-filter> Loading
res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ <dimen name="divider_margin_bottom">7dip</dimen> <!-- Size of icons in the top-level of settings --> <dimen name="header_icon_width">32dp</dimen> <dimen name="header_icon_width">28dp</dimen> <dimen name="appwidget_min_width">260dip</dimen> <dimen name="appwidget_min_height">40dip</dimen> </resources>
res/xml/sync_settings.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <CheckBoxPreference android:key="sync_switch" android:title="@string/sync_automatically" /> </PreferenceScreen>
src/com/android/settings/AccountPreference.java +24 −10 Original line number Diff line number Diff line Loading @@ -39,16 +39,24 @@ public class AccountPreference extends Preference { private int mStatus; private Account mAccount; private ArrayList<String> mAuthorities; private ImageView mSyncStatusIcon; private boolean mShowTypeIcon; public AccountPreference(Context context, Account account, Drawable icon, ArrayList<String> authorities) { ArrayList<String> authorities, boolean showTypeIcon) { super(context); mAccount = account; mAuthorities = authorities; mShowTypeIcon = showTypeIcon; if (showTypeIcon) { setIcon(icon); } else { setIcon(getSyncStatusIcon(SYNC_DISABLED)); } setTitle(mAccount.name); setSummary(""); setPersistent(false); setSyncStatus(SYNC_DISABLED); setSyncStatus(SYNC_DISABLED, false); } public Account getAccount() { Loading @@ -62,17 +70,23 @@ public class AccountPreference extends Preference { @Override protected void onBindView(View view) { super.onBindView(view); setSummary(getSyncStatusMessage(mStatus)); ImageView iconView = (ImageView) view.findViewById(android.R.id.icon); iconView.setImageResource(getSyncStatusIcon(mStatus)); iconView.setContentDescription(getSyncContentDescription(mStatus)); if (!mShowTypeIcon) { mSyncStatusIcon = (ImageView) view.findViewById(android.R.id.icon); mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus)); mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus)); } } public void setSyncStatus(int status) { public void setSyncStatus(int status, boolean updateSummary) { mStatus = status; setIcon(getSyncStatusIcon(status)); if (!mShowTypeIcon && mSyncStatusIcon != null) { mSyncStatusIcon.setImageResource(getSyncStatusIcon(status)); mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus)); } if (updateSummary) { setSummary(getSyncStatusMessage(status)); } } private int getSyncStatusMessage(int status) { int res; Loading Loading @@ -109,7 +123,7 @@ public class AccountPreference extends Preference { res = R.drawable.ic_sync_red_holo; break; case SYNC_IN_PROGRESS: res = R.drawable.ic_sync_grey_holo; res = R.drawable.ic_sync_green_holo; break; default: res = R.drawable.ic_sync_red_holo; Loading
src/com/android/settings/Settings.java +12 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public class Settings extends PreferenceActivity private AuthenticatorHelper mAuthenticatorHelper; private Header mLastHeader; private boolean mListeningToAccountUpdates; @Override protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -187,7 +188,6 @@ public class Settings extends PreferenceActivity ListAdapter listAdapter = getListAdapter(); if (listAdapter instanceof HeaderAdapter) { ((HeaderAdapter) listAdapter).resume(); AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true); } } Loading @@ -198,6 +198,13 @@ public class Settings extends PreferenceActivity ListAdapter listAdapter = getListAdapter(); if (listAdapter instanceof HeaderAdapter) { ((HeaderAdapter) listAdapter).pause(); } } @Override public void onDestroy() { super.onDestroy(); if (mListeningToAccountUpdates) { AccountManager.get(this).removeOnAccountsUpdatedListener(this); } } Loading Loading @@ -462,6 +469,10 @@ public class Settings extends PreferenceActivity for (Header header : accountHeaders) { target.add(headerIndex++, header); } if (!mListeningToAccountUpdates) { AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true); mListeningToAccountUpdates = true; } return headerIndex; } Loading