diff options
Diffstat (limited to 'main/src')
6 files changed, 33 insertions, 72 deletions
diff --git a/main/src/main/java/android/support/v4n/app/FragmentStatePagerAdapter.java b/main/src/main/java/android/support/v4n/app/FragmentStatePagerAdapter.java index 07810935..e3b51cfa 100644 --- a/main/src/main/java/android/support/v4n/app/FragmentStatePagerAdapter.java +++ b/main/src/main/java/android/support/v4n/app/FragmentStatePagerAdapter.java @@ -18,9 +18,11 @@ package android.support.v4n.app; import java.util.ArrayList; +import android.annotation.TargetApi; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; +import android.os.Build; import android.os.Bundle; import android.os.Parcelable; import android.support.v4n.view.PagerAdapter; @@ -88,6 +90,7 @@ public abstract class FragmentStatePagerAdapter extends PagerAdapter { public void startUpdate(ViewGroup container) { } + @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) @Override public Object instantiateItem(ViewGroup container, int position) { // If we already have this item instantiated, there is nothing @@ -142,6 +145,7 @@ public abstract class FragmentStatePagerAdapter extends PagerAdapter { mCurTransaction.remove(fragment); } + @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) @Override public void setPrimaryItem(ViewGroup container, int position, Object object) { Fragment fragment = (Fragment)object; diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 2c40e869..be803392 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -560,26 +560,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac VpnStatus.logInfo(R.string.routes_info_excl, TextUtils.join(", ", mRoutes.getNetworks(false)),TextUtils.join(", ", mRoutesv6.getNetworks(false))); VpnStatus.logDebug(R.string.routes_debug, TextUtils.join(", ", positiveIPv4Routes), TextUtils.join(", ", positiveIPv6Routes)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - - for (String pkg : mProfile.mAllowedAppsVpn) { - try { - if (mProfile.mAllowedAppsVpnAreDisallowed) { - builder.addDisallowedApplication(pkg); - } else { - builder.addAllowedApplication(pkg); - } - } catch (PackageManager.NameNotFoundException e) { - mProfile.mAllowedAppsVpn.remove(pkg); - VpnStatus.logInfo(R.string.app_no_longer_exists, pkg); - } - } - - if (mProfile.mAllowedAppsVpnAreDisallowed) { - VpnStatus.logDebug(R.string.disallowed_vpn_apps_info, TextUtils.join(", ", mProfile.mAllowedAppsVpn)); - } else { - VpnStatus.logDebug(R.string.allowed_vpn_apps_info, TextUtils.join(", ", mProfile.mAllowedAppsVpn)); - } - + setAllowedVpnPackages(builder); } @@ -621,6 +602,28 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private void setAllowedVpnPackages(Builder builder) { + for (String pkg : mProfile.mAllowedAppsVpn) { + try { + if (mProfile.mAllowedAppsVpnAreDisallowed) { + builder.addDisallowedApplication(pkg); + } else { + builder.addAllowedApplication(pkg); + } + } catch (PackageManager.NameNotFoundException e) { + mProfile.mAllowedAppsVpn.remove(pkg); + VpnStatus.logInfo(R.string.app_no_longer_exists, pkg); + } + } + + if (mProfile.mAllowedAppsVpnAreDisallowed) { + VpnStatus.logDebug(R.string.disallowed_vpn_apps_info, TextUtils.join(", ", mProfile.mAllowedAppsVpn)); + } else { + VpnStatus.logDebug(R.string.allowed_vpn_apps_info, TextUtils.join(", ", mProfile.mAllowedAppsVpn)); + } + } + public void addDNS(String dns) { mDnslist.add(dns); } diff --git a/main/src/main/java/de/blinkt/openvpn/views/SlidingTabStrip.java b/main/src/main/java/de/blinkt/openvpn/views/SlidingTabStrip.java index b11c356b..88bfb9a3 100644 --- a/main/src/main/java/de/blinkt/openvpn/views/SlidingTabStrip.java +++ b/main/src/main/java/de/blinkt/openvpn/views/SlidingTabStrip.java @@ -16,7 +16,6 @@ package de.blinkt.openvpn.views; -import android.R; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -65,7 +64,7 @@ class SlidingTabStrip extends LinearLayout { final float density = getResources().getDisplayMetrics().density; TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true); + context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true); final int themeForegroundColor = outValue.data; mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, diff --git a/main/src/main/res/drawable/oval_ripple.xml b/main/src/main/res/drawable/oval_ripple.xml index 65f754d2..8b07bb3d 100644 --- a/main/src/main/res/drawable/oval_ripple.xml +++ b/main/src/main/res/drawable/oval_ripple.xml @@ -4,7 +4,9 @@ --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="?android:colorControlHighlight"> + xmlns:tools="http://schemas.android.com/tools" + android:color="?android:colorControlHighlight" + tools:ignore="NewApi"> <item> <shape android:shape="oval"> <solid android:color="?android:colorAccent" /> diff --git a/main/src/main/res/layout/connection_fab.xml b/main/src/main/res/layout/connection_fab.xml index 0cf6ca95..cb3669c5 100644 --- a/main/src/main/res/layout/connection_fab.xml +++ b/main/src/main/res/layout/connection_fab.xml @@ -4,8 +4,8 @@ ~ Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<merge xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> -</FrameLayout>
\ No newline at end of file +</merge>
\ No newline at end of file diff --git a/main/src/main/res/xml/vpn_headers.xml b/main/src/main/res/xml/vpn_headers.xml deleted file mode 100644 index 18b78c09..00000000 --- a/main/src/main/res/xml/vpn_headers.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (c) 2012-2014 Arne Schwabe - ~ Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt - --> - -<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" > - - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_Behaviour" - android:title="@string/client_behaviour" - /> - <header android:fragment="de.blinkt.openvpn.fragments.Settings_Connections" - android:title="Server List" /> - <header - android:id="@+id/basicsettingsid" - android:fragment="de.blinkt.openvpn.fragments.Settings_Basic" - android:title="@string/basic" /> - <!-- android:icon="@drawable/ic_settings_applications" --> - - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_IP" - android:title="@string/ipdns" /> - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_Routing" - android:title="@string/routing" /> - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_Authentication" - android:title="@string/settings_auth" /> - - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_Allowed_Apps" - android:title="Allowed Apps on VPN" - android:id="@+id/allowed_apps_header" - /> - <!-- android:icon="@drawable/ic_settings_display" --> - <header - android:fragment="de.blinkt.openvpn.fragments.Settings_Obscure" - android:summary="@string/obscure" - android:title="@string/advanced" > - </header> - <header - android:fragment="de.blinkt.openvpn.fragments.ShowConfigFragment" - android:summary="@string/generated_config_summary" - android:title="@string/generated_config" /> - -</preference-headers>
\ No newline at end of file |