[tor-commits] [orbot/master] Fixes #321 IlleglaStateException on about dialog
n8fr8 at torproject.org
n8fr8 at torproject.org
Tue Apr 28 21:05:02 UTC 2020
commit b24750e786a510b0ccb954f581704220a5202a69
Author: bim <dsnake at protonmail.com>
Date: Sat Apr 25 17:35:55 2020 -0400
Fixes #321 IlleglaStateException on about dialog
---
.../org/torproject/android/OrbotMainActivity.java | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index d21e1d05..ede16bad 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -26,13 +26,11 @@ import android.os.Message;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnLongClickListener;
-import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
@@ -456,7 +454,6 @@ public class OrbotMainActivity extends AppCompatActivity
@Override
public boolean onOptionsItemSelected(MenuItem item) {
-
if (item.getItemId() == R.id.menu_newnym) {
requestNewTorIdentity();
} else if (item.getItemId() == R.id.menu_settings) {
@@ -469,7 +466,6 @@ public class OrbotMainActivity extends AppCompatActivity
} else if (item.getItemId() == R.id.menu_about) {
showAbout();
-
} else if (item.getItemId() == R.id.menu_scan) {
IntentIntegrator integrator = new IntentIntegrator(OrbotMainActivity.this);
integrator.initiateScan();
@@ -499,10 +495,7 @@ public class OrbotMainActivity extends AppCompatActivity
}
private void showAbout() {
-
- LayoutInflater li = LayoutInflater.from(this);
- View view = li.inflate(R.layout.layout_about, (ViewGroup) lblStatus.getRootView());
-
+ View view = getLayoutInflater().inflate(R.layout.layout_about, null);
String version;
try {
@@ -520,10 +513,10 @@ public class OrbotMainActivity extends AppCompatActivity
String aboutText = readFromAssets(this, "LICENSE");
aboutText = aboutText.replace("\n", "<br/>");
aboutOther.setText(Html.fromHtml(aboutText));
- } catch (Exception e) {
- // This should not happen. Ignore.
+ } catch (IOException e) {
}
+
new AlertDialog.Builder(this)
.setTitle(getString(R.string.button_about))
.setView(view)
@@ -1025,8 +1018,7 @@ public class OrbotMainActivity extends AppCompatActivity
if (torStatus == null || (newTorStatus != null && newTorStatus.equals(torStatus))) {
torStatus = newTorStatus;
return;
- }
- else {
+ } else {
torStatus = newTorStatus;
}
@@ -1071,8 +1063,7 @@ public class OrbotMainActivity extends AppCompatActivity
if (torServiceMsg != null) {
if (torServiceMsg.contains(TorServiceConstants.LOG_NOTICE_BOOTSTRAPPED))
lblStatus.setText(torServiceMsg);
- }
- else {
+ } else {
lblStatus.setText(getString(R.string.status_starting_up));
}
More information about the tor-commits
mailing list