[tor-commits] [orbot/master] altered code that will break with gradle 5 (resource IDs will be declared non-final in Java)
n8fr8 at torproject.org
n8fr8 at torproject.org
Wed Dec 22 21:55:06 UTC 2021
commit fe69a3156a4ea5e9e1af38e32eb881b51c436d71
Author: bim <dsnake at protonmail.com>
Date: Wed Feb 3 11:45:51 2021 -0500
altered code that will break with gradle 5 (resource IDs will be declared non-final in Java)
---
.../ui/hiddenservices/HiddenServicesActivity.java | 13 ++---
.../ui/onboarding/CustomBridgesActivity.java | 66 +++++++---------------
2 files changed, 24 insertions(+), 55 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
index 62b3613b..6c780dde 100644
--- a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
@@ -166,15 +166,10 @@ public class HiddenServicesActivity extends AppCompatActivity {
}
public void onRadioButtonClick(View view) {
- switch (view.getId()) {
- case R.id.radioUserServices:
- filterServices(true);
- break;
- case R.id.radioAppServices:
- filterServices(false);
- break;
- default:
- break;
+ if (view.getId() == R.id.radioUserServices) {
+ filterServices(true);
+ } else if (view.getId() == R.id.radioAppServices) {
+ filterServices(false);
}
}
diff --git a/app/src/main/java/org/torproject/android/ui/onboarding/CustomBridgesActivity.java b/app/src/main/java/org/torproject/android/ui/onboarding/CustomBridgesActivity.java
index a8eeb30f..6fce9852 100644
--- a/app/src/main/java/org/torproject/android/ui/onboarding/CustomBridgesActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/onboarding/CustomBridgesActivity.java
@@ -40,7 +40,7 @@ import java.net.URLEncoder;
import static org.torproject.android.MainConstants.EMAIL_TOR_BRIDGES;
import static org.torproject.android.MainConstants.URL_TOR_BRIDGES;
-public class CustomBridgesActivity extends AppCompatActivity implements View.OnClickListener, TextWatcher {
+public class CustomBridgesActivity extends AppCompatActivity implements TextWatcher {
private EditText mEtPastedBridges;
@@ -75,7 +75,7 @@ public class CustomBridgesActivity extends AppCompatActivity implements View.OnC
((TextView) findViewById(R.id.tvDescription)).setText(getString(R.string.in_a_browser, URL_TOR_BRIDGES));
- findViewById(R.id.btCopyUrl).setOnClickListener(this);
+ findViewById(R.id.btCopyUrl).setOnClickListener(v -> ClipboardUtils.copyToClipboard("bridge_url", URL_TOR_BRIDGES, getString(R.string.done), this));
String bridges = Prefs.getBridgesList().trim();
if (!Prefs.bridgesEnabled() || userHasSetPreconfiguredBridge(bridges)) {
@@ -86,62 +86,36 @@ public class CustomBridgesActivity extends AppCompatActivity implements View.OnC
configureMultilineEditTextInScrollView(mEtPastedBridges);
mEtPastedBridges.setText(bridges);
mEtPastedBridges.addTextChangedListener(this);
+ final IntentIntegrator integrator = new IntentIntegrator(this);
- findViewById(R.id.btScanQr).setOnClickListener(this);
- findViewById(R.id.btShareQr).setOnClickListener(this);
- findViewById(R.id.btEmail).setOnClickListener(this);
+ findViewById(R.id.btScanQr).setOnClickListener(v -> integrator.initiateScan());
+ findViewById(R.id.btShareQr).setOnClickListener(v -> {
+ String setBridges = Prefs.getBridgesList();
+ if (!TextUtils.isEmpty(setBridges)) {
+ try {
+ integrator.shareText("bridge://" + URLEncoder.encode(setBridges, "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ findViewById(R.id.btEmail).setOnClickListener(v -> {
+ Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + EMAIL_TOR_BRIDGES));
+ emailIntent.putExtra(Intent.EXTRA_SUBJECT, "get transport");
+ emailIntent.putExtra(Intent.EXTRA_TEXT, "get transport");
+ startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
+ });
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
-
return true;
}
-
return super.onOptionsItemSelected(item);
}
- @Override
- public void onClick(View view) {
- IntentIntegrator integrator = new IntentIntegrator(this);
-
- switch (view.getId()) {
- case R.id.btCopyUrl:
- ClipboardUtils.copyToClipboard("bridge_url", URL_TOR_BRIDGES, getString(R.string.done), this);
- break;
-
- case R.id.btScanQr:
- integrator.initiateScan();
- break;
-
- case R.id.btShareQr:
- String bridges = Prefs.getBridgesList();
-
- if (!TextUtils.isEmpty(bridges)) {
- try {
- bridges = "bridge://" + URLEncoder.encode(bridges, "UTF-8");
-
- integrator.shareText(bridges);
-
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
-
- break;
-
- case R.id.btEmail:
- Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + EMAIL_TOR_BRIDGES));
- emailIntent.putExtra(Intent.EXTRA_SUBJECT, "get transport");
- emailIntent.putExtra(Intent.EXTRA_TEXT, "get transport");
- startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
-
- break;
- }
- }
-
@Override
protected void onActivityResult(int request, int response, Intent data) {
super.onActivityResult(request, response, data);
More information about the tor-commits
mailing list