mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Fixes privacy policy link in Login page
This commit is contained in:
parent
bdd7a86cd5
commit
4ac8f88ec2
3 changed files with 20 additions and 38 deletions
|
|
@ -53,37 +53,18 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
intent.setPackage("com.facebook.katana");
|
intent.setPackage("com.facebook.katana");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + "1921335171459985\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985"));
|
||||||
if(intent.resolveActivity(this.getPackageManager()) != null){
|
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985"));
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.github_launch_icon)
|
@OnClick(R.id.github_launch_icon)
|
||||||
public void launchGithub(View view) {
|
public void launchGithub(View view) {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
|
||||||
//check if web browser available
|
|
||||||
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.website_launch_icon)
|
@OnClick(R.id.website_launch_icon)
|
||||||
public void launchWebsite(View view) {
|
public void launchWebsite(View view) {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://commons-app.github.io/\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
|
||||||
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.about_rate_us)
|
@OnClick(R.id.about_rate_us)
|
||||||
|
|
@ -93,24 +74,11 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
|
|
||||||
@OnClick(R.id.about_credits)
|
@OnClick(R.id.about_credits)
|
||||||
public void launchCredits(View view) {
|
public void launchCredits(View view) {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
||||||
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.about_privacy_policy)
|
@OnClick(R.id.about_privacy_policy)
|
||||||
public void launchPrivacyPolicy(View view) {
|
public void launchPrivacyPolicy(View view) {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
||||||
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.customtabs.CustomTabsIntent;
|
import android.support.customtabs.CustomTabsIntent;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
|
@ -15,7 +16,6 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
@ -24,6 +24,8 @@ import java.util.regex.Pattern;
|
||||||
import fr.free.nrw.commons.settings.Prefs;
|
import fr.free.nrw.commons.settings.Prefs;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -176,6 +178,13 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleWebUrl(Context context,Uri url){
|
public static void handleWebUrl(Context context,Uri url){
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, url);
|
||||||
|
if (browserIntent.resolveActivity(context.getPackageManager()) == null) {
|
||||||
|
Toast toast = Toast.makeText(context, context.getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
||||||
builder.setToolbarColor(ContextCompat.getColor(context, R.color.primaryColor));
|
builder.setToolbarColor(ContextCompat.getColor(context, R.color.primaryColor));
|
||||||
builder.setSecondaryToolbarColor(ContextCompat.getColor(context, R.color.primaryDarkColor));
|
builder.setSecondaryToolbarColor(ContextCompat.getColor(context, R.color.primaryDarkColor));
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import javax.inject.Named;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
import fr.free.nrw.commons.BuildConfig;
|
import fr.free.nrw.commons.BuildConfig;
|
||||||
import fr.free.nrw.commons.PageTitle;
|
import fr.free.nrw.commons.PageTitle;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
@ -132,6 +133,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL));
|
Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.about_privacy_policy)
|
||||||
|
void onPrivacyPolicyClicked() {
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
||||||
|
}
|
||||||
|
|
||||||
public void hideKeyboard(View view) {
|
public void hideKeyboard(View view) {
|
||||||
InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue