Fix some crashes

This commit is contained in:
Thomas 2022-05-25 14:41:27 +02:00
parent 44677c7af6
commit ba640a0991
2 changed files with 31 additions and 27 deletions

View file

@ -663,7 +663,7 @@ public class ProfileActivity extends BaseActivity {
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
getMenuInflater().inflate(R.menu.activity_profile, menu);
if (account != null) {
final boolean isOwner = account.id != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0;
final boolean isOwner = account.id != null && BaseMainActivity.currentUserID != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0;
String[] splitAcct = account.acct.split("@");
//check if user is from the same instance
if (splitAcct.length <= 1) { //If yes, these entries must be hidden

View file

@ -156,6 +156,29 @@ public class FragmentMastodonTimeline extends Fragment {
return found ? position : -1;
}
/**
* Returned list of checked status id for reports
*
* @return List<String>
*/
public List<String> getCheckedStatusesId() {
List<String> stringList = new ArrayList<>();
for (Status status : statuses) {
if (status.isChecked) {
stringList.add(status.id);
}
}
return stringList;
}
public void scrollToTop() {
if (binding != null) {
binding.recyclerView.scrollToPosition(0);
}
}
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
@ -195,33 +218,7 @@ public class FragmentMastodonTimeline extends Fragment {
LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION));
binding = FragmentPaginationBinding.inflate(inflater, container, false);
binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity()));
return binding.getRoot();
}
/**
* Returned list of checked status id for reports
*
* @return List<String>
*/
public List<String> getCheckedStatusesId() {
List<String> stringList = new ArrayList<>();
for (Status status : statuses) {
if (status.isChecked) {
stringList.add(status.id);
}
}
return stringList;
}
public void scrollToTop() {
if (binding != null) {
binding.recyclerView.scrollToPosition(0);
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int c1 = getResources().getColor(R.color.cyanea_accent_reference);
binding.swipeContainer.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.cyanea_primary_reference));
binding.swipeContainer.setColorSchemeColors(
@ -238,6 +235,13 @@ public class FragmentMastodonTimeline extends Fragment {
max_id = statusReport != null ? statusReport.id : null;
flagLoading = false;
router(null);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
/**