-
Notifications
You must be signed in to change notification settings - Fork 27
Fixes issue #1: fixed hardcoded strings #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,7 +71,7 @@ class MainActivity : AppCompatActivity() { | |||||||||||
|
|
||||||||||||
| private val onDownloadComplete: BroadcastReceiver = object : BroadcastReceiver() { | ||||||||||||
| override fun onReceive(context: Context, intent: Intent) { | ||||||||||||
| Toast.makeText(context, "Download completed!", Toast.LENGTH_SHORT).show() | ||||||||||||
| Toast.makeText(context, getString(R.string.download_completed), Toast.LENGTH_SHORT).show() | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -238,9 +238,9 @@ class MainActivity : AppCompatActivity() { | |||||||||||
| } else { | ||||||||||||
| if (!isFinishing && !isDestroyed) { | ||||||||||||
| mess.showAlertDialog( | ||||||||||||
| "Alert!", | ||||||||||||
| "You are not a member of Mess Committee!", | ||||||||||||
| "Ok", | ||||||||||||
| getString(R.string.alert), | ||||||||||||
| getString(R.string.not_mess_member), | ||||||||||||
| getString(R.string.ok), | ||||||||||||
| "" | ||||||||||||
| ) {} | ||||||||||||
| } | ||||||||||||
|
|
@@ -311,7 +311,7 @@ class MainActivity : AppCompatActivity() { | |||||||||||
|
|
||||||||||||
| mAuth.signOut() | ||||||||||||
| mGoogleSignInClient.signOut().addOnCompleteListener(this) { | ||||||||||||
| Toast.makeText(this, "Logged out successfully", Toast.LENGTH_SHORT).show() | ||||||||||||
| Toast.makeText(this, getString(R.string.logged_out_successfully), Toast.LENGTH_SHORT).show() | ||||||||||||
| } | ||||||||||||
| } catch (e: Exception) { | ||||||||||||
| mess.log("Sign out error: ${e.message}") | ||||||||||||
|
|
@@ -358,14 +358,14 @@ class MainActivity : AppCompatActivity() { | |||||||||||
| val intent = Intent(this@MainActivity, AlarmReceiver::class.java) | ||||||||||||
|
|
||||||||||||
| val times = listOf( | ||||||||||||
| mess.get("bt", "7:30"), | ||||||||||||
| mess.get("lt", "12:0"), | ||||||||||||
| mess.get("st", "16:30"), | ||||||||||||
| mess.get("dt", "19:0") | ||||||||||||
| mess.get(getString(R.string.bt),getString(R.string.b_time)), | ||||||||||||
| mess.get(getString(R.string.lt),getString(R.string.l_time)), | ||||||||||||
| mess.get(getString(R.string.st),getString(R.string.s_time)), | ||||||||||||
| mess.get(getString(R.string.dt),getString(R.string.d_time)) | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| mess.log("Setting alarms: Breakfast ${times[0]}, Lunch ${times[1]}, " + | ||||||||||||
| "Snack ${times[2]}, Dinner ${times[3]}") | ||||||||||||
| mess.log(String.format( | ||||||||||||
| getString(R.string.setting_alarms_log), times[0], times[1], times[2], times[3])) | ||||||||||||
|
Comment on lines
+367
to
+368
|
||||||||||||
| mess.log(String.format( | |
| getString(R.string.setting_alarms_log), times[0], times[1], times[2], times[3])) | |
| mess.log( | |
| getString(R.string.setting_alarms_log, times[0], times[1], times[2], times[3]) | |
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,14 +69,14 @@ | |
| android:layout_weight="1" | ||
| android:layout_marginEnd="8dp" | ||
| android:layout_height="wrap_content" | ||
| android:hint="Day"> | ||
| android:hint="@string/day"> | ||
| <AutoCompleteTextView | ||
| android:id="@+id/day" | ||
| android:textColor="@color/black" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:inputType="none" | ||
| android:text="Monday" /> | ||
| android:text="@string/monday" /> | ||
|
Comment on lines
+72
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partial migration: several user-facing strings remain hardcoded in this layout. The updated fields are good, but literals like Line 119 ( Also applies to: 88-96 🤖 Prompt for AI Agents |
||
| </com.google.android.material.textfield.TextInputLayout> | ||
|
|
||
| <com.google.android.material.textfield.TextInputLayout | ||
|
|
@@ -85,15 +85,15 @@ | |
| android:layout_width="0dp" | ||
| android:layout_weight="1" | ||
| android:layout_height="wrap_content" | ||
| android:hint="Meal Type"> | ||
| android:hint="@string/meal_type"> | ||
|
|
||
| <AutoCompleteTextView | ||
| android:id="@+id/type" | ||
| android:textColor="@color/black" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:inputType="none" | ||
| android:text="Breakfast" /> | ||
| android:text="@string/meal_breakfast" /> | ||
| </com.google.android.material.textfield.TextInputLayout> | ||
| </LinearLayout> | ||
| </com.google.android.material.card.MaterialCardView> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| android:layout_height="50dp" | ||
| android:layout_margin="25dp" | ||
| android:backgroundTint="#2196F3" | ||
| android:text="Done" | ||
| android:text="@string/done" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Localization is still incomplete in this dialog. Line 16 is fixed, but hardcoded UI text remains at Line 30 ( 🤖 Prompt for AI Agents |
||
|
|
||
| app:cornerRadius="10dp" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mess.get(getString(R.string.*_time), ...)uses string resources as preference keys (e.g., "bt", "lt"). Because string resources are translatable by default, localizing these values can change the stored keys and break reading/writing alarm times across locales. Prefer keeping these keys as non-localized constants (e.g., in a Constants object) or, if they must remain resources, mark themtranslatable="false"and avoid exposing them to translators.