Changed hardcoded strings to translatable

This commit is contained in:
0123456789
2021-04-09 20:38:17 +00:00
committed by Rahul Kumar Patel
parent 296a602b2b
commit 9a4ab1d97c
8 changed files with 58 additions and 47 deletions

View File

@@ -244,7 +244,7 @@ class MainActivity : BaseActivity() {
super.onBackPressed()
} else {
lastBackPressed = System.currentTimeMillis()
Toast.makeText(this, "Click twice to exit", Toast.LENGTH_SHORT).show()
Toast.makeText(this, getString(R.string.toast_double_press_to_exit), Toast.LENGTH_SHORT).show()
}
}
}
@@ -302,4 +302,4 @@ class MainActivity : BaseActivity() {
sheet.show(supportFragmentManager, SelfUpdateSheet.TAG)
}
}
}
}

View File

@@ -25,6 +25,7 @@ import android.content.pm.PackageInstaller
import android.os.Build
import android.os.IBinder
import androidx.annotation.RequiresApi
import com.aurora.store.R
import com.aurora.store.data.event.InstallerEvent
import com.aurora.store.util.Log
import org.greenrobot.eventbus.EventBus
@@ -65,7 +66,7 @@ class InstallerService : Service() {
private fun postStatus(status: Int, packageName: String?, extra: String?) {
when (status) {
PackageInstaller.STATUS_SUCCESS -> {
EventBus.getDefault().post(InstallerEvent.Success(packageName, "Success"))
EventBus.getDefault().post(InstallerEvent.Success(packageName, this.getString(R.string.installer_status_success)))
}
PackageInstaller.STATUS_FAILURE_ABORTED -> {
val errorString = AppInstaller.getErrorString(this, status)
@@ -88,4 +89,4 @@ class InstallerService : Service() {
override fun onBind(intent: Intent): IBinder? {
return null
}
}
}

View File

@@ -206,7 +206,7 @@ class ServiceInstaller(context: Context) : InstallerBase(context) {
when (returnCode) {
PackageInstaller.STATUS_SUCCESS -> {
EventBus.getDefault().post(InstallerEvent.Success(packageName, "Success"))
EventBus.getDefault().post(InstallerEvent.Success(packageName, this.getString(R.string.installer_status_success)))
}
else -> {
val error = AppInstaller.getErrorString(
@@ -234,4 +234,4 @@ class ServiceInstaller(context: Context) : InstallerBase(context) {
return uri
}
}
}

View File

@@ -118,14 +118,14 @@ class GoogleActivity : BaseActivity() {
EventBus.getDefault().post(BusEvent.GoogleAAS(false))
}
} else {
Toast.makeText(this, "Failed to generate AAS Token", Toast.LENGTH_LONG).show()
Toast.makeText(this, getString(R.string.toast_aas_token_failed), Toast.LENGTH_LONG).show()
EventBus.getDefault().post(BusEvent.GoogleAAS(false))
}
//Close Activity
close()
} fail {
Toast.makeText(this, "Failed to generate AAS Token", Toast.LENGTH_LONG).show()
Toast.makeText(this, getString(R.string.toast_aas_token_failed), Toast.LENGTH_LONG).show()
EventBus.getDefault().post(BusEvent.GoogleAAS(false))
//Close Activity
@@ -138,4 +138,4 @@ class GoogleActivity : BaseActivity() {
"https://accounts.google.com/EmbeddedSetup/identifier?flowName=EmbeddedSetupAndroid"
const val AUTH_TOKEN = "oauth_token"
}
}
}

View File

@@ -133,7 +133,7 @@ class CategoryBrowseActivity : BaseActivity(), GenericCarouselController.Callbac
if (streamCluster.clusterBrowseUrl.isNotEmpty())
openStreamBrowseActivity(streamCluster.clusterBrowseUrl)
else
Toast.makeText(this, "Browse page unavailable", Toast.LENGTH_SHORT).show()
Toast.makeText(this, getString(R.string.toast_page_unavailable), Toast.LENGTH_SHORT).show()
}
override fun onClusterScrolled(streamCluster: StreamCluster) {
@@ -147,4 +147,4 @@ class CategoryBrowseActivity : BaseActivity(), GenericCarouselController.Callbac
override fun onAppLongClick(app: App) {
AppPeekDialogSheet.newInstance(app).show(supportFragmentManager, "APDS")
}
}
}

View File

@@ -293,7 +293,7 @@ abstract class BaseDetailsActivity : BaseActivity() {
streamCluster.clusterTitle
)
else
toast("Browse page unavailable")
toast(getString(R.string.toast_page_unavailable))
}
override fun onClusterScrolled(streamCluster: StreamCluster) {
@@ -380,10 +380,10 @@ abstract class BaseDetailsActivity : BaseActivity() {
}.successUi {
it?.let {
B.userStars.rating = it.rating.toFloat()
Toast.makeText(this, "Rated successfully", Toast.LENGTH_SHORT).show()
Toast.makeText(this, getString(R.string.toast_rated_success), Toast.LENGTH_SHORT).show()
}
}.failUi {
Toast.makeText(this, "Failed to submit rating", Toast.LENGTH_SHORT).show()
Toast.makeText(this, getString(R.string.toast_rated_failed), Toast.LENGTH_SHORT).show()
}
}