Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: mobile/android/base/java/org/adblockplus/browser/FeedbackPreference.java

Issue 30018598: Issue 7281 - Remove Google+ links (Closed)
Left Patch Set: Created Feb. 26, 2019, 12:07 p.m.
Right Patch Set: Adjustments in regards to Anton's comments Created Feb. 27, 2019, 5 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.browser; 18 package org.adblockplus.browser;
19 19
20 import android.content.ActivityNotFoundException;
20 import android.content.Context; 21 import android.content.Context;
21 import android.content.Intent; 22 import android.content.Intent;
22 import android.content.pm.PackageInfo; 23 import android.content.pm.PackageInfo;
23 import android.content.pm.PackageManager; 24 import android.content.pm.PackageManager;
24 import android.content.res.Resources; 25 import android.content.res.Resources;
25 import android.net.Uri; 26 import android.net.Uri;
26 import android.os.Build; 27 import android.os.Build;
27 import android.preference.Preference; 28 import android.preference.Preference;
28 import android.util.AttributeSet; 29 import android.util.AttributeSet;
29 30
(...skipping 18 matching lines...) Expand all
48 } 49 }
49 50
50 @Override 51 @Override
51 protected void onClick() 52 protected void onClick()
52 { 53 {
53 final String emailBody = generateEmailBody(); 54 final String emailBody = generateEmailBody();
54 final Intent intent = new Intent(Intent.ACTION_VIEW); 55 final Intent intent = new Intent(Intent.ACTION_VIEW);
55 final Uri data = Uri.parse( 56 final Uri data = Uri.parse(
56 "mailto:" + EMAIL_RECIPIENT + "?subject=" + EMAIL_SUBJECT + "&body=" + e mailBody); 57 "mailto:" + EMAIL_RECIPIENT + "?subject=" + EMAIL_SUBJECT + "&body=" + e mailBody);
57 intent.setData(data); 58 intent.setData(data);
58 getContext().startActivity(intent); 59 try
anton 2019/02/26 12:52:54 do we assume email client is always installed? oth
diegocarloslima 2019/02/27 16:37:57 I don't think that an exception will ever occur, b
60 {
61 getContext().startActivity(intent);
62 }
63 catch (ActivityNotFoundException e)
64 {
65 }
59 } 66 }
60 67
61 private String generateEmailBody() 68 private String generateEmailBody()
62 { 69 {
63 String emailBody = "\n\n\nUseful information:"; 70 String emailBody = "\n\n\nUseful information:";
64 emailBody += "\n App Version: " + getAppVersion(); 71 emailBody += "\n App Version: " + getAppVersion();
65 emailBody += "\n Android Version: " + Build.VERSION.RELEASE; 72 emailBody += "\n Android Version: " + Build.VERSION.RELEASE;
66 emailBody += "\n Device Model: " + Build.MANUFACTURER + " - " + Build.MODEL; 73 emailBody += "\n Device Model: " + Build.MANUFACTURER + " - " + Build.MODEL;
67 emailBody += "\n Language: " + getLanguage(); 74 emailBody += "\n Language: " + getLanguage();
68 return emailBody; 75 return emailBody;
69 } 76 }
70 77
71 private String getAppVersion() 78 private String getAppVersion()
72 { 79 {
73 try 80 try
74 { 81 {
75 final PackageInfo packageInfo = getContext().getPackageManager().getPackag eInfo( 82 final PackageInfo packageInfo = getContext().getPackageManager().getPackag eInfo(
76 getContext().getPackageName(), 0); 83 getContext().getPackageName(), 0);
77 return packageInfo.versionName; 84 return packageInfo.versionName;
78 } 85 }
79 catch (PackageManager.NameNotFoundException e) 86 catch (PackageManager.NameNotFoundException e)
80 { 87 {
81 } 88 }
82 return ""; 89 return "";
83 } 90 }
84 91
85 private String getLanguage() 92 private String getLanguage()
86 { 93 {
87 // TODO: Replace by ConfigurationCompat when the support lib is >= 26.1.0
anton 2019/02/26 12:52:54 afaik somewhere in code style guide there is requi
diegocarloslima 2019/02/27 16:37:57 Acknowledged.
88 return Resources.getSystem().getConfiguration().locale.toString(); 94 return Resources.getSystem().getConfiguration().locale.toString();
89 } 95 }
90 } 96 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld