liuzhenxing 3 éve
szülő
commit
6890a146c4

+ 1 - 0
.idea/misc.xml

@@ -15,6 +15,7 @@
         <entry key="app/src/main/res/layout/activity_list_title.xml" value="0.1" />
         <entry key="app/src/main/res/layout/activity_main.xml" value="0.3546195652173913" />
         <entry key="app/src/main/res/layout/activity_qr.xml" value="0.19300911854103345" />
+        <entry key="app/src/main/res/layout/activity_wifi_list.xml" value="0.2807971014492754" />
         <entry key="app/src/main/res/layout/activity_wifi_login.xml" value="0.16236068895643363" />
         <entry key="app/src/main/res/layout/bright_activity.xml" value="0.1889564336372847" />
         <entry key="app/src/main/res/layout/button_sure.xml" value="0.1" />

+ 95 - 21
app/src/main/java/com/xplora/xpsettings/Activity/BluetoothActivity.java

@@ -21,12 +21,14 @@ import androidx.annotation.RequiresApi;
 import androidx.core.app.ActivityCompat;
 
 import com.xplora.xpsettings.Adapter.BluetoothDevicesAdapter;
+import com.xplora.xpsettings.BtManager;
 import com.xplora.xpsettings.Model.BluetoothModel;
 import com.xplora.xpsettings.R;
 import com.xplora.xpsettings.Utils.Constant;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 public class BluetoothActivity extends BaseActivity {
     private final List<BluetoothModel> mDataList = new ArrayList<>();
@@ -36,19 +38,91 @@ public class BluetoothActivity extends BaseActivity {
     private static final int REQUEST_LOGIN = 0;
     private static final int REQUEST_CONTROL = 1;
     private List<String> mPermissionList = new ArrayList<>();
+    private BtManager mBtManager;
+    private List<BluetoothDevice> mBeanList = new ArrayList<>();
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_list);
 
+        mBtManager = BtManager.getInstance();
+
         initPermission();
         //initBluetooth();
 
-//        initData();
+        initData();
 //        initView();
     }
 
