diff options
author | Erica Chang <echang@cyngn.com> | 2016-03-10 14:19:10 -0800 |
---|---|---|
committer | Erica Chang <echang@cyngn.com> | 2016-04-07 12:05:50 -0700 |
commit | dbdb27d43f7af59a1a16f88422c20586eb7eca23 (patch) | |
tree | ca6fe045b136fa25a48d4eec954e67d626a9795f | |
parent | 64e5ffe387e08ab1ace20d93354c08e86f7cb625 (diff) | |
download | android_packages_apps_Contacts-dbdb27d43f7af59a1a16f88422c20586eb7eca23.tar.gz android_packages_apps_Contacts-dbdb27d43f7af59a1a16f88422c20586eb7eca23.tar.bz2 android_packages_apps_Contacts-dbdb27d43f7af59a1a16f88422c20586eb7eca23.zip |
Contacts Card: fix nudges
-Fixed empty nudges
-Fixed dismissed nudge reappear issue (check shared preferences)
CD-464, CD-496
Change-Id: I930048e111616461ea3062a37f6d6f2dc8f88d1b
-rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index c3e8878ca..6be8f563e 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -175,6 +175,7 @@ import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListen import com.android.contacts.widget.QuickContactImageView; import com.android.phone.common.incall.CallMethodHelper; import com.android.phone.common.incall.CallMethodInfo; +import com.cyanogen.ambient.discovery.util.NudgeKey; import com.cyanogen.ambient.incall.extension.OriginCodes; import com.cyanogen.ambient.plugin.PluginStatus; import com.android.contactsbind.HelpUtils; @@ -3452,19 +3453,28 @@ public class QuickContactActivity extends ContactsActivity implements final Resources res = getResources(); List<Entry> containerList; Entry entry; + Intent dismissIntent; + String nudgeKey; if (cmi.mStatus == PluginStatus.HIDDEN) { - if (cmi.mLoginNudgeEnable) { + nudgeKey = NudgeKey.INCALL_CONTACT_CARD_DOWNLOAD; + if (!PreferenceManager.getDefaultSharedPreferences(this) + .getBoolean(cmi.mComponent.getClassName() + "." + nudgeKey, true)) { + return; + } + if (cmi.mInstallNudgeEnable) { containerList = new ArrayList<Entry>(); // install nudge + dismissIntent = new Intent(ACTION_INCALL_PLUGIN_DISMISS_NUDGE); + dismissIntent.putExtra(InCallPluginUtils.KEY_NUDGE_KEY, nudgeKey); entry = new Entry(CARD_ENTRY_ID_INCALL_PLUGIN, cmi.mBrandIcon, null, - cmi.mInstallNudgeSubtitle, + cmi.mInstallNudgeTitle, null, cmi.mInstallNudgeActionText, new Intent(ACTION_INCALL_PLUGIN_INSTALL), res.getDrawable(R.drawable.ic_close), - new Intent(ACTION_INCALL_PLUGIN_DISMISS_NUDGE), + dismissIntent, null, null, null, @@ -3500,17 +3510,24 @@ public class QuickContactActivity extends ContactsActivity implements parentList.add(containerList); } else { // login nudge + nudgeKey = NudgeKey.INCALL_CONTACT_CARD_LOGIN; + if (!PreferenceManager.getDefaultSharedPreferences(this) + .getBoolean(cmi.mComponent.getClassName() + "." + nudgeKey, true)) { + return; + } if (cmi.mLoginNudgeEnable) { containerList = new ArrayList<Entry>(); + dismissIntent = new Intent(ACTION_INCALL_PLUGIN_DISMISS_NUDGE); + dismissIntent.putExtra(InCallPluginUtils.KEY_NUDGE_KEY, nudgeKey); entry = new Entry(CARD_ENTRY_ID_INCALL_PLUGIN, cmi.mBrandIcon, null, - cmi.mInstallNudgeSubtitle, + cmi.mLoginNudgeTitle, null, - cmi.mInstallNudgeActionText, + cmi.mLoginNudgeActionText, new Intent(ACTION_INCALL_PLUGIN_LOGIN), res.getDrawable(R.drawable.ic_close), - new Intent(ACTION_INCALL_PLUGIN_DISMISS_NUDGE), + dismissIntent, null, null, null, @@ -3607,8 +3624,7 @@ public class QuickContactActivity extends ContactsActivity implements startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + cmi.mDependentPackage))); } else if (intent.getAction().equals(ACTION_INCALL_PLUGIN_DISMISS_NUDGE)) { - String nudgeKey = intent.getStringExtra(InCallPluginUtils - .KEY_NUDGE_KEY); + String nudgeKey = intent.getStringExtra(InCallPluginUtils.KEY_NUDGE_KEY); dismissNudge(tag, nudgeKey); } else if (intent.getAction().equals(ACTION_INCALL_PLUGIN_LOGIN)) { if (cmi.mLoginIntent != null) { |