-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: refactored recordings screen to compose
- Loading branch information
Showing
27 changed files
with
778 additions
and
411 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
76 changes: 76 additions & 0 deletions
76
...ui-compose/src/main/kotlin/com/f0x1d/logfox/ui/compose/component/button/VerticalButton.kt
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,76 @@ | ||
package com.f0x1d.logfox.ui.compose.component.button | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.ProvideTextStyle | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import com.f0x1d.logfox.strings.Strings | ||
import com.f0x1d.logfox.ui.Icons | ||
import com.f0x1d.logfox.ui.compose.preview.DayNightPreview | ||
import com.f0x1d.logfox.ui.compose.theme.LogFoxTheme | ||
|
||
@Composable | ||
fun VerticalButton( | ||
icon: @Composable () -> Unit, | ||
text: @Composable () -> Unit, | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
enabled: Boolean = true, | ||
shape: Shape = CardDefaults.shape, | ||
) { | ||
Card( | ||
modifier = modifier, | ||
onClick = onClick, | ||
enabled = enabled, | ||
shape = shape, | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(20.dp), | ||
verticalArrangement = Arrangement.spacedBy(6.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
icon() | ||
|
||
ProvideTextStyle( | ||
value = MaterialTheme.typography.bodyLarge.copy( | ||
fontWeight = FontWeight.Medium, | ||
), | ||
) { | ||
text() | ||
} | ||
} | ||
} | ||
} | ||
|
||
@DayNightPreview | ||
@Composable | ||
private fun Preview() = LogFoxTheme { | ||
VerticalButton( | ||
icon = { | ||
Icon( | ||
painter = painterResource(Icons.ic_menu_overflow), | ||
contentDescription = null, | ||
) | ||
}, | ||
text = { | ||
Text(text = stringResource(Strings.root)) | ||
}, | ||
onClick = { }, | ||
) | ||
} |
68 changes: 68 additions & 0 deletions
68
...pose/src/main/kotlin/com/f0x1d/logfox/ui/compose/component/placeholder/ListPlaceholder.kt
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,68 @@ | ||
package com.f0x1d.logfox.ui.compose.component.placeholder | ||
|
||
import androidx.annotation.DrawableRes | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.ProvideTextStyle | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.f0x1d.logfox.strings.Strings | ||
import com.f0x1d.logfox.ui.Icons | ||
import com.f0x1d.logfox.ui.compose.preview.DayNightPreview | ||
import com.f0x1d.logfox.ui.compose.theme.LogFoxTheme | ||
|
||
@Composable | ||
fun ListPlaceholder( | ||
@DrawableRes iconResId: Int, | ||
text: @Composable () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column( | ||
modifier = modifier.padding(horizontal = 10.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(16.dp), | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.size(120.dp) | ||
.clip(CircleShape) | ||
.background(MaterialTheme.colorScheme.surfaceContainerHighest) | ||
.padding(26.dp), | ||
) { | ||
Icon( | ||
modifier = Modifier.fillMaxSize(), | ||
painter = painterResource(iconResId), | ||
contentDescription = null, | ||
) | ||
} | ||
|
||
ProvideTextStyle(MaterialTheme.typography.bodyLarge) { | ||
text() | ||
} | ||
} | ||
} | ||
|
||
@DayNightPreview | ||
@Composable | ||
private fun Preview() = LogFoxTheme { | ||
ListPlaceholder( | ||
iconResId = Icons.ic_recording, | ||
text = { | ||
Text(text = stringResource(Strings.no_crashes)) | ||
}, | ||
) | ||
} |
37 changes: 37 additions & 0 deletions
37
core/ui/src/main/kotlin/com/f0x1d/logfox/ui/view/EditTextExt.kt
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,37 @@ | ||
package com.f0x1d.logfox.ui.view | ||
|
||
import android.text.Editable | ||
import android.text.TextWatcher | ||
import android.widget.EditText | ||
|
||
class ExtendedTextWatcher( | ||
val editText: EditText, | ||
var enabled: Boolean = true, | ||
private val doAfterTextChanged: (e: Editable?) -> Unit, | ||
) : TextWatcher { | ||
|
||
init { | ||
editText.addTextChangedListener(this) | ||
} | ||
|
||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) = Unit | ||
|
||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) = Unit | ||
|
||
override fun afterTextChanged(e: Editable?) { | ||
if (enabled) { | ||
doAfterTextChanged(e) | ||
} | ||
} | ||
|
||
fun setText(text: String?) { | ||
enabled = false | ||
editText.setText(text) | ||
enabled = true | ||
} | ||
} | ||
|
||
fun EditText.applyExtendedTextWatcher(doAfterTextChanged: (e: Editable?) -> Unit): ExtendedTextWatcher = ExtendedTextWatcher( | ||
editText = this, | ||
doAfterTextChanged = doAfterTextChanged, | ||
) |
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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:height="24dp" | ||
android:width="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="#000000" | ||
android:pathData="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /> | ||
</vector> |
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
2 changes: 2 additions & 0 deletions
2
.../src/main/kotlin/com/f0x1d/logfox/feature/recordings/list/presentation/RecordingsState.kt
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
22 changes: 0 additions & 22 deletions
22
...kotlin/com/f0x1d/logfox/feature/recordings/list/presentation/adapter/RecordingsAdapter.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.