Extract RedPhone string resources

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-09-24 16:53:48 -07:00
parent b68691bf05
commit 123c7b2119
7 changed files with 66 additions and 45 deletions

View file

@ -124,7 +124,7 @@
android:maxLines="1"
android:ellipsize="end"
android:visibility="visible"
android:text="RedPhone Call"
android:text="@string/redphone_call_card__signal_call"
/>
<!-- Social status (currently unused) -->

View file

@ -137,7 +137,7 @@
android:layout_weight="1"
android:src="@drawable/redphone_ic_end_call"
android:background="@drawable/selectable_item_background"
android:contentDescription="end call"/>
android:contentDescription="@string/redphone_call_controls__end_call"/>
</LinearLayout>
<!-- android:background="?android:attr/selectableItemBackground" -->
@ -199,7 +199,7 @@
<ToggleButton android:id="@+id/audioButton"
style="@style/InCallCompoundButton"
android:background="@drawable/redphone_btn_compound_audio"
android:contentDescription="Audio"
android:contentDescription="@string/redphone_call_controls__audio"
/>
<View
@ -212,7 +212,7 @@
<ToggleButton android:id="@+id/muteButton"
style="@style/InCallCompoundButton"
android:background="@drawable/redphone_btn_compound_mute"
android:contentDescription="Mute"
android:contentDescription="@string/redphone_call_controls__mute"
/>
<View

View file

@ -127,6 +127,7 @@
<string name="ConversationActivity_are_you_sure_you_want_to_unblock_this_contact">Are you sure you want to unblock this contact?</string>
<string name="ConversationActivity_unblock">Unblock</string>
<string name="ConversationActivity_attachment_exceeds_size_limits">Attachment exceeds size limits for the type of message you\'re sending.</string>
<string name="ConversationActivity_quick_camera_unavailable">Camera unavailable</string>
<!-- ConversationFragment -->
<string name="ConversationFragment_message_details">Message details</string>
@ -271,6 +272,11 @@
<string name="MmsDownloader_error_connecting_to_mms_provider">Error connecting to MMS provider...</string>
<string name="MmsDownloader_error_reading_mms_settings">Error reading wireless provider MMS settings...</string>
<!--- NotificationBarManager -->
<string name="NotificationBarManager_signal_call_in_progress">Signal call in progress</string>
<string name="NotificationBarManager_missed_call_from_s">Missed call from %s</string>
<string name="NotificationBarManager_missed_signal_call">Missed Signal call</string>
<!-- NotificationMmsMessageRecord -->
<string name="NotificationMmsMessageRecord_multimedia_message">Multimedia message</string>
@ -328,6 +334,28 @@
<string name="RecipientPreferenceActivity_enabled">Enabled</string>
<string name="RecipientPreferenceActivity_disabled">Disabled</string>
<!-- RedPhone -->
<string name="RedPhone_answering">Answering</string>
<string name="RedPhone_ending_call">Ending call</string>
<string name="RedPhone_dialing">Dialing</string>
<string name="RedPhone_canceling_call">Canceling call</string>
<string name="RedPhone_call_rejected">Call rejected</string>
<string name="RedPhone_ringing">Ringing</string>
<string name="RedPhone_busy">Busy</string>
<string name="RedPhone_connected">Connected</string>
<string name="RedPhone_connecting">Connecting</string>
<string name="RedPhone_handshake_failed">Handshake failed!</string>
<string name="RedPhone_recipient_unavailable">Recipient unavailable</string>
<string name="RedPhone_performing_handshake">Performing handshake</string>
<string name="RedPhone_network_failed">Server failed!</string>
<string name="RedPhone_client_failed">Client failed</string>
<string name="RedPhone_fatal_error">Fatal Error</string>
<string name="RedPhone_login_failed">Login failed!</string>
<string name="RedPhone_message_from_the_server">Message from the server</string>
<string name="RedPhone_number_not_registered">Number not registered!</string>
<string name="RedPhone_the_number_you_dialed_does_not_support_secure_voice">The number you dialed does not support secure voice!</string>
<string name="RedPhone_got_it">Got it</string>
<!-- RegistrationActivity -->
<string name="RegistrationActivity_connect_with_signal">Connect With Signal</string>
<string name="RegistrationActivity_select_your_country">Select your country</string>
@ -632,6 +660,12 @@
<string name="recipient_preferences__color">Color</string>
<string name="recipient_preferences__color_for_this_contact">Color for this contact</string>
<!--- redphone_call_controls -->
<string name="redphone_call_card__signal_call">Signal Call</string>
<string name="redphone_call_controls__end_call">end call</string>
<string name="redphone_call_controls__audio">Audio</string>
<string name="redphone_call_controls__mute">Mute</string>
<!-- registration_activity -->
<string name="registration_activity__verify_your_number_to_connect_with_signal">
Verify your phone number to connect with Signal.
@ -1009,8 +1043,6 @@
<!-- transport_selection_list_item -->
<string name="transport_selection_list_item__transport_icon">Transport icon</string>
<!-- quick_attachment_drawer -->
<string name="quick_camera_unavailable">Camera unavailable</string>
<!-- EOF -->

View file

@ -158,7 +158,7 @@ public class RedPhone extends Activity {
private void handleAnswerCall() {
state = STATE_ANSWERING;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Answering");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(org.thoughtcrime.securesms.R.string.RedPhone_answering));
Intent intent = new Intent(this, RedPhoneService.class);
intent.setAction(RedPhoneService.ACTION_ANSWER_CALL);
@ -172,7 +172,7 @@ public class RedPhone extends Activity {
intent.setAction(RedPhoneService.ACTION_DENY_CALL);
startService(intent);
callScreen.setActiveCall(redPhoneService.getRecipient(), "Ending call");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(org.thoughtcrime.securesms.R.string.RedPhone_ending_call));
delayedFinish();
}
@ -183,7 +183,7 @@ public class RedPhone extends Activity {
private void handleOutgoingCall(Recipient recipient) {
state = STATE_DIALING;
callScreen.setActiveCall(recipient, "Dialing");
callScreen.setActiveCall(recipient, getString(org.thoughtcrime.securesms.R.string.RedPhone_dialing));
}
private void handleTerminate( int terminationType ) {
@ -192,12 +192,12 @@ public class RedPhone extends Activity {
if( state == STATE_DIALING ) {
if (terminationType == LOCAL_TERMINATE) {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Canceling call");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(org.thoughtcrime.securesms.R.string.RedPhone_canceling_call));
} else {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Call rejected");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_call_rejected));
}
} else if (state != STATE_IDLE) {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Ending call");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_ending_call));
}
state = STATE_IDLE;
@ -205,11 +205,11 @@ public class RedPhone extends Activity {
}
private void handleCallRinging() {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Ringing");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_ringing));
}
private void handleCallBusy() {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Busy");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_busy));
state = STATE_IDLE;
delayedFinish(BUSY_SIGNAL_DELAY_FINISH);
@ -217,7 +217,7 @@ public class RedPhone extends Activity {
private void handleCallConnected(SASInfo sas) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);
callScreen.setActiveCall(redPhoneService.getRecipient(), "Connected", sas);
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_connected), sas);
state = STATE_CONNECTED;
redPhoneService.notifyCallConnectionUIUpdateComplete();
@ -228,40 +228,40 @@ public class RedPhone extends Activity {
}
private void handleConnectingToInitiator() {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Connecting");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_connecting));
}
private void handleHandshakeFailed() {
state = STATE_IDLE;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Handshake failed!");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_handshake_failed));
delayedFinish();
}
private void handleRecipientUnavailable() {
state = STATE_IDLE;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Recipient unavailable");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_recipient_unavailable));
delayedFinish();
}
private void handlePerformingHandshake() {
callScreen.setActiveCall(redPhoneService.getRecipient(), "Performing handshake");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_performing_handshake));
}
private void handleServerFailure() {
state = STATE_IDLE;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Server failed!");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_network_failed));
delayedFinish();
}
private void handleClientFailure(String msg) {
state = STATE_IDLE;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Client failed");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_client_failed));
if( msg != null && !isFinishing() ) {
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("Fatal Error");
ad.setTitle(R.string.RedPhone_fatal_error);
ad.setMessage(msg);
ad.setCancelable(false);
ad.setPositiveButton("Ok", new OnClickListener() {
ad.setPositiveButton(android.R.string.ok, new OnClickListener() {
public void onClick(DialogInterface dialog, int arg) {
RedPhone.this.handleTerminate(LOCAL_TERMINATE);
}
@ -272,14 +272,14 @@ public class RedPhone extends Activity {
private void handleLoginFailed() {
state = STATE_IDLE;
callScreen.setActiveCall(redPhoneService.getRecipient(), "Login failed!");
callScreen.setActiveCall(redPhoneService.getRecipient(), getString(R.string.RedPhone_login_failed));
delayedFinish();
}
private void handleServerMessage(String message) {
if( isFinishing() ) return; //we're already shutting down, this might crash
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("Message from the server");
ad.setTitle(R.string.RedPhone_message_from_the_server);
ad.setMessage(message);
ad.setCancelable(false);
ad.setPositiveButton(android.R.string.ok, new OnClickListener() {
@ -293,11 +293,11 @@ public class RedPhone extends Activity {
private void handleNoSuchUser(final Recipient recipient) {
if (isFinishing()) return; // XXX Stuart added this check above, not sure why, so I'm repeating in ignorance. - moxie
AlertDialogWrapper.Builder dialog = new AlertDialogWrapper.Builder(this);
dialog.setTitle("Number not registered!");
dialog.setTitle(R.string.RedPhone_number_not_registered);
dialog.setIconAttribute(R.attr.dialog_alert_icon);
dialog.setMessage("The number you dialed does not support secure voice!");
dialog.setMessage(R.string.RedPhone_the_number_you_dialed_does_not_support_secure_voice);
dialog.setCancelable(true);
dialog.setPositiveButton("Got it", new OnClickListener() {
dialog.setPositiveButton(R.string.RedPhone_got_it, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
RedPhone.this.handleTerminate(LOCAL_TERMINATE);

View file

@ -96,21 +96,10 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
try {
mediaPlayer.setDataSource(context, dataUri);
} catch (IllegalArgumentException e) {
} catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) {
Log.w(TAG, e);
// TODO Auto-generated catch block
return;
} catch (SecurityException e) {
// TODO Auto-generated catch block
Log.w(TAG, e);
return;
} catch (IllegalStateException e) {
Log.w(TAG, e);
return;
} catch (IOException e) {
// TODO Auto-generated catch block
Log.w(TAG, e);
return;
}
try {
mediaPlayer.prepareAsync();

View file

@ -58,7 +58,7 @@ public class NotificationBarManager {
Intent contentIntent = new Intent(context, RedPhone.class);
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, 0);
String notificationText = "Signal call in progress";
String notificationText = context.getString(R.string.NotificationBarManager_signal_call_in_progress);
Notification notification = new Notification(R.drawable.redphone_stat_sys_phone_call, null,
System.currentTimeMillis());
@ -79,9 +79,9 @@ public class NotificationBarManager {
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.ic_call_missed_grey600_24dp);
builder.setWhen(System.currentTimeMillis());
builder.setTicker(String.format("Missed call from %s", notifyRecipients.toShortString()));
builder.setContentTitle("Missed Signal call");
builder.setContentText(String.format("Missed call from %s", notifyRecipients.toShortString()));
builder.setTicker(context.getString(R.string.NotificationBarManager_missed_call_from_s, notifyRecipients.toShortString()));
builder.setContentTitle(context.getString(R.string.NotificationBarManager_missed_signal_call));
builder.setContentText(context.getString(R.string.NotificationBarManager_missed_call_from_s, notifyRecipients.toShortString()));
builder.setContentIntent(pendingIntent);
builder.setDefaults(Notification.DEFAULT_VIBRATE);
builder.setAutoCancel(true);

View file

@ -1323,7 +1323,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
@Override
public void onCameraFail(FailureReason reason) {
Toast.makeText(this, R.string.quick_camera_unavailable, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.ConversationActivity_quick_camera_unavailable, Toast.LENGTH_SHORT).show();
quickAttachmentDrawer.hide(false);
quickAttachmentToggle.disable();
}