Content-Length: 374 frost - My fork of Frost, a third-party app for Facebook
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt65
-rw-r--r--app/src/main/res/layout/view_nav_header.xml17
-rw-r--r--app/src 500 - Internal Server Error

500 - Internal Server Error

/main/res/values/dimens.xml
2
-rw-r--r--app/src/main/res/values/styles.xml19
4 files changed, 97 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
index 3543300d..dee94046 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -22,6 +22,7 @@ import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.PointF
+import android.graphics.drawable.Drawable
import android.graphics.drawable.RippleDrawable
import android.net.Uri
import android.os.Bundle
@@ -33,6 +34,7 @@ import android.webkit.WebChromeClient
import android.webkit.WebView
import android.widget.FrameLayout
import android.widget.ImageView
+import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.widget.Toolbar
@@ -47,11 +49,11 @@ import ca.allanwang.kau.searchview.bindSearchView
import ca.allanwang.kau.ui.ProgressAnimator
import ca.allanwang.kau.utils.adjustAlpha
import ca.allanwang.kau.utils.colorToForeground
+import ca.allanwang.kau.utils.dimenPixelSize
import ca.allanwang.kau.utils.drawable
import ca.allanwang.kau.utils.fadeScaleTransition
import ca.allanwang.kau.utils.gone
import ca.allanwang.kau.utils.invisible
-import ca.allanwang.kau.utils.isVisible
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.restart
import ca.allanwang.kau.utils.setIcon
@@ -63,6 +65,9 @@ import ca.allanwang.kau.utils.toDrawable
import ca.allanwang.kau.utils.visible
import ca.allanwang.kau.utils.withMinAlpha
import com.afollestad.materialdialogs.checkbox.checkBoxPrompt
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.transition.Transition
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.tabs.TabLayout
@@ -483,7 +488,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
)
)
var showOptions = false
- val animator: ProgressAnimator = ProgressAnimator.ofFloat { }
+ val animator: ProgressAnimator = ProgressAnimator.ofFloat { }
background.setOnClickListener {
animator.reset()
if (showOptions) {
@@ -499,7 +504,10 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
} else {
animator.apply {
- optionsContainer.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
+ optionsContainer.measure(
+ View.MeasureSpec.UNSPECIFIED,
+ View.MeasureSpec.UNSPECIFIED
+ )
withAnimator(
optionsContainer.height.toFloat(),
optionsContainer.measuredHeight.toFloat()
@@ -516,6 +524,19 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
showOptions = !showOptions
animator.start()
}
+
+ fun TextView.setOptionsIcon(iicon: IIcon) {
+ setCompoundDrawablesRelativeWithIntrinsicBounds(
+ iicon.toDrawable(this@BaseMainActivity, sizeDp = 20),
+ null,
+ null,
+ null
+ )
+ }
+
+ optionsLogout.setOptionsIcon(GoogleMaterial.Icon.gmd_exit_to_app)
+ optionsAddAccount.setOptionsIcon(GoogleMaterial.Icon.gmd_add)
+ optionsManageAccount.setOptionsIcon(GoogleMaterial.Icon.gmd_settings)
}
}
@@ -536,6 +557,44 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
avatarPrimary.setAccount(orderedAccounts.getOrNull(0), true)
avatarSecondary.setAccount(orderedAccounts.getOrNull(1), false)
avatarTertiary.setAccount(orderedAccounts.getOrNull(2), false)
+ optionsAccountsContainer.removeAllViews()
+ name.text = orderedAccounts.getOrNull(0)?.name
+ val glide = Glide.with(root)
+ val accountSize = dimenPixelSize(R.dimen.drawer_account_avatar_size)
+ orderedAccounts.forEach {
+ val tv =
+ TextView(
+ this@BaseMainActivity,
+ null,
+ 0,
+ R.style.Main_DrawerAccountUserOptions
+ )
+ glide.load(profilePictureUrl(it.id)).transform(FrostGlide.circleCrop)
+ .into(object : CustomTarget<Drawable>(accountSize, accountSize) {
+ override fun onLoadCleared(placeholder: Drawable?) {
+ tv.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ placeholder,
+ null,
+ null,
+ null
+ )
+ }
+
+ override fun onResourceReady(
+ resource: Drawable,
+ transition: Transition<in Drawable>?
+ ) {
+ tv.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ resource,
+ null,
+ null,
+ null
+ )
+ }
+ })
+ tv.text = it.name
+ optionsAccountsContainer.addView(tv)
+ }
}
private fun closeDrawer() {
diff --git a/app/src/main/res/layout/view_nav_header.xml b/app/src/main/res/layout/view_nav_header.xml
index af918736..38df36d7 100644
--- a/app/src/main/res/layout/view_nav_header.xml
+++ b/app/src/main/res/layout/view_nav_header.xml
@@ -8,6 +8,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
+ android:elevation="2dp"
android:layout_height="160dp">
<androidx.appcompat.widget.AppCompatImageView
@@ -86,6 +87,18 @@
android:visibility="gone"
tools:visibility="visible">
+ <LinearLayout
+ android:id="@+id/options_accounts_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" />
+
+ <TextView
+ android:id="@+id/options_logout"
+ style="@style/Main.DrawerAccountOptions"
+ android:text="@string/kau_logout"
+ tools:drawableStart="@drawable/abc_vector_test" />
+
<TextView
android:id="@+id/options_add_account"
style="@style/Main.DrawerAccountOptions"
@@ -93,9 +106,9 @@
tools:drawableStart="@drawable/abc_vector_test" />
<TextView
- android:id="@+id/options_logout"
+ android:id="@+id/options_manage_account"
style="@style/Main.DrawerAccountOptions"
- android:text="@string/kau_logout"
+ android:text="@string/kau_manage_account"
tools:drawableStart="@drawable/abc_vector_test" />
</LinearLayout>
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 1f66683d..c81aee3c 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/