mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-07-08 04:40:28 +03:00
- Fix reports crashes after submitting
- Use full reports for profiles
This commit is contained in:
parent
cb96f0df44
commit
b034f6731a
3 changed files with 22 additions and 29 deletions
|
@ -216,7 +216,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
} else if (mention_str != null) {
|
} else if (mention_str != null) {
|
||||||
accountsVM.searchAccounts(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mention_str, 1, true, false).observe(ProfileActivity.this, accounts -> {
|
accountsVM.searchAccounts(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mention_str, 1, true, false).observe(ProfileActivity.this, accounts -> {
|
||||||
if (accounts != null && accounts.size() > 0) {
|
if (accounts != null && !accounts.isEmpty()) {
|
||||||
account = accounts.get(0);
|
account = accounts.get(0);
|
||||||
initializeView(account);
|
initializeView(account);
|
||||||
} else {
|
} else {
|
||||||
|
@ -342,13 +342,13 @@ public class ProfileActivity extends BaseActivity {
|
||||||
accountListToCheck.add(account.id);
|
accountListToCheck.add(account.id);
|
||||||
//Retrieve relation ship
|
//Retrieve relation ship
|
||||||
accountsVM.getRelationships(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, relationShips -> {
|
accountsVM.getRelationships(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, relationShips -> {
|
||||||
if (relationShips != null && relationShips.size() > 0) {
|
if (relationShips != null && !relationShips.isEmpty()) {
|
||||||
this.relationship = relationShips.get(0);
|
this.relationship = relationShips.get(0);
|
||||||
updateAccount();
|
updateAccount();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
accountsVM.getFamiliarFollowers(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, familiarFollowersList -> {
|
accountsVM.getFamiliarFollowers(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, familiarFollowersList -> {
|
||||||
if (familiarFollowersList != null && familiarFollowersList.size() > 0) {
|
if (familiarFollowersList != null && !familiarFollowersList.isEmpty()) {
|
||||||
this.familiarFollowers = familiarFollowersList.get(0);
|
this.familiarFollowers = familiarFollowersList.get(0);
|
||||||
updateAccount();
|
updateAccount();
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
updateAccount();
|
updateAccount();
|
||||||
});
|
});
|
||||||
//Animate emojis
|
//Animate emojis
|
||||||
if (account.emojis != null && account.emojis.size() > 0) {
|
if (account.emojis != null && !account.emojis.isEmpty()) {
|
||||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false);
|
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false);
|
||||||
if (!disableAnimatedEmoji) {
|
if (!disableAnimatedEmoji) {
|
||||||
scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
|
scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
@ -527,7 +527,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
//Fields for profile
|
//Fields for profile
|
||||||
List<Field> fields = account.fields;
|
List<Field> fields = account.fields;
|
||||||
if (fields != null && fields.size() > 0) {
|
if (fields != null && !fields.isEmpty()) {
|
||||||
FieldAdapter fieldAdapter = new FieldAdapter(fields, account);
|
FieldAdapter fieldAdapter = new FieldAdapter(fields, account);
|
||||||
binding.fieldsContainer.setAdapter(fieldAdapter);
|
binding.fieldsContainer.setAdapter(fieldAdapter);
|
||||||
binding.fieldsContainer.setLayoutManager(new LinearLayoutManager(ProfileActivity.this));
|
binding.fieldsContainer.setLayoutManager(new LinearLayoutManager(ProfileActivity.this));
|
||||||
|
@ -701,7 +701,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
|
|
||||||
//Manage indentity proofs if not yet displayed
|
//Manage indentity proofs if not yet displayed
|
||||||
|
|
||||||
if (identityProofList != null && identityProofList.size() > 0) {
|
if (identityProofList != null && !identityProofList.isEmpty()) {
|
||||||
ImageView identity_proofs_indicator = findViewById(R.id.identity_proofs_indicator);
|
ImageView identity_proofs_indicator = findViewById(R.id.identity_proofs_indicator);
|
||||||
identity_proofs_indicator.setVisibility(View.VISIBLE);
|
identity_proofs_indicator.setVisibility(View.VISIBLE);
|
||||||
//Recyclerview for identity proof has not been inflated yet
|
//Recyclerview for identity proof has not been inflated yet
|
||||||
|
@ -722,7 +722,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (familiarFollowers != null && familiarFollowers.accounts != null && familiarFollowers.accounts.size() > 0) {
|
if (familiarFollowers != null && familiarFollowers.accounts != null && !familiarFollowers.accounts.isEmpty()) {
|
||||||
binding.relatedAccounts.removeAllViews();
|
binding.relatedAccounts.removeAllViews();
|
||||||
for (Account account : familiarFollowers.accounts) {
|
for (Account account : familiarFollowers.accounts) {
|
||||||
NotificationsRelatedAccountsBinding notificationsRelatedAccountsBinding = NotificationsRelatedAccountsBinding.inflate(LayoutInflater.from(ProfileActivity.this));
|
NotificationsRelatedAccountsBinding notificationsRelatedAccountsBinding = NotificationsRelatedAccountsBinding.inflate(LayoutInflater.from(ProfileActivity.this));
|
||||||
|
@ -1075,7 +1075,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
String[] codesArr;
|
String[] codesArr;
|
||||||
String[] languagesArr;
|
String[] languagesArr;
|
||||||
boolean[] presentArr;
|
boolean[] presentArr;
|
||||||
if (storedLanguages != null && storedLanguages.size() > 0) {
|
if (storedLanguages != null && !storedLanguages.isEmpty()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
codesArr = new String[storedLanguages.size()];
|
codesArr = new String[storedLanguages.size()];
|
||||||
languagesArr = new String[storedLanguages.size()];
|
languagesArr = new String[storedLanguages.size()];
|
||||||
|
@ -1300,24 +1300,15 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_report) {
|
} else if (itemId == R.id.action_report) {
|
||||||
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
Intent intent = new Intent(ProfileActivity.this, ReportActivity.class);
|
||||||
builderInner.setTitle(R.string.report_account);
|
Bundle args = new Bundle();
|
||||||
//Text for report
|
args.putSerializable(Helper.ARG_ACCOUNT, account);
|
||||||
EditText input = new EditText(ProfileActivity.this);
|
new CachedBundle(ProfileActivity.this).insertBundle(args, Helper.getCurrentAccount(ProfileActivity.this), bundleId -> {
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
Bundle bundle = new Bundle();
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
intent.putExtras(bundle);
|
||||||
input.setLayoutParams(lp);
|
startActivity(intent);
|
||||||
builderInner.setView(input);
|
|
||||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
||||||
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
|
||||||
String comment = null;
|
|
||||||
if (input.getText() != null)
|
|
||||||
comment = input.getText().toString();
|
|
||||||
accountsVM.report(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, null, null, null, comment, false);
|
|
||||||
dialog.dismiss();
|
|
||||||
});
|
});
|
||||||
builderInner.show();
|
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_block) {
|
} else if (itemId == R.id.action_block) {
|
||||||
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
AlertDialog.Builder builderInner = new MaterialAlertDialogBuilder(ProfileActivity.this);
|
||||||
|
|
|
@ -342,9 +342,11 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
*/
|
*/
|
||||||
public List<String> getCheckedStatusesId() {
|
public List<String> getCheckedStatusesId() {
|
||||||
List<String> stringList = new ArrayList<>();
|
List<String> stringList = new ArrayList<>();
|
||||||
for (Status status : timelineStatuses) {
|
if(timelineStatuses != null) {
|
||||||
if (status.isChecked) {
|
for (Status status : timelineStatuses) {
|
||||||
stringList.add(status.id);
|
if (status.isChecked) {
|
||||||
|
stringList.add(status.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stringList;
|
return stringList;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:padding="@dimen/fab_margin"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
|
Loading…
Reference in a new issue