Showing
2 changed files
with
26 additions
and
5 deletions
| ... | ... | @@ -31,7 +31,6 @@ import android.database.Cursor; |
| 31 | 31 | import android.database.sqlite.SQLiteDatabase; |
| 32 | 32 | import android.text.TextUtils; |
| 33 | 33 | import android.util.Log; |
| 34 | - | |
| 35 | 34 | import com.amitshekhar.model.Response; |
| 36 | 35 | import com.amitshekhar.utils.Constants; |
| 37 | 36 | import com.amitshekhar.utils.PrefUtils; |
| ... | ... | @@ -52,7 +51,6 @@ import java.io.UnsupportedEncodingException; |
| 52 | 51 | import java.net.InetSocketAddress; |
| 53 | 52 | import java.net.ServerSocket; |
| 54 | 53 | import java.net.Socket; |
| 55 | -import java.net.SocketException; | |
| 56 | 54 | import java.net.URLDecoder; |
| 57 | 55 | import java.util.ArrayList; |
| 58 | 56 | import java.util.List; |
| ... | ... | @@ -533,6 +531,15 @@ public class ClientServer implements Runnable { |
| 533 | 531 | } else if (Constants.APP_SHARED_TEST_OFFLINE.equals(cmd)) { |
| 534 | 532 | saveTest(true); |
| 535 | 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 | 543 | } else if (Constants.APP_START_ADB.equals(cmd)) { |
| 537 | 544 | ShellUtils.execCommand(new String[]{"su", "start adbd"}, false); |
| 538 | 545 | data = "open adb success,please connect by pc"; |
| ... | ... | @@ -581,12 +588,16 @@ public class ClientServer implements Runnable { |
| 581 | 588 | } |
| 582 | 589 | |
| 583 | 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 | 601 | SharedPreferences.Editor edit = sharedPreferences.edit(); |
| 591 | 602 | edit.putBoolean(key, bool); |
| 592 | 603 | edit.apply(); |
| ... | ... | @@ -599,6 +610,13 @@ public class ClientServer implements Runnable { |
| 599 | 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 | 36 | public static final String APP_SHARED_SHOW_LOGCAT = "show_logcat"; |
| 37 | 37 | public static final String APP_SHARED_TEST_ONLINE = "test_online"; |
| 38 | 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 | 42 | public static final String APP_SHARED_SET_STRING = "wugian_set_string"; |
| 40 | 43 | public static final String APP_START_ADB = "wugian_open_adb"; |
| 41 | 44 | } | ... | ... |
Please
register
or
login
to post a comment