From bba95d7d0428c4bb0b786427fbcb09604c916ec7 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Wed, 30 Aug 2017 11:59:57 +0800 Subject: [PATCH] updated strings --- .../mariotaku/twidere/TwidereConstants.java | 1 + .../twidere/activity/HomeActivity.kt | 28 ++++++++++++------- twidere/src/main/res/values/strings.xml | 7 +++-- .../main/svg/drawable/ic_stat_gift-mdpi.svg | 13 +++++++++ 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 twidere/src/main/svg/drawable/ic_stat_gift-mdpi.svg diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/TwidereConstants.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/TwidereConstants.java index bfc479d98..13ed6d0a3 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/TwidereConstants.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/TwidereConstants.java @@ -236,6 +236,7 @@ public interface TwidereConstants extends SharedPreferenceConstants, IntentConst int NOTIFICATION_ID_DIRECT_MESSAGES = 3; int NOTIFICATION_ID_DRAFTS = 4; int NOTIFICATION_ID_DATA_PROFILING = 5; + int NOTIFICATION_ID_PROMOTIONS_OFFER = 6; int NOTIFICATION_ID_USER_NOTIFICATION = 10; int NOTIFICATION_ID_UPDATE_STATUS = 101; int NOTIFICATION_ID_SEND_DIRECT_MESSAGE = 102; diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/HomeActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/HomeActivity.kt index e81f415de..87645d81b 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/HomeActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/HomeActivity.kt @@ -22,6 +22,7 @@ package org.mariotaku.twidere.activity import android.accounts.Account import android.accounts.AccountManager import android.accounts.OnAccountsUpdateListener +import android.annotation.SuppressLint import android.app.Dialog import android.app.PendingIntent import android.app.SearchManager @@ -65,6 +66,7 @@ import kotlinx.android.synthetic.main.activity_home_content.* import kotlinx.android.synthetic.main.layout_empty_tab_hint.* import nl.komponents.kovenant.task import org.mariotaku.chameleon.ChameleonUtils +import org.mariotaku.kpreferences.contains import org.mariotaku.kpreferences.get import org.mariotaku.kpreferences.set import org.mariotaku.ktextension.* @@ -98,6 +100,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Statuses import org.mariotaku.twidere.service.StreamingService import org.mariotaku.twidere.util.* import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback +import org.mariotaku.twidere.util.premium.ExtraFeaturesService import org.mariotaku.twidere.view.HomeDrawerLayout import org.mariotaku.twidere.view.TabPagerIndicator import java.lang.ref.WeakReference @@ -143,6 +146,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp drawerToggleButton.contentDescription = getString(contentDescRes) } + @SuppressLint("RestrictedApi") override fun getThemeUpIndicator(): Drawable { val a = TintTypedArray.obtainStyledAttributes(actionBarThemedContext, null, HOME_AS_UP_ATTRS) @@ -261,7 +265,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp setupSlidingMenu() setupBars() - showDataProfilingRequest() + showPromotionOffer() initUnreadCount() setupHomeTabs() updateActionsButton() @@ -399,6 +403,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp return true } + @SuppressLint("RestrictedApi") override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat { super.onApplyWindowInsets(v, insets) val fragment = leftDrawerFragment @@ -836,21 +841,24 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp }) } - private fun showDataProfilingRequest() { - //spice - if (preferences.contains(KEY_USAGE_STATISTICS)) { + private fun showPromotionOffer() { + // Skip if app doesn't support extra features + if (!extraFeaturesService.isSupported()) return + // Skip if already bought enhanced features pack or have set promotions options + if (!extraFeaturesService.isEnabled(ExtraFeaturesService.FEATURE_FEATURES_PACK) + || promotionsEnabledKey in preferences) { return } - val intent = Intent(this, UsageStatisticsActivity::class.java) + val intent = Intent(this, PremiumDashboardActivity::class.java) val contentIntent = PendingIntent.getActivity(this, 0, intent, 0) val builder = NotificationChannelSpec.appNotices.notificationBuilder(this) builder.setAutoCancel(true) - builder.setSmallIcon(R.drawable.ic_stat_info) - builder.setTicker(getString(R.string.usage_statistics)) - builder.setContentTitle(getString(R.string.usage_statistics)) - builder.setContentText(getString(R.string.usage_statistics_notification_summary)) + builder.setSmallIcon(R.drawable.ic_stat_gift) + builder.setTicker(getString(R.string.message_ticker_promotions_reward)) + builder.setContentTitle(getString(R.string.title_promotions_reward)) + builder.setContentText(getString(R.string.message_promotions_reward)) builder.setContentIntent(contentIntent) - notificationManager.notify(NOTIFICATION_ID_DATA_PROFILING, builder.build()) + notificationManager.notify(NOTIFICATION_ID_PROMOTIONS_OFFER, builder.build()) } private fun triggerActionsClick() { diff --git a/twidere/src/main/res/values/strings.xml b/twidere/src/main/res/values/strings.xml index ed9e0e6ba..2338e5485 100644 --- a/twidere/src/main/res/values/strings.xml +++ b/twidere/src/main/res/values/strings.xml @@ -452,7 +452,7 @@ Search users No account Search GIF - Will be sent as quote because mention to tweet user removed. <a href=\"#dialog\";>Why?</a> + Will be sent as quote because mention to tweet author was removed. <a href=\"#dialog\";>Why?</a> Hints @@ -650,7 +650,8 @@ Twidere needs storage permission for sharing media to some apps. Pin this tweet? This will replace previously pinned tweet. Please wait. - Twitter makes tweet user always be mentioned in a reply. If tweet user was removed, Twidere will send this reply as a quote to preserve context. + Enable promotions to use all enhanced features for free, we promise not to disturb you! + Twitter makes tweet author always be mentioned in a reply. If tweet author was removed, Twidere will send this reply as a quote to preserve context. Connect to Buffer to schedule tweets even in offline Twidere is now connected to Buffer [Sticker] @@ -659,7 +660,7 @@ Disconnect from %s? Last synced: %s Field \"%s\" is required - Enable promotions to use all enhanced features for free, we promise not to disturb you! + Enable promotions to use all enhanced features for free! + ic_stat_gift-mdpi + Created with Sketch. + + + + + + + + \ No newline at end of file