Prepare new conversation screens for localization

This commit is contained in:
nielsandriesse 2020-05-25 16:12:24 +10:00
parent e585d94892
commit 7855c7dc4f
7 changed files with 56 additions and 31 deletions

View File

@ -16,7 +16,7 @@
android:layout_marginLeft="@dimen/large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/large_spacing"
android:hint="Enter Session ID of recipient" />
android:hint="@string/fragment_enter_public_key_edit_text_hint" />
<TextView
android:layout_width="match_parent"
@ -28,7 +28,7 @@
android:textColor="@color/text"
android:alpha="0.6"
android:textAlignment="center"
android:text="Users can share their Session ID by going into their account settings and tapping &quot;Share Session ID&quot;, or by sharing their QR code." />
android:text="@string/fragment_enter_public_key_explanation" />
<org.thoughtcrime.securesms.loki.views.LabeledSeparatorView
android:id="@+id/separatorView"
@ -65,7 +65,7 @@
android:layout_width="0dp"
android:layout_height="@dimen/medium_button_height"
android:layout_weight="1"
android:text="Copy" />
android:text="@string/copy" />
<Button
style="@style/MediumUnimportantFilledButton"
@ -74,7 +74,7 @@
android:layout_height="@dimen/medium_button_height"
android:layout_weight="1"
android:layout_marginLeft="@dimen/medium_spacing"
android:text="Share" />
android:text="@string/share" />
</LinearLayout>
@ -89,6 +89,6 @@
android:layout_width="196dp"
android:layout_height="@dimen/medium_button_height"
android:layout_marginBottom="@dimen/medium_spacing"
android:text="Next" />
android:text="@string/next" />
</LinearLayout>

View File

@ -19,7 +19,7 @@
android:layout_marginLeft="@dimen/large_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/large_spacing"
android:hint="Enter a group name" />
android:hint="@string/activity_create_closed_group_edit_text_hint" />
<TextView
android:layout_width="match_parent"
@ -32,7 +32,7 @@
android:textColor="@color/text"
android:alpha="0.6"
android:textAlignment="center"
android:text="Closed groups support up to 10 members and provide the same privacy protections as one-on-one sessions." />
android:text="@string/activity_create_closed_group_explanation" />
<View
android:layout_width="match_parent"
@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:textSize="@dimen/medium_font_size"
android:textColor="@color/text"
android:text="You don't have any contacts yet" />
android:text="@string/activity_create_closed_group_empty_state_message" />
<Button
style="@style/MediumProminentOutlineButton"
@ -67,7 +67,7 @@
android:layout_width="196dp"
android:layout_height="@dimen/medium_button_height"
android:layout_marginTop="@dimen/medium_spacing"
android:text="Start a Session" />
android:text="@string/activity_create_closed_group_empty_state_button_title" />
</LinearLayout>

View File

@ -16,7 +16,7 @@
android:layout_marginLeft="@dimen/large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/large_spacing"
android:hint="Enter an open group URL" />
android:hint="@string/fragment_enter_chat_url_edit_text_hint" />
<View
android:layout_width="0dp"
@ -28,7 +28,7 @@
android:id="@+id/joinPublicChatButton"
android:layout_width="196dp"
android:layout_height="@dimen/medium_button_height"
android:text="Next" />
android:text="@string/next" />
<TextView
android:layout_width="match_parent"
@ -41,6 +41,6 @@
android:textColor="@color/text"
android:alpha="0.6"
android:textAlignment="center"
android:text="Open groups can be joined by anyone and do not provide full privacy protection" />
android:text="@string/fragment_enter_chat_url_privacy_warning" />
</LinearLayout>

View File

