0003-Bug-28051-Delete-the-Onboarding-activity.patch 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. From 1b6c2cf4b610787e17ad746f7a69f947f717b938 Mon Sep 17 00:00:00 2001
  2. From: Matthew Finkel <Matthew.Finkel@gmail.com>
  3. Date: Sat, 24 Nov 2018 04:36:56 +0000
  4. Subject: [PATCH 03/13] Bug 28051 - Delete the Onboarding activity
  5. It depends on a library that depends on a newer version of
  6. the Android Support Library
  7. ---
  8. .../torproject/android/OrbotMainActivity.java | 13 +-
  9. .../ui/onboarding/OnboardingActivity.java | 147 ------------------
  10. 2 files changed, 1 insertion(+), 159 deletions(-)
  11. delete mode 100644 app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
  12. diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
  13. index e18711b1..7ad979ff 100644
  14. --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
  15. +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
  16. @@ -29,7 +29,6 @@ import org.torproject.android.settings.SettingsPreferences;
  17. import org.torproject.android.ui.AppManagerActivity;
  18. import org.torproject.android.ui.Rotate3dAnimation;
  19. import org.torproject.android.ui.onboarding.BridgeWizardActivity;
  20. -import org.torproject.android.ui.onboarding.OnboardingActivity;
  21. import org.torproject.android.ui.hiddenservices.ClientCookiesActivity;
  22. import org.torproject.android.ui.hiddenservices.HiddenServicesActivity;
  23. import org.torproject.android.ui.hiddenservices.backup.BackupUtils;
  24. @@ -197,16 +196,6 @@ public class OrbotMainActivity extends AppCompatActivity
  25. new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
  26. boolean showFirstTime = mPrefs.getBoolean("connect_first_time", true);
  27. -
  28. - if (showFirstTime)
  29. - {
  30. - Editor pEdit = mPrefs.edit();
  31. - pEdit.putBoolean("connect_first_time", false);
  32. - pEdit.commit();
  33. - startActivity(new Intent(this,OnboardingActivity.class));
  34. - }
  35. -
  36. -
  37. }
  38. private void sendIntentToService(final String action) {
  39. @@ -870,7 +859,7 @@ public class OrbotMainActivity extends AppCompatActivity
  40. @Override
  41. public void onClick(DialogInterface dialog, int which) {
  42. - startActivity(OnboardingActivity.getInstallIntent(TorServiceConstants.BROWSER_APP_USERNAME,OrbotMainActivity.this));
  43. + dialog.cancel();
  44. }
  45. diff --git a/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java b/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
  46. deleted file mode 100644
  47. index a8bad692..00000000
  48. --- a/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
  49. +++ /dev/null
  50. @@ -1,147 +0,0 @@
  51. -package org.torproject.android.ui.onboarding;
  52. -
  53. -import android.content.Context;
  54. -import android.content.Intent;
  55. -import android.content.pm.PackageManager;
  56. -import android.content.pm.ResolveInfo;
  57. -import android.net.Uri;
  58. -import android.os.Bundle;
  59. -import android.support.annotation.Nullable;
  60. -import android.support.v4.app.Fragment;
  61. -import android.text.TextUtils;
  62. -import android.util.Log;
  63. -import android.view.View;
  64. -
  65. -import com.github.paolorotolo.appintro.AppIntro;
  66. -
  67. -import org.torproject.android.R;
  68. -import org.torproject.android.settings.LocaleHelper;
  69. -import org.torproject.android.ui.AppManagerActivity;
  70. -import org.torproject.android.ui.hiddenservices.permissions.PermissionManager;
  71. -import org.torproject.android.vpn.VPNEnableActivity;
  72. -
  73. -import java.util.List;
  74. -
  75. -public class OnboardingActivity extends AppIntro {
  76. -
  77. - @Override
  78. - protected void onCreate(@Nullable Bundle savedInstanceState) {
  79. - super.onCreate(savedInstanceState);
  80. -
  81. - // Instead of fragments, you can also use our default slide
  82. - // Just set a title, description, background and image. AppIntro will do the rest.
  83. - CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
  84. - welcome.setTitle(getString(R.string.hello));
  85. - welcome.setSubTitle(getString(R.string.welcome));
  86. - addSlide(welcome);
  87. -
  88. - CustomSlideBigText intro2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
  89. - intro2.setTitle(getString(R.string.browser_the_internet));
  90. - intro2.setSubTitle(getString(R.string.no_tracking));
  91. - addSlide(intro2);
  92. -
  93. - CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
  94. - cs2.setTitle(getString(R.string.bridges_sometimes));
  95. - cs2.showButton(getString(R.string.action_more), new View.OnClickListener() {
  96. - @Override
  97. - public void onClick(View v) {
  98. - startActivity(new Intent(OnboardingActivity.this,BridgeWizardActivity.class));
  99. - }
  100. - });
  101. - addSlide(cs2);
  102. -
  103. - if (PermissionManager.isLollipopOrHigher()) {
  104. -
  105. - CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
  106. - cs3.setTitle(getString(R.string.vpn_setup));
  107. - cs3.setSubTitle(getString(R.string.vpn_setup_sub));
  108. - cs3.showButton(getString(R.string.action_vpn_choose), new View.OnClickListener() {
  109. - @Override
  110. - public void onClick(View v) {
  111. - startActivity(new Intent(OnboardingActivity.this, VPNEnableActivity.class));
  112. - startActivityForResult(new Intent(OnboardingActivity.this, AppManagerActivity.class), 9999);
  113. -
  114. - }
  115. - });
  116. - addSlide(cs3);
  117. -
  118. - }
  119. -
  120. - // OPTIONAL METHODS
  121. - // Override bar/separator color.
  122. - setBarColor(getResources().getColor(R.color.dark_purple));
  123. - setSeparatorColor(getResources().getColor(R.color.panel_background_main));
  124. -
  125. - // Hide Skip/Done button.
  126. - showSkipButton(false);
  127. - setProgressButtonEnabled(true);
  128. - }
  129. -
  130. - @Override
  131. - public void onSkipPressed(Fragment currentFragment) {
  132. - super.onSkipPressed(currentFragment);
  133. - // Do something when users tap on Skip button.
  134. - }
  135. -
  136. - @Override
  137. - public void onDonePressed(Fragment currentFragment) {
  138. - super.onDonePressed(currentFragment);
  139. - // Do something when users tap on Done button.
  140. - finish();
  141. - }
  142. -
  143. - @Override
  144. - public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
  145. - super.onSlideChanged(oldFragment, newFragment);
  146. - // Do something when the slide changes.
  147. - }
  148. -
  149. -
  150. - @Override
  151. - protected void attachBaseContext(Context base) {
  152. - super.attachBaseContext(LocaleHelper.onAttach(base));
  153. - }
  154. -
  155. - public static boolean isAppInstalled(PackageManager pm, String packageName) {
  156. - try {
  157. - pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
  158. - return true;
  159. - } catch (PackageManager.NameNotFoundException e) {
  160. - return false;
  161. - }
  162. - }
  163. -
  164. - public static Intent getInstallIntent(String packageName, Context context) {
  165. - final Intent intent = new Intent(Intent.ACTION_VIEW);
  166. - intent.setData(Uri.parse(MARKET_URI + packageName));
  167. -
  168. - PackageManager pm = context.getPackageManager();
  169. - List<ResolveInfo> resInfos = pm.queryIntentActivities(intent, 0);
  170. -
  171. - String foundPackageName = null;
  172. - for (ResolveInfo r : resInfos) {
  173. - Log.i("Install", "market: " + r.activityInfo.packageName);
  174. - if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME)
  175. - || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) {
  176. - foundPackageName = r.activityInfo.packageName;
  177. - break;
  178. - }
  179. - }
  180. -
  181. - if (foundPackageName == null) {
  182. - intent.setData(Uri.parse(FDROID_APP_URI + packageName));
  183. - } else {
  184. - intent.setPackage(foundPackageName);
  185. - }
  186. - return intent;
  187. - }
  188. -
  189. - final static String MARKET_URI = "market://details?id=";
  190. - final static String FDROID_APP_URI = "https://f-droid.org/repository/browse/?fdid=";
  191. - final static String PLAY_APP_URI = "https://play.google.com/store/apps/details?id=";
  192. - final static String FDROID_URI = "https://f-droid.org/repository/browse/?fdfilter=info.guardianproject";
  193. - final static String PLAY_URI = "https://play.google.com/store/apps/developer?id=The+Guardian+Project";
  194. -
  195. - private final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid";
  196. - private final static String PLAY_PACKAGE_NAME = "com.android.vending";
  197. -}
  198. \ No newline at end of file
  199. --
  200. 2.17.1