-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
625 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.b3log.siyuan.compose | ||
|
||
import android.annotation.SuppressLint | ||
import androidx.compose.foundation.text.selection.SelectionContainer | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
|
||
@SuppressLint("UnrememberedMutableInteractionSource") | ||
@Composable | ||
fun SelectableText(text: String, modifier: Modifier = Modifier, style: TextStyle = TextStyle()) { | ||
// 支持长按选择操作 | ||
SelectionContainer { | ||
Text( | ||
text = text, | ||
modifier = modifier, | ||
style = style | ||
.copy( | ||
fontSize = 16.sp, | ||
fontWeight = FontWeight.Normal, | ||
fontStyle = FontStyle.Normal | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package org.b3log.siyuan.compose | ||
|
||
import android.content.res.Configuration | ||
import android.net.Uri | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalInspectionMode | ||
import androidx.compose.ui.unit.dp | ||
import org.b3log.siyuan.S | ||
import org.b3log.siyuan.Us | ||
|
||
|
||
@Composable | ||
fun AudioButtons() { | ||
val TAG = "MainPro-BtnPart-AudioButtons" | ||
val inspectionMode = LocalInspectionMode.current // 获取当前是否处于预览模式// 获取窗口尺寸 | ||
val Button_Width = S.C.Button_Width.current | ||
val btn_lspace = S.C.btn_lspace.current | ||
val btn_PaddingTopH = S.C.btn_PaddingTopH.current | ||
val btn_PaddingTopV = S.C.btn_PaddingTopV.current | ||
val btn_TextFontsizeH = S.C.btn_TextFontsizeH.current | ||
val btn_TextFontsizeV = S.C.btn_TextFontsizeV.current | ||
val btn_Color1 = S.C.btn_Color1.current | ||
val btn_bgColor1 = S.C.btn_bgColor_pink.current | ||
val btnText1 = S.C.btnTextAudio1.current | ||
val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE // 是否横屏(宽高比) | ||
Button(modifier= Modifier | ||
.width(Button_Width.dp) | ||
.padding(top = if (isLandscape) btn_PaddingTopH else btn_PaddingTopV), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = btn_bgColor1, | ||
contentColor = btn_Color1 | ||
), enabled = false, | ||
onClick = { /*TODO*/ }) { | ||
Text( | ||
text = btnText1, | ||
letterSpacing = btn_lspace, | ||
fontSize = if (isLandscape) btn_TextFontsizeH else btn_TextFontsizeV | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun VideoButtons(uri: Uri) { | ||
val TAG = "MainPro-BtnPart-AudioButtons" | ||
val inspectionMode = LocalInspectionMode.current // 获取当前是否处于预览模式// 获取窗口尺寸 | ||
val Lcc = LocalContext.current | ||
val Button_Width = S.C.Button_Width.current | ||
val btn_lspace = S.C.btn_lspace.current | ||
val btn_PaddingTopH = S.C.btn_PaddingTopH.current | ||
val btn_PaddingTopV = S.C.btn_PaddingTopV.current | ||
val btn_TextFontsizeH = S.C.btn_TextFontsizeH.current | ||
val btn_TextFontsizeV = S.C.btn_TextFontsizeV.current | ||
val btn_Color1 = S.C.btn_Color1.current | ||
val btn_bgColor1 = S.C.btn_bgColor_pink.current | ||
val btnText1 = S.C.btnTextVideo1.current | ||
val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE // 是否横屏(宽高比) | ||
Button(modifier= Modifier | ||
.width(Button_Width.dp) | ||
.padding(top = if (isLandscape) btn_PaddingTopH else btn_PaddingTopV), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = btn_bgColor1, | ||
contentColor = btn_Color1 | ||
), enabled = true, onClick = { | ||
Us.handleVideo(Lcc, uri) | ||
}) { | ||
Text( | ||
text = btnText1, | ||
letterSpacing = btn_lspace, | ||
fontSize = if (isLandscape) btn_TextFontsizeH else btn_TextFontsizeV | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun ApkButtons( ApkBTNonClick1: () -> Unit) { | ||
val TAG = "MainPro-BtnPart-AudioButtons" | ||
val inspectionMode = LocalInspectionMode.current // 获取当前是否处于预览模式// 获取窗口尺寸 | ||
val Button_Width = S.C.Button_Width.current | ||
val btn_lspace = S.C.btn_lspace.current | ||
val btn_PaddingTopH = S.C.btn_PaddingTopH.current | ||
val btn_PaddingTopV = S.C.btn_PaddingTopV.current | ||
val btn_TextFontsizeH = S.C.btn_TextFontsizeH.current | ||
val btn_TextFontsizeV = S.C.btn_TextFontsizeV.current | ||
val btn_Color1 = S.C.btn_Color1.current | ||
val btn_bgColor1 = S.C.btn_bgColor_pink.current | ||
val btnText1 = S.C.btnText5Apk1.current | ||
val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE // 是否横屏(宽高比) | ||
Button(modifier= Modifier | ||
.width(Button_Width.dp) | ||
.padding(top = if (isLandscape) btn_PaddingTopH else btn_PaddingTopV), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = btn_bgColor1, | ||
contentColor = btn_Color1 | ||
), enabled = true, onClick = ApkBTNonClick1) { | ||
Text( | ||
text = btnText1, | ||
letterSpacing = btn_lspace, | ||
fontSize = if (isLandscape) btn_TextFontsizeH else btn_TextFontsizeV | ||
) | ||
} | ||
} |
Oops, something went wrong.