summaryrefslogtreecommitdiffstats
path: root/app/src/main
diff options
context:
space:
mode:
authorThomas <tschneider.ac@gmail.com>2022-05-28 09:31:19 +0200
committerThomas <tschneider.ac@gmail.com>2022-05-28 09:31:19 +0200
commit26e6fab5d989369015c7fcce996b4a149885f290 (patch)
treeda5c908144412fe51f31476d0049c2ab6a309838 /app/src/main
parent35c248bcb2d72b030a02a7e7d4a4d6dd0535c4ba (diff)
Moderation - Display accounts and filter them
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml5
-rw-r--r--app/src/main/java/app/fedilab/android/BaseMainActivity.java7
-rw-r--r--app/src/main/java/app/fedilab/android/activities/AdminActionActivity.java256
-rw-r--r--app/src/main/java/app/fedilab/android/activities/SettingsActivity.java7
-rw-r--r--app/src/main/java/app/fedilab/android/client/endpoints/MastodonAdminService.java4
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/api/AdminAccount.java5
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/api/AdminAccounts.java24
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/api/AdminReport.java23
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/api/AdminReports.java24
-rw-r--r--app/src/main/java/app/fedilab/android/helper/RecyclerViewThreadLines.kt4
-rw-r--r--app/src/main/java/app/fedilab/android/ui/drawer/AdminAccountAdapter.java97
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/admin/FragmentAdminAccount.java216
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/admin/FragmentAdminReport.java227
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentAdministrationSettings.java63
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java10
-rw-r--r--app/src/main/java/app/fedilab/android/viewmodel/mastodon/AdminVM.java81
-rw-r--r--app/src/main/res/drawable/ic_baseline_admin_panel_settings_24.xml13
-rw-r--r--app/src/main/res/layout/activity_admin_actions.xml52
-rw-r--r--app/src/main/res/layout/drawer_admin_account.xml139
-rw-r--r--app/src/main/res/layout/drawer_admin_report.xml55
-rw-r--r--app/src/main/res/layout/drawer_admin_report_account.xml51
-rw-r--r--app/src/main/res/layout/popup_admin_filter_accounts.xml132
-rw-r--r--app/src/main/res/menu/activity_main_drawer.xml5
-rw-r--r--app/src/main/res/menu/menu_admin_account.xml9
-rw-r--r--app/src/main/res/values/strings.xml5
-rw-r--r--app/src/main/res/xml/pref_administration.xml7
26 files changed, 1385 insertions, 136 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9299f85f5..3b4ec64f6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -101,6 +101,11 @@
android:label="@string/interactions"
android:theme="@style/AppThemeBar" />
<activity
+ android:name=".activities.AdminActionActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/administration"
+ android:theme="@style/AppThemeBar" />
+ <activity
android:name=".activities.MastodonListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_lists"
diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java
index a6c5f31d6..e3a203206 100644
--- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java
+++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java
@@ -78,6 +78,7 @@ import java.util.List;
import java.util.regex.Pattern;
import app.fedilab.android.activities.ActionActivity;
+import app.fedilab.android.activities.AdminActionActivity;
import app.fedilab.android.activities.BaseActivity;
import app.fedilab.android.activities.ComposeActivity;
import app.fedilab.android.activities.ContextActivity;
@@ -337,6 +338,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} else if (id == R.id.nav_follow_requests) {
Intent intent = new Intent(this, FollowRequestActivity.class);
startActivity(intent);
+ } else if (id == R.id.nav_administration) {
+ Intent intent = new Intent(this, AdminActionActivity.class);
+ startActivity(intent);
}
binding.drawerLayout.close();
return false;
@@ -571,6 +575,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
if (account.mastodon_account.locked) {
binding.navView.getMenu().findItem(R.id.nav_follow_requests).setVisible(true);
}
+ if (account.admin) {
+ binding.navView.getMenu().findItem(R.id.nav_administration).setVisible(true);
+ }
if (bottomMenu != null) {
//ManageClick on bottom menu items
if (binding.bottomNavView.findViewById(R.id.nav_home) != null) {
diff --git a/app/src/main/java/app/fedilab/android/activities/AdminActionActivity.java b/app/src/main/java/app/fedilab/android/activities/AdminActionActivity.java
new file mode 100644
index 000000000..1a14d8dd7
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/activities/AdminActionActivity.java
@@ -0,0 +1,256 @@
+package app.fedilab.android.activities;
+/* Copyright 2022 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+import static app.fedilab.android.activities.AdminActionActivity.AdminEnum.REPORT;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
+import com.google.gson.annotations.SerializedName;
+
+import app.fedilab.android.R;
+import app.fedilab.android.databinding.ActivityAdminActionsBinding;
+import app.fedilab.android.databinding.PopupAdminFilterAccountsBinding;
+import app.fedilab.android.helper.Helper;
+import app.fedilab.android.helper.ThemeHelper;
+import app.fedilab.android.ui.fragment.admin.FragmentAdminAccount;
+import app.fedilab.android.ui.fragment.admin.FragmentAdminReport;
+
+public class AdminActionActivity extends BaseActivity {
+
+ public static Boolean local = true, remote = true, active = true, pending = true, disabled = true, silenced = true, suspended = true, staff = null, orderByMostRecent = true;
+ private ActivityAdminActionsBinding binding;
+ private boolean canGoBack;
+ private FragmentAdminReport fragmentAdminReport;
+ private FragmentAdminAccount fragmentAdminAccount;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ ThemeHelper.applyThemeBar(this);
+ binding = ActivityAdminActionsBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
+
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary)));
+ }
+ canGoBack = false;
+ binding.reports.setOnClickListener(v -> displayTimeline(REPORT));
+ binding.accounts.setOnClickListener(v -> displayTimeline(AdminEnum.ACCOUNT));
+ }
+
+ private void displayTimeline(AdminEnum type) {
+ canGoBack = true;
+ if (type == REPORT) {
+
+ ThemeHelper.slideViewsToLeft(binding.buttonContainer, binding.fragmentContainer, () -> {
+ fragmentAdminReport = new FragmentAdminReport();
+ Bundle bundle = new Bundle();
+ bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, type);
+ bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + type.getValue());
+ fragmentAdminReport.setArguments(bundle);
+ FragmentManager fragmentManager = getSupportFragmentManager();
+ FragmentTransaction fragmentTransaction =
+ fragmentManager.beginTransaction();
+ fragmentTransaction.replace(R.id.fragment_container, fragmentAdminReport);
+ fragmentTransaction.commit();
+ });
+
+ } else {
+
+ ThemeHelper.slideViewsToLeft(binding.buttonContainer, binding.fragmentContainer, () -> {
+ fragmentAdminAccount = new FragmentAdminAccount();
+ Bundle bundle = new Bundle();
+ bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, type);
+ bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + type.getValue());
+ fragmentAdminAccount.setArguments(bundle);
+ FragmentManager fragmentManager = getSupportFragmentManager();
+ FragmentTransaction fragmentTransaction =
+ fragmentManager.beginTransaction();
+ fragmentTransaction.replace(R.id.fragment_container, fragmentAdminAccount);
+ fragmentTransaction.commit();
+ });
+
+ }
+ switch (type) {
+ case REPORT:
+ setTitle(R.string.reports);
+ break;
+ case ACCOUNT:
+ setTitle(R.string.accounts);
+ break;
+ }
+ invalidateOptionsMenu();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(@NonNull Menu menu) {
+ if (canGoBack && getTitle().toString().equalsIgnoreCase(getString(R.string.accounts))) {
+ getMenuInflater().inflate(R.menu.menu_admin_account, menu);
+ }
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ return true;
+ } else if (item.getItemId() == R.id.action_filter) {
+ AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(AdminActionActivity.this, Helper.dialogStyle());
+ PopupAdminFilterAccountsBinding binding = PopupAdminFilterAccountsBinding.inflate(getLayoutInflater());
+ alertDialogBuilder.setView(binding.getRoot());
+ if (local != null && remote == null) {
+ binding.locationLocal.setChecked(true);
+ } else if (remote != null && local == null) {
+ binding.locationRemote.setChecked(true);
+ } else {
+ binding.locationAll.setChecked(true);
+ }
+ binding.location.setOnCheckedChangeListener((group, checkedId) -> {
+ if (checkedId == R.id.location_all) {
+ local = true;
+ remote = true;
+ } else if (checkedId == R.id.location_local) {
+ local = true;
+ remote = null;
+ } else if (checkedId == R.id.location_remote) {
+ local = null;
+ remote = true;
+ }
+ });
+ if (pending != null && suspended == null && active == null) {
+ binding.moderationPending.setChecked(true);
+ } else if (suspended != null && pending == null && active == null) {
+ binding.moderationSuspended.setChecked(true);
+ } else if (active != null && pending == null && suspended == null) {
+ binding.moderationActive.setChecked(true);
+ } else {
+ binding.moderationAll.setChecked(true);
+ }
+ binding.moderation.setOnCheckedChangeListener((group, checkedId) -> {
+ if (checkedId == R.id.moderation_all) {
+ active = true;
+ suspended = true;
+ pending = true;
+ } else if (checkedId == R.id.moderation_active) {
+ active = true;
+ suspended = null;
+ pending = null;
+ } else if (checkedId == R.id.moderation_suspended) {
+ active = null;
+ suspended = true;
+ pending = null;
+ } else if (checkedId == R.id.moderation_pending) {
+ active = null;
+ suspended = null;
+ pending = true;
+ }
+ });
+ if (staff != null) {
+ binding.permissionsStaff.setChecked(true);
+ } else {
+ binding.permissionsAll.setChecked(true);
+ }
+ binding.permissions.setOnCheckedChangeListener((group, checkedId) -> {
+ if (checkedId == R.id.permissions_all) {
+ staff = null;
+ } else if (checkedId == R.id.permissions_staff) {
+ staff = true;
+ }
+ });
+ if (orderByMostRecent != null) {
+ binding.orderByMostRecent.setChecked(true);
+ } else {
+ binding.orderByLastActive.setChecked(true);
+ }
+ binding.orderBy.setOnCheckedChangeListener((group, checkedId) -> {
+ if (checkedId == R.id.order_by_most_recent) {
+ orderByMostRecent = true;
+ } else if (checkedId == R.id.order_by_last_active) {
+ orderByMostRecent = null;
+ }
+ });
+ alertDialogBuilder.setPositiveButton(R.string.filter, (dialog, id) -> {
+ final FragmentTransaction ft1 = getSupportFragmentManager().beginTransaction();
+ ft1.detach(fragmentAdminAccount);
+ ft1.commit();
+ final FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction();
+ ft2.attach(fragmentAdminAccount);
+ ft2.commit();
+ dialog.dismiss();
+ });
+ alertDialogBuilder.setNegativeButton(R.string.reset, (dialog, id) -> {
+ binding.locationAll.callOnClick();
+ binding.permissionsAll.callOnClick();
+ binding.moderationAll.callOnClick();
+ binding.orderByMostRecent.callOnClick();
+ });
+ AlertDialog alert = alertDialogBuilder.create();
+ alert.show();
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (canGoBack) {
+ canGoBack = false;
+ ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.buttonContainer, () -> {
+ if (fragmentAdminReport != null) {
+ fragmentAdminReport.onDestroyView();
+ }
+ if (fragmentAdminAccount != null) {
+ fragmentAdminAccount.onDestroyView();
+ }
+ setTitle(R.string.administration);
+ invalidateOptionsMenu();
+ });
+ } else {
+ super.onBackPressed();
+ }
+
+ }
+
+ public enum AdminEnum {
+ @SerializedName("REPORT")
+ REPORT("REPORT"),
+ @SerializedName("ACCOUNT")
+ ACCOUNT("ACCOUNT");
+
+ private final String value;
+
+ AdminEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java
index 8946d0a23..af9f268ab 100644
--- a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java
@@ -32,7 +32,6 @@ import java.util.Locale;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivitySettingsBinding;
import app.fedilab.android.helper.ThemeHelper;
-import app.fedilab.android.ui.fragment.settings.FragmentAdministrationSettings;
import app.fedilab.android.ui.fragment.settings.FragmentComposeSettings;
import app.fedilab.android.ui.fragment.settings.FragmentInterfaceSettings;
import app.fedilab.android.ui.fragment.settings.FragmentLanguageSettings;
@@ -120,12 +119,6 @@ public class SettingsActivity extends BaseActivity {
currentFragment = fragmentThemingSettings;
category = getString(R.string.theming);
break;
- case ADMINISTRATION:
- FragmentAdministrationSettings fragmentAdministrationSettings = new FragmentAdministrationSettings();
- fragmentTransaction.replace(R.id.fragment_container, fragmentAdministrationSettings);
- currentFragment = fragmentAdministrationSettings;
- category = getString(R.string.administration);
- break;
case LANGUAGE:
FragmentLanguageSettings fragmentLanguageSettings = new FragmentLanguageSettings();
fragmentTransaction.replace(R.id.fragment_container, fragmentLanguageSettings);
diff --git a/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAdminService.java b/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAdminService.java
index 11a3efc26..746462db0 100644
--- a/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAdminService.java
+++ b/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAdminService.java
@@ -109,7 +109,9 @@ public interface MastodonAdminService {
@Header("Authorization") String token,
@Field("resolved") Boolean resolved,
@Field("account_id") String account_id,
- @Field("target_account_id") String target_account_id
+ @Field("target_account_id") String target_account_id,
+ @Field("max_id") String max_id,
+ @Field("limit") int limit
);
@FormUrlEncoded
diff --git a/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccount.java b/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccount.java
index 8faf845d7..0dcaf923e 100644
--- a/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccount.java
+++ b/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccount.java
@@ -16,10 +16,11 @@ package app.fedilab.android.client.entities.api;
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
import java.util.Date;
import java.util.List;
-public class AdminAccount {
+public class AdminAccount implements Serializable {
@SerializedName("id")
public String id;
@@ -59,7 +60,7 @@ public class AdminAccount {
public String invited_by_account_id;
- public final class IP {
+ public static class IP implements Serializable {
@SerializedName("ip")
public String ip;
@SerializedName("used_at")
diff --git a/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccounts.java b/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccounts.java
new file mode 100644
index 000000000..eed98dcdb
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/client/entities/api/AdminAccounts.java
@@ -0,0 +1,24 @@
+package app.fedilab.android.client.entities.api;
+/* Copyright 2021 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+
+import java.util.List;
+
+public class AdminAccounts {
+
+ public Pagination pagination = new Pagination();
+ public List<AdminAccount> adminAccounts;
+}
diff --git a/app/src/main/java/app/fedilab/android/client/entities/api/AdminReport.java b/app/src/main/java/app/fedilab/android/client/entities/api/AdminReport.java
index 34502cc23..3ecc41340 100644
--- a/app/src/main/java/app/fedilab/android/client/entities/api/AdminReport.java
+++ b/app/src/main/java/app/fedilab/android/client/entities/api/AdminReport.java
@@ -16,29 +16,34 @@ package app.fedilab.android.client.entities.api;
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
import java.util.Date;
import java.util.List;
-public class AdminReport {
+public class AdminReport implements Serializable {
@SerializedName("id")
public String id;
+ @SerializedName("account")
+ public Account account;
@SerializedName("action_taken")
public String action_taken;
+ @SerializedName("action_taken_by_account")
+ public String action_taken_by_account;
+ @SerializedName("assigned_account")
+ public Account assigned_account;
+ @SerializedName("category")
+ public String category;
@SerializedName("comment")
public String comment;
@SerializedName("created_at")
public Date created_at;
- @SerializedName("updated_at")
- public Date updated_at;
- @SerializedName("account")
- public Account account;
@SerializedName("target_account")
public Account target_account;
- @SerializedName("assigned_account")
- public Account assigned_account;
- @SerializedName("action_taken_by_account")
- public String action_taken_by_account;
@SerializedName("statuses")
public List<Status> statuses;
+ @SerializedName("rules")
+ public List<Instance.Rule> rules;
+ @SerializedName("updated_at")
+ public Date updated_at;
}
diff --git a/app/src/main/java/app/fedilab/android/client/entities/api/AdminReports.java b/app/src/main/java/app/fedilab/android/client/entities/api/AdminReports.java
new file mode 100644
index 000000000..e7674d3ae
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/client/entities/api/AdminReports.java
@@ -0,0 +1,24 @@
+package app.fedilab.android.client.entities.api;
+/* Copyright 2021 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+
+import java.util.List;
+
+public class AdminReports {
+
+ public Pagination pagination = new Pagination();
+ public List<AdminReport> adminReports;
+}
diff --git a/app/src/main/java/app/fedilab/android/helper/RecyclerViewThreadLines.kt b/app/src/main/java/app/fedilab/android/helper/RecyclerViewThreadLines.kt
index f8e258e58..bfad6bf8c 100644
--- a/app/src/main/java/app/fedilab/android/helper/RecyclerViewThreadLines.kt
+++ b/app/src/main/java/app/fedilab/android/helper/RecyclerViewThreadLines.kt
@@ -43,7 +43,7 @@ class RecyclerViewThreadLines(context: Context, private val lineInfoList: List<L
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
val position = parent.getChildAdapterPosition(view)
- if (position < 0) return
+ if (position < 0 || position >= lineInfoList.size) return
val level = lineInfoList[position].level
val startMargin = margin * level + margin * fontScale
if (parent.layoutDirection == View.LAYOUT_DIRECTION_LTR) outRect.left = startMargin else outRect.right = startMargin
@@ -54,7 +54,7 @@ class RecyclerViewThreadLines(context: Context, private val lineInfoList: List<L
for (i in 0 until childCount) {
val view = parent.getChildAt(i)
val position = parent.getChildAdapterPosition(view)
- if (position < 0) return
+ if (position < 0 || position >= lineInfoList.size) return
val lineInfo = lineInfoList[position]
val level = lineInfo.level
diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/AdminAccountAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/AdminAccountAdapter.java
new file mode 100644
index 000000000..55ed0b514
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/ui/drawer/AdminAccountAdapter.java
@@ -0,0 +1,97 @@
+package app.fedilab.android.ui.drawer;
+/* Copyright 2022 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+import java.util.Locale;
+
+import app.fedilab.android.client.entities.api.AdminAccount;
+import app.fedilab.android.databinding.DrawerAdminAccountBinding;
+import app.fedilab.android.helper.Helper;
+import app.fedilab.android.helper.MastodonHelper;
+
+
+public class AdminAccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+
+ private final List<AdminAccount> adminAccountList;
+
+ public AdminAccountAdapter(List<AdminAccount> adminAccountList) {
+ this.adminAccountList = adminAccountList;
+ }
+
+ public int getCount() {
+ return adminAccountList.size();
+ }
+
+ public AdminAccount getItem(int position) {
+ return adminAccountList.get(position);
+ }
+
+ @NonNull
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ DrawerAdminAccountBinding itemBinding = DrawerAdminAccountBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
+ return new AccountAdminViewHolder(itemBinding);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
+ AdminAccount adminAccount = adminAccountList.get(position);
+ AccountAdminViewHolder holder = (AccountAdminViewHolder) viewHolder;
+ MastodonHelper.loadPPMastodon(holder.binding.pp, adminAccount.account);
+ holder.binding.username.setText(adminAccount.account.display_name);
+ holder.binding.acct.setText(String.format(Locale.getDefault(), "@%s", adminAccount.account.acct));
+ holder.binding.postCount.setText(String.valueOf(adminAccount.account.statuses_count));
+ holder.binding.followersCount.setText(String.valueOf(adminAccount.account.followers_count));
+ holder.binding.email.setText(adminAccount.email);
+ if (adminAccount.ip != null) {
+ holder.binding.lastActive.setText(Helper.shortDateToString(adminAccount.ip.used_at));
+ holder.binding.ip.setText(adminAccount.ip.ip);
+ } else if (adminAccount.ips != null && adminAccount.ips.size() > 0) {
+ holder.binding.lastActive.setText(Helper.shortDateToString(adminAccount.ips.get(0).used_at));
+ holder.binding.ip.setText(adminAccount.ips.get(0).ip);
+ } else {
+ holder.binding.lastActive.setText(Helper.shortDateToString(adminAccount.created_at));
+ }
+
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public int getItemCount() {
+ return adminAccountList.size();
+ }
+
+
+ public static class AccountAdminViewHolder extends RecyclerView.ViewHolder {
+ DrawerAdminAccountBinding binding;
+
+ AccountAdminViewHolder(DrawerAdminAccountBinding itemView) {
+ super(itemView.getRoot());
+ binding = itemView;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/admin/FragmentAdminAccount.java b/app/src/main/java/app/fedilab/android/ui/fragment/admin/FragmentAdminAccount.java
new file mode 100644
index 000000000..230c8c362
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/ui/fragment/admin/FragmentAdminAccount.java
@@ -0,0 +1,216 @@
+package app.fedilab.android.ui.fragment.admin;
+/* Copyright 2022 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even