some fixes
This commit is contained in:
parent
18e4250a66
commit
973ca53393
|
@ -311,7 +311,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
try {
|
||||
new RetrievePeertubeInformationAsyncTask(BaseMainActivity.this);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,26 +442,26 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
Helper.changeDrawableColor(BaseMainActivity.this, R.drawable.ic_home, R.attr.iconColorMenu);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconSub = pTabsub.getCustomView().findViewById(R.id.tab_icon);
|
||||
|
||||
iconSub.setImageResource(R.drawable.ic_subscriptions);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconOver = pTabOver.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconOver.setImageResource(R.drawable.ic_overview);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconTrend = pTabTrend.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconTrend.setImageResource(R.drawable.ic_trending_up);
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconAdded = pTabAdded.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconAdded.setImageResource(R.drawable.ic_recently_added);
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconLocal = pTabLocal.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconLocal.setImageResource(R.drawable.ic_home);
|
||||
|
||||
|
@ -542,18 +543,18 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
//pfTabDiscover.setCustomView(R.layout.tab_badge);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconHome = pfTabHome.getCustomView().findViewById(R.id.tab_icon);
|
||||
|
||||
iconHome.setImageResource(R.drawable.ic_home);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconLocal = pfTabLocal.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconLocal.setImageResource(R.drawable.ic_people);
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconNotif = pfTabNotification.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconNotif.setImageResource(R.drawable.ic_notifications);
|
||||
|
||||
|
@ -561,7 +562,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
ImageView iconDiscover = pfTabDiscover.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconDiscover.setImageResource(R.drawable.ic_people);*/
|
||||
|
||||
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
|
||||
@SuppressLint("CutPasteId")
|
||||
ImageView iconStories = pfStories.getCustomView().findViewById(R.id.tab_icon);
|
||||
iconStories.setImageResource(R.drawable.ic_story);
|
||||
|
||||
|
@ -1262,7 +1263,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
try {
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(dialogBuilderOptin::show, 1000);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1312,9 +1314,11 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
dialogBuilderOptin.show();
|
||||
}
|
||||
}, 1000);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_POPUP_RELEASE_NOTES, versionCode);
|
||||
|
@ -1705,7 +1709,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
new TimelineCacheDAO(contextReference.get(), db).removeAll();
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -159,7 +159,8 @@ public class InstanceProfileActivity extends BaseActivity {
|
|||
loader.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
|
|
@ -359,7 +359,8 @@ public class LoginActivity extends BaseActivity {
|
|||
login_instance.showDropDown();
|
||||
oldSearch = s.toString().trim();
|
||||
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -454,8 +455,10 @@ public class LoginActivity extends BaseActivity {
|
|||
try {
|
||||
URL url = new URL(instanceFromField);
|
||||
host = url.getHost();
|
||||
} catch (MalformedURLException ignored) {
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
instance = URLEncoder.encode(host, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
@ -571,7 +574,8 @@ public class LoginActivity extends BaseActivity {
|
|||
}
|
||||
try {
|
||||
instance = URLEncoder.encode(host, "utf-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String username = login_uid.getText().toString().trim().toLowerCase();
|
||||
String password = login_passwd.getText().toString();
|
||||
|
@ -744,18 +748,10 @@ public class LoginActivity extends BaseActivity {
|
|||
}
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||
intent.setType("*/*");
|
||||
String[] mimetypes = {"*/*"};
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||
startActivityForResult(intent, PICK_IMPORT);
|
||||
} else {
|
||||
intent.setType("*/*");
|
||||
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_import));
|
||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
|
||||
startActivityForResult(chooserIntent, PICK_IMPORT);
|
||||
}
|
||||
intent.setType("*/*");
|
||||
String[] mimetypes = {"*/*"};
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||
startActivityForResult(intent, PICK_IMPORT);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class RetrieveNotificationsAsyncTask {
|
|||
|
||||
protected void doInBackground() {
|
||||
new Thread(() -> {
|
||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
API api;
|
||||
if (account == null) {
|
||||
api = new API(this.contextReference.get());
|
||||
|
@ -73,7 +73,10 @@ public class RetrieveNotificationsAsyncTask {
|
|||
api = new API(this.contextReference.get(), account.getInstance(), account.getToken());
|
||||
apiResponse = api.getNotificationsSince(type, max_id, display);
|
||||
}
|
||||
} else {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> listener.onRetrieveNotifications(apiResponse, account, refreshData);
|
||||
mainHandler.post(myRunnable);
|
||||
} else if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
GNUAPI gnuapi;
|
||||
if (account == null) {
|
||||
gnuapi = new GNUAPI(this.contextReference.get());
|
||||
|
@ -86,10 +89,11 @@ public class RetrieveNotificationsAsyncTask {
|
|||
gnuapi = new GNUAPI(this.contextReference.get(), account.getInstance(), account.getToken());
|
||||
apiResponse = gnuapi.getNotificationsSince(type, max_id);
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> listener.onRetrieveNotifications(apiResponse, account, refreshData);
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> listener.onRetrieveNotifications(apiResponse, account, refreshData);
|
||||
mainHandler.post(myRunnable);
|
||||
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -807,7 +807,8 @@ public class API {
|
|||
if (resobj.has("pleroma") && resobj.getJSONObject("pleroma").has("emoji_reactions")) {
|
||||
try {
|
||||
reactions = parseReaction(resobj.getJSONObject("pleroma").getJSONArray("emoji_reactions"));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
status.setReactions(reactions);
|
||||
|
@ -881,7 +882,8 @@ public class API {
|
|||
Emojis emojis = parseEmojis(emojisObj);
|
||||
emojiList.add(emojis);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
status.setEmojis(emojiList);
|
||||
|
@ -938,7 +940,8 @@ public class API {
|
|||
if (recursive) {
|
||||
status.setReblog(parseStatuses(context, resobj.getJSONObject("reblog"), false));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (resobj.has("poll") && !resobj.isNull("poll")) {
|
||||
|
@ -976,7 +979,8 @@ public class API {
|
|||
status.setVisibility("public");
|
||||
}
|
||||
status.setContent(context, resobj.getString("text"));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
@ -1089,7 +1093,8 @@ public class API {
|
|||
resobj.getJSONObject("renoteId");
|
||||
if (!resobj.getJSONObject("renoteId").toString().equals("null"))
|
||||
status.setReblog(parseStatuses(context, resobj.getJSONObject("renote")));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
status.setMentions(mentions);
|
||||
|
@ -1131,7 +1136,8 @@ public class API {
|
|||
status.setApplication(application);
|
||||
|
||||
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1156,7 +1162,8 @@ public class API {
|
|||
} catch (Exception e) {
|
||||
emojis.setVisible_in_picker(true);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return emojis;
|
||||
}
|
||||
|
@ -1173,7 +1180,8 @@ public class API {
|
|||
emojis.setShortcode(resobj.getString("name"));
|
||||
emojis.setStatic_url(resobj.getString("url"));
|
||||
emojis.setUrl(resobj.getString("url"));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return emojis;
|
||||
}
|
||||
|
@ -1189,7 +1197,8 @@ public class API {
|
|||
try {
|
||||
list.setId(resobj.getString("id"));
|
||||
list.setTitle(resobj.getString("title"));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -1234,7 +1243,8 @@ public class API {
|
|||
} else
|
||||
account.setAvatar(null);
|
||||
account.setAvatar_static(resobj.getString("avatar"));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1429,7 +1439,8 @@ public class API {
|
|||
account.setAcct(resobj.getString("value"));
|
||||
account.setUrl(resobj.getString("url"));
|
||||
account.setStatuses_count(resobj.getJSONObject("entity").getInt("post_count"));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
@ -1480,12 +1491,13 @@ public class API {
|
|||
} catch (Exception e) {
|
||||
account.setBot(false);
|
||||
}
|
||||
account.setMoved_to_account(null);
|
||||
try {
|
||||
if (recursive) {
|
||||
if (recursive && resobj.has("moved")) {
|
||||
account.setMoved_to_account(parseAccountResponse(resobj.getJSONObject("moved"), false));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
account.setMoved_to_account(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
account.setUrl(resobj.getString("url"));
|
||||
account.setAvatar(resobj.getString("avatar"));
|
||||
|
@ -1503,7 +1515,8 @@ public class API {
|
|||
try {
|
||||
account.setModerator(resobj.getJSONObject("pleroma").getBoolean("is_moderator"));
|
||||
account.setAdmin(resobj.getJSONObject("pleroma").getBoolean("is_admin"));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
account.setModerator(false);
|
||||
account.setAdmin(false);
|
||||
}
|
||||
|
@ -1645,7 +1658,8 @@ public class API {
|
|||
attachments.add(attachment);
|
||||
i++;
|
||||
}
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return attachments;
|
||||
}
|
||||
|
@ -1730,7 +1744,8 @@ public class API {
|
|||
if (attachment.getOrientation() != null && attachment.getOrientation().toLowerCase().compareTo("null") == 0) {
|
||||
attachment.setOrientation(null);
|
||||
}
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return attachment;
|
||||
}
|
||||
|
@ -1753,12 +1768,12 @@ public class API {
|
|||
if (resobj.has("status")) {
|
||||
try {
|
||||
notification.setStatus(parseStatuses(context, resobj.getJSONObject("status"), false));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
notification.setCreated_at(Helper.mstStringToDate(resobj.getString("created_at")));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (ParseException e) {
|
||||
} catch (JSONException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return notification;
|
||||
|
@ -1995,7 +2010,8 @@ public class API {
|
|||
} else {
|
||||
try {
|
||||
id = URLEncoder.encode(id, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
params = new HashMap<>();
|
||||
params.put("query", id);
|
||||
|
@ -3899,7 +3915,8 @@ public class API {
|
|||
newStatus.setArt_attachment(attachment);
|
||||
apiResponseReply.getStatuses().add(newStatus);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3978,7 +3995,8 @@ public class API {
|
|||
for (String a : any) {
|
||||
try {
|
||||
a = URLEncoder.encode(a, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
parameters.append("any[]=").append(a).append("&");
|
||||
}
|
||||
|
@ -3990,7 +4008,8 @@ public class API {
|
|||
for (String a : all) {
|
||||
try {
|
||||
a = URLEncoder.encode(a, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
parameters.append("all[]=").append(a).append("&");
|
||||
}
|
||||
|
@ -4002,7 +4021,8 @@ public class API {
|
|||
for (String a : none) {
|
||||
try {
|
||||
a = URLEncoder.encode(a, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
parameters.append("none[]=").append(a).append("&");
|
||||
}
|
||||
|
@ -4019,7 +4039,8 @@ public class API {
|
|||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||
try {
|
||||
query = URLEncoder.encode(query, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String response;
|
||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||
|
@ -4668,7 +4689,8 @@ public class API {
|
|||
try {
|
||||
Status status1 = parseStatuses(context, new JSONObject(resp));
|
||||
b.putParcelable("status", status1);
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||
intentBC.putExtras(b);
|
||||
|
@ -5830,7 +5852,8 @@ public class API {
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
try {
|
||||
list.add(jsonArray.getJSONObject(i).getString("acct"));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
|
@ -5880,7 +5903,8 @@ public class API {
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
try {
|
||||
list_tmp.add(jsonArray.getString(i));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return list_tmp;
|
||||
|
@ -5906,7 +5930,8 @@ public class API {
|
|||
} else {
|
||||
list_tmp.add(jsonArray.getString(i));
|
||||
}
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return list_tmp;
|
||||
|
@ -6014,7 +6039,8 @@ public class API {
|
|||
}
|
||||
}
|
||||
trend.setTrendsHistory(historyList);
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return trend;
|
||||
}
|
||||
|
@ -6057,7 +6083,8 @@ public class API {
|
|||
conversation.setUnread(resobj.getBoolean("unread"));
|
||||
conversation.setAccounts(parseAccountResponse(resobj.getJSONArray("accounts")));
|
||||
conversation.setLast_status(parseStatuses(context, resobj.getJSONObject("last_status")));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return conversation;
|
||||
}
|
||||
|
@ -6271,7 +6298,8 @@ public class API {
|
|||
filter.setContext(finalContext);
|
||||
}
|
||||
return filter;
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,8 @@ public class PeertubeAPI {
|
|||
peertubeAccounFollowingNotification.setName(following.get("name").toString());
|
||||
try {
|
||||
peertubeAccounFollowingNotification.setId(following.get("id").toString());
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (following.has("avatar")) {
|
||||
peertubeAccounFollowingNotification.setAvatar(following.getJSONObject("avatar").get("path").toString());
|
||||
|
@ -251,16 +252,20 @@ public class PeertubeAPI {
|
|||
peertube.setAccount(parseAccountResponsePeertube(resobj.getJSONObject("account")));
|
||||
try {
|
||||
peertube.setChannel(parseAccountResponsePeertube(resobj.getJSONObject("channel")));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
peertube.setView(Integer.parseInt(resobj.get("views").toString()));
|
||||
peertube.setLike(Integer.parseInt(resobj.get("likes").toString()));
|
||||
peertube.setDislike(Integer.parseInt(resobj.get("dislikes").toString()));
|
||||
peertube.setDuration(Integer.parseInt(resobj.get("duration").toString()));
|
||||
peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString()));
|
||||
try {
|
||||
peertube.setCommentsEnabled(Boolean.parseBoolean(resobj.get("commentsEnabled").toString()));
|
||||
} catch (Exception ignored) {
|
||||
if (resobj.has("commentsEnabled")) {
|
||||
try {
|
||||
peertube.setCommentsEnabled(Boolean.parseBoolean(resobj.get("commentsEnabled").toString()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -274,16 +279,25 @@ public class PeertubeAPI {
|
|||
LinkedHashMap<Integer, String> category = new LinkedHashMap<>();
|
||||
LinkedHashMap<Integer, String> license = new LinkedHashMap<>();
|
||||
LinkedHashMap<Integer, String> privacy = new LinkedHashMap<>();
|
||||
category.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").get("label").toString());
|
||||
license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").get("label").toString());
|
||||
privacy.put(resobj.getJSONObject("privacy").getInt("id"), resobj.getJSONObject("privacy").get("label").toString());
|
||||
langue.put(resobj.getJSONObject("language").get("id").toString(), resobj.getJSONObject("language").get("label").toString());
|
||||
if (!resobj.getJSONObject("category").isNull("id") && !resobj.getJSONObject("category").isNull("label")) {
|
||||
category.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").get("label").toString());
|
||||
}
|
||||
if (!resobj.getJSONObject("licence").isNull("id") && !resobj.getJSONObject("licence").isNull("label")) {
|
||||
license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").get("label").toString());
|
||||
}
|
||||
if (!resobj.getJSONObject("privacy").isNull("id") && !resobj.getJSONObject("privacy").isNull("label")) {
|
||||
privacy.put(resobj.getJSONObject("privacy").getInt("id"), resobj.getJSONObject("privacy").get("label").toString());
|
||||
}
|
||||
if (!resobj.getJSONObject("privacy").isNull("id") && !resobj.getJSONObject("privacy").isNull("label")) {
|
||||
langue.put(resobj.getJSONObject("privacy").get("id").toString(), resobj.getJSONObject("privacy").get("label").toString());
|
||||
}
|
||||
|
||||
peertube.setCategory(category);
|
||||
peertube.setLicense(license);
|
||||
peertube.setLanguage(langue);
|
||||
peertube.setPrivacy(privacy);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -325,11 +339,13 @@ public class PeertubeAPI {
|
|||
tags.add(value);
|
||||
}
|
||||
peertube.setTags(tags);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
peertube.setChannel(parseAccountResponsePeertube(resobj.getJSONObject("channel")));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
peertube.setSensitive(Boolean.parseBoolean(resobj.get("nsfw").toString()));
|
||||
try {
|
||||
|
@ -376,7 +392,8 @@ public class PeertubeAPI {
|
|||
peertube.setLicense(license);
|
||||
peertube.setLanguage(langue);
|
||||
peertube.setPrivacy(privacy);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
peertube.setResolution(resolutions);
|
||||
} catch (JSONException e) {
|
||||
|
@ -413,13 +430,16 @@ public class PeertubeAPI {
|
|||
type.put(resobj.getJSONObject("type").getInt("id"), resobj.getJSONObject("type").get("label").toString());
|
||||
playlist.setType(type);
|
||||
playlist.setPrivacy(privacy);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
playlist.setUpdatedAt(Helper.stringToDate(context, resobj.getString("updatedAt")));
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return playlist;
|
||||
}
|
||||
|
@ -583,7 +603,8 @@ public class PeertubeAPI {
|
|||
String key = iter.next();
|
||||
try {
|
||||
_languages.put(key, (String) languages.get(key));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
peertubeInformation.setLanguages(_languages);
|
||||
|
@ -631,7 +652,8 @@ public class PeertubeAPI {
|
|||
String key = itertrans.next();
|
||||
try {
|
||||
_translations.put(key, (String) translations.get(key));
|
||||
} catch (JSONException ignored) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
peertubeInformation.setTranslations(_translations);
|
||||
|
|
|
@ -32,7 +32,6 @@ import app.fedilab.android.helper.Helper;
|
|||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class PixelfedAPI {
|
||||
|
||||
|
||||
|
@ -42,7 +41,6 @@ public class PixelfedAPI {
|
|||
private String prefKeyOauthTokenT;
|
||||
private APIResponse apiResponse;
|
||||
private Error APIError;
|
||||
private int actionCode;
|
||||
|
||||
public PixelfedAPI(Context context) {
|
||||
this.context = context;
|
||||
|
@ -114,8 +112,8 @@ public class PixelfedAPI {
|
|||
pixelFedStory.setSeen(false);
|
||||
}
|
||||
pixelFedStory.setPixelFedStoryItems(parseStoryItems(jsonObject.getJSONArray("items")));
|
||||
} catch (JSONException ignored) {
|
||||
ignored.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return pixelFedStory;
|
||||
}
|
||||
|
@ -163,13 +161,13 @@ public class PixelfedAPI {
|
|||
pixelFedStoryItem.setTime(new Date(jsonObject.getLong("time")));
|
||||
pixelFedStoryItem.setExpires_at(new Date(jsonObject.getLong("expires_at")));
|
||||
pixelFedStoryItem.setSeen(jsonObject.getBoolean("seen"));
|
||||
} catch (JSONException ignored) {
|
||||
ignored.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return pixelFedStoryItem;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Retrieves Pixelfed Own Stories *synchronously*
|
||||
*
|
||||
* @return APIResponse
|
||||
|
@ -340,8 +338,8 @@ public class PixelfedAPI {
|
|||
String errorM = jsonObject.get("error").toString();
|
||||
message = "Error " + statusCode + " : " + errorM;
|
||||
} catch (JSONException e) {
|
||||
if (error.getMessage().split(".").length > 0) {
|
||||
String errorM = error.getMessage().split(".")[0];
|
||||
if (error.getMessage().split("\\.").length > 0) {
|
||||
String errorM = error.getMessage().split("\\.")[0];
|
||||
message = "Error " + statusCode + " : " + errorM;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue