- * "ro.miui.ui.version.code" -> "5" - *
- * "ro.miui.ui.version.name" -> "V7" - *
- * "ro.miui.has_handy_mode_sf" -> "1" - *
- * "ro.miui.has_real_blur" -> "1" - *
- *
- *
- * Flyme ROM标识 - *
- * "ro.build.user" -> "flyme" - *
- * "persist.sys.use.flyme.icon" -> "true" - *
- * "ro.flyme.published" -> "true" - *
- * "ro.build.display.id" -> "Flyme OS 5.1.2.0U" - *
- * "ro.meizu.setupwizard.flyme" -> "true" - *
- *
- *
- * EMUI ROM标识 - *
- * "ro.build.version.emui" -> "EmotionUI_1.6" - */ - - //MIUI标识 - private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code"; - private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name"; - //EMUI标识 - private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui"; - //Flyme标识 - private static final String KEY_FLYME_ID_FLAG_KEY = "ro.build.display.id"; - private static final String KEY_FLYME_ID_FLAG_VALUE_KEYWORD = "Flyme"; - private static final String KEY_FLYME_ICON_FLAG = "persist.sys.use.flyme.icon"; - private static final String KEY_FLYME_SETUP_FLAG = "ro.meizu.setupwizard.flyme"; - private static final String KEY_FLYME_PUBLISH_FLAG = "ro.flyme.published"; - - /** - * 获取ROM类型,MIUI_ROM, *FLYME_ROM, * EMUI_ROM, * OTHER_ROM - * - * @return ROM_TYPE ROM类型的枚举 - */ - public static ROM_TYPE getRomType() { - ROM_TYPE rom_type = ROM_TYPE.OTHER_ROM; - try { - BuildProperties buildProperties = BuildProperties.getInstance(); - if (buildProperties.containsKey(KEY_EMUI_VERSION_CODE)) { - return ROM_TYPE.EMUI_ROM; - } - if (buildProperties.containsKey(KEY_MIUI_VERSION_CODE) || buildProperties.containsKey(KEY_MIUI_VERSION_NAME)) { - return ROM_TYPE.MIUI_ROM; - } - if (buildProperties.containsKey(KEY_FLYME_ICON_FLAG) || buildProperties.containsKey(KEY_FLYME_SETUP_FLAG) || buildProperties.containsKey(KEY_FLYME_PUBLISH_FLAG)) { - return ROM_TYPE.FLYME_ROM; - } - if (buildProperties.containsKey(KEY_FLYME_ID_FLAG_KEY)) { - String romName = buildProperties.getProperty(KEY_FLYME_ID_FLAG_KEY); - if (!TextUtils.isEmpty(romName) && romName.contains(KEY_FLYME_ID_FLAG_VALUE_KEYWORD)) { - return ROM_TYPE.FLYME_ROM; - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return rom_type; - } - - public enum ROM_TYPE { - MIUI_ROM, - FLYME_ROM, - EMUI_ROM, - OTHER_ROM - } -} +package com.idormy.sms.forwarder.utils; + +import android.os.Environment; +import android.text.TextUtils; + +import com.alibaba.fastjson.util.IOUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +/** + * 使用方法: + * OSUtils.ROM_TYPE romType = OSUtils.getRomType(); + * 可能您需要对其他的ROM进行区分,那么只需三步: + * 一:使用BuildProperties获取到所有的key,遍历获取到所有的value(getProperty),或者直接找到build.prop文件。 + * 二:找到定制ROM特征的标识(key/value) + * 三:增加ROM_TYPE枚举类型,getRomType方法加入识别比对即可 + * 作者:YouAreMyShine + * 链接:https://www.jianshu.com/p/bb1f765a425f + */ +public class OSUtils { + + /** + * 判断是否为MIUI系统,参考http://blog.csdn.net/xx326664162/article/details/52438706 + * + * @return 返回结果 + */ + @SuppressWarnings("unused") + public static boolean isMIUI() { + File file = new File(Environment.getRootDirectory(), "build.prop"); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code"; + String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name"; + String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage"; + Properties prop = new Properties(); + prop.load(fis); + + return prop.getProperty(KEY_MIUI_VERSION_CODE, null) != null + || prop.getProperty(KEY_MIUI_VERSION_NAME, null) != null + || prop.getProperty(KEY_MIUI_INTERNAL_STORAGE, null) != null; + } catch (final IOException e) { + return false; + } finally { + IOUtils.close(fis); + } + } + + /** + * MIUI ROM标识 + *
+ * "ro.miui.ui.version.code" -> "5" + *
+ * "ro.miui.ui.version.name" -> "V7" + *
+ * "ro.miui.has_handy_mode_sf" -> "1" + *
+ * "ro.miui.has_real_blur" -> "1" + *
+ *
+ *
+ * Flyme ROM标识 + *
+ * "ro.build.user" -> "flyme" + *
+ * "persist.sys.use.flyme.icon" -> "true" + *
+ * "ro.flyme.published" -> "true" + *
+ * "ro.build.display.id" -> "Flyme OS 5.1.2.0U" + *
+ * "ro.meizu.setupwizard.flyme" -> "true" + *
+ *
+ *
+ * EMUI ROM标识 + *
+ * "ro.build.version.emui" -> "EmotionUI_1.6"
+ */
+
+ //MIUI标识
+ private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
+ private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
+ //EMUI标识
+ private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui";
+ //Flyme标识
+ private static final String KEY_FLYME_ID_FLAG_KEY = "ro.build.display.id";
+ private static final String KEY_FLYME_ID_FLAG_VALUE_KEYWORD = "Flyme";
+ private static final String KEY_FLYME_ICON_FLAG = "persist.sys.use.flyme.icon";
+ private static final String KEY_FLYME_SETUP_FLAG = "ro.meizu.setupwizard.flyme";
+ private static final String KEY_FLYME_PUBLISH_FLAG = "ro.flyme.published";
+
+ /**
+ * 获取ROM类型,MIUI_ROM, *FLYME_ROM, * EMUI_ROM, * OTHER_ROM
+ *
+ * @return ROM_TYPE ROM类型的枚举
+ */
+ public static ROM_TYPE getRomType() {
+ ROM_TYPE rom_type = ROM_TYPE.OTHER_ROM;
+ try {
+ BuildProperties buildProperties = BuildProperties.getInstance();
+ if (buildProperties.containsKey(KEY_EMUI_VERSION_CODE)) {
+ return ROM_TYPE.EMUI_ROM;
+ }
+ if (buildProperties.containsKey(KEY_MIUI_VERSION_CODE) || buildProperties.containsKey(KEY_MIUI_VERSION_NAME)) {
+ return ROM_TYPE.MIUI_ROM;
+ }
+ if (buildProperties.containsKey(KEY_FLYME_ICON_FLAG) || buildProperties.containsKey(KEY_FLYME_SETUP_FLAG) || buildProperties.containsKey(KEY_FLYME_PUBLISH_FLAG)) {
+ return ROM_TYPE.FLYME_ROM;
+ }
+ if (buildProperties.containsKey(KEY_FLYME_ID_FLAG_KEY)) {
+ String romName = buildProperties.getProperty(KEY_FLYME_ID_FLAG_KEY);
+ if (!TextUtils.isEmpty(romName) && romName.contains(KEY_FLYME_ID_FLAG_VALUE_KEYWORD)) {
+ return ROM_TYPE.FLYME_ROM;
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return rom_type;
+ }
+
+ public enum ROM_TYPE {
+ MIUI_ROM,
+ FLYME_ROM,
+ EMUI_ROM,
+ OTHER_ROM
+ }
+}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtils.java
similarity index 99%
rename from app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtil.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtils.java
index 7ad33453..b1cb9d27 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/RuleUtils.java
@@ -15,8 +15,8 @@ import java.util.ArrayList;
import java.util.List;
@SuppressWarnings({"UnusedReturnValue", "SynchronizeOnNonFinalField"})
-public class RuleUtil {
- static final String TAG = "RuleUtil";
+public class RuleUtils {
+ static final String TAG = "RuleUtils";
static Boolean hasInit = false;
@SuppressLint("StaticFieldLeak")
static Context context;
diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtils.java
similarity index 95%
rename from app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtil.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtils.java
index 77e6fca0..4047453c 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/SettingUtils.java
@@ -1,332 +1,332 @@
-package com.idormy.sms.forwarder.utils;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.preference.PreferenceManager;
-import android.util.Log;
-
-import com.idormy.sms.forwarder.MyApplication;
-import com.idormy.sms.forwarder.R;
-
-@SuppressWarnings({"SynchronizeOnNonFinalField", "unused"})
-public class SettingUtil {
- static Boolean hasInit = false;
- private static final String TAG = "SettingUtil";
- private static SharedPreferences sp_setting = null;
- @SuppressLint("StaticFieldLeak")
- private static Context context = null;
-
- public static void init(Context context1) {
- synchronized (hasInit) {
- if (hasInit) return;
- hasInit = true;
- context = context1;
- Log.d(TAG, "SettingUtil init ");
- sp_setting = PreferenceManager.getDefaultSharedPreferences(context1);
- }
- }
-
- public static void switchAddExtra(Boolean switchAddExtra) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, switchAddExtra).apply();
- }
-
- public static boolean getSwitchAddExtra() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, false);
- }
-
- public static void switchAddDeviceName(Boolean switchAddDeviceName) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, switchAddDeviceName).apply();
- }
-
- public static boolean getSwitchAddDeviceName() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, false);
- }
-
- public static void switchEnableSms(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_SMS, enable).apply();
- }
-
- public static boolean getSwitchEnableSms() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_SMS, false);
- }
-
- public static void switchEnablePhone(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, enable).apply();
- }
-
- public static boolean getSwitchEnablePhone() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, false);
- }
-
- public static void switchEnableAppNotify(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_APP_NOTIFY, enable).apply();
- }
-
- public static boolean getSwitchEnableAppNotify() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_APP_NOTIFY, false);
- }
-
- public static void switchCancelAppNotify(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_CANCEL_APP_NOTIFY, enable).apply();
- }
-
- public static boolean getSwitchCancelAppNotify() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_CANCEL_APP_NOTIFY, false);
- }
-
- public static void switchNotUserPresent(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_NOT_USER_PRESENT, enable).apply();
- }
-
- public static boolean getSwitchNotUserPresent() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_NOT_USER_PRESENT, false);
- }
-
- public static void switchEnableBatteryReceiver(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_RECEIVER, enable).apply();
- }
-
- public static boolean getSwitchEnableBatteryReceiver() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_RECEIVER, false);
- }
-
- public static void switchExcludeFromRecents(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_EXCLUDE_FROM_RECENTS, enable).apply();
- }
-
- public static boolean getExcludeFromRecents() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_EXCLUDE_FROM_RECENTS, false);
- }
-
- public static void switchPlaySilenceMusic(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PLAY_SILENCE_MUSIC, enable).apply();
- }
-
- public static boolean getPlaySilenceMusic() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PLAY_SILENCE_MUSIC, false);
- }
-
- public static void switchOnePixelActivity(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_ONE_PIXEL_ACTIVITY, enable).apply();
- }
-
- public static boolean getOnePixelActivity() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_ONE_PIXEL_ACTIVITY, false);
- }
-
- public static void switchSmsTemplate(Boolean switchSmsTemplate) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_SWITCH_SMS_TEMPLATE, switchSmsTemplate).apply();
- }
-
- public static boolean getSwitchSmsTemplate() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_SMS_TEMPLATE, false);
- }
-
- public static String getAddExtraDeviceMark() {
- String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, "");
- if (res == null || res.equals("")) {
- res = android.os.Build.MODEL;
- }
- return res;
- }
-
- public static void setAddExtraDeviceMark(String addExtraDeviceMark) {
- sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, addExtraDeviceMark).apply();
- }
-
- public static String getSmsTemplate() {
- return sp_setting.getString(Define.SP_MSG_KEY_STRING_SMS_TEMPLATE,
- getString(R.string.tag_from) + "\n" +
- getString(R.string.tag_sms) + "\n" +
- getString(R.string.tag_card_slot) + "\n" +
- getString(R.string.tag_receive_time) + "\n" +
- getString(R.string.tag_device_name));
- }
-
- public static void setSmsTemplate(String textSmsTemplate) {
- sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_SMS_TEMPLATE, textSmsTemplate).apply();
- }
-
- public static String getAddExtraSim1() {
- String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, "");
- if (res == null || res.equals("")) {
- res = SimUtil.getSimInfo(1);
- }
- return res;
- }
-
- public static void setAddExtraSim1(String sim1) {
- sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, sim1).apply();
- }
-
- public static String getAddExtraSim2() {
- String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, "");
- if (res == null || res.equals("")) {
- res = SimUtil.getSimInfo(2);
- }
- return res;
- }
-
- public static void setAddExtraSim2(String sim2) {
- sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, sim2).apply();
- }
-
- public static int getBatteryLevelAlarmMin() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, 0);
- }
-
- public static void setBatteryLevelAlarmMin(int battery_level) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, battery_level).apply();
- }
-
- public static int getBatteryLevelAlarmMax() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_MAX, 0);
- }
-
- public static void switchBatteryLevelAlarmOnce(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ONCE, enable).apply();
- }
-
- public static boolean getBatteryLevelAlarmOnce() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ONCE, false);
- }
-
- public static void setBatteryLevelAlarmMax(int battery_level) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_MAX, battery_level).apply();
- }
-
- public static int getBatteryLevelCurrent() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_CURRENT, 0);
- }
-
- public static void setBatteryLevelCurrent(int battery_level) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_CURRENT, battery_level).apply();
- }
-
- public static int getBatteryStatus() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_STATUS, 0);
- }
-
- public static void setBatteryStatus(int battery_status) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_STATUS, battery_status).apply();
- }
-
- public static boolean saveMsgHistory() {
- return !sp_setting.getBoolean("option_save_history_on", false);
- }
-
- public static String getPrevNoticeHash(String key) {
- return sp_setting.getString(key, "");
- }
-
- public static void setPrevNoticeHash(String key, String value) {
- sp_setting.edit().putString(key, value).apply();
- }
-
- public static void switchEnableHttpServer(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_HTTP_SERVER, enable).apply();
- }
-
- public static boolean getSwitchEnableHttpServer() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_HTTP_SERVER, false);
- }
-
- public static void switchCallType1(Boolean switchCallType) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_1, switchCallType).apply();
- }
-
- public static boolean getSwitchCallType1() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_1, false);
- }
-
- public static void switchCallType2(Boolean switchCallType) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_2, switchCallType).apply();
- }
-
- public static boolean getSwitchCallType2() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_2, false);
- }
-
- public static void switchCallType3(Boolean switchCallType) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_3, switchCallType).apply();
- }
-
- public static boolean getSwitchCallType3() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_3, true);
- }
-
- public static int getRetryTimes() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_RETRY_TIMES, 0);
- }
-
- public static void setRetryTimes(int retry_times) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_RETRY_TIMES, retry_times).apply();
- }
-
- public static int getDelayTime() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_DELAY_TIME, 1);
- }
-
- public static void setDelayTime(int delay_time) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_DELAY_TIME, delay_time).apply();
- }
-
- public static void switchEnableBatteryCron(Boolean enable) {
- sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_CRON, enable).apply();
- }
-
- public static boolean getSwitchEnableBatteryCron() {
- return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_CRON, false);
- }
-
- public static void setBatteryCronStartTime(String startTime) {
- sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_BATTERY_CRON_START_TIME, startTime).apply();
- }
-
- public static String getBatteryCronStartTime() {
- return sp_setting.getString(Define.SP_MSG_KEY_STRING_BATTERY_CRON_START_TIME, "00:00");
- }
-
- public static void setBatteryCronInterval(int interval) {
- sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_CRON_INTERVAL, interval).apply();
- }
-
- public static int getBatteryCronInterval() {
- return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_CRON_INTERVAL, 60);
- }
-
- //获取当前版本名称
- public static String getVersionName() {
- // 获取PackageManager的实例
- PackageManager packageManager = context.getPackageManager();
- // getPackageName()是你当前类的包名,0代表是获取版本信息
- PackageInfo packInfo;
- try {
- packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
- return packInfo.versionName;
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- return "";
- }
- }
-
- //获取应用的版本号
- public static int getVersionCode() {
- PackageManager manager = context.getPackageManager();
- int code = 0;
- try {
- PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
- code = info.versionCode;
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- return code;
- }
-
- private static String getString(int resId) {
- return MyApplication.getContext().getString(resId);
- }
-}
+package com.idormy.sms.forwarder.utils;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import com.idormy.sms.forwarder.MyApplication;
+import com.idormy.sms.forwarder.R;
+
+@SuppressWarnings({"SynchronizeOnNonFinalField", "unused"})
+public class SettingUtils {
+ static Boolean hasInit = false;
+ private static final String TAG = "SettingUtils";
+ private static SharedPreferences sp_setting = null;
+ @SuppressLint("StaticFieldLeak")
+ private static Context context = null;
+
+ public static void init(Context context1) {
+ synchronized (hasInit) {
+ if (hasInit) return;
+ hasInit = true;
+ context = context1;
+ Log.d(TAG, "SettingUtils init ");
+ sp_setting = PreferenceManager.getDefaultSharedPreferences(context1);
+ }
+ }
+
+ public static void switchAddExtra(Boolean switchAddExtra) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, switchAddExtra).apply();
+ }
+
+ public static boolean getSwitchAddExtra() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, false);
+ }
+
+ public static void switchAddDeviceName(Boolean switchAddDeviceName) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, switchAddDeviceName).apply();
+ }
+
+ public static boolean getSwitchAddDeviceName() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, false);
+ }
+
+ public static void switchEnableSms(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_SMS, enable).apply();
+ }
+
+ public static boolean getSwitchEnableSms() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_SMS, false);
+ }
+
+ public static void switchEnablePhone(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, enable).apply();
+ }
+
+ public static boolean getSwitchEnablePhone() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, false);
+ }
+
+ public static void switchEnableAppNotify(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_APP_NOTIFY, enable).apply();
+ }
+
+ public static boolean getSwitchEnableAppNotify() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_APP_NOTIFY, false);
+ }
+
+ public static void switchCancelAppNotify(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_CANCEL_APP_NOTIFY, enable).apply();
+ }
+
+ public static boolean getSwitchCancelAppNotify() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_CANCEL_APP_NOTIFY, false);
+ }
+
+ public static void switchNotUserPresent(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_NOT_USER_PRESENT, enable).apply();
+ }
+
+ public static boolean getSwitchNotUserPresent() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_NOT_USER_PRESENT, false);
+ }
+
+ public static void switchEnableBatteryReceiver(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_RECEIVER, enable).apply();
+ }
+
+ public static boolean getSwitchEnableBatteryReceiver() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_RECEIVER, false);
+ }
+
+ public static void switchExcludeFromRecents(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_EXCLUDE_FROM_RECENTS, enable).apply();
+ }
+
+ public static boolean getExcludeFromRecents() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_EXCLUDE_FROM_RECENTS, false);
+ }
+
+ public static void switchPlaySilenceMusic(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PLAY_SILENCE_MUSIC, enable).apply();
+ }
+
+ public static boolean getPlaySilenceMusic() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PLAY_SILENCE_MUSIC, false);
+ }
+
+ public static void switchOnePixelActivity(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_ONE_PIXEL_ACTIVITY, enable).apply();
+ }
+
+ public static boolean getOnePixelActivity() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_ONE_PIXEL_ACTIVITY, false);
+ }
+
+ public static void switchSmsTemplate(Boolean switchSmsTemplate) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_SWITCH_SMS_TEMPLATE, switchSmsTemplate).apply();
+ }
+
+ public static boolean getSwitchSmsTemplate() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_SMS_TEMPLATE, false);
+ }
+
+ public static String getAddExtraDeviceMark() {
+ String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, "");
+ if (res == null || res.equals("")) {
+ res = android.os.Build.MODEL;
+ }
+ return res;
+ }
+
+ public static void setAddExtraDeviceMark(String addExtraDeviceMark) {
+ sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, addExtraDeviceMark).apply();
+ }
+
+ public static String getSmsTemplate() {
+ return sp_setting.getString(Define.SP_MSG_KEY_STRING_SMS_TEMPLATE,
+ getString(R.string.tag_from) + "\n" +
+ getString(R.string.tag_sms) + "\n" +
+ getString(R.string.tag_card_slot) + "\n" +
+ getString(R.string.tag_receive_time) + "\n" +
+ getString(R.string.tag_device_name));
+ }
+
+ public static void setSmsTemplate(String textSmsTemplate) {
+ sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_SMS_TEMPLATE, textSmsTemplate).apply();
+ }
+
+ public static String getAddExtraSim1() {
+ String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, "");
+ if (res == null || res.equals("")) {
+ res = SimUtils.getSimInfo(1);
+ }
+ return res;
+ }
+
+ public static void setAddExtraSim1(String sim1) {
+ sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, sim1).apply();
+ }
+
+ public static String getAddExtraSim2() {
+ String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, "");
+ if (res == null || res.equals("")) {
+ res = SimUtils.getSimInfo(2);
+ }
+ return res;
+ }
+
+ public static void setAddExtraSim2(String sim2) {
+ sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, sim2).apply();
+ }
+
+ public static int getBatteryLevelAlarmMin() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, 0);
+ }
+
+ public static void setBatteryLevelAlarmMin(int battery_level) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, battery_level).apply();
+ }
+
+ public static int getBatteryLevelAlarmMax() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_MAX, 0);
+ }
+
+ public static void switchBatteryLevelAlarmOnce(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ONCE, enable).apply();
+ }
+
+ public static boolean getBatteryLevelAlarmOnce() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ONCE, false);
+ }
+
+ public static void setBatteryLevelAlarmMax(int battery_level) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_MAX, battery_level).apply();
+ }
+
+ public static int getBatteryLevelCurrent() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_CURRENT, 0);
+ }
+
+ public static void setBatteryLevelCurrent(int battery_level) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_CURRENT, battery_level).apply();
+ }
+
+ public static int getBatteryStatus() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_STATUS, 0);
+ }
+
+ public static void setBatteryStatus(int battery_status) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_STATUS, battery_status).apply();
+ }
+
+ public static boolean saveMsgHistory() {
+ return !sp_setting.getBoolean("option_save_history_on", false);
+ }
+
+ public static String getPrevNoticeHash(String key) {
+ return sp_setting.getString(key, "");
+ }
+
+ public static void setPrevNoticeHash(String key, String value) {
+ sp_setting.edit().putString(key, value).apply();
+ }
+
+ public static void switchEnableHttpServer(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_HTTP_SERVER, enable).apply();
+ }
+
+ public static boolean getSwitchEnableHttpServer() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_HTTP_SERVER, false);
+ }
+
+ public static void switchCallType1(Boolean switchCallType) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_1, switchCallType).apply();
+ }
+
+ public static boolean getSwitchCallType1() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_1, false);
+ }
+
+ public static void switchCallType2(Boolean switchCallType) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_2, switchCallType).apply();
+ }
+
+ public static boolean getSwitchCallType2() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_2, false);
+ }
+
+ public static void switchCallType3(Boolean switchCallType) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_3, switchCallType).apply();
+ }
+
+ public static boolean getSwitchCallType3() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_CALL_TYPE_3, true);
+ }
+
+ public static int getRetryTimes() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_RETRY_TIMES, 0);
+ }
+
+ public static void setRetryTimes(int retry_times) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_RETRY_TIMES, retry_times).apply();
+ }
+
+ public static int getDelayTime() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_DELAY_TIME, 1);
+ }
+
+ public static void setDelayTime(int delay_time) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_DELAY_TIME, delay_time).apply();
+ }
+
+ public static void switchEnableBatteryCron(Boolean enable) {
+ sp_setting.edit().putBoolean(Define.SP_MSG_KEY_STRING_BATTERY_CRON, enable).apply();
+ }
+
+ public static boolean getSwitchEnableBatteryCron() {
+ return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_BATTERY_CRON, false);
+ }
+
+ public static void setBatteryCronStartTime(String startTime) {
+ sp_setting.edit().putString(Define.SP_MSG_KEY_STRING_BATTERY_CRON_START_TIME, startTime).apply();
+ }
+
+ public static String getBatteryCronStartTime() {
+ return sp_setting.getString(Define.SP_MSG_KEY_STRING_BATTERY_CRON_START_TIME, "00:00");
+ }
+
+ public static void setBatteryCronInterval(int interval) {
+ sp_setting.edit().putInt(Define.SP_MSG_KEY_STRING_BATTERY_CRON_INTERVAL, interval).apply();
+ }
+
+ public static int getBatteryCronInterval() {
+ return sp_setting.getInt(Define.SP_MSG_KEY_STRING_BATTERY_CRON_INTERVAL, 60);
+ }
+
+ //获取当前版本名称
+ public static String getVersionName() {
+ // 获取PackageManager的实例
+ PackageManager packageManager = context.getPackageManager();
+ // getPackageName()是你当前类的包名,0代表是获取版本信息
+ PackageInfo packInfo;
+ try {
+ packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+ return packInfo.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+ //获取应用的版本号
+ public static int getVersionCode() {
+ PackageManager manager = context.getPackageManager();
+ int code = 0;
+ try {
+ PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
+ code = info.versionCode;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return code;
+ }
+
+ private static String getString(int resId) {
+ return MyApplication.getContext().getString(resId);
+ }
+}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/SimUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/SimUtils.java
similarity index 94%
rename from app/src/main/java/com/idormy/sms/forwarder/utils/SimUtil.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/SimUtils.java
index 877d4065..c2d1f7a2 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/utils/SimUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/SimUtils.java
@@ -1,91 +1,91 @@
-package com.idormy.sms.forwarder.utils;
-
-import android.os.Bundle;
-import android.util.Log;
-
-import com.idormy.sms.forwarder.MyApplication;
-
-
-@SuppressWarnings("unused")
-public class SimUtil {
- private static final String TAG = "SimUtil";
-
- //获取卡槽信息ID
- public static int getSimId(Bundle bundle) {
- int whichSIM = -1;
- if (bundle == null) {
- return whichSIM;
- }
-
- if (bundle.containsKey("simId")) {
- whichSIM = bundle.getInt("simId");
- Log.d(TAG, "simId = " + whichSIM);
- } else if (bundle.containsKey("com.android.phone.extra.slot")) {
- whichSIM = bundle.getInt("com.android.phone.extra.slot");
- Log.d(TAG, "com.android.phone.extra.slot = " + whichSIM);
- } else {
- String keyName = "";
- for (String key : bundle.keySet()) {
- if (key.contains("sim"))
- keyName = key;
- }
- if (bundle.containsKey(keyName)) {
- whichSIM = bundle.getInt(keyName);
- }
- }
-
- Log.d(TAG, "Slot Number " + whichSIM);
- return whichSIM + 1;
- }
-
- //通过SubscriptionId获取卡槽信息ID
- public static int getSimIdBySubscriptionId(int subscriptionId) {
- try {
- Log.d(TAG, MyApplication.SimInfoList.toString());
- for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
- Log.d(TAG, simInfo.toString());
- if (simInfo.mSubscriptionId == subscriptionId) {
- return simInfo.mSimSlotIndex + 1;
- }
- }
- } catch (Exception e) {
- Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
- }
-
- return 1;
- }
-
- //通过卡槽ID获取SubscriptionId
- public static int getSubscriptionIdBySimId(int simId) {
- try {
- for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
- Log.d(TAG, "mSimSlotIndex = " + simInfo.mSimSlotIndex);
- if (simInfo.mSimSlotIndex != -1 && simInfo.mSimSlotIndex == simId) {
- return simInfo.mSubscriptionId;
- }
- }
- } catch (Exception e) {
- Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
- }
-
- return 0;
- }
-
- //获取卡槽备注
- public static String getSimInfo(int simId) {
- String res = "";
- try {
- for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
- Log.d(TAG, String.valueOf(simInfo));
- if (simInfo.mSimSlotIndex != -1 && simInfo.mSimSlotIndex + 1 == simId) {
- res = simInfo.mCarrierName + "_" + simInfo.mNumber;
- break;
- }
- }
- } catch (Exception e) {
- Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
- }
-
- return res.replace("null", "unknown");
- }
-}
+package com.idormy.sms.forwarder.utils;
+
+import android.os.Bundle;
+import android.util.Log;
+
+import com.idormy.sms.forwarder.MyApplication;
+
+
+@SuppressWarnings("unused")
+public class SimUtils {
+ private static final String TAG = "SimUtils";
+
+ //获取卡槽信息ID
+ public static int getSimId(Bundle bundle) {
+ int whichSIM = -1;
+ if (bundle == null) {
+ return whichSIM;
+ }
+
+ if (bundle.containsKey("simId")) {
+ whichSIM = bundle.getInt("simId");
+ Log.d(TAG, "simId = " + whichSIM);
+ } else if (bundle.containsKey("com.android.phone.extra.slot")) {
+ whichSIM = bundle.getInt("com.android.phone.extra.slot");
+ Log.d(TAG, "com.android.phone.extra.slot = " + whichSIM);
+ } else {
+ String keyName = "";
+ for (String key : bundle.keySet()) {
+ if (key.contains("sim"))
+ keyName = key;
+ }
+ if (bundle.containsKey(keyName)) {
+ whichSIM = bundle.getInt(keyName);
+ }
+ }
+
+ Log.d(TAG, "Slot Number " + whichSIM);
+ return whichSIM + 1;
+ }
+
+ //通过SubscriptionId获取卡槽信息ID
+ public static int getSimIdBySubscriptionId(int subscriptionId) {
+ try {
+ Log.d(TAG, MyApplication.SimInfoList.toString());
+ for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
+ Log.d(TAG, simInfo.toString());
+ if (simInfo.mSubscriptionId == subscriptionId) {
+ return simInfo.mSimSlotIndex + 1;
+ }
+ }
+ } catch (Exception e) {
+ Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
+ }
+
+ return 1;
+ }
+
+ //通过卡槽ID获取SubscriptionId
+ public static int getSubscriptionIdBySimId(int simId) {
+ try {
+ for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
+ Log.d(TAG, "mSimSlotIndex = " + simInfo.mSimSlotIndex);
+ if (simInfo.mSimSlotIndex != -1 && simInfo.mSimSlotIndex == simId) {
+ return simInfo.mSubscriptionId;
+ }
+ }
+ } catch (Exception e) {
+ Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
+ }
+
+ return 0;
+ }
+
+ //获取卡槽备注
+ public static String getSimInfo(int simId) {
+ String res = "";
+ try {
+ for (PhoneUtils.SimInfo simInfo : MyApplication.SimInfoList) {
+ Log.d(TAG, String.valueOf(simInfo));
+ if (simInfo.mSimSlotIndex != -1 && simInfo.mSimSlotIndex + 1 == simId) {
+ res = simInfo.mCarrierName + "_" + simInfo.mNumber;
+ break;
+ }
+ }
+ } catch (Exception e) {
+ Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
+ }
+
+ return res.replace("null", "unknown");
+ }
+}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtils.java
similarity index 97%
rename from app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtils.java
index e33ac123..3cacee1e 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtils.java
@@ -14,8 +14,8 @@ import java.util.ArrayList;
import java.util.Objects;
@SuppressWarnings("SynchronizeOnNonFinalField")
-public class SmsUtil {
- static final String TAG = "SmsUtil";
+public class SmsUtils {
+ static final String TAG = "SmsUtils";
static Boolean hasInit = false;
@SuppressLint("StaticFieldLeak")
static Context context;
diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtils.java
similarity index 99%
rename from app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtil.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtils.java
index f531bde2..d0f01ac8 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/TimeUtils.java
@@ -8,7 +8,7 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-public class TimeUtil {
+public class TimeUtils {
//友好时间显示
public static String friendlyTime(String utcTime) {
diff --git a/app/src/main/java/com/idormy/sms/forwarder/UmInitConfig.java b/app/src/main/java/com/idormy/sms/forwarder/utils/UmInitConfig.java
similarity index 98%
rename from app/src/main/java/com/idormy/sms/forwarder/UmInitConfig.java
rename to app/src/main/java/com/idormy/sms/forwarder/utils/UmInitConfig.java
index 855b82bb..ad071e4c 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/UmInitConfig.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/utils/UmInitConfig.java
@@ -1,4 +1,4 @@
-package com.idormy.sms.forwarder;
+package com.idormy.sms.forwarder.utils;
import android.content.Context;
diff --git a/app/src/main/java/com/idormy/sms/forwarder/RefreshListView.java b/app/src/main/java/com/idormy/sms/forwarder/view/RefreshListView.java
similarity index 99%
rename from app/src/main/java/com/idormy/sms/forwarder/RefreshListView.java
rename to app/src/main/java/com/idormy/sms/forwarder/view/RefreshListView.java
index 74d37928..78573537 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/RefreshListView.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/view/RefreshListView.java
@@ -1,4 +1,4 @@
-package com.idormy.sms.forwarder;
+package com.idormy.sms.forwarder.view;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -15,6 +15,8 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.idormy.sms.forwarder.R;
+
import java.text.SimpleDateFormat;
import java.util.Locale;
diff --git a/app/src/main/java/com/idormy/sms/forwarder/view/StepBar.java b/app/src/main/java/com/idormy/sms/forwarder/view/StepBar.java
index c88a9718..45bce08f 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/view/StepBar.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/view/StepBar.java
@@ -18,9 +18,9 @@ import com.idormy.sms.forwarder.RuleActivity;
import com.idormy.sms.forwarder.SenderActivity;
import com.idormy.sms.forwarder.SettingActivity;
import com.idormy.sms.forwarder.sender.SenderUtil;
-import com.idormy.sms.forwarder.utils.LogUtil;
-import com.idormy.sms.forwarder.utils.RuleUtil;
-import com.idormy.sms.forwarder.utils.SettingUtil;
+import com.idormy.sms.forwarder.utils.LogUtils;
+import com.idormy.sms.forwarder.utils.RuleUtils;
+import com.idormy.sms.forwarder.utils.SettingUtils;
@SuppressWarnings("FieldCanBeLocal")
public class StepBar extends LinearLayout {
@@ -165,15 +165,15 @@ public class StepBar extends LinearLayout {
@SuppressLint("UseCompatLoadingForDrawables")
public void setHighlight() {
- SettingUtil.init(mContext);
+ SettingUtils.init(mContext);
SenderUtil.init(mContext);
- RuleUtil.init(mContext);
- LogUtil.init(mContext);
+ RuleUtils.init(mContext);
+ LogUtils.init(mContext);
- boolean Step1 = SettingUtil.getSwitchEnableSms() || SettingUtil.getSwitchEnablePhone() || SettingUtil.getSwitchEnableAppNotify();
+ boolean Step1 = SettingUtils.getSwitchEnableSms() || SettingUtils.getSwitchEnablePhone() || SettingUtils.getSwitchEnableAppNotify();
boolean Step2 = SenderUtil.countSender("1", null) > 0;
- boolean Step3 = RuleUtil.countRule("1", null, null) > 0;
- boolean Step4 = LogUtil.countLog("2", null, null) > 0;
+ boolean Step3 = RuleUtils.countRule("1", null, null) > 0;
+ boolean Step4 = LogUtils.countLog("2", null, null) > 0;
//页面提示文本
if (txHelpTip != null) {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 04728949..af9e41bb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -76,7 +76,7 @@
-