Enhance not seen indication & Fix MainActivity toolbar bug
This commit is contained in:
parent
f5ca518713
commit
87e17c818e
@ -77,12 +77,11 @@ class MainActivity : ServiceBoundActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar.toolbar)
|
||||
|
||||
val identityName = intent.getStringExtra("identityName")
|
||||
identityName?.let {
|
||||
setSupportActionBar(binding.toolbar.toolbar)
|
||||
binding.toolbar.textAvatar.setLetterFrom(it)
|
||||
binding.toolbar.title.text = it
|
||||
initToolbar(it)
|
||||
}
|
||||
|
||||
val openedToShareFile = intent.action == Intent.ACTION_SEND || intent.action == Intent.ACTION_SEND_MULTIPLE
|
||||
@ -140,7 +139,7 @@ class MainActivity : ServiceBoundActivity() {
|
||||
airaService.isAppInBackground = false
|
||||
refreshSessions()
|
||||
if (AIRAService.isServiceRunning) {
|
||||
title = airaService.identityName
|
||||
airaService.identityName?.let { initToolbar(it) }
|
||||
} else {
|
||||
airaService.identityName = identityName
|
||||
startService(serviceIntent)
|
||||
@ -253,6 +252,11 @@ class MainActivity : ServiceBoundActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun initToolbar(identityName: String) {
|
||||
binding.toolbar.textAvatar.setLetterFrom(identityName)
|
||||
binding.toolbar.title.text = identityName
|
||||
}
|
||||
|
||||
private fun refreshSessions() {
|
||||
onlineSessionAdapter.reset()
|
||||
offlineSessionAdapter?.reset()
|
||||
|
@ -5,14 +5,12 @@ import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.BaseAdapter
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.*
|
||||
import androidx.core.content.ContextCompat
|
||||
import sushi.hardcore.aira.R
|
||||
import sushi.hardcore.aira.widgets.TextAvatar
|
||||
|
||||
class SessionAdapter(val context: Context): BaseAdapter() {
|
||||
class SessionAdapter(private val context: Context): BaseAdapter() {
|
||||
private val sessions = mutableListOf<Session>()
|
||||
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
val selectedItems = mutableListOf<Int>()
|
||||
@ -52,11 +50,16 @@ class SessionAdapter(val context: Context): BaseAdapter() {
|
||||
setImageDrawable(null)
|
||||
}
|
||||
}
|
||||
view.findViewById<ImageView>(R.id.image_seen).visibility = if (currentSession.seen) {
|
||||
view.findViewById<LinearLayout>(R.id.marker_not_seen).visibility = if (currentSession.seen) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
view.findViewById<ImageView>(R.id.image_arrow).setColorFilter(ContextCompat.getColor(context, if (currentSession.seen) {
|
||||
R.color.sessionArrow
|
||||
} else {
|
||||
R.color.secondary
|
||||
}))
|
||||
view.setBackgroundColor(ContextCompat.getColor(context, if (selectedItems.contains(position)) {
|
||||
R.color.itemSelected
|
||||
} else {
|
||||
|
5
app/src/main/res/drawable/ic_arrow_forward.xml
Normal file
5
app/src/main/res/drawable/ic_arrow_forward.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#FFFFFF" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M6.23,20.23l1.77,1.77l10,-10l-10,-10l-1.77,1.77l8.23,8.23z"/>
|
||||
</vector>
|
@ -1,45 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="15dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<sushi.hardcore.aira.widgets.TextAvatar
|
||||
android:id="@+id/text_avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
app:textSize="8sp"
|
||||
<LinearLayout
|
||||
android:id="@+id/marker_not_seen"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:background="@color/secondary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/text_avatar"/>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toEndOf="@id/marker_not_seen"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="15dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_trust_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/text_name"/>
|
||||
<sushi.hardcore.aira.widgets.TextAvatar
|
||||
android:id="@+id/text_avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
app:textSize="8sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_seen"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/round_background"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
<TextView
|
||||
android:id="@+id/text_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/text_avatar"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_trust_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/text_name"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_arrow"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_arrow_forward"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -11,4 +11,5 @@
|
||||
<color name="messageTextColor">#ffffff</color>
|
||||
<color name="itemSelected">#66666666</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="sessionArrow">#777777</color>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user