Some fixes

This commit is contained in:
stom79 2018-12-17 18:27:01 +01:00
parent ac4c759344
commit 2b6c0e210b
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.setSelection(set_profile_name.getText().length());
final String content;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(account.getNote(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(account.getNote()).toString();
String content = account.getNote();
if( content != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
content = Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
content = Html.fromHtml(content).toString();
}else
content = "";
set_profile_description.setText(content);
set_profile_save.setEnabled(true);

View File

@ -196,7 +196,8 @@ public class CrossActions {
} else if (doAction == API.StatusAction.PIN) {
status.setPinned(true);
}
baseAdapter.notifyDataSetChanged();
if( baseAdapter != null)
baseAdapter.notifyDataSetChanged();
}
}else{
new PostActionAsyncTask(context, selectedAccount, targetedAccount, doAction, onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -204,7 +205,8 @@ public class CrossActions {
if (doAction == API.StatusAction.FOLLOW) {
targetedAccount.setFollowing(true);
}
baseAdapter.notifyDataSetChanged();
if( baseAdapter != null)
baseAdapter.notifyDataSetChanged();
}
}
dialog.dismiss();

View File

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