@ -16,7 +16,7 @@
android:layout_marginLeft="@dimen/large_spacing"
android:layout_marginTop="@dimen/large_spacing"
android:layout_marginRight="@dimen/large_spacing"
android:hint="Enter Session ID of recipient" />
android:hint="@string/fragment_enter_public_key_edit_text_hint" />
<TextView
android:layout_width="match_parent"
@ -28,7 +28,7 @@
android:textColor="@color/text"
android:alpha="0.6"
android:textAlignment="center"
android:text="Users can share their Session ID by going into their account settings and tapping &quot;Share Session ID&quot;, or by sharing their QR code." />
android:text="@string/fragment_enter_public_key_explanation" />
<org.thoughtcrime.securesms.loki.views.LabeledSeparatorView
android:id="@+id/separatorView"
@ -65,7 +65,7 @@
android:layout_width="0dp"
android:layout_height="@dimen/medium_button_height"
android:layout_weight="1"
android:text="Copy" />
android:text="@string/copy" />
<Button
style="@style/MediumUnimportantFilledButton"
@ -74,7 +74,7 @@
android:layout_height="@dimen/medium_button_height"
android:layout_weight="1"
android:layout_marginLeft="@dimen/medium_spacing"
android:text="Share" />
android:text="@string/share" />
</LinearLayout>
@ -89,6 +89,6 @@
android:layout_width="196dp"
android:layout_height="@dimen/medium_button_height"
android:layout_marginBottom="@dimen/medium_spacing"
android:text="Next" />
android:text="@string/next" />
</LinearLayout>

View File

@ -1674,10 +1674,11 @@
<string name="continue_2">Continue</string>
<string name="copy">Copy</string>
<string name="invalid_url">Couldn\'t open link</string>
<string name="invalid_url">Invalid URL</string>
<string name="copied_to_clipboard">Copied to clipboard</string>
<string name="device_linking_failed">Couldn\'t link device.</string>
<string name="next">Next</string>
<string name="share">Share</string>
<string name="invalid_session_id">Invalid Session ID</string>
<string name="activity_landing_title_2">Your Session begins here...</string>
@ -1703,7 +1704,7 @@
<string name="activity_link_device_title">Link Device</string>
<string name="activity_link_device_enter_session_id_tab_title">Enter Session ID</string>
<string name="activity_link_device_scan_qr_code_tab_title">Scan QR Code</string>
<string name="activity_link_device_scan_qr_code_explanation">"Navigate to "Settings" > "Devices" > "Link a Device" on your other device and then scan the QR code that comes up to start the linking process."</string>
<string name="activity_link_device_scan_qr_code_explanation">Navigate to "Settings" > "Devices" > "Link a Device" on your other device and then scan the QR code that comes up to start the linking process.</string>
<string name="fragment_enter_session_id_title">Link your device</string>
<string name="fragment_enter_session_id_explanation">Navigate to "Settings" > "Devices" > "Link a Device" on your other device and then enter your Session ID here to start the linking process.</string>
@ -1752,6 +1753,30 @@
<string name="view_seed_reminder_subtitle_2">Tap and hold the redacted words to reveal your recovery phrase, then store it safely to secure your Session ID.</string>
<string name="view_seed_reminder_subtitle_3">Make sure to store your recovery phrase in a safe place</string>
<string name="activity_create_private_chat_title">New Session</string>
<string name="activity_create_private_chat_enter_session_id_tab_title">Enter Session ID</string>
<string name="activity_create_private_chat_scan_qr_code_tab_title">Scan QR Code</string>
<string name="activity_create_private_chat_scan_qr_code_explanation">Scan a user\s QR code to start a session. QR codes can be found by tapping the QR code icon in account settings.</string>
<string name="fragment_enter_public_key_edit_text_hint">Enter Session ID of recipient</string>
<string name="fragment_enter_public_key_explanation">Users can share their Session ID by going into their account settings and tapping "Share Session ID", or by sharing their QR code.</string>
<string name="activity_create_closed_group_edit_text_hint">Enter a group name</string>
<string name="activity_create_closed_group_explanation">Closed groups support up to 10 members and provide the same privacy protections as one-on-one sessions.</string>
<string name="activity_create_closed_group_empty_state_message">You don\'t have any contacts yet</string>
<string name="activity_create_closed_group_empty_state_button_title">Start a Session</string>
<string name="activity_join_public_chat_title">Join Open Group</string>
<string name="activity_join_public_chat_error">Couldn\'t join group</string>
<string name="activity_join_public_chat_enter_group_url_tab_title">Open Group URL</string>
<string name="activity_join_public_chat_scan_qr_code_tab_title">Scan QR Code</string>
<string name="activity_join_public_chat_scan_qr_code_explanation">Scan the QR code of the open group you\'d like to join</string>
<string name="fragment_enter_chat_url_edit_text_hint">Enter an open group URL</string>
<string name="fragment_enter_chat_url_privacy_warning">Open groups can be joined by anyone and do not provide full privacy protection</string>
<string name="fragment_contact_selection_contacts_title">Contacts</string>
<string name="fragment_contact_selection_closed_groups_title">Closed Groups</string>
<string name="fragment_contact_selection_open_groups_title">Open Groups</string>

