a bit more cleanup on strings for about and hidden service requests

This commit is contained in:
Nathan Freitas 2011-11-14 04:03:41 -05:00
parent bfeceb7fd0
commit 2b8eef305c
3 changed files with 78 additions and 94 deletions

View File

@ -40,14 +40,14 @@
android:paddingLeft="15px" android:paddingLeft="15px"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="Project Home(s): " <TextView android:text="@string/project_home"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="15px" android:paddingTop="15px"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#00ff00" /> android:textColor="#00ff00" />
<TextView android:text="https://www.torproject.org/docs/android\nhttps://guardianproject.info/apps/orbot/" <TextView android:text="@string/project_urls"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
@ -61,47 +61,47 @@
android:paddingLeft="15px" android:paddingLeft="15px"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#00ff00" /> android:textColor="#00ff00" />
<TextView android:text="The Tor License" <TextView android:text="@string/the_tor_license"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="https://torproject.org" <TextView android:text="@string/https_torproject_org"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:textColorLink="#ffffff" android:textColorLink="#ffffff"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="3rd-Party-Software: " <TextView android:text="@string/third_party_software"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="15px" android:paddingTop="15px"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#00ff00" /> android:textColor="#00ff00" />
<TextView android:text="Tor v0.2.3.6-alpha: https://www.torproject.org" <TextView android:text="@string/tor_version"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:textColorLink="#ffffff" android:textColorLink="#ffffff"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="LibEvent v1.4.13: http://www.monkey.org/~provos/libevent/" <TextView android:text="@string/libevent_version"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:textColorLink="#ffffff" android:textColorLink="#ffffff"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="Privoxy v3.0.12: http://www.privoxy.org" <TextView android:text="@string/privoxy_version"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:textColorLink="#ffffff" android:textColorLink="#ffffff"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="Iptables v1.4.7: http://www.netfilter.org" <TextView android:text="@string/iptables_version"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"

View File

@ -232,5 +232,14 @@
<string name="hidden_service_ports">Hidden Service Ports</string> <string name="hidden_service_ports">Hidden Service Ports</string>
<string name="the_addressable_name_for_your_hidden_service_generated_automatically_">the addressable name for your hidden service (generated automatically)</string> <string name="the_addressable_name_for_your_hidden_service_generated_automatically_">the addressable name for your hidden service (generated automatically)</string>
<string name="enable_debug_log_to_output_must_use_adb_or_alogcat_to_view_">enable debug log to output (must use adb or aLogCat to view)</string> <string name="enable_debug_log_to_output_must_use_adb_or_alogcat_to_view_">enable debug log to output (must use adb or aLogCat to view)</string>
<string name="project_home">Project Home(s): </string>
<string name="project_urls">https://www.torproject.org/docs/android\nhttps://guardianproject.info/apps/orbot/</string>
<string name="the_tor_license">The Tor License</string>
<string name="https_torproject_org">https://torproject.org</string>
<string name="third_party_software">3rd-Party-Software: </string>
<string name="tor_version">Tor v0.2.3.7-alpha: https://www.torproject.org</string>
<string name="libevent_version">LibEvent v1.4.13: http://www.monkey.org/~provos/libevent/</string>
<string name="privoxy_version">Privoxy v3.0.12: http://www.privoxy.org</string>
<string name="iptables_version">Iptables v1.4.7: http://www.netfilter.org</string>
<string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string>
</resources> </resources>

View File

