mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Add home screen gradient
This commit is contained in:
parent
f94bf6301b
commit
cae76a2f66
11
res/drawable/home_activity_gradient.xml
Normal file
11
res/drawable/home_activity_gradient.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:startColor="@android:color/transparent"
|
||||||
|
android:endColor="#000000"
|
||||||
|
android:angle="270" />
|
||||||
|
|
||||||
|
</shape>
|
@ -58,6 +58,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/gradientView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/home_activity_gradient" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.loki.redesign.views.NewConversationButtonSetView
|
<org.thoughtcrime.securesms.loki.redesign.views.NewConversationButtonSetView
|
||||||
android:id="@+id/newConversationButtonSet"
|
android:id="@+id/newConversationButtonSet"
|
||||||
android:layout_width="252dp"
|
android:layout_width="252dp"
|
||||||
|
@ -19,7 +19,9 @@ import android.support.v7.widget.helper.ItemTouchHelper
|
|||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.style.ForegroundColorSpan
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.util.DisplayMetrics
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.RelativeLayout
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import kotlinx.android.synthetic.main.activity_home.*
|
import kotlinx.android.synthetic.main.activity_home.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
@ -124,6 +126,13 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
|||||||
homeAdapter.changeCursor(null)
|
homeAdapter.changeCursor(null)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// Set up gradient view
|
||||||
|
val gradientViewLayoutParams = gradientView.layoutParams as RelativeLayout.LayoutParams
|
||||||
|
val displayMetrics = DisplayMetrics()
|
||||||
|
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||||
|
val height = displayMetrics.heightPixels
|
||||||
|
gradientViewLayoutParams.topMargin = (0.15 * height.toFloat()).toInt()
|
||||||
|
// Set up new conversation button set
|
||||||
newConversationButtonSet.delegate = this
|
newConversationButtonSet.delegate = this
|
||||||
// Set up typing observer
|
// Set up typing observer
|
||||||
ApplicationContext.getInstance(this).typingStatusRepository.typingThreads.observe(this, Observer<Set<Long>> { threadIDs ->
|
ApplicationContext.getInstance(this).typingStatusRepository.typingThreads.observe(this, Observer<Set<Long>> { threadIDs ->
|
||||||
|
@ -209,7 +209,9 @@ class NewConversationButtonSetView : RelativeLayout {
|
|||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
val touch = PointF(event.x, event.y)
|
val touch = PointF(event.x, event.y)
|
||||||
val expandedButton = expandedButton
|
val expandedButton = expandedButton
|
||||||
|
val allButtons = listOf( mainButton, sessionButton, closedGroupButton, openGroupButton )
|
||||||
val buttonsExcludingMainButton = listOf( sessionButton, closedGroupButton, openGroupButton )
|
val buttonsExcludingMainButton = listOf( sessionButton, closedGroupButton, openGroupButton )
|
||||||
|
if (allButtons.none { it.contains(touch) }) { return false }
|
||||||
when (event.action) {
|
when (event.action) {
|
||||||
MotionEvent.ACTION_DOWN -> {
|
MotionEvent.ACTION_DOWN -> {
|
||||||
val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator
|
val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator
|
||||||
|
Loading…
Reference in New Issue
Block a user