mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 21:27:21 +00:00
Add expand button
This commit is contained in:
parent
0fcd997290
commit
d719660030
@ -17,17 +17,24 @@ import androidx.compose.foundation.pager.HorizontalPager
|
|||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.Button
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
|
import androidx.compose.material.Icon
|
||||||
|
import androidx.compose.material.IconButton
|
||||||
import androidx.compose.material.LocalTextStyle
|
import androidx.compose.material.LocalTextStyle
|
||||||
|
import androidx.compose.material.Surface
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.platform.ComposeView
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
@ -59,7 +66,6 @@ import org.thoughtcrime.securesms.ui.Cell
|
|||||||
import org.thoughtcrime.securesms.ui.CellNoMargin
|
import org.thoughtcrime.securesms.ui.CellNoMargin
|
||||||
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
|
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
|
||||||
import org.thoughtcrime.securesms.ui.ItemButton
|
import org.thoughtcrime.securesms.ui.ItemButton
|
||||||
import org.thoughtcrime.securesms.ui.LocalExtraColors
|
|
||||||
import org.thoughtcrime.securesms.ui.SessionHorizontalPagerIndicator
|
import org.thoughtcrime.securesms.ui.SessionHorizontalPagerIndicator
|
||||||
import org.thoughtcrime.securesms.ui.colorDestructive
|
import org.thoughtcrime.securesms.ui.colorDestructive
|
||||||
import org.thoughtcrime.securesms.ui.destructiveButtonColors
|
import org.thoughtcrime.securesms.ui.destructiveButtonColors
|
||||||
@ -284,6 +290,24 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Buttons(
|
||||||
|
messageDetails.error != null,
|
||||||
|
onReply,
|
||||||
|
onResend,
|
||||||
|
onDelete,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Buttons(
|
||||||
|
hasError: Boolean,
|
||||||
|
onReply: () -> Unit = {},
|
||||||
|
onResend: () -> Unit = {},
|
||||||
|
onDelete: () -> Unit = {},
|
||||||
|
) {
|
||||||
Cell {
|
Cell {
|
||||||
Column {
|
Column {
|
||||||
ItemButton(
|
ItemButton(
|
||||||
@ -292,7 +316,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
onClick = onReply
|
onClick = onReply
|
||||||
)
|
)
|
||||||
Divider()
|
Divider()
|
||||||
if (error != null) {
|
if (hasError) {
|
||||||
ItemButton(
|
ItemButton(
|
||||||
"Resend",
|
"Resend",
|
||||||
R.drawable.ic_message_details__refresh,
|
R.drawable.ic_message_details__refresh,
|
||||||
@ -309,9 +333,6 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Attachments(attachments: List<Attachment>) {
|
fun Attachments(attachments: List<Attachment>) {
|
||||||
@ -356,6 +377,16 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
pageCount = imageAttachments.size,
|
pageCount = imageAttachments.size,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Surface(
|
||||||
|
shape = CircleShape,
|
||||||
|
color = Color.Black.copy(alpha = 0.4f),
|
||||||
|
modifier = Modifier.align(Alignment.BottomEnd).padding(8.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = R.drawable.ic_expand),
|
||||||
|
contentDescription = ""
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CarouselNextButton(
|
CarouselNextButton(
|
||||||
pagerState,
|
pagerState,
|
||||||
@ -383,15 +414,6 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun Divider() {
|
|
||||||
Divider(
|
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
|
||||||
thickness = 1.dp,
|
|
||||||
color = LocalExtraColors.current.divider
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun titledText(
|
fun titledText(
|
||||||
titledText: TitledText,
|
titledText: TitledText,
|
||||||
|
@ -143,3 +143,11 @@ fun CarouselButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Divider() {
|
||||||
|
androidx.compose.material.Divider(
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
|
color = LocalExtraColors.current.divider
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user