Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
FongMi committed Oct 27, 2023
1 parent 42bd2d3 commit a7d0fd0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void start(Activity activity, String key, Result result) {
Intent intent = new Intent(activity, VodActivity.class);
intent.putExtra("key", key);
intent.putExtra("result", result);
for (Map.Entry<String, List<Filter>> entry : result.getFilters().entrySet()) Prefers.put(entry.getKey(), App.gson().toJson(entry.getValue()));
for (Map.Entry<String, List<Filter>> entry : result.getFilters().entrySet()) Prefers.put("filter_" + entry.getKey(), App.gson().toJson(entry.getValue()));
activity.startActivity(intent);
}

Expand All @@ -66,7 +66,7 @@ private Result getResult() {
}

private List<Filter> getFilter(String typeId) {
return Filter.arrayFrom(Prefers.getString(typeId));
return Filter.arrayFrom(Prefers.getString("filter_" + typeId));
}

private Site getSite() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private String getTypeId() {
}

private List<Filter> getFilter() {
return Filter.arrayFrom(Prefers.getString(getTypeId()));
return Filter.arrayFrom(Prefers.getString("filter_" + getTypeId()));
}

private HashMap<String, String> getExtend() {
Expand Down
16 changes: 8 additions & 8 deletions catvod/src/main/java/com/github/catvod/utils/Prefers.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ private static SharedPreferences getPrefers() {
return PreferenceManager.getDefaultSharedPreferences(Init.context());
}

public static String getString(String key) {
return getString(key, "");
}

public static String getString(String key, String defaultValue) {
return getPrefers().getString(key, defaultValue);
}

public static String getString(String key) {
return getString(key, "");
public static int getInt(String key) {
return getInt(key, 0);
}

public static int getInt(String key, int defaultValue) {
return getPrefers().getInt(key, defaultValue);
}

public static int getInt(String key) {
return getInt(key, 0);
public static boolean getBoolean(String key) {
return getBoolean(key, false);
}

public static boolean getBoolean(String key, boolean defaultValue) {
return getPrefers().getBoolean(key, defaultValue);
}

public static boolean getBoolean(String key) {
return getPrefers().getBoolean(key, false);
}

public static void put(String key, Object obj) {
if (obj == null) return;
if (obj instanceof String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void release() {
}

private String getPeerId() {
String uuid = Prefers.getString("phoneId5", "");
String uuid = Prefers.getString("phoneId5");
if (uuid.isEmpty()) Prefers.put("phoneId5", uuid = XLUtil.getPeerId());
return uuid;
}
Expand Down

0 comments on commit a7d0fd0

Please sign in to comment.