aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-12 00:52:12 -0500
committerGitHub <noreply@github.com>2017-12-12 00:52:12 -0500
commit82f9aca96493316bc62008f2b3167d34a6029b38 (patch)
tree665f2a450b7b2d9ee8f9abc35d25007c1db81ef3 /app/src/main/kotlin
parentb90dcc04376b48d2b91fea8a5de48acbd7f885c4 (diff)
downloadfrost-82f9aca96493316bc62008f2b3167d34a6029b38.tar.gz
frost-82f9aca96493316bc62008f2b3167d34a6029b38.tar.bz2
frost-82f9aca96493316bc62008f2b3167d34a6029b38.zip
Update/intro (#550)v1.7.0
* Add edit button to intro * Update readme * Fix video error and cancellation * Update changelog * Hide invalid tab options
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt22
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoView.kt15
9 files changed, 34 insertions, 15 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
index 9888c377..8c70f5f2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
@@ -1,12 +1,10 @@
package com.pitchedapps.frost
-import android.content.Context
import android.os.Bundle
import ca.allanwang.kau.internal.KauBaseActivity
import com.pitchedapps.frost.activities.LoginActivity
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.activities.SelectorActivity
-import com.pitchedapps.frost.activities.TabCustomizerActivity
import com.pitchedapps.frost.dbflow.loadFbCookiesAsync
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.L
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
index 6ab65399..a32ba10e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
@@ -2,7 +2,6 @@ package com.pitchedapps.frost.activities
import android.content.res.Configuration
import android.os.Bundle
-import android.transition.Fade
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.searchview.SearchViewHolder
import com.pitchedapps.frost.contracts.VideoViewHolder
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
index bac352af..ca7a231d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
@@ -58,7 +58,7 @@ class TabCustomizerActivity : BaseActivity() {
instructions.setTextColor(Prefs.textColor)
val tabs = loadFbTabs().toMutableList()
- val remaining = FbItem.values().toMutableList()
+ val remaining = FbItem.values().filter { it.name[0] != '_' }.toMutableList()
remaining.removeAll(tabs)
tabs.addAll(remaining)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
index 27479691..32955f06 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
@@ -44,7 +44,7 @@ enum class FbItem(
inline val fbSearch
get() = fbSearch()
-fun fbSearch(query: String = "a") = "${FB_SEARCH}$query"
+fun fbSearch(query: String = "a") = "$FB_SEARCH$query"
private const val FB_SEARCH = "${FB_URL_BASE}search/top/?q="
fun defaultTabs(): List<FbItem> = listOf(FbItem.FEED, FbItem.MESSAGES, FbItem.NOTIFICATIONS, FbItem.MENU)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
index 73d80538..506d1cab 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
@@ -1,6 +1,5 @@
package com.pitchedapps.frost.iitems
-import android.graphics.Color
import android.view.View
import android.widget.ImageView
import android.widget.TextView
@@ -11,7 +10,6 @@ import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter_extensions.drag.IDraggable
import com.pitchedapps.frost.R
import com.pitchedapps.frost.facebook.FbItem
-import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
/**
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 dff7d8b8..b9c83c50 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroImageFragments.kt
@@ -4,20 +4,26 @@ import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.os.Bundle
import android.view.View
-import ca.allanwang.kau.utils.colorToForeground
-import ca.allanwang.kau.utils.tint
-import ca.allanwang.kau.utils.withAlpha
+import android.widget.ImageView
+import ca.allanwang.kau.utils.*
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.Prefs
+import com.pitchedapps.frost.utils.launchTabCustomizerActivity
/**
* Created by Allan Wang on 2017-07-28.
*/
-abstract class BaseImageIntroFragment(val titleRes: Int, val imageRes: Int, val descRes: Int) : BaseIntroFragment(R.layout.intro_image) {
+abstract class BaseImageIntroFragment(
+ val titleRes: Int,
+ val imageRes: Int,
+ val descRes: Int
+) : BaseIntroFragment(R.layout.intro_image) {
val imageDrawable: LayerDrawable by lazyResettableRegistered { image.drawable as LayerDrawable }
val phone: Drawable by lazyResettableRegistered { imageDrawable.findDrawableByLayerId(R.id.intro_phone) }
val screen: Drawable by lazyResettableRegistered { imageDrawable.findDrawableByLayerId(R.id.intro_phone_screen) }
+ val icon: ImageView by bindViewResettable(R.id.intro_button)
override fun viewArray(): Array<Array<out View>>
= arrayOf(arrayOf(title), arrayOf(desc))
@@ -83,6 +89,14 @@ class IntroTabTouchFragment : BaseImageIntroFragment(
R.string.intro_easy_navigation, R.drawable.intro_phone_tab, R.string.intro_easy_navigation_desc
) {
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ icon.visible().setIcon(GoogleMaterial.Icon.gmd_edit, 24)
+ icon.setOnClickListener {
+ activity?.launchTabCustomizerActivity()
+ }
+ }
+
override fun themeFragmentImpl() {
super.themeFragmentImpl()
themeImageComponent(Prefs.iconColor, R.id.intro_phone_icon_1, R.id.intro_phone_icon_2, R.id.intro_phone_icon_3, R.id.intro_phone_icon_4)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
index 60397158..60512f17 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
@@ -36,7 +36,7 @@ fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
Debugger.values().forEach {
plainText(it.data.titleId) {
iicon = it.data.icon
- onClick = { it.debug(itemView.context) }
+ onClick = { it.debug(itemView.context) }
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
index ed7a3c4f..60713034 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
@@ -7,7 +7,6 @@ import android.util.AttributeSet
import android.widget.ImageView
import android.widget.TextView
import ca.allanwang.kau.utils.*
-import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.Prefs
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoView.kt
index 9d5e199a..4e3aa097 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoView.kt
@@ -8,11 +8,14 @@ import android.util.AttributeSet
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
+import android.widget.Toast
import ca.allanwang.kau.ui.ProgressAnimator
import ca.allanwang.kau.utils.AnimHolder
import ca.allanwang.kau.utils.dpToPx
import ca.allanwang.kau.utils.scaleXY
+import ca.allanwang.kau.utils.toast
import com.devbrackets.android.exomedia.ui.widget.VideoView
+import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.L
/**
@@ -58,8 +61,6 @@ class FrostVideoView @JvmOverloads constructor(
var isExpanded: Boolean = true
set(value) {
if (field == value) return
- if (videoDimensions.x <= 0f || videoDimensions.y <= 0f)
- return L.d("Attempted to toggle video expansion when points have not been finalized")
field = value
val origX = translationX
val origY = translationY
@@ -96,6 +97,11 @@ class FrostVideoView @JvmOverloads constructor(
* and return the necessary transitions to get there
*/
private fun mapBounds(): Triple<Float, Float, Float> {
+ if (videoDimensions.x <= 0f || videoDimensions.y <= 0f) {
+ L.d("Attempted to toggle video expansion when points have not been finalized")
+ val dimen = Math.min(height, width).toFloat()
+ videoDimensions.set(dimen, dimen)
+ }
val portrait = height > width
val scale = Math.min(height / (if (portrait) 4f else 2.3f) / videoDimensions.y, width / (if (portrait) 2.3f else 4f) / videoDimensions.x)
val desiredHeight = scale * videoDimensions.y
@@ -124,6 +130,11 @@ class FrostVideoView @JvmOverloads constructor(
start()
if (isExpanded) showControls()
}
+ setOnErrorListener {
+ toast(R.string.video_load_failed, Toast.LENGTH_SHORT)
+ destroy()
+ true
+ }
setOnCompletionListener {
if (repeat) restart()
else viewerContract.onVideoComplete()