@ -3,9 +3,6 @@
package org.torproject.android; package org.torproject.android;
import org.torproject.android.service.ITorService; import org.torproject.android.service.ITorService;
import org.torproject.android.service.ITorServiceCallback; import org.torproject.android.service.ITorServiceCallback;
import org.torproject.android.service.TorServiceConstants; import org.torproject.android.service.TorServiceConstants;
@ -253,30 +250,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
} }
/* Return to the main view when the back key is pressed
* (non-Javadoc)
* @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
*/
/*
public boolean onKeyDown(int keyCode, KeyEvent event){
//yeah this should probably go away now :) - or not
if(keyCode==KeyEvent.KEYCODE_BACK){
if(currentView != R.layout.layout_main){
showMain ();
return true;
}
else{
return super.onKeyDown(keyCode, event);
}
}
return super.onKeyDown(keyCode, event);
}*/
/* (non-Javadoc) /* (non-Javadoc)
* @see android.app.Activity#onPause() * @see android.app.Activity#onPause()
*/ */
@ -405,7 +378,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
int hsPort = getIntent().getIntExtra("hs_port", -1); int hsPort = getIntent().getIntExtra("hs_port", -1);
String requestMsg = "An app wants to open a server port (" + hsPort + ") to the Tor network. This is safe if you trust the app."; String requestMsg = getString(R.string.hidden_service_request, hsPort);
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener) builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener)
.setNegativeButton("Deny", dialogClickListener).show(); .setNegativeButton("Deny", dialogClickListener).show();
@ -499,61 +472,62 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
/* /*
* Load the basic settings application to display torrc * Load the basic settings application to display torrc
*/ */
private void showSettings () private void showSettings ()
{ {
startActivityForResult(new Intent(this, SettingsPreferences.class), 1); startActivityForResult(new Intent(this, SettingsPreferences.class), 1);
} }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
//if we get a response from an activity we launched (like from line 527 where we launch the Settings/Prefs screen) //if we get a response from an activity we launched (like from line 527 where we launch the Settings/Prefs screen)
//and the resultCode matches our arbitrary 1010 value, AND Tor is running //and the resultCode matches our arbitrary 1010 value, AND Tor is running
//then update the preferences in an async background task //then update the preferences in an async background task
if (requestCode == 1 && resultCode == 1010 && mService != null) if (requestCode == 1 && resultCode == 1010 && mService != null)
{ {
new ProcessSettingsAsyncTask().execute(mService); new ProcessSettingsAsyncTask().execute(mService);
} }
} }
AlertDialog aDialog = null; AlertDialog aDialog = null;
//general alert dialog for mostly Tor warning messages //general alert dialog for mostly Tor warning messages
//sometimes this can go haywire or crazy with too many error //sometimes this can go haywire or crazy with too many error
//messages from Tor, and the user cannot stop or exit Orbot //messages from Tor, and the user cannot stop or exit Orbot
//so need to ensure repeated error messages are not spamming this method //so need to ensure repeated error messages are not spamming this method
private void showAlert(String title, String msg, boolean button) private void showAlert(String title, String msg, boolean button)
{ {
try try
{ {
if (aDialog != null && aDialog.isShowing()) if (aDialog != null && aDialog.isShowing())
aDialog.dismiss(); aDialog.dismiss();
} }
catch (Exception e){} //swallow any errors catch (Exception e){} //swallow any errors
if (button) if (button)
{ {
aDialog = new AlertDialog.Builder(this) aDialog = new AlertDialog.Builder(this)
.setIcon(R.drawable.icon) .setIcon(R.drawable.icon)
.setTitle(title) .setTitle(title)
.setMessage(msg) .setMessage(msg)
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.show(); .show();
} }
else else
{ {
aDialog = new AlertDialog.Builder(this) aDialog = new AlertDialog.Builder(this)
.setIcon(R.drawable.icon) .setIcon(R.drawable.icon)
.setTitle(title) .setTitle(title)
.setMessage(msg) .setMessage(msg)
.show(); .show();
} }
aDialog.setCanceledOnTouchOutside(true);
}
aDialog.setCanceledOnTouchOutside(true);
}
/* /*
* Set the state of the running/not running graphic and label * Set the state of the running/not running graphic and label
* this all needs to be looked at w/ the shift to progressDialog * this all needs to be looked at w/ the shift to progressDialog
@ -875,6 +849,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
} }
//unbind removes the callback, and unbinds the service //unbind removes the callback, and unbinds the service
/*
private void unbindService () private void unbindService ()
{ {
if (mIsBound) { if (mIsBound) {
@ -898,7 +873,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
mIsBound = false; mIsBound = false;
} }
} }*/
private void createProgressDialog (String msg) private void createProgressDialog (String msg)
{ {