Showing
2 changed files
with
26 additions
and
5 deletions
| @@ -31,7 +31,6 @@ import android.database.Cursor; | @@ -31,7 +31,6 @@ import android.database.Cursor; | ||
| 31 | import android.database.sqlite.SQLiteDatabase; | 31 | import android.database.sqlite.SQLiteDatabase; |
| 32 | import android.text.TextUtils; | 32 | import android.text.TextUtils; |
| 33 | import android.util.Log; | 33 | import android.util.Log; |
| 34 | - | ||
| 35 | import com.amitshekhar.model.Response; | 34 | import com.amitshekhar.model.Response; |
| 36 | import com.amitshekhar.utils.Constants; | 35 | import com.amitshekhar.utils.Constants; |
| 37 | import com.amitshekhar.utils.PrefUtils; | 36 | import com.amitshekhar.utils.PrefUtils; |
| @@ -52,7 +51,6 @@ import java.io.UnsupportedEncodingException; | @@ -52,7 +51,6 @@ import java.io.UnsupportedEncodingException; | ||
| 52 | import java.net.InetSocketAddress; | 51 | import java.net.InetSocketAddress; |
| 53 | import java.net.ServerSocket; | 52 | import java.net.ServerSocket; |
| 54 | import java.net.Socket; | 53 | import java.net.Socket; |
| 55 | -import java.net.SocketException; | ||
| 56 | import java.net.URLDecoder; | 54 | import java.net.URLDecoder; |
| 57 | import java.util.ArrayList; | 55 | import java.util.ArrayList; |
| 58 | import java.util.List; | 56 | import java.util.List; |
| @@ -533,6 +531,15 @@ public class ClientServer implements Runnable { | @@ -533,6 +531,15 @@ public class ClientServer implements Runnable { | ||
| 533 | } else if (Constants.APP_SHARED_TEST_OFFLINE.equals(cmd)) { | 531 | } else if (Constants.APP_SHARED_TEST_OFFLINE.equals(cmd)) { |
| 534 | saveTest(true); | 532 | saveTest(true); |
| 535 | data = "set test off line please reboot"; | 533 | data = "set test off line please reboot"; |
| 534 | + } else if (Constants.APP_SHARED_FT_ONLINE.equals(cmd)) { | ||
| 535 | + saveFt(0);//test_ft_xs | ||
| 536 | + data = "已设置为方糖线上,请重启后尝试"; | ||
| 537 | + } else if (Constants.APP_SHARED_FT_DEVELOP.equals(cmd)) { | ||
| 538 | + saveFt(1);//test_ft_kf | ||
| 539 | + data = "已设置为方糖开发,请重启后尝试"; | ||
| 540 | + } else if (Constants.APP_SHARED_FT_TEST.equals(cmd)) { | ||
| 541 | + saveFt(2);//test_ft_cs | ||
| 542 | + data = "已设置为方糖测试,请重启后尝试"; | ||
| 536 | } else if (Constants.APP_START_ADB.equals(cmd)) { | 543 | } else if (Constants.APP_START_ADB.equals(cmd)) { |
| 537 | ShellUtils.execCommand(new String[]{"su", "start adbd"}, false); | 544 | ShellUtils.execCommand(new String[]{"su", "start adbd"}, false); |
| 538 | data = "open adb success,please connect by pc"; | 545 | data = "open adb success,please connect by pc"; |
| @@ -581,12 +588,16 @@ public class ClientServer implements Runnable { | @@ -581,12 +588,16 @@ public class ClientServer implements Runnable { | ||
| 581 | } | 588 | } |
| 582 | 589 | ||
| 583 | private void saveTest(boolean bool) { | 590 | private void saveTest(boolean bool) { |
| 584 | - saveBoolean("test", bool); | 591 | + saveBoolean("gimi-cinema-pref", "test", bool); |
| 592 | + } | ||
| 593 | + | ||
| 594 | + private void saveFt(int value) { | ||
| 595 | + saveInt("gimi-cinema-pref", "ft-test", value); | ||
| 585 | } | 596 | } |
| 586 | 597 | ||
| 587 | 598 | ||
| 588 | - private void saveBoolean(String key, boolean bool) { | ||
| 589 | - SharedPreferences sharedPreferences = mContext.getSharedPreferences("gimi-cinema-pref", Context.MODE_PRIVATE); | 599 | + private void saveBoolean(String shareName, String key, boolean bool) { |
| 600 | + SharedPreferences sharedPreferences = mContext.getSharedPreferences(shareName, Context.MODE_PRIVATE); | ||
| 590 | SharedPreferences.Editor edit = sharedPreferences.edit(); | 601 | SharedPreferences.Editor edit = sharedPreferences.edit(); |
| 591 | edit.putBoolean(key, bool); | 602 | edit.putBoolean(key, bool); |
| 592 | edit.apply(); | 603 | edit.apply(); |
| @@ -599,6 +610,13 @@ public class ClientServer implements Runnable { | @@ -599,6 +610,13 @@ public class ClientServer implements Runnable { | ||
| 599 | edit.apply(); | 610 | edit.apply(); |
| 600 | } | 611 | } |
| 601 | 612 | ||
| 613 | + private void saveInt(String shareName, String key, int bool) { | ||
| 614 | + SharedPreferences sharedPreferences = mContext.getSharedPreferences(shareName, Context.MODE_PRIVATE); | ||
| 615 | + SharedPreferences.Editor edit = sharedPreferences.edit(); | ||
| 616 | + edit.putInt(key, bool); | ||
| 617 | + edit.apply(); | ||
| 618 | + } | ||
| 619 | + | ||
| 602 | /** | 620 | /** |
| 603 | * 以行为单位读取文件,常用于读面向行的格式化文件 | 621 | * 以行为单位读取文件,常用于读面向行的格式化文件 |
| 604 | */ | 622 | */ |
| @@ -36,6 +36,9 @@ public final class Constants { | @@ -36,6 +36,9 @@ public final class Constants { | ||
| 36 | public static final String APP_SHARED_SHOW_LOGCAT = "show_logcat"; | 36 | public static final String APP_SHARED_SHOW_LOGCAT = "show_logcat"; |
| 37 | public static final String APP_SHARED_TEST_ONLINE = "test_online"; | 37 | public static final String APP_SHARED_TEST_ONLINE = "test_online"; |
| 38 | public static final String APP_SHARED_TEST_OFFLINE = "test_offline"; | 38 | public static final String APP_SHARED_TEST_OFFLINE = "test_offline"; |
| 39 | + public static final String APP_SHARED_FT_ONLINE = "test_ft_xs"; | ||
| 40 | + public static final String APP_SHARED_FT_DEVELOP = "test_ft_kf"; | ||
| 41 | + public static final String APP_SHARED_FT_TEST = "test_ft_cs"; | ||
| 39 | public static final String APP_SHARED_SET_STRING = "wugian_set_string"; | 42 | public static final String APP_SHARED_SET_STRING = "wugian_set_string"; |
| 40 | public static final String APP_START_ADB = "wugian_open_adb"; | 43 | public static final String APP_START_ADB = "wugian_open_adb"; |
| 41 | } | 44 | } |
Please
register
or
login
to post a comment