enable backwards compat to Android SDK 10 (Android 2.3.*)
This commit is contained in:
parent
e1d46c49b9
commit
bac16a57fc
|
@ -1 +1 @@
|
|||
Subproject commit be997be8fff6dc00cd249fdfd128d6820461db99
|
||||
Subproject commit 834a50146a2dc07c57f02d37ecd7f2d521b52c2b
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
package org.torproject.android;
|
||||
|
||||
import static org.torproject.android.OrbotConstants.TAG;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -25,8 +27,7 @@ import org.torproject.android.ui.PromoAppsActivity;
|
|||
import org.torproject.android.ui.Rotate3dAnimation;
|
||||
import org.torproject.android.vpn.VPNEnableActivity;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.RunningServiceInfo;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -49,10 +50,10 @@ import android.os.Message;
|
|||
import android.os.RemoteException;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.GestureDetector.SimpleOnGestureListener;
|
||||
|
@ -124,6 +125,14 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
|
||||
private ArrayList<Bridge> alBridges = null;
|
||||
|
||||
//this is needed for backwards compat back to Android 2.3.*
|
||||
@SuppressLint("NewApi")
|
||||
public View onCreateView(View parent, String name, Context context, AttributeSet attrs)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= 11)
|
||||
return super.onCreateView(parent, name, context, attrs);
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -261,6 +270,15 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
|
||||
mBtnVPN = (ToggleButton)findViewById(R.id.btnVPN);
|
||||
|
||||
boolean canDoVPN = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
if (!canDoVPN)
|
||||
{
|
||||
//if not SDK 14 or higher, we can't use the VPN feature
|
||||
mBtnVPN.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean useVPN = Prefs.useVpn();
|
||||
mBtnVPN.setChecked(useVPN);
|
||||
|
||||
|
@ -284,6 +302,7 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
mBtnBridges = (ToggleButton)findViewById(R.id.btnBridges);
|
||||
|
@ -1019,21 +1038,6 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
sendIntentToService(TorServiceConstants.CMD_SIGNAL_HUP);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public void startVpnService ()
|
||||
{
|
||||
Intent intent = VpnService.prepare(getApplicationContext());
|
||||
if (intent != null) {
|
||||
startActivityForResult(intent,REQUEST_VPN);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendIntentToService(TorServiceConstants.CMD_VPN);
|
||||
}
|
||||
}*/
|
||||
|
||||
public void stopVpnService ()
|
||||
{
|
||||
sendIntentToService(TorServiceConstants.CMD_VPN_CLEAR);
|
||||
|
|
Loading…
Reference in New Issue