Some fixes
This commit is contained in:
parent
365179def8
commit
72fd064f8a
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize"
|
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
for (Status status : statusList) {
|
for (Status status : statusList) {
|
||||||
if (status.media_attachments != null && status.media_attachments.size() > 0) {
|
if (status.media_attachments != null && status.media_attachments.size() > 0) {
|
||||||
for (Attachment attachment : status.media_attachments) {
|
for (Attachment attachment : status.media_attachments) {
|
||||||
if (attachment.local_path.equalsIgnoreCase(imgpath)) {
|
if (attachment.local_path != null && attachment.local_path.equalsIgnoreCase(imgpath)) {
|
||||||
if (focusX != -2) {
|
if (focusX != -2) {
|
||||||
attachment.focus = focusX + "," + focusY;
|
attachment.focus = focusX + "," + focusY;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
visibility = b.getString(Helper.ARG_VISIBILITY, null);
|
visibility = b.getString(Helper.ARG_VISIBILITY, null);
|
||||||
if (visibility == null && statusReply != null) {
|
if (visibility == null && statusReply != null) {
|
||||||
visibility = getVisibility(statusReply.visibility);
|
visibility = getVisibility(statusReply.visibility);
|
||||||
} else if (visibility == null && currentAccount != null && currentAccount.mastodon_account.source != null) {
|
} else if (visibility == null && currentAccount != null && currentAccount.mastodon_account != null && currentAccount.mastodon_account.source != null) {
|
||||||
visibility = currentAccount.mastodon_account.source.privacy;
|
visibility = currentAccount.mastodon_account.source.privacy;
|
||||||
}
|
}
|
||||||
mentionBooster = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
mentionBooster = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
||||||
|
@ -615,7 +615,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
//We change order for mentions
|
//We change order for mentions
|
||||||
//At first place the account that has been mentioned if it's not our
|
//At first place the account that has been mentioned if it's not our
|
||||||
statusDraftList.get(0).mentions = new ArrayList<>();
|
statusDraftList.get(0).mentions = new ArrayList<>();
|
||||||
if (statusReply.account.acct != null && !statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
|
if (statusReply.account.acct != null && currentAccount.mastodon_account != null && !statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
|
||||||
Mention mention = new Mention();
|
Mention mention = new Mention();
|
||||||
mention.acct = "@" + statusReply.account.acct;
|
mention.acct = "@" + statusReply.account.acct;
|
||||||
mention.url = statusReply.account.url;
|
mention.url = statusReply.account.url;
|
||||||
|
@ -626,7 +626,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
//There are other mentions to
|
//There are other mentions to
|
||||||
if (statusReply.mentions != null && statusReply.mentions.size() > 0) {
|
if (statusReply.mentions != null && statusReply.mentions.size() > 0) {
|
||||||
for (Mention mentionTmp : statusReply.mentions) {
|
for (Mention mentionTmp : statusReply.mentions) {
|
||||||
if (statusReply.account.acct != null && !mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
|
if (statusReply.account.acct != null && !mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && currentAccount.mastodon_account != null && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
|
||||||
statusDraftList.get(0).mentions.add(mentionTmp);
|
statusDraftList.get(0).mentions.add(mentionTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ public class MastodonListActivity extends BaseActivity implements MastodonListAd
|
||||||
if (mastodonListList == null) {
|
if (mastodonListList == null) {
|
||||||
mastodonListList = new ArrayList<>();
|
mastodonListList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
if (newMastodonList != null) {
|
if (newMastodonList != null && mastodonListAdapter != null) {
|
||||||
mastodonListList.add(0, newMastodonList);
|
mastodonListList.add(0, newMastodonList);
|
||||||
mastodonListAdapter.notifyItemInserted(0);
|
mastodonListAdapter.notifyItemInserted(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -663,7 +663,10 @@ public class ProfileActivity extends BaseActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
String[] splitAcct = account.acct.split("@");
|
String[] splitAcct = null;
|
||||||
|
if (account.acct != null) {
|
||||||
|
splitAcct = account.acct.split("@");
|
||||||
|
}
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ProfileActivity.this);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ProfileActivity.this);
|
||||||
AlertDialog.Builder builderInner = null;
|
AlertDialog.Builder builderInner = null;
|
||||||
final boolean isOwner = account.id != null && BaseMainActivity.currentUserID != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0;
|
final boolean isOwner = account.id != null && BaseMainActivity.currentUserID != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0;
|
||||||
|
@ -677,7 +680,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
if (itemId == android.R.id.home) {
|
if (itemId == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_follow_instance) {
|
} else if (itemId == R.id.action_follow_instance && splitAcct != null) {
|
||||||
String finalInstanceName = splitAcct[1];
|
String finalInstanceName = splitAcct[1];
|
||||||
ReorderVM reorderVM = new ViewModelProvider(ProfileActivity.this).get(ReorderVM.class);
|
ReorderVM reorderVM = new ViewModelProvider(ProfileActivity.this).get(ReorderVM.class);
|
||||||
//Get pinned instances
|
//Get pinned instances
|
||||||
|
|
|
@ -59,7 +59,12 @@ public class DomainsBlock {
|
||||||
List<String> domains = new ArrayList<>();
|
List<String> domains = new ArrayList<>();
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
if (line.startsWith("0.0.0.0 ")) {
|
if (line.startsWith("0.0.0.0 ")) {
|
||||||
domains.add(line.replace("0.0.0.0 ", "").trim());
|
try {
|
||||||
|
domains.add(line.replace("0.0.0.0 ", "").trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
|
|
|
@ -95,7 +95,9 @@ public class CustomEmoji extends ReplacementSpan {
|
||||||
((Animatable) resource).start();
|
((Animatable) resource).start();
|
||||||
}
|
}
|
||||||
imageDrawable = resource;
|
imageDrawable = resource;
|
||||||
view.invalidate();
|
if (view != null) {
|
||||||
|
view.invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -990,8 +990,12 @@ public class Helper {
|
||||||
*/
|
*/
|
||||||
public static String getFileName(Context context, Uri uri) {
|
public static String getFileName(Context context, Uri uri) {
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
Cursor returnCursor =
|
Cursor returnCursor = null;
|
||||||
resolver.query(uri, null, null, null, null);
|
try {
|
||||||
|
returnCursor =
|
||||||
|
resolver.query(uri, null, null, null, null);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
if (returnCursor != null) {
|
if (returnCursor != null) {
|
||||||
try {
|
try {
|
||||||
int nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
int nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
||||||
|
@ -1092,7 +1096,7 @@ public class Helper {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
|
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
|
||||||
String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar;
|
String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar;
|
||||||
if (targetedUrl != null) {
|
if (targetedUrl != null && Helper.isValidContextForGlide(view.getContext())) {
|
||||||
if (disableGif || (!targetedUrl.endsWith(".gif"))) {
|
if (disableGif || (!targetedUrl.endsWith(".gif"))) {
|
||||||
RequestBuilder<Drawable> requestBuilder = Glide.with(view.getContext())
|
RequestBuilder<Drawable> requestBuilder = Glide.with(view.getContext())
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
|
@ -1112,7 +1116,7 @@ public class Helper {
|
||||||
}
|
}
|
||||||
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
|
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (Helper.isValidContextForGlide(view.getContext())) {
|
||||||
Glide.with(view.getContext())
|
Glide.with(view.getContext())
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
.load(R.drawable.ic_person)
|
.load(R.drawable.ic_person)
|
||||||
|
@ -1201,7 +1205,7 @@ public class Helper {
|
||||||
|
|
||||||
int w = options.outWidth;
|
int w = options.outWidth;
|
||||||
int h = options.outHeight;
|
int h = options.outHeight;
|
||||||
float valx = (float) 1.0 - (float) width / (float) w;
|
float valx = (float) 1.0 - width / (float) w;
|
||||||
if (valx < 0)
|
if (valx < 0)
|
||||||
valx = 0;
|
valx = 0;
|
||||||
float valy = (h - Helper.convertDpToPixel(textSize, context) - 10) / (float) h;
|
float valy = (h - Helper.convertDpToPixel(textSize, context) - 10) / (float) h;
|
||||||
|
|
|
@ -488,7 +488,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//For first tab we fetch new messages, if we keep position
|
//For first tab we fetch new messages, if we keep position
|
||||||
if (slug.compareTo(Helper.getSlugOfFirstFragment(requireActivity(), currentUserID, currentInstance)) == 0 && rememberPosition) {
|
if (slug != null && slug.compareTo(Helper.getSlugOfFirstFragment(requireActivity(), currentUserID, currentInstance)) == 0 && rememberPosition) {
|
||||||
route(DIRECTION.FETCH_NEW, true);
|
route(DIRECTION.FETCH_NEW, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,39 +66,42 @@ public class NodeInfoVM extends AndroidViewModel {
|
||||||
* @return LiveData<WellKnownNodeinfo.NodeInfo>
|
* @return LiveData<WellKnownNodeinfo.NodeInfo>
|
||||||
*/
|
*/
|
||||||
public LiveData<WellKnownNodeinfo.NodeInfo> getNodeInfo(String instance) {
|
public LiveData<WellKnownNodeinfo.NodeInfo> getNodeInfo(String instance) {
|
||||||
NodeInfoService nodeInfoService = init(instance);
|
if (instance != null) {
|
||||||
nodeInfoMutableLiveData = new MutableLiveData<>();
|
NodeInfoService nodeInfoService = init(instance);
|
||||||
new Thread(() -> {
|
nodeInfoMutableLiveData = new MutableLiveData<>();
|
||||||
WellKnownNodeinfo.NodeInfo nodeInfo = null;
|
new Thread(() -> {
|
||||||
|
WellKnownNodeinfo.NodeInfo nodeInfo = null;
|
||||||
|
|
||||||
Call<WellKnownNodeinfo> nodeInfoLinksCall = nodeInfoService.getWellKnownNodeinfoLinks();
|
Call<WellKnownNodeinfo> nodeInfoLinksCall = nodeInfoService.getWellKnownNodeinfoLinks();
|
||||||
if (nodeInfoLinksCall != null) {
|
if (nodeInfoLinksCall != null) {
|
||||||
try {
|
try {
|
||||||
Response<WellKnownNodeinfo> nodeInfoLinksResponse = nodeInfoLinksCall.execute();
|
Response<WellKnownNodeinfo> nodeInfoLinksResponse = nodeInfoLinksCall.execute();
|
||||||
if (nodeInfoLinksResponse.isSuccessful() && nodeInfoLinksResponse.body() != null) {
|
if (nodeInfoLinksResponse.isSuccessful() && nodeInfoLinksResponse.body() != null) {
|
||||||
WellKnownNodeinfo wellKnownNodeinfo = nodeInfoLinksResponse.body();
|
WellKnownNodeinfo wellKnownNodeinfo = nodeInfoLinksResponse.body();
|
||||||
Call<WellKnownNodeinfo.NodeInfo> wellKnownNodeinfoCall = nodeInfoService.getNodeinfo(wellKnownNodeinfo.links.get(0).href);
|
Call<WellKnownNodeinfo.NodeInfo> wellKnownNodeinfoCall = nodeInfoService.getNodeinfo(wellKnownNodeinfo.links.get(0).href);
|
||||||
if (wellKnownNodeinfoCall != null) {
|
if (wellKnownNodeinfoCall != null) {
|
||||||
try {
|
try {
|
||||||
Response<WellKnownNodeinfo.NodeInfo> response = wellKnownNodeinfoCall.execute();
|
Response<WellKnownNodeinfo.NodeInfo> response = wellKnownNodeinfoCall.execute();
|
||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
nodeInfo = response.body();
|
nodeInfo = response.body();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
WellKnownNodeinfo.NodeInfo finalNodeInfo = nodeInfo;
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Runnable myRunnable = () -> nodeInfoMutableLiveData.setValue(finalNodeInfo);
|
||||||
WellKnownNodeinfo.NodeInfo finalNodeInfo = nodeInfo;
|
mainHandler.post(myRunnable);
|
||||||
Runnable myRunnable = () -> nodeInfoMutableLiveData.setValue(finalNodeInfo);
|
}).start();
|
||||||
mainHandler.post(myRunnable);
|
} else {
|
||||||
}).start();
|
nodeInfoMutableLiveData.setValue(null);
|
||||||
|
}
|
||||||
return nodeInfoMutableLiveData;
|
return nodeInfoMutableLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue