Merge branch 'bug_fix' into develop

This commit is contained in:
stom79 2018-12-17 18:27:45 +01:00
commit c5cae50b00
3 changed files with 73 additions and 21 deletions

View File

@ -217,12 +217,15 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
set_profile_name.setText(account.getDisplay_name()); set_profile_name.setText(account.getDisplay_name());
set_profile_name.setSelection(set_profile_name.getText().length()); set_profile_name.setSelection(set_profile_name.getText().length());
final String content; String content = account.getNote();
if( content != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(account.getNote(), Html.FROM_HTML_MODE_LEGACY).toString(); content = Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY).toString();
else else
//noinspection deprecation //noinspection deprecation
content = Html.fromHtml(account.getNote()).toString(); content = Html.fromHtml(content).toString();
}else
content = "";
set_profile_description.setText(content); set_profile_description.setText(content);
set_profile_save.setEnabled(true); set_profile_save.setEnabled(true);

View File

@ -196,6 +196,7 @@ public class CrossActions {
} else if (doAction == API.StatusAction.PIN) { } else if (doAction == API.StatusAction.PIN) {
status.setPinned(true); status.setPinned(true);
} }
if( baseAdapter != null)
baseAdapter.notifyDataSetChanged(); baseAdapter.notifyDataSetChanged();
} }
}else{ }else{
@ -204,6 +205,7 @@ public class CrossActions {
if (doAction == API.StatusAction.FOLLOW) { if (doAction == API.StatusAction.FOLLOW) {
targetedAccount.setFollowing(true); targetedAccount.setFollowing(true);
} }
if( baseAdapter != null)
baseAdapter.notifyDataSetChanged(); baseAdapter.notifyDataSetChanged();
} }
} }

View File

@ -1937,7 +1937,11 @@ public class Helper {
*/ */
public static String localeToStringStorage(Locale locale){ public static String localeToStringStorage(Locale locale){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(locale); return gson.toJson(locale);
}catch (Exception e){
return null;
}
} }
/** /**
@ -1947,7 +1951,11 @@ public class Helper {
*/ */
public static String statusToStringStorage(Status status){ public static String statusToStringStorage(Status status){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(status); return gson.toJson(status);
}catch (Exception e){
return null;
}
} }
/** /**
@ -1971,7 +1979,11 @@ public class Helper {
*/ */
public static String cardToStringStorage(Card card){ public static String cardToStringStorage(Card card){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(card); return gson.toJson(card);
}catch (Exception e){
return null;
}
} }
/** /**
@ -1995,7 +2007,11 @@ public class Helper {
*/ */
public static String arrayToStringStorage(List<String> list){ public static String arrayToStringStorage(List<String> list){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(list); return gson.toJson(list);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2019,7 +2035,11 @@ public class Helper {
*/ */
public static String applicationToStringStorage(Application application){ public static String applicationToStringStorage(Application application){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(application); return gson.toJson(application);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2063,7 +2083,6 @@ public class Helper {
try { try {
return gson.fromJson(serializedAccount, Account.class); return gson.fromJson(serializedAccount, Account.class);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
return null; return null;
} }
} }
@ -2076,7 +2095,11 @@ public class Helper {
*/ */
public static String emojisToStringStorage(List<Emojis> emojis){ public static String emojisToStringStorage(List<Emojis> emojis){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(emojis); return gson.toJson(emojis);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2086,7 +2109,11 @@ public class Helper {
*/ */
public static List<Emojis> restoreEmojisFromString(String serializedEmojis){ public static List<Emojis> restoreEmojisFromString(String serializedEmojis){
Type listType = new TypeToken<ArrayList<Emojis>>(){}.getType(); Type listType = new TypeToken<ArrayList<Emojis>>(){}.getType();
try {
return new Gson().fromJson(serializedEmojis, listType); return new Gson().fromJson(serializedEmojis, listType);
}catch (Exception e){
return null;
}
} }
@ -2097,7 +2124,11 @@ public class Helper {
*/ */
public static String attachmentToStringStorage(List<Attachment> attachments){ public static String attachmentToStringStorage(List<Attachment> attachments){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(attachments); return gson.toJson(attachments);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2124,7 +2155,11 @@ public class Helper {
*/ */
public static String mentionToStringStorage(List<Mention> mentions){ public static String mentionToStringStorage(List<Mention> mentions){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(mentions); return gson.toJson(mentions);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2134,7 +2169,11 @@ public class Helper {
*/ */
public static List<Mention> restoreMentionFromString(String serializedMention){ public static List<Mention> restoreMentionFromString(String serializedMention){
Type listType = new TypeToken<ArrayList<Mention>>(){}.getType(); Type listType = new TypeToken<ArrayList<Mention>>(){}.getType();
try {
return new Gson().fromJson(serializedMention, listType); return new Gson().fromJson(serializedMention, listType);
}catch (Exception e){
return null;
}
} }
@ -2145,7 +2184,11 @@ public class Helper {
*/ */
public static String tagToStringStorage(List<Tag> tags){ public static String tagToStringStorage(List<Tag> tags){
Gson gson = new Gson(); Gson gson = new Gson();
try {
return gson.toJson(tags); return gson.toJson(tags);
}catch (Exception e){
return null;
}
} }
/** /**
@ -2155,7 +2198,11 @@ public class Helper {
*/ */
public static List<Tag> restoreTagFromString(String serializedTag){ public static List<Tag> restoreTagFromString(String serializedTag){
Type listType = new TypeToken<ArrayList<Tag>>(){}.getType(); Type listType = new TypeToken<ArrayList<Tag>>(){}.getType();
try {
return new Gson().fromJson(serializedTag, listType); return new Gson().fromJson(serializedTag, listType);
}catch (Exception e){
return null;
}
} }