View File

@ -34,7 +34,7 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC
// Set content view
setContentView(R.layout.activity_create_private_chat)
// Set title
supportActionBar!!.title = "New Session"
supportActionBar!!.title = resources.getString(R.string.activity_create_private_chat_title)
// Set up view pager
viewPager.adapter = adapter
tabLayout.setupWithViewPager(viewPager)
@ -47,7 +47,7 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC
}
fun createPrivateChatIfPossible(hexEncodedPublicKey: String) {
if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, "Invalid Session ID", Toast.LENGTH_SHORT).show() }
if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, R.string.invalid_session_id, Toast.LENGTH_SHORT).show() }
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(this)
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)
val targetHexEncodedPublicKey = if (hexEncodedPublicKey == masterHexEncodedPublicKey) userHexEncodedPublicKey else hexEncodedPublicKey
@ -78,7 +78,7 @@ private class CreatePrivateChatActivityAdapter(val activity: CreatePrivateChatAc
1 -> {
val result = ScanQRCodeWrapperFragment()
result.delegate = activity
result.message = "Scan a users QR code to start a session. QR codes can be found by tapping the QR code icon in account settings."
result.message = activity.resources.getString(R.string.activity_create_private_chat_scan_qr_code_explanation)
result
}
else -> throw IllegalStateException()
@ -87,8 +87,8 @@ private class CreatePrivateChatActivityAdapter(val activity: CreatePrivateChatAc
override fun getPageTitle(index: Int): CharSequence? {
return when (index) {
0 -> "Enter Session ID"
1 -> "Scan QR Code"
0 -> activity.resources.getString(R.string.activity_create_private_chat_enter_session_id_tab_title)
1 -> activity.resources.getString(R.string.activity_create_private_chat_scan_qr_code_tab_title)
else -> throw IllegalStateException()
}
}
@ -122,7 +122,7 @@ class EnterPublicKeyFragment : Fragment() {
val clipboard = activity!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Session ID", hexEncodedPublicKey)
clipboard.primaryClip = clip
Toast.makeText(context!!, R.string.activity_register_public_key_copied_message, Toast.LENGTH_SHORT).show()
Toast.makeText(context!!, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
}
private fun sharePublicKey() {

View File

@ -32,7 +32,7 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode
// Set content view
setContentView(R.layout.activity_join_public_chat)
// Set title
supportActionBar!!.title = "Join Open Group"
supportActionBar!!.title = resources.getString(R.string.activity_join_public_chat_title)
// Set up view pager
viewPager.adapter = adapter
tabLayout.setupWithViewPager(viewPager)
@ -63,7 +63,7 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode
fun joinPublicChatIfPossible(url: String) {
if (!Patterns.WEB_URL.matcher(url).matches() || !url.startsWith("https://")) {
return Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show()
return Toast.makeText(this, R.string.invalid_url, Toast.LENGTH_SHORT).show()
}
showLoader()
val channel: Long = 1
@ -73,7 +73,7 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode
finish()
}.failUi {
hideLoader()
Toast.makeText(this, "Couldn't join channel", Toast.LENGTH_SHORT).show()
Toast.makeText(this, R.string.activity_join_public_chat_error, Toast.LENGTH_SHORT).show()
}
}
// endregion
@ -92,7 +92,7 @@ private class JoinPublicChatActivityAdapter(val activity: JoinPublicChatActivity
1 -> {
val result = ScanQRCodeWrapperFragment()
result.delegate = activity
result.message = "Scan the QR code of the open group you'd like to join"
result.message = activity.resources.getString(R.string.activity_join_public_chat_scan_qr_code_explanation)
result
}
else -> throw IllegalStateException()
@ -101,8 +101,8 @@ private class JoinPublicChatActivityAdapter(val activity: JoinPublicChatActivity
override fun getPageTitle(index: Int): CharSequence? {
return when (index) {
0 -> "Open Group URL"
1 -> "Scan QR Code"
0 -> activity.resources.getString(R.string.activity_join_public_chat_enter_group_url_tab_title)
1 -> activity.resources.getString(R.string.activity_join_public_chat_scan_qr_code_tab_title)
else -> throw IllegalStateException()
}
}