mirror of
https://github.com/lone-cloud/prism-android
synced 2026-06-04 04:04:44 -07:00
Use lib strings
This commit is contained in:
parent
1845b608be
commit
ac22124244
6 changed files with 25 additions and 36 deletions
|
|
@ -14,6 +14,7 @@ import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import org.unifiedpush.distributor.sunup.R
|
import org.unifiedpush.distributor.sunup.R
|
||||||
|
import org.unifiedpush.android.distributor.ui.R as LibR
|
||||||
import org.unifiedpush.distributor.sunup.activities.AppAction
|
import org.unifiedpush.distributor.sunup.activities.AppAction
|
||||||
import org.unifiedpush.distributor.sunup.activities.AppBarViewModel
|
import org.unifiedpush.distributor.sunup.activities.AppBarViewModel
|
||||||
import org.unifiedpush.distributor.sunup.activities.publishAction
|
import org.unifiedpush.distributor.sunup.activities.publishAction
|
||||||
|
|
@ -42,7 +43,7 @@ fun AppBarUi(appBarViewModel: AppBarViewModel) {
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.MoreVert,
|
imageVector = Icons.Default.MoreVert,
|
||||||
contentDescription = stringResource(R.string.app_bar_dropdown_description)
|
contentDescription = stringResource(LibR.string.app_bar_dropdown_description)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Dropdown(
|
Dropdown(
|
||||||
|
|
@ -79,7 +80,7 @@ fun Dropdown(expanded: Boolean, onRestart: () -> Unit, onDismiss: () -> Unit, on
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
onClick = onRestart,
|
onClick = onRestart,
|
||||||
text = {
|
text = {
|
||||||
Text(stringResource(R.string.app_dropdown_restart))
|
Text(stringResource(LibR.string.app_dropdown_restart))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
|
|
@ -89,7 +90,7 @@ fun Dropdown(expanded: Boolean, onRestart: () -> Unit, onDismiss: () -> Unit, on
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.app_dropdown_change_server)
|
stringResource(LibR.string.app_dropdown_change_server)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.unifiedpush.distributor.sunup.BuildConfig
|
import org.unifiedpush.distributor.sunup.BuildConfig
|
||||||
import org.unifiedpush.distributor.sunup.R
|
import org.unifiedpush.android.distributor.ui.R
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import org.unifiedpush.distributor.sunup.AppStore
|
||||||
import org.unifiedpush.distributor.sunup.DatabaseFactory
|
import org.unifiedpush.distributor.sunup.DatabaseFactory
|
||||||
import org.unifiedpush.distributor.sunup.Distributor
|
import org.unifiedpush.distributor.sunup.Distributor
|
||||||
import org.unifiedpush.distributor.sunup.Distributor.sendMessage
|
import org.unifiedpush.distributor.sunup.Distributor.sendMessage
|
||||||
import org.unifiedpush.distributor.sunup.R
|
import org.unifiedpush.android.distributor.ui.R as LibR
|
||||||
import org.unifiedpush.distributor.sunup.activities.UiAction
|
import org.unifiedpush.distributor.sunup.activities.UiAction
|
||||||
import org.unifiedpush.distributor.sunup.api.data.ClientMessage
|
import org.unifiedpush.distributor.sunup.api.data.ClientMessage
|
||||||
import org.unifiedpush.distributor.sunup.api.data.ServerMessage
|
import org.unifiedpush.distributor.sunup.api.data.ServerMessage
|
||||||
|
|
@ -93,7 +93,7 @@ class ServerConnection(private val context: Context, private val releaseLock: ()
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.toast_url_candidate_success, it),
|
context.getString(LibR.string.toast_url_candidate_success, it),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +178,7 @@ class ServerConnection(private val context: Context, private val releaseLock: ()
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.toast_url_candidate_fail, url),
|
context.getString(LibR.string.toast_url_candidate_fail, url),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import android.content.Context
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import org.unifiedpush.distributor.AppNotification
|
import org.unifiedpush.distributor.AppNotification
|
||||||
import org.unifiedpush.distributor.sunup.R
|
import org.unifiedpush.distributor.sunup.R
|
||||||
|
import org.unifiedpush.android.distributor.ui.R as LibR
|
||||||
import org.unifiedpush.distributor.sunup.activities.MainActivity
|
import org.unifiedpush.distributor.sunup.activities.MainActivity
|
||||||
import org.unifiedpush.distributor.sunup.services.MainRegistrationCounter
|
import org.unifiedpush.distributor.sunup.services.MainRegistrationCounter
|
||||||
|
|
||||||
|
|
@ -31,9 +32,9 @@ class MainNotificationData(
|
||||||
private val Context.warningChannelData: AppNotification.ChannelData
|
private val Context.warningChannelData: AppNotification.ChannelData
|
||||||
get() = AppNotification.ChannelData(
|
get() = AppNotification.ChannelData(
|
||||||
"${this.getString(R.string.app_name)}.Warning",
|
"${this.getString(R.string.app_name)}.Warning",
|
||||||
"Warning",
|
this.getString(LibR.string.warning),
|
||||||
NotificationManager.IMPORTANCE_HIGH,
|
NotificationManager.IMPORTANCE_HIGH,
|
||||||
this.getString(R.string.warning_notif_description)
|
this.resources.getString(LibR.string.warning_notif_description).format(this.getString(R.string.app_name))
|
||||||
)
|
)
|
||||||
|
|
||||||
class DisconnectedNotification(context: Context) : AppNotification(
|
class DisconnectedNotification(context: Context) : AppNotification(
|
||||||
|
|
@ -42,8 +43,10 @@ class DisconnectedNotification(context: Context) : AppNotification(
|
||||||
NOTIFICATION_ID_WARNING,
|
NOTIFICATION_ID_WARNING,
|
||||||
MainNotificationData(
|
MainNotificationData(
|
||||||
context.getString(R.string.app_name),
|
context.getString(R.string.app_name),
|
||||||
context.getString(R.string.warning_notif_content),
|
context.getString(LibR.string.warning_notif_content).format(
|
||||||
context.getString(R.string.warning_notif_ticker),
|
context.getString(R.string.app_name)
|
||||||
|
),
|
||||||
|
context.getString(LibR.string.warning),
|
||||||
Notification.PRIORITY_HIGH,
|
Notification.PRIORITY_HIGH,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
|
|
@ -57,20 +60,21 @@ class ForegroundNotification(context: Context) : AppNotification(
|
||||||
MainNotificationData(
|
MainNotificationData(
|
||||||
context.getString(R.string.app_name),
|
context.getString(R.string.app_name),
|
||||||
if (MainRegistrationCounter.oneOrMore(context)) {
|
if (MainRegistrationCounter.oneOrMore(context)) {
|
||||||
context.getString(R.string.foreground_notif_content_with_reg)
|
MainRegistrationCounter.getCount(context).let {
|
||||||
.format(MainRegistrationCounter.getCount(context))
|
context.resources.getQuantityString(LibR.plurals.foreground_notif_content_with_reg, it, it)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getString(R.string.foreground_notif_content_no_reg)
|
context.getString(LibR.string.foreground_notif_content_no_reg)
|
||||||
},
|
},
|
||||||
context.getString(R.string.foreground_notif_ticker),
|
context.getString(LibR.string.foreground_service),
|
||||||
Notification.PRIORITY_LOW,
|
Notification.PRIORITY_LOW,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
ChannelData(
|
ChannelData(
|
||||||
"${context.getString(R.string.app_name)}.Listener",
|
"${context.getString(R.string.app_name)}.Listener",
|
||||||
"Foreground Service",
|
context.getString(LibR.string.foreground_service),
|
||||||
NotificationManager.IMPORTANCE_LOW,
|
NotificationManager.IMPORTANCE_LOW,
|
||||||
context.getString(R.string.foreground_notif_description)
|
context.getString(LibR.string.foreground_notif_description)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
<resources>
|
|
||||||
<string name="foreground_notif_description">Notification to run in the foreground</string>
|
|
||||||
<string name="foreground_notif_content_no_reg">Waiting for registration to connect</string>
|
|
||||||
<string name="foreground_notif_content_with_reg">Connected for %s registration(s)</string>
|
|
||||||
<string name="foreground_notif_ticker">Foreground</string>
|
|
||||||
<string name="app_dropdown_restart">Restart Service</string>
|
|
||||||
<string name="app_dropdown_change_server">Change server</string>
|
|
||||||
<string name="warning_notif_content">Sunup is disconnected</string>
|
|
||||||
<string name="warning_notif_description">Warn when Sunup is disconnected or an issue occurred.</string>
|
|
||||||
<string name="warning_notif_ticker">Warning</string>
|
|
||||||
<string name="toast_url_candidate_fail">Fail to use %1$s</string>
|
|
||||||
<string name="toast_url_candidate_success">Successfully using %1$s</string>
|
|
||||||
<string name="app_bar_dropdown_description">Actions</string>
|
|
||||||
<string name="custom_push_server">Custom Push server</string>
|
|
||||||
<string name="url">URL</string>
|
|
||||||
</resources>
|
|
||||||
|
|
@ -9,10 +9,10 @@ androidx-lifecycle = "2.8.7"
|
||||||
androidx-runtimeAndroid = "1.7.6"
|
androidx-runtimeAndroid = "1.7.6"
|
||||||
androidx-work = "2.10.0"
|
androidx-work = "2.10.0"
|
||||||
appcompat = "1.7.0"
|
appcompat = "1.7.0"
|
||||||
unifiedpush_distributor = "0.1.0"
|
unifiedpush_distributor = "0.1.1"
|
||||||
unifiedpush_distributor_ui = "0.1.0"
|
unifiedpush_distributor_ui = "0.1.1"
|
||||||
kotlin = "2.1.0"
|
kotlin = "2.1.0"
|
||||||
kotlinx_serializationJson = "1.8.0-RC"
|
kotlinx_serializationJson = "1.8.0"
|
||||||
ktlint = "12.1.2"
|
ktlint = "12.1.2"
|
||||||
material = "1.12.0"
|
material = "1.12.0"
|
||||||
material3Android = "1.3.1"
|
material3Android = "1.3.1"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue