Refactored string resources

This commit is contained in:
Deniz Düzgören
2019-09-22 13:39:20 +02:00
parent 8684e763b1
commit 49eefe8131
18 changed files with 351 additions and 343 deletions
@@ -74,12 +74,12 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
if (plan || menu) {
mView.get()?.let { v: View ->
var snackText = "${mContext.get()?.getText(R.string.lastUpdated)} ${when {
var snackText = "${mContext.get()?.getText(R.string.last_updated)} ${when {
plan -> currentTime
menu -> currentFoodTime
else -> "---"
}}"
snackText = if (forceRefresh) mContext.get()?.getString(R.string.forcedRefresh) ?: "" else snackText
snackText = if (forceRefresh) mContext.get()?.getString(R.string.force_refresh_successful) ?: "" else snackText
val snackBarView = v.findViewById<View>(R.id.coordination)
Snackbar.make(snackBarView, snackText, Snackbar.LENGTH_LONG).show()
}
@@ -87,7 +87,7 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
} catch (e: Exception) {
mView.get()?.let { v: View ->
val snackBarView = v.findViewById<View>(R.id.coordination)
Snackbar.make(snackBarView, mContext.get()?.getString(R.string.noInternet) ?: "", Snackbar.LENGTH_LONG).setBackgroundTint(ContextCompat.getColor(mContext.get()!!,
Snackbar.make(snackBarView, mContext.get()?.getString(R.string.no_internet_connection) ?: "", Snackbar.LENGTH_LONG).setBackgroundTint(ContextCompat.getColor(mContext.get()!!,
R.color.colorError
)).show()
}
@@ -197,7 +197,7 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
}
}
if (countOfMoreNotificationItems > 0) {
notificationText += mContext.get()?.resources?.getQuantityString(R.plurals.moreMessages, countOfMoreNotificationItems, countOfMoreNotificationItems)
notificationText += mContext.get()?.resources?.getQuantityString(R.plurals.notification_more_messages, countOfMoreNotificationItems, countOfMoreNotificationItems)
}
}
@@ -218,7 +218,7 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
val notificationLayout = RemoteViews(context.packageName, R.layout.notification)
notificationLayout.setTextViewText(R.id.notification_title, context.getString(
R.string.substitutionPlan
R.string.substitution_plan
))
notificationLayout.setTextViewText(R.id.notification_textview, notificationText)
@@ -225,7 +225,7 @@ internal object HelperFunctions {
out.close()
Toast.makeText(context, context.getString(R.string.success), Toast.LENGTH_LONG).show()
} else {
Toast.makeText(context, context.getString(R.string.permissionDenied), Toast.LENGTH_LONG).show()
Toast.makeText(context, context.getString(R.string.permission_denied), Toast.LENGTH_LONG).show()
requestPermissions(activity, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 42)
}
}
@@ -251,7 +251,7 @@ internal object HelperFunctions {
}
Toast.makeText(context, context.getString(R.string.success), Toast.LENGTH_LONG).show()
} else {
Toast.makeText(context, context.getString(R.string.permissionDenied), Toast.LENGTH_LONG).show()
Toast.makeText(context, context.getString(R.string.permission_denied), Toast.LENGTH_LONG).show()
requestPermissions(activity, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 42)
}
}
@@ -23,6 +23,7 @@ internal class LoginWebViewClient(successListener: OnLoginSuccessListener) : Web
*/
override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
view?.scrollY = -4000
val cookies = CookieManager.getInstance().getCookie(url)
if (cookies.contains("joomla_user_state=logged_in")) {
@@ -36,7 +37,7 @@ internal class LoginWebViewClient(successListener: OnLoginSuccessListener) : Web
internal interface OnLoginSuccessListener {
/**
* the function that can be overridden to check whether a successful login has occurred
* this function can be overridden to execute code when a login has been successful
*
* @param success boolean value that returns true if the cookie could be found,
* false otherwise