Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Voine committed May 12, 2023
1 parent b691cb0 commit 24189c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import com.chatwaifu.mobile.ChatActivityViewModel
import com.chatwaifu.mobile.R
import com.chatwaifu.mobile.data.Constant
import com.chatwaifu.mobile.ui.theme.ChatWaifu_MobileTheme
import com.chatwaifu.mobile.utils.LocalModelManager

class ChatLogFragment : Fragment() {
private val activityViewModel: ChatActivityViewModel by activityViewModels()
private val fragmentViewModel: ChatLogViewModel by viewModels()
private val localModelManager: LocalModelManager by lazy { LocalModelManager() }
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
Expand All @@ -30,7 +32,8 @@ class ChatLogFragment : Fragment() {
chatLogViewModel = fragmentViewModel,
onNavIconPressed = {
activityViewModel.openDrawer()
}
},
externalModelList = localModelManager.getChatLogExternalItemList()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fun SettingEditText(
hint: String = "this is a hint",
onValueChanged: (String) -> Unit = {}
) {
val value by rememberSaveable { mutableStateOf(initValue) }
var value by rememberSaveable { mutableStateOf(initValue) }
Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -255,7 +255,10 @@ fun SettingEditText(
),
fontStyle = FontStyle.Italic
) else TextStyle.Default,
onValueChange = { onValueChanged(it) },
onValueChange = {
value = it
onValueChanged(it)
},
decorationBox = { innerTextField ->
// Because the decorationBox is used, the whole Row gets the same behaviour as the
// internal input field would have otherwise. For example, there is no need to add a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ class LocalModelManager() {
return list
}

fun getChatLogExternalItemList(): List<String> {
val chatWaifuExternalDir = Environment.getExternalStorageDirectory().path
val externalLive2dNames =
File(chatWaifuExternalDir, Constant.EXTEND_LIVE2D_PATH).listFiles()?.map { it.name }
return externalLive2dNames ?: emptyList()
}

companion object {
val vitsFileArr= listOf(
"config.json",
Expand Down

0 comments on commit 24189c6

Please sign in to comment.