mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: harden reliability, clean up KMP compliance, and improve code quality (#5023)
This commit is contained in:
parent
537029a71c
commit
14b381c1eb
53 changed files with 370 additions and 409 deletions
|
|
@ -16,9 +16,7 @@
|
|||
*/
|
||||
package org.meshtastic.core.ui.util
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import android.widget.Toast
|
||||
|
|
@ -33,13 +31,6 @@ suspend fun Context.showToast(text: String) {
|
|||
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
/** Finds the [Activity] from a [Context]. */
|
||||
fun Context.findActivity(): Activity? = when (this) {
|
||||
is Activity -> this
|
||||
is ContextWrapper -> baseContext.findActivity()
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun Context.openNfcSettings() {
|
||||
val intent = Intent(Settings.ACTION_NFC_SETTINGS)
|
||||
startActivity(intent)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@file:Suppress("detekt:ALL")
|
||||
|
||||
package org.meshtastic.core.ui.component
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
|
|
@ -30,28 +28,6 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.jetbrains.compose.resources.StringResource
|
||||
import org.jetbrains.compose.resources.stringResource
|
||||
|
||||
@Deprecated(message = "Use overload that accepts Strings for button text.")
|
||||
@Composable
|
||||
fun PreferenceFooter(
|
||||
enabled: Boolean,
|
||||
negativeText: StringResource,
|
||||
onNegativeClicked: () -> Unit,
|
||||
positiveText: StringResource,
|
||||
onPositiveClicked: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
PreferenceFooter(
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
negativeText = stringResource(negativeText),
|
||||
onNegativeClicked = onNegativeClicked,
|
||||
positiveText = stringResource(positiveText),
|
||||
onPositiveClicked = onPositiveClicked,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun PreferenceFooter(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue