123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- From 1b6c2cf4b610787e17ad746f7a69f947f717b938 Mon Sep 17 00:00:00 2001
- From: Matthew Finkel <Matthew.Finkel@gmail.com>
- Date: Sat, 24 Nov 2018 04:36:56 +0000
- Subject: [PATCH 03/13] Bug 28051 - Delete the Onboarding activity
- It depends on a library that depends on a newer version of
- the Android Support Library
- ---
- .../torproject/android/OrbotMainActivity.java | 13 +-
- .../ui/onboarding/OnboardingActivity.java | 147 ------------------
- 2 files changed, 1 insertion(+), 159 deletions(-)
- delete mode 100644 app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
- diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- index e18711b1..7ad979ff 100644
- --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
- @@ -29,7 +29,6 @@ import org.torproject.android.settings.SettingsPreferences;
- import org.torproject.android.ui.AppManagerActivity;
- import org.torproject.android.ui.Rotate3dAnimation;
- import org.torproject.android.ui.onboarding.BridgeWizardActivity;
- -import org.torproject.android.ui.onboarding.OnboardingActivity;
- import org.torproject.android.ui.hiddenservices.ClientCookiesActivity;
- import org.torproject.android.ui.hiddenservices.HiddenServicesActivity;
- import org.torproject.android.ui.hiddenservices.backup.BackupUtils;
- @@ -197,16 +196,6 @@ public class OrbotMainActivity extends AppCompatActivity
- new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
-
- boolean showFirstTime = mPrefs.getBoolean("connect_first_time", true);
- -
- - if (showFirstTime)
- - {
- - Editor pEdit = mPrefs.edit();
- - pEdit.putBoolean("connect_first_time", false);
- - pEdit.commit();
- - startActivity(new Intent(this,OnboardingActivity.class));
- - }
- -
- -
- }
-
- private void sendIntentToService(final String action) {
- @@ -870,7 +859,7 @@ public class OrbotMainActivity extends AppCompatActivity
- @Override
- public void onClick(DialogInterface dialog, int which) {
-
- - startActivity(OnboardingActivity.getInstallIntent(TorServiceConstants.BROWSER_APP_USERNAME,OrbotMainActivity.this));
- + dialog.cancel();
-
-
- }
- 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
- deleted file mode 100644
- index a8bad692..00000000
- --- a/app/src/main/java/org/torproject/android/ui/onboarding/OnboardingActivity.java
- +++ /dev/null
- @@ -1,147 +0,0 @@
- -package org.torproject.android.ui.onboarding;
- -
- -import android.content.Context;
- -import android.content.Intent;
- -import android.content.pm.PackageManager;
- -import android.content.pm.ResolveInfo;
- -import android.net.Uri;
- -import android.os.Bundle;
- -import android.support.annotation.Nullable;
- -import android.support.v4.app.Fragment;
- -import android.text.TextUtils;
- -import android.util.Log;
- -import android.view.View;
- -
- -import com.github.paolorotolo.appintro.AppIntro;
- -
- -import org.torproject.android.R;
- -import org.torproject.android.settings.LocaleHelper;
- -import org.torproject.android.ui.AppManagerActivity;
- -import org.torproject.android.ui.hiddenservices.permissions.PermissionManager;
- -import org.torproject.android.vpn.VPNEnableActivity;
- -
- -import java.util.List;
- -
- -public class OnboardingActivity extends AppIntro {
- -
- - @Override
- - protected void onCreate(@Nullable Bundle savedInstanceState) {
- - super.onCreate(savedInstanceState);
- -
- - // Instead of fragments, you can also use our default slide
- - // Just set a title, description, background and image. AppIntro will do the rest.
- - CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- - welcome.setTitle(getString(R.string.hello));
- - welcome.setSubTitle(getString(R.string.welcome));
- - addSlide(welcome);
- -
- - CustomSlideBigText intro2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- - intro2.setTitle(getString(R.string.browser_the_internet));
- - intro2.setSubTitle(getString(R.string.no_tracking));
- - addSlide(intro2);
- -
- - CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- - cs2.setTitle(getString(R.string.bridges_sometimes));
- - cs2.showButton(getString(R.string.action_more), new View.OnClickListener() {
- - @Override
- - public void onClick(View v) {
- - startActivity(new Intent(OnboardingActivity.this,BridgeWizardActivity.class));
- - }
- - });
- - addSlide(cs2);
- -
- - if (PermissionManager.isLollipopOrHigher()) {
- -
- - CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
- - cs3.setTitle(getString(R.string.vpn_setup));
- - cs3.setSubTitle(getString(R.string.vpn_setup_sub));
- - cs3.showButton(getString(R.string.action_vpn_choose), new View.OnClickListener() {
- - @Override
- - public void onClick(View v) {
- - startActivity(new Intent(OnboardingActivity.this, VPNEnableActivity.class));
- - startActivityForResult(new Intent(OnboardingActivity.this, AppManagerActivity.class), 9999);
- -
- - }
- - });
- - addSlide(cs3);
- -
- - }
- -
- - // OPTIONAL METHODS
- - // Override bar/separator color.
- - setBarColor(getResources().getColor(R.color.dark_purple));
- - setSeparatorColor(getResources().getColor(R.color.panel_background_main));
- -
- - // Hide Skip/Done button.
- - showSkipButton(false);
- - setProgressButtonEnabled(true);
- - }
- -
- - @Override
- - public void onSkipPressed(Fragment currentFragment) {
- - super.onSkipPressed(currentFragment);
- - // Do something when users tap on Skip button.
- - }
- -
- - @Override
- - public void onDonePressed(Fragment currentFragment) {
- - super.onDonePressed(currentFragment);
- - // Do something when users tap on Done button.
- - finish();
- - }
- -
- - @Override
- - public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
- - super.onSlideChanged(oldFragment, newFragment);
- - // Do something when the slide changes.
- - }
- -
- -
- - @Override
- - protected void attachBaseContext(Context base) {
- - super.attachBaseContext(LocaleHelper.onAttach(base));
- - }
- -
- - public static boolean isAppInstalled(PackageManager pm, String packageName) {
- - try {
- - pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
- - return true;
- - } catch (PackageManager.NameNotFoundException e) {
- - return false;
- - }
- - }
- -
- - public static Intent getInstallIntent(String packageName, Context context) {
- - final Intent intent = new Intent(Intent.ACTION_VIEW);
- - intent.setData(Uri.parse(MARKET_URI + packageName));
- -
- - PackageManager pm = context.getPackageManager();
- - List<ResolveInfo> resInfos = pm.queryIntentActivities(intent, 0);
- -
- - String foundPackageName = null;
- - for (ResolveInfo r : resInfos) {
- - Log.i("Install", "market: " + r.activityInfo.packageName);
- - if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME)
- - || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) {
- - foundPackageName = r.activityInfo.packageName;
- - break;
- - }
- - }
- -
- - if (foundPackageName == null) {
- - intent.setData(Uri.parse(FDROID_APP_URI + packageName));
- - } else {
- - intent.setPackage(foundPackageName);
- - }
- - return intent;
- - }
- -
- - final static String MARKET_URI = "market://details?id=";
- - final static String FDROID_APP_URI = "https://f-droid.org/repository/browse/?fdid=";
- - final static String PLAY_APP_URI = "https://play.google.com/store/apps/details?id=";
- - final static String FDROID_URI = "https://f-droid.org/repository/browse/?fdfilter=info.guardianproject";
- - final static String PLAY_URI = "https://play.google.com/store/apps/developer?id=The+Guardian+Project";
- -
- - private final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid";
- - private final static String PLAY_PACKAGE_NAME = "com.android.vending";
- -}
- \ No newline at end of file
- --
- 2.17.1
|