+    private void initData() {
+        boolean isEnabled = mBtManager.isEnabled();
+        if (isEnabled) {
+            mBtManager.connBluetoothProfile(this);
+        }
+
+        startScanDevice();
+    }
+
+    private void startScanDevice() {
+        if (mBtManager != null) {
+            mBeanList.clear();
+            addDevice(mBtManager.getBluetoothAdapter().getBondedDevices());
+            //updateList();
+
+            mBtManager.startScan();
+        }
+    }
+
+    private BroadcastReceiver btBroadcastReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String action = intent.getAction();
+            if (BluetoothDevice.ACTION_FOUND.equals(action)) {  //发现新设备
+                //发现新设备
+                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+                boolean result = addDevice(device);
+                if (!result) {
+                    return;
+                }
+            } else if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {  //绑定状态改变
+                //绑定状态改变
+                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+                int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE);
+                if (bondState == BluetoothDevice.BOND_BONDED && mBtManager != null) {
+                    mBtManager.connectDevice(context, device);
+                }
+            } else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {  //蓝牙开关状态改变
+
+            }
+        }
+    };
+
+    private void addDevice(Set<BluetoothDevice> devices) {
+        if (devices != null) {
+            for (BluetoothDevice device : devices) {
+                addDevice(device);
+            }
+        }
+    }
+
+    private boolean addDevice(BluetoothDevice device) {
+        if (device != null && !mBeanList.contains(device)) {
+//            //过滤无名设备
+//            if (TextUtils.isEmpty(device.getName())) {
+//                return false;
+//            }
+
+            //过滤非音频设备
+            if (mBtManager != null && mBtManager.isAudioDevice(device)) {
+                mBeanList.add(device);
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     private void initPermission() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
             // Android 版本大于等于 Android12 时
@@ -190,26 +264,26 @@ public class BluetoothActivity extends BaseActivity {
         }
     };
 
-    private void initData() {
-        String[] stringList = getResources().getStringArray(R.array.connections_title_array);
-
-        BluetoothModel switchModel = new BluetoothModel();
-        switchModel.title = stringList[0];
-        switchModel.cellType = Constant.CellType.SWITCH;
-        mDataList.add(switchModel);
-
-        BluetoothModel refreshModel = new BluetoothModel();
-        refreshModel.title = getResources().getString(R.string.available_devices);
-        refreshModel.cellType = Constant.CellType.REFRESH;
-        mDataList.add(refreshModel);
-
-        for (int i = 0; i < 10; i++) {
-            BluetoothModel model = new BluetoothModel();
-            model.title = "aaaa";
-            model.cellType = Constant.CellType.ICON_TITLE_SUBTITLE;
-            mDataList.add(model);
-        }
-    }
+//    private void initData() {
+//        String[] stringList = getResources().getStringArray(R.array.connections_title_array);
+//
+//        BluetoothModel switchModel = new BluetoothModel();
+//        switchModel.title = stringList[0];
+//        switchModel.cellType = Constant.CellType.SWITCH;
+//        mDataList.add(switchModel);
+//
+//        BluetoothModel refreshModel = new BluetoothModel();
+//        refreshModel.title = getResources().getString(R.string.available_devices);
+//        refreshModel.cellType = Constant.CellType.REFRESH;
+//        mDataList.add(refreshModel);
+//
+//        for (int i = 0; i < 10; i++) {
+//            BluetoothModel model = new BluetoothModel();
+//            model.title = "aaaa";
+//            model.cellType = Constant.CellType.ICON_TITLE_SUBTITLE;
+//            mDataList.add(model);
+//        }
+//    }
 
     private void initView() {
         mDevicesAdapter = new BluetoothDevicesAdapter(BluetoothActivity.this, 0, mDataList, handler);

+ 308 - 0
app/src/main/java/com/xplora/xpsettings/BtManager.java

@@ -0,0 +1,308 @@
+package com.xplora.xpsettings;
+
+import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothClass;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothHeadset;
+import android.bluetooth.BluetoothProfile;
+import android.content.Context;
+
+public class BtManager {
+
+    private static volatile BtManager instance;
+
+    private BluetoothAdapter mBluetoothAdapter;
+
+    private BluetoothA2dp mBluetoothA2dp;
+    private BluetoothHeadset mBluetoothHeadset;
+
+    private BtManager() {
+        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+    }
+
+    public static BtManager getInstance() {
+        if (instance == null) {
+            synchronized (BtManager.class) {
+                if (instance == null) {
+                    instance = new BtManager();
+                }
+            }
+        }
+        return instance;
+    }
+
+    public BluetoothAdapter getBluetoothAdapter() {
+        return mBluetoothAdapter;
+    }
+
+    /**
+     * 检查当前手机是否支持蓝牙
+     * @return
+     */
+    public boolean isSupprotBt() {
+        return mBluetoothAdapter != null;
+    }
+
+    public boolean isEnabled() {
+        if (mBluetoothAdapter != null) {
+            return mBluetoothAdapter.isEnabled();
+        }
+        return false;
+    }
+
+    public boolean setEnable(boolean isEnable) {
+        boolean isChanged = false;
+        if (mBluetoothAdapter != null) {
+            int state = mBluetoothAdapter.getState();
+            if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_ON) { //当前开
+                if (!isEnable) {
+                    mBluetoothAdapter.disable();
+                    isChanged = true;
+                }
+            } else { //当前关
+                if (isEnable) {
+                    mBluetoothAdapter.enable();
+                    isChanged = true;
+                }
+            }
+        }
+        return isChanged;
+    }
+
+    public BluetoothDevice getRemoteDevice(String btAddress) {
+        BluetoothDevice device = null;
+        if (mBluetoothAdapter != null) {
+            device = mBluetoothAdapter.getRemoteDevice(btAddress);
+        }
+        return device;
+    }
+
+    public void startScan() {
+        if (mBluetoothAdapter != null) {
+            mBluetoothAdapter.startDiscovery();
+        }
+    }
+
+    public void stopScan() {
+        if (mBluetoothAdapter != null) {
+            mBluetoothAdapter.cancelDiscovery();
+        }
+    }
+
+    public void bondDevice(BluetoothDevice device) {
+        if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) {
+            //直接调用(api 19 以后才支持)
+            device.createBond();
+            /*
+            //反射工具类调用
+            try {
+                RefInvoke.invokeMethod(BluetoothDevice.class.getName(), "createBond", device);
+            } catch (Exception e) {
+                if (BuildConstants.DEBUG_SWITCH) {
+                    e.printStackTrace();
+                }
+            }
+            */
+        }
+    }
+
+    public void removeBondDevice(BluetoothDevice device) {
+        if (device != null && device.getBondState() != BluetoothDevice.BOND_NONE) {
+            //直接调用(需要源码环境)
+            //device.removeBond();
+            /*
+            //反射工具类调用
+            try {
+                RefInvoke.invokeMethod(BluetoothDevice.class.getName(), "removeBond", device);
+            } catch (Exception e) {
+                if (BuildConstants.DEBUG_SWITCH) {
+                    e.printStackTrace();
+                }
+            }
+            */
+        }
+    }
+
+    public int getConnectionState(BluetoothDevice device) {
+        int state = BluetoothAdapter.STATE_DISCONNECTED;
+        try {
+            if (mBluetoothA2dp != null && doesClassMatch(device, BluetoothProfile.A2DP)) {
+                state = mBluetoothA2dp.getConnectionState(device);
+            }
+
+            if (state == BluetoothAdapter.STATE_DISCONNECTED) {
+                if (mBluetoothHeadset != null && doesClassMatch(device, BluetoothProfile.HEADSET)) {
+                    state = mBluetoothHeadset.getConnectionState(device);
+                }
+            }
+        } catch (Exception e) {
+        }
+        return state;
+    }
+
+    public void connBluetoothProfile(Context context) {
+        connBluetoothProfile(context, null);
+    }
+
+    private void connBluetoothProfile(Context context, final BluetoothDevice device) {
+        try {
+            final BluetoothProfile.ServiceListener profileListener = new BluetoothProfile.ServiceListener() {
+                public void onServiceConnected(int profile, BluetoothProfile proxy) {
+                    if (profile == BluetoothProfile.HEADSET) {
+                        mBluetoothHeadset = (BluetoothHeadset) proxy;
+                    } else if (profile == BluetoothProfile.A2DP) {
+                        mBluetoothA2dp = (BluetoothA2dp) proxy;
+                    }
+
+                    if (device != null) {
+                        connectDevice(device);
+                    }
+                }
+
+                public void onServiceDisconnected(int profile) {
+                    if (profile == BluetoothProfile.HEADSET) {
+                        mBluetoothHeadset = null;
+                    } else if (profile == BluetoothProfile.A2DP) {
+                        mBluetoothA2dp = null;
+                    }
+                }
+            };
+
+            mBluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEADSET);
+            mBluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.A2DP);
+        } catch (Exception e) {
+
+        }
+    }
+
+    private void closeBluetoothProfile() {
+        try {
+            if (mBluetoothHeadset != null) {
+                mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
+                mBluetoothHeadset = null;
+            }
+
+            if (mBluetoothA2dp != null) {
+                mBluetoothAdapter.closeProfileProxy(BluetoothProfile.A2DP, mBluetoothA2dp);
+                mBluetoothA2dp = null;
+            }
+        } catch (Exception e) {
+
+        }
+    }
+
+    public void connectDevice(Context context, BluetoothDevice device) {
+        try {
+            if (mBluetoothHeadset != null && mBluetoothA2dp != null) {
+                connectDevice(device);
+            } else {
+                connBluetoothProfile(context, device);
+            }
+        } catch (Exception e) {
+
+        }
+    }
+
+    public void connectDevice(BluetoothDevice device) {
+        if (device != null) {
+            try {
+                if (mBluetoothHeadset != null) {
+                    //直接调用(需要源码环境)
+                    //mBluetoothHeadset.connect(device);
+                    //反射工具类调用
+                    //RefInvoke.invokeMethod(mBluetoothHeadset.getClass().getName(), "connect", mBluetoothHeadset, device);
+                }
+
+                if (mBluetoothA2dp != null) {
+                    //直接调用(需要源码环境)
+                    //mBluetoothA2dp.connect(device);
+                    //反射工具类调用
+                    //RefInvoke.invokeMethod(mBluetoothA2dp.getClass().getName(), "connect", mBluetoothA2dp, device);
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    public void disConnectDevice(BluetoothDevice device) {
+        if (device != null) {
+            try {
+                if (mBluetoothHeadset != null && doesClassMatch(device, BluetoothProfile.HEADSET)) {
+                    //直接调用(需要源码环境)
+                    //mBluetoothHeadset.disconnect(device);
+                    //反射工具类调用
+                    //RefInvoke.invokeMethod(mBluetoothHeadset.getClass().getName(), "disconnect", mBluetoothHeadset, device);
+                }
+
+                if (mBluetoothA2dp != null && doesClassMatch(device, BluetoothProfile.A2DP)) {
+                    //直接调用(需要源码环境)
+                    //mBluetoothA2dp.disconnect(device);
+                    //反射工具类调用
+                    //RefInvoke.invokeMethod(mBluetoothA2dp.getClass().getName(), "disconnect", mBluetoothA2dp, device);
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    private void doDestroy() {
+        stopScan();
+        closeBluetoothProfile();
+    }
+
+    public static void destroy() {
+        if (instance != null) {
+            instance.doDestroy();
+        }
+        instance = null;
+    }
+
+    /**
+     * 判断是否支持某profile,需要源码环境
+     * @param device
+     * @param profile 参数只支持BluetoothProfile.A2DP,BluetoothProfile.HEADSET
+     * @return
+     */
+    private boolean doesClassMatch(BluetoothDevice device, int profile) {
+        try {
+            //int deviceProfile = profile == BluetoothProfile.A2DP ? BluetoothClass.PROFILE_A2DP : BluetoothClass.PROFILE_HEADSET;
+            //return device.getBluetoothClass().doesClassMatch(deviceProfile);
+        } catch (Exception e) {
+
+        }
+
+        return true;
+    }
+
+    /**
+     * 判断设备是否支持音频(耳机/音箱)
+     * @param device
+     * @return
+     */
+    public boolean isAudioDevice(BluetoothDevice device) {
+        if (device == null) {
+            return false;
+        }
+
+        /*
+        //根据设备类型判断(根据常见的设备)
+        int deviceClass = device.getBluetoothClass().getDeviceClass();
+        if (deviceClass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET
+                || deviceClass == BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES) {
+            return true;
+        }
+        */
+
+        //根据设备类型判断(系统的判断更全面)
+        boolean result = doesClassMatch(device, BluetoothProfile.A2DP);
+        if (!result) {
+            result = doesClassMatch(device, BluetoothProfile.HEADSET);
+        }
+
+        return result;
+    }
+
+}

+ 229 - 0
app/src/main/java/com/xplora/xpsettings/RefInvoke.java

@@ -0,0 +1,229 @@
+package com.xplora.xpsettings;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * 反射操作
+ */
+public class RefInvoke {
+
+    /**
+     * 获取对象的属性值
+     * @param className 类名
+     * @param fieldName 属性名
+     * @param owner 所属对象
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object getField(String className, String fieldName, Object owner) throws SecurityException, NoSuchFieldException, Exception{
+    	Class<?> ownerClass = Class.forName(className);
+    	Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		return field.get(owner);
+    }
+
+    /**
+     * 设置对象的属性值
+     * @param className 类名
+     * @param fieldName 属性名
+     * @param owner 所属对象
+     * @return value 属性值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static void setField(String className, String fieldName, Object owner, Object value) throws SecurityException, NoSuchFieldException, Exception{
+    	Class<?> ownerClass = Class.forName(className);
+    	Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		field.set(owner, value);
+    }
+
+    /**
+     * 获取对象的静态属性值
+     * @param className 类名
+     * @param fieldName 属性名
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object getStaticField(String className, String fieldName) throws SecurityException, NoSuchFieldException, Exception{
+		Class<?> ownerClass = Class.forName(className);
+		Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		return field.get(null);
+    }
+
+    /**
+     * 设置对象的静态属性值
+     * @param className 类名
+     * @param fieldName 属性名
+     * @return value 属性值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static void setStaticField(String className, String fieldName, Object value) throws SecurityException, NoSuchFieldException, Exception{
+    	Class<?> ownerClass = Class.forName(className);
+    	Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		field.set(null, value);
+    }
+
+
+    /**
+     * 调用对象中的方法
+     * @param className 类名
+     * @param methodName 方法名
+     * @param owner 所属对象
+     * @param argsClass 参数类型集
+     * @param paras 参数集
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchMethodException 方法不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object invokeMethod(String className, String methodName, Object owner, Class<?>[] argsClass, Object[] paras) throws SecurityException, NoSuchMethodException, Exception{
+    	Class<?> ownerClass = Class.forName(className);
+		Method method = ownerClass.getDeclaredMethod(methodName, argsClass);
+		// 私有化函数也能使用
+		method.setAccessible(true);
+		// 执行方法
+		return method.invoke(owner, paras);
+    }
+	
+    /**
+     * 调用对象中的静态方法
+     * @param className 类名
+     * @param methodName 方法名
+     * @param argsClass 参数类型集
+     * @param paras 参数集
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchMethodException 方法不存在异常
+     * @throws Exception 其它异常
+     */
+	public static Object invokeStaticMethod(String className, String methodName, Class<?>[] argsClass, Object[] paras) throws SecurityException, NoSuchMethodException, Exception{
+		Class<?> ownerClass = Class.forName(className);
+		Method method = ownerClass.getDeclaredMethod(methodName, argsClass);
+		// 私有化函数也能使用
+		method.setAccessible(true);
+		// 执行方法
+		return method.invoke(null, paras);
+	}
+
+	
+    /**
+     * 调用对象中的方法
+     * @param className 类名
+     * @param methodName 方法名
+     * @param owner 所属对象
+     * @param paras 参数集
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchMethodException 方法不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object invokeMethod(String className, String methodName, Object owner, Object... paras) throws SecurityException, NoSuchMethodException, Exception{
+    	Class<?> ownerClass = Class.forName(className);
+    	Class<?>[] argsClass = new Class[paras.length];
+		for (int i = 0, j = paras.length; i < j; i++) {
+			argsClass[i] = paras[i].getClass();
+		}
+		Method method = ownerClass.getDeclaredMethod(methodName, argsClass);
+		// 私有化函数也能使用
+		method.setAccessible(true);
+		// 执行方法
+		return method.invoke(owner, paras);
+    }
+	
+    /**
+     * 调用对象中的静态方法
+     * @param className 类名
+     * @param methodName 方法名
+     * @param paras 参数集
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchMethodException 方法不存在异常
+     * @throws Exception 其它异常
+     */
+	public static Object invokeStaticMethod(String className, String methodName, Object... paras) throws SecurityException, NoSuchMethodException, Exception{
+		Class<?> ownerClass = Class.forName(className);
+		Class<?>[] argsClass = new Class[paras.length];
+		for (int i = 0, j = paras.length; i < j; i++) {
+			argsClass[i] = paras[i].getClass();
+		}
+		Method method = ownerClass.getDeclaredMethod(methodName, argsClass);
+		// 私有化函数也能使用
+		method.setAccessible(true);
+		// 执行方法
+		return method.invoke(null, paras);
+	}
+
+
+    /**
+     * 获取对象的属性值
+     * @param fieldName 属性名
+     * @param owner 所属对象
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object getFieldByOwner(String fieldName, Object owner) throws SecurityException, NoSuchFieldException, Exception{
+    	Class<?> ownerClass = owner.getClass();
+    	Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		return field.get(owner);
+    }
+
+    /**
+     * 设置对象的属性值
+     * @param fieldName 属性名
+     * @param owner 所属对象
+     * @return value 属性值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchFieldException 属性不存在异常
+     * @throws Exception 其它异常
+     */
+    public static void setFieldByOwner(String fieldName, Object owner, Object value) throws SecurityException, NoSuchFieldException, Exception{
+    	Class<?> ownerClass = owner.getClass();
+    	Field field = ownerClass.getDeclaredField(fieldName);
+		// 私有化属性也能使用
+		field.setAccessible(true);
+		field.set(owner, value);
+    }
+
+    /**
+     * 调用对象中的方法
+     * @param methodName 方法名
+     * @param owner 所属对象
+     * @param paras 参数集
+     * @return 返回值
+     * @throws SecurityException 权限异常
+     * @throws NoSuchMethodException 方法不存在异常
+     * @throws Exception 其它异常
+     */
+    public static Object invokeMethodByOwner(String methodName, Object owner, Object... paras) throws SecurityException, NoSuchMethodException, Exception{
+    	Class<?> ownerClass = owner.getClass();
+    	Class<?>[] argsClass = new Class[paras.length];
+		for (int i = 0, j = paras.length; i < j; i++) {
+			argsClass[i] = paras[i].getClass();
+		}
+		Method method = ownerClass.getDeclaredMethod(methodName, argsClass);
+		// 私有化函数也能使用
+		method.setAccessible(true);
+		// 执行方法
+		return method.invoke(owner, paras);
+    }
+    
+}

+ 1 - 1
app/src/main/java/com/xplora/xpsettings/Utils/Constant.java

@@ -5,7 +5,7 @@ import android.provider.Settings;
 
 public class Constant {
 
-    public static boolean DEBUG = true;
+    public static boolean DEBUG = false;
 
     public static String PACKAGE_NAME = "com.xplora.xpsettings";
     public static String INENT_VIEW_TYPE = "inent_view_type";