From e1c12f7716511d15e7534b959370619ebf04af81 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 9 Nov 2017 01:54:12 -0500 Subject: Update/kau (#476) * Update all dependencies * Revert to working build * Update kau again * Update nullables * Update more nullables * Inline some things * Add images to readme * Update readme translators --- .../kotlin/com/pitchedapps/frost/activities/AboutActivity.kt | 6 +++--- .../kotlin/com/pitchedapps/frost/activities/MainActivity.kt | 2 +- .../com/pitchedapps/frost/activities/SettingsActivity.kt | 1 + .../com/pitchedapps/frost/activities/WebOverlayActivity.kt | 6 +++--- app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt | 2 +- .../main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt | 10 +++++----- .../kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt | 2 +- .../kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt | 2 +- .../kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt | 4 ++-- .../com/pitchedapps/frost/services/FrostNotifications.kt | 4 ++-- .../main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt | 4 ++-- app/src/main/res/values/strings_no_translate.xml | 1 + 12 files changed, 23 insertions(+), 21 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 8168efca..94c43331 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -73,8 +73,8 @@ class AboutActivity : AboutActivityBase(null, { */ val frost = Library().apply { libraryName = string(R.string.frost_name) - author = "Pitched Apps" - libraryWebsite = "https://github.com/AllanWang/Frost-for-Facebook" + author = string(R.string.dev_name) + libraryWebsite = string(R.string.github_url) isOpenSource = true libraryDescription = string(R.string.frost_description) libraryVersion = BuildConfig.VERSION_NAME @@ -109,7 +109,7 @@ class AboutActivity : AboutActivityBase(null, { override fun getLayoutRes(): Int = R.layout.item_about_links - override fun bindView(holder: ViewHolder, payloads: MutableList?) { + override fun bindView(holder: ViewHolder, payloads: MutableList) { super.bindView(holder, payloads) with(holder) { bindIconColor(*images.toTypedArray()) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt index b347d6a0..2f4bd2e1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt @@ -453,7 +453,7 @@ class MainActivity : BaseActivity(), super.onBackPressed() } - val currentFragment + inline val currentFragment get() = supportFragmentManager.findFragmentByTag("android:switcher:${R.id.container}:${viewPager.currentItem}") as WebFragment inner class SectionsPagerAdapter(fm: FragmentManager, val pages: List) : FragmentPagerAdapter(fm) { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt index 0511a74f..293be694 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt @@ -105,6 +105,7 @@ class SettingsActivity : KPrefActivity(), FrostBilling by IabSettings() { plainText(R.string.get_pro) { descRes = R.string.get_pro_desc iicon = GoogleMaterial.Icon.gmd_star + visible = { !IS_FROST_PRO } onClick = { _, _, _ -> restorePurchases(); true } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt index bca10606..c2556563 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -102,16 +102,16 @@ open class WebOverlayActivityBase(private val forceBasicAgent: Boolean) : KauBas val frostWeb: FrostWebView by bindView(R.id.overlay_frost_webview) val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content) - val urlTest: String? + inline val urlTest: String? get() = intent.extras?.getString(ARG_URL) ?: intent.dataString open val url: String get() = (intent.extras?.getString(ARG_URL) ?: intent.dataString).formattedFbUrl - val userId: Long + inline val userId: Long get() = intent.extras?.getLong(ARG_USER_ID, Prefs.userId) ?: Prefs.userId - val overlayContext: OverlayContext? + inline val overlayContext: OverlayContext? get() = intent.extras?.getSerializable(ARG_OVERLAY_CONTEXT) as OverlayContext? override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt index 4dc7b62d..6f08981c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt @@ -20,7 +20,7 @@ import io.reactivex.subjects.SingleSubject */ object FbCookie { - val webCookie: String? + inline val webCookie: String? get() = CookieManager.getInstance().getCookie(FB_URL_BASE) private fun setWebCookie(cookie: String?, callback: (() -> Unit)?) { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt index 4286be86..f1b76e57 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt @@ -42,9 +42,9 @@ class WebFragment : Fragment() { // val refresh: SwipeRefreshLayout by lazy { frostWebView.refresh } val web: FrostWebViewCore by lazy { frostWebView.web } - val url: String by lazy { arguments.getString(ARG_URL) } - val urlEnum: FbItem by lazy { arguments.getSerializable(ARG_URL_ENUM) as FbItem } - val position: Int by lazy { arguments.getInt(ARG_POSITION) } + val url: String by lazy { arguments!!.getString(ARG_URL) } + val urlEnum: FbItem by lazy { arguments!!.getSerializable(ARG_URL_ENUM) as FbItem } + val position: Int by lazy { arguments!!.getInt(ARG_POSITION) } lateinit var frostWebView: FrostWebView private var firstLoad = true private var activityDisposable: Disposable? = null @@ -60,12 +60,12 @@ class WebFragment : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { super.onCreateView(inflater, container, savedInstanceState) - frostWebView = FrostWebView(context) + frostWebView = FrostWebView(context!!) frostWebView.setupWebview(url, urlEnum) return frostWebView } - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) onCreateRunnable?.invoke(this) onCreateRunnable = null diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt index 2e7d3572..37f93987 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt @@ -25,7 +25,7 @@ class IntroFragmentTheme : BaseIntroFragment(R.layout.intro_theme) { override fun viewArray(): Array> = arrayOf(arrayOf(title), arrayOf(light, dark), arrayOf(amoled, glass)) - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) light.setThemeClick(Theme.LIGHT) dark.setThemeClick(Theme.DARK) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt index d19a488d..dff7d8b8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt @@ -22,7 +22,7 @@ abstract class BaseImageIntroFragment(val titleRes: Int, val imageRes: Int, val override fun viewArray(): Array> = arrayOf(arrayOf(title), arrayOf(desc)) - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { title.setText(titleRes) image.setImageResource(imageRes) desc.setText(descRes) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt index 552fad3b..bae8ac7a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt @@ -64,7 +64,7 @@ abstract class BaseIntroFragment(val layoutRes: Int) : Fragment() { return view } - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) themeFragment() } @@ -126,7 +126,7 @@ class IntroFragmentEnd : BaseIntroFragment(R.layout.intro_end) { } @SuppressLint("ClickableViewAccessibility") - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) container.setOnSingleTapListener { _, event -> (activity as IntroActivity).finish(event.x, event.y) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt index 749aec09..44b01bc3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt @@ -45,7 +45,7 @@ fun setupNotificationChannels(c: Context) { manager.createNotificationChannel(mainChannel) } -val Context.frostNotification: NotificationCompat.Builder +inline val Context.frostNotification: NotificationCompat.Builder get() = NotificationCompat.Builder(this, BuildConfig.APPLICATION_ID).apply { setSmallIcon(R.drawable.frost_f_24) setAutoCancel(true) @@ -63,7 +63,7 @@ fun NotificationCompat.Builder.withDefaults(ringtone: String = Prefs.notificatio setDefaults(defaults) } -val NotificationCompat.Builder.withBigText: NotificationCompat.BigTextStyle +inline val NotificationCompat.Builder.withBigText: NotificationCompat.BigTextStyle get() = NotificationCompat.BigTextStyle(this) /** diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt index 15c0f9a8..64fc9cb8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt @@ -26,8 +26,8 @@ private const val FROST_PRO = "frost_pro" * Implemented pro checker with a hook for debug builds * Use this when checking if the pro feature is enabled */ -val IS_FROST_PRO: Boolean - get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.pro +inline val IS_FROST_PRO: Boolean + get() = Prefs.pro || (BuildConfig.DEBUG && Prefs.debugPro) interface FrostBilling : BillingProcessor.IBillingHandler { fun Activity.onCreateBilling() diff --git a/app/src/main/res/values/strings_no_translate.xml b/app/src/main/res/values/strings_no_translate.xml index 4b6c2e6e..cd8523ad 100644 --- a/app/src/main/res/values/strings_no_translate.xml +++ b/app/src/main/res/values/strings_no_translate.xml @@ -1,4 +1,5 @@ + Pitched Apps pitchedapps@gmail.com https://www.paypal.me/Allanw9 PayPal -- cgit v1.2.3