diff options
author | Arne Schwabe <arne@rfc2549.org> | 2017-05-29 17:53:50 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2017-05-29 17:53:50 +0200 |
commit | 7ee11eff189eb999c5ecf8f726113df63d783739 (patch) | |
tree | d5920a1b6fe1f83c4f33742c0fee57130b9275f6 /main | |
parent | 6025ce70053a6b25619c2d88c7845711a966b220 (diff) |
Fix lint issues
Diffstat (limited to 'main')
-rw-r--r-- | main/build.gradle | 4 | ||||
-rw-r--r-- | main/src/main/AndroidManifest.xml | 22 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/LaunchVPN.java | 5 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java | 21 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java | 1 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/CIDRIP.java | 4 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/Connection.java | 3 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/X509Utils.java | 3 | ||||
-rw-r--r-- | main/src/main/res/drawable/ic_shortcut_cancel.xml | 14 | ||||
-rw-r--r-- | main/src/main/res/drawable/ic_shortcut_vpn_key.xml | 4 | ||||
-rwxr-xr-x | main/src/main/res/values-ko/arrays.xml | 2 | ||||
-rwxr-xr-x | main/src/main/res/values-vi/strings.xml | 3 |
12 files changed, 42 insertions, 44 deletions
diff --git a/main/build.gradle b/main/build.gradle index f2b416bb..766a3552 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -65,8 +65,8 @@ android { lintOptions { enable 'BackButton', 'EasterEgg', 'StopShip', 'IconExpectedSize', 'GradleDynamicVersion', 'NewerVersionAvailable' - warning 'ImpliedQuantity' - disable 'MissingTranslation' + warning 'ImpliedQuantity', 'MissingQuantity' + disable 'MissingTranslation', 'UnsafeNativeCodeLocation' } buildTypes { diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml index 548e0ef8..d8239bc9 100644 --- a/main/src/main/AndroidManifest.xml +++ b/main/src/main/AndroidManifest.xml @@ -129,7 +129,8 @@ android:taskAffinity=".ConfigConverter" android:uiOptions="splitActionBarWhenNarrow" tools:ignore="ExportedActivity"> - <intent-filter android:label="@string/import_config"> + <intent-filter android:label="@string/import_config" + tools:ignore="AppLinkUrlError"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> @@ -137,7 +138,8 @@ <data android:mimeType="application/x-openvpn-profile" /> </intent-filter> - <intent-filter android:label="@string/import_config"> + <intent-filter android:label="@string/import_config" + tools:ignore="AppLinkUrlError"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> @@ -180,6 +182,22 @@ <activity + android:name=".api.Intents" + android:autoRemoveFromRecents="true" + android:excludeFromRecents="true" + android:label="@string/vpn_launch_title" + android:taskAffinity=".LaunchVPN" + android:theme="@style/blinkt.dialog" + tools:ignore="ExportedActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + <activity android:name=".activities.CreateShortcuts" android:excludeFromRecents="true" android:label="@string/vpn_shortcut" diff --git a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java index ad5171e8..44e355ff 100644 --- a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java +++ b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java @@ -5,6 +5,7 @@ package de.blinkt.openvpn; +import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; @@ -156,7 +157,6 @@ public class LaunchVPN extends Activity { private void askForPW(final int type) { final EditText entry = new EditText(this); - final View userpwlayout = getLayoutInflater().inflate(R.layout.userpass, null, false); entry.setSingleLine(); entry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); @@ -166,6 +166,9 @@ public class LaunchVPN extends Activity { dialog.setTitle(getString(R.string.pw_request_dialog_title, getString(type))); dialog.setMessage(getString(R.string.pw_request_dialog_prompt, mSelectedProfile.mName)); + + @SuppressLint("InflateParams") final View userpwlayout = getLayoutInflater().inflate(R.layout.userpass, null, false); + if (type == R.string.password) { ((EditText) userpwlayout.findViewById(R.id.username)).setText(mSelectedProfile.mUsername); ((EditText) userpwlayout.findViewById(R.id.password)).setText(mSelectedProfile.mPassword); diff --git a/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java b/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java index 43c816cc..3e51285a 100644 --- a/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java +++ b/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java @@ -39,7 +39,7 @@ public class MainActivity extends BaseActivity { private SlidingTabLayout mSlidingTabLayout; protected void onCreate(android.os.Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); @@ -54,14 +54,13 @@ public class MainActivity extends BaseActivity { } - mPagerAdapter.addTab(R.string.vpn_list_title, VPNProfileList.class); mPagerAdapter.addTab(R.string.graph, GraphFragment.class); mPagerAdapter.addTab(R.string.generalsettings, GeneralSettings.class); mPagerAdapter.addTab(R.string.faq, FaqFragment.class); - if(SendDumpFragment.getLastestDump(this)!=null) { + if (SendDumpFragment.getLastestDump(this) != null) { mPagerAdapter.addTab(R.string.crashdump, SendDumpFragment.class); } @@ -74,22 +73,6 @@ public class MainActivity extends BaseActivity { TabBarView tabs = (TabBarView) findViewById(R.id.sliding_tabs); tabs.setViewPager(mPager); - - // requestDozeDisable(); - } - - @TargetApi(Build.VERSION_CODES.M) - private void requestDozeDisable() { - Intent intent = new Intent(); - String packageName = getPackageName(); - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - if (pm.isIgnoringBatteryOptimizations(packageName)) - intent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS); - else { - intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - intent.setData(Uri.parse("package:" + packageName)); - } - startActivity(intent); } private static final String FEATURE_TELEVISION = "android.hardware.type.television"; diff --git a/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java b/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java index bcab79ed..4124b7d4 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java +++ b/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java @@ -76,7 +76,6 @@ CompoundButton.OnCheckedChangeListener, DialogInterface.OnClickListener { mAlert.setCanceledOnTouchOutside(false); mAlert.setOnShowListener (new OnShowListener() { - @Override public void onShow(DialogInterface dialog) { mButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE); diff --git a/main/src/main/java/de/blinkt/openvpn/core/CIDRIP.java b/main/src/main/java/de/blinkt/openvpn/core/CIDRIP.java index 07f2152f..799c68c9 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/CIDRIP.java +++ b/main/src/main/java/de/blinkt/openvpn/core/CIDRIP.java @@ -47,9 +47,9 @@ class CIDRIP { public boolean normalise() { long ip = getInt(mIp); - long newip = ip & (0xffffffffl << (32 - len)); + long newip = ip & (0xffffffffL << (32 - len)); if (newip != ip) { - mIp = String.format("%d.%d.%d.%d", (newip & 0xff000000) >> 24, (newip & 0xff0000) >> 16, (newip & 0xff00) >> 8, newip & 0xff); + mIp = String.format(Locale.US,"%d.%d.%d.%d", (newip & 0xff000000) >> 24, (newip & 0xff0000) >> 16, (newip & 0xff00) >> 8, newip & 0xff); return true; } else { return false; diff --git a/main/src/main/java/de/blinkt/openvpn/core/Connection.java b/main/src/main/java/de/blinkt/openvpn/core/Connection.java index 72cc2cd5..ff15daec 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/Connection.java +++ b/main/src/main/java/de/blinkt/openvpn/core/Connection.java @@ -8,6 +8,7 @@ package de.blinkt.openvpn.core; import android.text.TextUtils; import java.io.Serializable; +import java.util.Locale; public class Connection implements Serializable, Cloneable { public String mServerName = "openvpn.example.com"; @@ -36,7 +37,7 @@ public class Connection implements Serializable, Cloneable { cfg += " tcp-client\n"; if (mConnectTimeout != 0) - cfg += String.format(" connect-timeout %d\n", mConnectTimeout); + cfg += String.format(Locale.US, " connect-timeout %d\n", mConnectTimeout); if (!TextUtils.isEmpty(mCustomConfiguration) && mUseCustomConfig) { diff --git a/main/src/main/java/de/blinkt/openvpn/core/X509Utils.java b/main/src/main/java/de/blinkt/openvpn/core/X509Utils.java index 5b1da811..4c8a226b 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/X509Utils.java +++ b/main/src/main/java/de/blinkt/openvpn/core/X509Utils.java @@ -5,6 +5,7 @@ package de.blinkt.openvpn.core; +import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; @@ -131,7 +132,7 @@ public class X509Utils { /* Hack so we do not have to ship a whole Spongy/bouncycastle */ Exception exp=null; try { - Class X509NameClass = Class.forName("com.android.org.bouncycastle.asn1.x509.X509Name"); + @SuppressLint("PrivateApi") Class X509NameClass = Class.forName("com.android.org.bouncycastle.asn1.x509.X509Name"); Method getInstance = X509NameClass.getMethod("getInstance",Object.class); Hashtable defaultSymbols = (Hashtable) X509NameClass.getField("DefaultSymbols").get(X509NameClass); diff --git a/main/src/main/res/drawable/ic_shortcut_cancel.xml b/main/src/main/res/drawable/ic_shortcut_cancel.xml index bf7daf58..84b0a7de 100644 --- a/main/src/main/res/drawable/ic_shortcut_cancel.xml +++ b/main/src/main/res/drawable/ic_shortcut_cancel.xml @@ -4,18 +4,16 @@ --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="48dp" - android:height="48dp" - android:viewportWidth="48.0" - android:viewportHeight="48.0"> + android:width="48dp" + android:height="48dp"> <path + android:fillColor="#F5F5F5" android:pathData="M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0" android:strokeColor="#00000000" - android:fillColor="#F5F5F5" - android:strokeWidth="1"/> + android:strokeWidth="1" /> <path + android:fillColor="#3F51B5" android:pathData="M24,14C18.47,14 14,18.47 14,24C14,29.53 18.47,34 24,34C29.53,34 34,29.53 34,24C34,18.47 29.53,14 24,14L24,14ZM29,27.59L27.59,29L24,25.41L20.41,29L19,27.59L22.59,24L19,20.41L20.41,19L24,22.59L27.59,19L29,20.41L25.41,24L29,27.59L29,27.59Z" android:strokeColor="#00000000" - android:fillColor="#3F51B5" - android:strokeWidth="1"/> + android:strokeWidth="1" /> </vector> diff --git a/main/src/main/res/drawable/ic_shortcut_vpn_key.xml b/main/src/main/res/drawable/ic_shortcut_vpn_key.xml index 780c1316..ba939fc2 100644 --- a/main/src/main/res/drawable/ic_shortcut_vpn_key.xml +++ b/main/src/main/res/drawable/ic_shortcut_vpn_key.xml @@ -5,9 +5,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" - android:height="48dp" - android:viewportWidth="48.0" - android:viewportHeight="48.0"> + android:height="48dp"> <path android:pathData="M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0" android:strokeColor="#00000000" diff --git a/main/src/main/res/values-ko/arrays.xml b/main/src/main/res/values-ko/arrays.xml index 3f4aed28..d232e6b9 100755 --- a/main/src/main/res/values-ko/arrays.xml +++ b/main/src/main/res/values-ko/arrays.xml @@ -20,6 +20,6 @@ <item translatable="false">0</item> <item translatable="false">1</item> <item>미지정</item> - <item>Encryption (tls-crypt)</item> + <item>Encryption (--tls-crypt)</item> </string-array> </resources> diff --git a/main/src/main/res/values-vi/strings.xml b/main/src/main/res/values-vi/strings.xml index 67d1e655..3eb64c66 100755 --- a/main/src/main/res/values-vi/strings.xml +++ b/main/src/main/res/values-vi/strings.xml @@ -413,7 +413,4 @@ <string name="connectretrymaxmessage">Hãy nhập tối đa thời gian giữa các kết nối lại. OpenVPN sẽ dần dần tăng thời gian chờ đợi của mình sau khi cố kết nối không thành công đến giá trị này. Mặc định là hệ thống 300.</string> <string name="connectretrymaxtitle">Thời gian tối đa giữa kết nối lại</string> <string name="state_waitconnectretry">Vui lòng chờ %ss giây để kết nối</string> - <string name="nought_alwayson_warning"><![CDATA[https://crowdin.com/translate/ics-openvpn/1396/en-vi#2617316]]></string> - <string name="management_socket_closed">Https://crowdin. com/translate/ics-openvpn/1396/en-vi#2617317</string> - <string name="change_sorting">Change sorting</string> </resources> |