diff options
author | Allan Wang <me@allanwang.ca> | 2017-11-09 01:54:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-09 01:54:12 -0500 |
commit | e1c12f7716511d15e7534b959370619ebf04af81 (patch) | |
tree | fe8af0e01c6dc44f869b165b15b991ac9caee22a /app/src/main/kotlin/com/pitchedapps | |
parent | fc4a018d4862f6d64b6a4c737d90c46574bbf92b (diff) | |
download | frost-e1c12f7716511d15e7534b959370619ebf04af81.tar.gz frost-e1c12f7716511d15e7534b959370619ebf04af81.tar.bz2 frost-e1c12f7716511d15e7534b959370619ebf04af81.zip |
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
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
11 files changed, 22 insertions, 21 deletions
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<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { 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<FbItem>) : 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<Array<out View>> = 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<Array<out View>> = 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() |