Some fixes with admin
This commit is contained in:
parent
f213b0ddcb
commit
e110dc71ff
|
@ -70,7 +70,6 @@ public class AccountReportActivity extends BaseActivity {
|
||||||
report = (AdminReport) b.getSerializable(Helper.ARG_REPORT);
|
report = (AdminReport) b.getSerializable(Helper.ARG_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.allow.getBackground().setColorFilter(ContextCompat.getColor(AccountReportActivity.this, R.color.green_1), PorterDuff.Mode.MULTIPLY);
|
binding.allow.getBackground().setColorFilter(ContextCompat.getColor(AccountReportActivity.this, R.color.green_1), PorterDuff.Mode.MULTIPLY);
|
||||||
binding.reject.getBackground().setColorFilter(ContextCompat.getColor(AccountReportActivity.this, R.color.red_1), PorterDuff.Mode.MULTIPLY);
|
binding.reject.getBackground().setColorFilter(ContextCompat.getColor(AccountReportActivity.this, R.color.red_1), PorterDuff.Mode.MULTIPLY);
|
||||||
|
|
||||||
|
@ -88,7 +87,6 @@ public class AccountReportActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report != null) {
|
if (report != null) {
|
||||||
|
|
||||||
ArrayList<String> contents = new ArrayList<>();
|
ArrayList<String> contents = new ArrayList<>();
|
||||||
for (Status status : report.statuses) {
|
for (Status status : report.statuses) {
|
||||||
contents.add(status.content);
|
contents.add(status.content);
|
||||||
|
@ -96,8 +94,8 @@ public class AccountReportActivity extends BaseActivity {
|
||||||
binding.lvStatuses.setLayoutManager(new LinearLayoutManager(this));
|
binding.lvStatuses.setLayoutManager(new LinearLayoutManager(this));
|
||||||
StatusReportAdapter adapter = new StatusReportAdapter(contents);
|
StatusReportAdapter adapter = new StatusReportAdapter(contents);
|
||||||
binding.lvStatuses.setAdapter(adapter);
|
binding.lvStatuses.setAdapter(adapter);
|
||||||
|
|
||||||
binding.statusesGroup.setVisibility(View.VISIBLE);
|
binding.statusesGroup.setVisibility(View.VISIBLE);
|
||||||
|
targeted_account = report.target_account;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (targeted_account != null) {
|
if (targeted_account != null) {
|
||||||
|
@ -299,11 +297,13 @@ public class AccountReportActivity extends BaseActivity {
|
||||||
binding.assign.setOnClickListener(view -> {
|
binding.assign.setOnClickListener(view -> {
|
||||||
if (report.assigned_account == null) {
|
if (report.assigned_account == null) {
|
||||||
adminVM.assignToSelf(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
adminVM.assignToSelf(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
||||||
|
report = adminReport;
|
||||||
|
fillReport(accountAdmin, null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.unassign(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
adminVM.unassign(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
||||||
|
report = adminReport;
|
||||||
|
fillReport(accountAdmin, null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -315,11 +315,13 @@ public class AccountReportActivity extends BaseActivity {
|
||||||
binding.status.setOnClickListener(view -> {
|
binding.status.setOnClickListener(view -> {
|
||||||
if (report.action_taken) {
|
if (report.action_taken) {
|
||||||
adminVM.reopen(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
adminVM.reopen(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
||||||
|
report = adminReport;
|
||||||
|
fillReport(accountAdmin, null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.resolved(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
adminVM.resolved(MainActivity.currentInstance, MainActivity.currentToken, report.id).observe(this, adminReport -> {
|
||||||
|
report = adminReport;
|
||||||
|
fillReport(accountAdmin, null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -55,7 +55,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
|
||||||
import app.fedilab.android.client.entities.api.AdminAccount;
|
import app.fedilab.android.client.entities.api.AdminAccount;
|
||||||
import app.fedilab.android.client.entities.api.Attachment;
|
import app.fedilab.android.client.entities.api.Attachment;
|
||||||
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
|
||||||
|
@ -70,11 +69,11 @@ import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class AdminAccountActivity extends BaseActivity {
|
public class AdminAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
private AdminAccount adminAccount;
|
|
||||||
private Account account;
|
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
private ActivityAdminAccountBinding binding;
|
private ActivityAdminAccountBinding binding;
|
||||||
|
private String account_id;
|
||||||
|
private AdminVM adminVM;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -85,11 +84,10 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
setSupportActionBar(binding.toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
|
AdminAccount adminAccount = null;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
|
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
|
||||||
if (adminAccount != null) {
|
account_id = b.getString(Helper.ARG_ACCOUNT_ID, null);
|
||||||
account = adminAccount.account;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
postponeEnterTransition();
|
postponeEnterTransition();
|
||||||
|
|
||||||
|
@ -106,22 +104,27 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
}
|
}
|
||||||
binding.toolbar.setPopupTheme(Helper.popupStyle());
|
binding.toolbar.setPopupTheme(Helper.popupStyle());
|
||||||
if (account != null) {
|
adminVM = new ViewModelProvider(AdminAccountActivity.this).get(AdminVM.class);
|
||||||
initializeView(account);
|
if (account_id != null) {
|
||||||
|
adminVM.getAccount(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, this::initializeView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (adminAccount != null && adminAccount.account != null) {
|
||||||
|
initializeView(adminAccount);
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(AdminAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
Toasty.error(AdminAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeView(Account account) {
|
private void initializeView(AdminAccount adminAccount) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(AdminAccountActivity.this);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(AdminAccountActivity.this);
|
||||||
if (account == null) {
|
if (adminAccount == null) {
|
||||||
Toasty.error(AdminAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
Toasty.error(AdminAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
binding.title.setText(String.format(Locale.getDefault(), "@%s", account.acct));
|
binding.title.setText(String.format(Locale.getDefault(), "@%s", adminAccount.account.acct));
|
||||||
|
|
||||||
// MastodonHelper.loadPPMastodon(binding.profilePicture, account);
|
// MastodonHelper.loadPPMastodon(binding.profilePicture, account);
|
||||||
binding.appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
binding.appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||||
|
@ -141,8 +144,13 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
binding.email.setText(adminAccount.email);
|
binding.email.setText(adminAccount.email);
|
||||||
StringBuilder lastActive = new StringBuilder();
|
StringBuilder lastActive = new StringBuilder();
|
||||||
if (adminAccount.ips != null) {
|
if (adminAccount.ips != null) {
|
||||||
|
int count = 0;
|
||||||
for (AdminAccount.IP ip : adminAccount.ips) {
|
for (AdminAccount.IP ip : adminAccount.ips) {
|
||||||
lastActive.append(Helper.shortDateToString(ip.used_at)).append(" - ").append(ip.ip).append("\r\n");
|
lastActive.append(Helper.shortDateToString(ip.used_at)).append(" - ").append(ip.ip).append("\r\n");
|
||||||
|
count++;
|
||||||
|
if (count > 4) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastActive.toString().trim().length() == 0) {
|
if (lastActive.toString().trim().length() == 0) {
|
||||||
|
@ -162,18 +170,18 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
binding.silenceAction.setText(adminAccount.silenced ? R.string.unsilence : R.string.silence);
|
binding.silenceAction.setText(adminAccount.silenced ? R.string.unsilence : R.string.silence);
|
||||||
binding.suspendAction.setText(adminAccount.suspended ? R.string.unsuspend : R.string.suspend);
|
binding.suspendAction.setText(adminAccount.suspended ? R.string.unsuspend : R.string.suspend);
|
||||||
|
|
||||||
AdminVM adminVM = new ViewModelProvider(AdminAccountActivity.this).get(AdminVM.class);
|
|
||||||
|
|
||||||
binding.disableAction.setOnClickListener(v -> {
|
binding.disableAction.setOnClickListener(v -> {
|
||||||
if (adminAccount.disabled) {
|
if (adminAccount.disabled) {
|
||||||
adminVM.enable(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
adminVM.enable(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
|
||||||
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
||||||
adminAccount.disabled = false;
|
adminAccount.disabled = false;
|
||||||
binding.disableAction.setText(R.string.disable);
|
binding.disableAction.setText(R.string.disable);
|
||||||
binding.disabled.setText(R.string.no);
|
binding.disabled.setText(R.string.no);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, "disable ", null, null, null, null);
|
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id, "disable ", null, null, null, null);
|
||||||
adminAccount.disabled = true;
|
adminAccount.disabled = true;
|
||||||
binding.disableAction.setText(R.string.undisable);
|
binding.disableAction.setText(R.string.undisable);
|
||||||
binding.disabled.setText(R.string.yes);
|
binding.disabled.setText(R.string.yes);
|
||||||
|
@ -182,14 +190,14 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
binding.approveAction.setOnClickListener(v -> {
|
binding.approveAction.setOnClickListener(v -> {
|
||||||
if (adminAccount.approved) {
|
if (adminAccount.approved) {
|
||||||
adminVM.reject(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
adminVM.reject(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
|
||||||
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
||||||
adminAccount.approved = false;
|
adminAccount.approved = false;
|
||||||
binding.approveAction.setText(R.string.approve);
|
binding.approveAction.setText(R.string.approve);
|
||||||
binding.approved.setText(R.string.no);
|
binding.approved.setText(R.string.no);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.approve(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id);
|
adminVM.approve(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id);
|
||||||
adminAccount.approved = true;
|
adminAccount.approved = true;
|
||||||
binding.approveAction.setText(R.string.reject);
|
binding.approveAction.setText(R.string.reject);
|
||||||
binding.approved.setText(R.string.yes);
|
binding.approved.setText(R.string.yes);
|
||||||
|
@ -198,14 +206,14 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
binding.silenceAction.setOnClickListener(v -> {
|
binding.silenceAction.setOnClickListener(v -> {
|
||||||
if (adminAccount.disabled) {
|
if (adminAccount.disabled) {
|
||||||
adminVM.unsilence(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
adminVM.unsilence(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
|
||||||
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
||||||
adminAccount.silenced = false;
|
adminAccount.silenced = false;
|
||||||
binding.silenceAction.setText(R.string.silence);
|
binding.silenceAction.setText(R.string.silence);
|
||||||
binding.disabled.setText(R.string.no);
|
binding.disabled.setText(R.string.no);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, "silence", null, null, null, null);
|
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id, "silence", null, null, null, null);
|
||||||
adminAccount.silenced = true;
|
adminAccount.silenced = true;
|
||||||
binding.disableAction.setText(R.string.unsilence);
|
binding.disableAction.setText(R.string.unsilence);
|
||||||
binding.disabled.setText(R.string.yes);
|
binding.disabled.setText(R.string.yes);
|
||||||
|
@ -214,14 +222,14 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
binding.suspendAction.setOnClickListener(v -> {
|
binding.suspendAction.setOnClickListener(v -> {
|
||||||
if (adminAccount.disabled) {
|
if (adminAccount.disabled) {
|
||||||
adminVM.unsuspend(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
|
adminVM.unsuspend(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
|
||||||
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
.observe(AdminAccountActivity.this, adminAccountResult -> {
|
||||||
adminAccount.suspended = false;
|
adminAccount.suspended = false;
|
||||||
binding.suspendAction.setText(R.string.suspend);
|
binding.suspendAction.setText(R.string.suspend);
|
||||||
binding.suspended.setText(R.string.no);
|
binding.suspended.setText(R.string.no);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, "suspend", null, null, null, null);
|
adminVM.performAction(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id, "suspend", null, null, null, null);
|
||||||
adminAccount.suspended = true;
|
adminAccount.suspended = true;
|
||||||
binding.disableAction.setText(R.string.unsuspend);
|
binding.disableAction.setText(R.string.unsuspend);
|
||||||
binding.suspended.setText(R.string.yes);
|
binding.suspended.setText(R.string.yes);
|
||||||
|
@ -231,9 +239,9 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
//Retrieve relationship with the connected account
|
//Retrieve relationship with the connected account
|
||||||
List<String> accountListToCheck = new ArrayList<>();
|
List<String> accountListToCheck = new ArrayList<>();
|
||||||
accountListToCheck.add(account.id);
|
accountListToCheck.add(adminAccount.id);
|
||||||
//Animate emojis
|
//Animate emojis
|
||||||
if (account.emojis != null && account.emojis.size() > 0) {
|
if (adminAccount.account.emojis != null && adminAccount.account.emojis.size() > 0) {
|
||||||
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();
|
||||||
|
@ -244,7 +252,7 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
//Tablayout for timelines/following/followers
|
//Tablayout for timelines/following/followers
|
||||||
|
|
||||||
boolean disableGif = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_GIF), false);
|
boolean disableGif = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_GIF), false);
|
||||||
String targetedUrl = disableGif ? account.avatar_static : account.avatar;
|
String targetedUrl = disableGif ? adminAccount.account.avatar_static : adminAccount.account.avatar;
|
||||||
Glide.with(AdminAccountActivity.this)
|
Glide.with(AdminAccountActivity.this)
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
.dontTransform()
|
.dontTransform()
|
||||||
|
@ -269,10 +277,10 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
//Load header
|
//Load header
|
||||||
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, account, MastodonHelper.MediaAccountType.HEADER);
|
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, adminAccount.account, MastodonHelper.MediaAccountType.HEADER);
|
||||||
//Redraws icon for locked accounts
|
//Redraws icon for locked accounts
|
||||||
final float scale = getResources().getDisplayMetrics().density;
|
final float scale = getResources().getDisplayMetrics().density;
|
||||||
if (account.locked) {
|
if (adminAccount.account.locked) {
|
||||||
Drawable img = ContextCompat.getDrawable(AdminAccountActivity.this, R.drawable.ic_baseline_lock_24);
|
Drawable img = ContextCompat.getDrawable(AdminAccountActivity.this, R.drawable.ic_baseline_lock_24);
|
||||||
assert img != null;
|
assert img != null;
|
||||||
img.setBounds(0, 0, (int) (16 * scale + 0.5f), (int) (16 * scale + 0.5f));
|
img.setBounds(0, 0, (int) (16 * scale + 0.5f), (int) (16 * scale + 0.5f));
|
||||||
|
@ -282,11 +290,11 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
//Peertube account watched by a Mastodon account
|
//Peertube account watched by a Mastodon account
|
||||||
//Bot account
|
//Bot account
|
||||||
if (account.bot) {
|
if (adminAccount.account.bot) {
|
||||||
binding.accountBot.setVisibility(View.VISIBLE);
|
binding.accountBot.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (account.acct != null) {
|
if (adminAccount.account.acct != null) {
|
||||||
setTitle(account.acct);
|
setTitle(adminAccount.account.acct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,27 +304,27 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
|
||||||
//This account was moved to another one
|
//This account was moved to another one
|
||||||
if (account.moved != null) {
|
if (adminAccount.account.moved != null) {
|
||||||
binding.accountMoved.setVisibility(View.VISIBLE);
|
binding.accountMoved.setVisibility(View.VISIBLE);
|
||||||
Drawable imgTravel = ContextCompat.getDrawable(AdminAccountActivity.this, R.drawable.ic_baseline_card_travel_24);
|
Drawable imgTravel = ContextCompat.getDrawable(AdminAccountActivity.this, R.drawable.ic_baseline_card_travel_24);
|
||||||
assert imgTravel != null;
|
assert imgTravel != null;
|
||||||
imgTravel.setBounds(0, 0, (int) (20 * scale + 0.5f), (int) (20 * scale + 0.5f));
|
imgTravel.setBounds(0, 0, (int) (20 * scale + 0.5f), (int) (20 * scale + 0.5f));
|
||||||
binding.accountMoved.setCompoundDrawables(imgTravel, null, null, null);
|
binding.accountMoved.setCompoundDrawables(imgTravel, null, null, null);
|
||||||
//Retrieves content and make account names clickable
|
//Retrieves content and make account names clickable
|
||||||
SpannableString spannableString = SpannableHelper.moveToText(AdminAccountActivity.this, account);
|
SpannableString spannableString = SpannableHelper.moveToText(AdminAccountActivity.this, adminAccount.account);
|
||||||
binding.accountMoved.setText(spannableString, TextView.BufferType.SPANNABLE);
|
binding.accountMoved.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||||
binding.accountMoved.setMovementMethod(LinkMovementMethod.getInstance());
|
binding.accountMoved.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.accountDn.setText(
|
binding.accountDn.setText(
|
||||||
account.getSpanDisplayName(AdminAccountActivity.this,
|
adminAccount.account.getSpanDisplayName(AdminAccountActivity.this,
|
||||||
new WeakReference<>(binding.accountDn)),
|
new WeakReference<>(binding.accountDn)),
|
||||||
TextView.BufferType.SPANNABLE);
|
TextView.BufferType.SPANNABLE);
|
||||||
binding.accountUn.setText(String.format("@%s", account.acct));
|
binding.accountUn.setText(String.format("@%s", adminAccount.account.acct));
|
||||||
binding.accountUn.setOnLongClickListener(v -> {
|
binding.accountUn.setOnLongClickListener(v -> {
|
||||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
String account_id = account.acct;
|
String account_id = adminAccount.account.acct;
|
||||||
if (account_id.split("@").length == 1)
|
if (account_id.split("@").length == 1)
|
||||||
account_id += "@" + BaseMainActivity.currentInstance;
|
account_id += "@" + BaseMainActivity.currentInstance;
|
||||||
ClipData clip = ClipData.newPlainText("mastodon_account_id", "@" + account_id);
|
ClipData clip = ClipData.newPlainText("mastodon_account_id", "@" + account_id);
|
||||||
|
@ -326,15 +334,15 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
MastodonHelper.loadPPMastodon(binding.accountPp, account);
|
MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account);
|
||||||
binding.accountPp.setOnClickListener(v -> {
|
binding.accountPp.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class);
|
Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
Attachment attachment = new Attachment();
|
Attachment attachment = new Attachment();
|
||||||
attachment.description = account.acct;
|
attachment.description = adminAccount.account.acct;
|
||||||
attachment.preview_url = account.avatar;
|
attachment.preview_url = adminAccount.account.avatar;
|
||||||
attachment.url = account.avatar;
|
attachment.url = adminAccount.account.avatar;
|
||||||
attachment.remote_url = account.avatar;
|
attachment.remote_url = adminAccount.account.avatar;
|
||||||
attachment.type = "image";
|
attachment.type = "image";
|
||||||
ArrayList<Attachment> attachments = new ArrayList<>();
|
ArrayList<Attachment> attachments = new ArrayList<>();
|
||||||
attachments.add(attachment);
|
attachments.add(attachment);
|
||||||
|
@ -348,10 +356,10 @@ public class AdminAccountActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
binding.accountDate.setText(Helper.shortDateToString(account.created_at));
|
binding.accountDate.setText(Helper.shortDateToString(adminAccount.created_at));
|
||||||
binding.accountDate.setVisibility(View.VISIBLE);
|
binding.accountDate.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String[] accountInstanceArray = account.acct.split("@");
|
String[] accountInstanceArray = adminAccount.account.acct.split("@");
|
||||||
String accountInstance = BaseMainActivity.currentInstance;
|
String accountInstance = BaseMainActivity.currentInstance;
|
||||||
if (accountInstanceArray.length > 1) {
|
if (accountInstanceArray.length > 1) {
|
||||||
accountInstance = accountInstanceArray[1];
|
accountInstance = accountInstanceArray[1];
|
||||||
|
|
|
@ -57,6 +57,7 @@ public interface MastodonAdminService {
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@FormUrlEncoded
|
||||||
@POST("admin/accounts/{account_id}/action")
|
@POST("admin/accounts/{account_id}/action")
|
||||||
Call<Void> performAction(
|
Call<Void> performAction(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
|
@ -68,35 +69,35 @@ public interface MastodonAdminService {
|
||||||
@Field("send_email_notification") Boolean send_email_notification
|
@Field("send_email_notification") Boolean send_email_notification
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/accounts/{account_id}/approve")
|
@POST("admin/accounts/{account_id}/approve")
|
||||||
Call<AdminAccount> approve(
|
Call<AdminAccount> approve(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("account_id") String account_id
|
@Path("account_id") String account_id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/accounts/{account_id}/reject")
|
@POST("admin/accounts/{account_id}/reject")
|
||||||
Call<AdminAccount> reject(
|
Call<AdminAccount> reject(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("account_id") String account_id
|
@Path("account_id") String account_id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/accounts/{account_id}/enable")
|
@POST("admin/accounts/{account_id}/enable")
|
||||||
Call<AdminAccount> enable(
|
Call<AdminAccount> enable(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("account_id") String account_id
|
@Path("account_id") String account_id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/accounts/{account_id}/unsilence")
|
@POST("admin/accounts/{account_id}/unsilence")
|
||||||
Call<AdminAccount> unsilence(
|
Call<AdminAccount> unsilence(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("account_id") String account_id
|
@Path("account_id") String account_id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/accounts/{account_id}/unsuspend")
|
@POST("admin/accounts/{account_id}/unsuspend")
|
||||||
Call<AdminAccount> unsuspend(
|
Call<AdminAccount> unsuspend(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
|
@ -114,35 +115,35 @@ public interface MastodonAdminService {
|
||||||
@Query("limit") int limit
|
@Query("limit") int limit
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@GET("admin/reports/{id}")
|
@GET("admin/reports/{id}")
|
||||||
Call<AdminReport> getReport(
|
Call<AdminReport> getReport(
|
||||||
@Header("Authorization") String token,
|
@Header("Authorization") String token,
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/reports/{id}/assign_to_self")
|
@POST("admin/reports/{id}/assign_to_self")
|
||||||
Call<AdminReport> assignToSelf(
|
Call<AdminReport> assignToSelf(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/reports/{id}/unassign")
|
@POST("admin/reports/{id}/unassign")
|
||||||
Call<AdminReport> unassign(
|
Call<AdminReport> unassign(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/reports/{id}/resolve")
|
@POST("admin/reports/{id}/resolve")
|
||||||
Call<AdminReport> resolved(
|
Call<AdminReport> resolved(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
@Path("id") String id
|
@Path("id") String id
|
||||||
);
|
);
|
||||||
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("admin/reports/{id}/reopen")
|
@POST("admin/reports/{id}/reopen")
|
||||||
Call<AdminReport> reopen(
|
Call<AdminReport> reopen(
|
||||||
@Header("Authorization") String app_token,
|
@Header("Authorization") String app_token,
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class AdminReport implements Serializable {
|
||||||
@SerializedName("action_taken")
|
@SerializedName("action_taken")
|
||||||
public Boolean action_taken;
|
public Boolean action_taken;
|
||||||
@SerializedName("action_taken_by_account")
|
@SerializedName("action_taken_by_account")
|
||||||
public String action_taken_by_account;
|
public AdminAccount action_taken_by_account;
|
||||||
@SerializedName("assigned_account")
|
@SerializedName("assigned_account")
|
||||||
public AdminAccount assigned_account;
|
public AdminAccount assigned_account;
|
||||||
@SerializedName("category")
|
@SerializedName("category")
|
||||||
|
|
|
@ -100,7 +100,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.AccountReportActivity;
|
import app.fedilab.android.activities.AdminAccountActivity;
|
||||||
import app.fedilab.android.activities.ComposeActivity;
|
import app.fedilab.android.activities.ComposeActivity;
|
||||||
import app.fedilab.android.activities.ContextActivity;
|
import app.fedilab.android.activities.ContextActivity;
|
||||||
import app.fedilab.android.activities.CustomSharingActivity;
|
import app.fedilab.android.activities.CustomSharingActivity;
|
||||||
|
@ -1785,7 +1785,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
} else if (itemId == R.id.action_schedule_boost) {
|
} else if (itemId == R.id.action_schedule_boost) {
|
||||||
MastodonHelper.scheduleBoost(context, MastodonHelper.ScheduleType.BOOST, statusToDeal, null, null);
|
MastodonHelper.scheduleBoost(context, MastodonHelper.ScheduleType.BOOST, statusToDeal, null, null);
|
||||||
} else if (itemId == R.id.action_admin) {
|
} else if (itemId == R.id.action_admin) {
|
||||||
Intent intent = new Intent(context, AccountReportActivity.class);
|
Intent intent = new Intent(context, AdminAccountActivity.class);
|
||||||
intent.putExtra(Helper.ARG_ACCOUNT_ID, statusToDeal.account.id);
|
intent.putExtra(Helper.ARG_ACCOUNT_ID, statusToDeal.account.id);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
} else if (itemId == R.id.action_open_browser) {
|
} else if (itemId == R.id.action_open_browser) {
|
||||||
|
|
Loading…
Reference in New Issue