mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Cleaning code 1
This commit is contained in:
parent
25e42fc7da
commit
5cca26e0c4
9 changed files with 127 additions and 173 deletions
|
@ -150,7 +150,6 @@ public class LoginActivity extends BaseActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(LoginActivity.this);
|
||||
setContentView(new FrameLayout(this));
|
||||
FragmentLoginMain fragmentLoginMain = new FragmentLoginMain();
|
||||
Helper.addFragment(getSupportFragmentManager(), android.R.id.content, fragmentLoginMain, null, null, null);
|
||||
|
|
|
@ -27,6 +27,7 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.MainActivity;
|
||||
|
@ -134,12 +135,12 @@ public class AccountReportActivity extends BaseBarActivity {
|
|||
binding.reject.setOnClickListener(view -> adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.REJECT)));
|
||||
binding.allow.setOnClickListener(view -> adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.APPROVE)));
|
||||
binding.warn.setOnClickListener(view -> {
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "none", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "none", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
||||
fillReport(accountAdmin, actionType.NONE);
|
||||
});
|
||||
binding.silence.setOnClickListener(view -> {
|
||||
if (!accountAdmin.silenced) {
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "silence", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "silence", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
||||
accountAdmin.silenced = true;
|
||||
fillReport(accountAdmin, actionType.SILENCE);
|
||||
} else {
|
||||
|
@ -148,7 +149,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
|||
});
|
||||
binding.disable.setOnClickListener(view -> {
|
||||
if (!accountAdmin.disabled) {
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "disable", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "disable", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
||||
accountAdmin.disabled = true;
|
||||
fillReport(accountAdmin, actionType.DISABLE);
|
||||
} else {
|
||||
|
@ -158,7 +159,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
|||
|
||||
binding.suspend.setOnClickListener(view -> {
|
||||
if (!accountAdmin.suspended) {
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "suspend", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
||||
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "suspend", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
||||
accountAdmin.suspended = true;
|
||||
fillReport(accountAdmin, actionType.SUSPEND);
|
||||
} else {
|
||||
|
@ -170,35 +171,21 @@ public class AccountReportActivity extends BaseBarActivity {
|
|||
if (type != null) {
|
||||
String message = null;
|
||||
switch (type) {
|
||||
case SILENCE:
|
||||
message = getString(R.string.account_silenced);
|
||||
break;
|
||||
case UNSILENCE:
|
||||
message = getString(R.string.account_unsilenced);
|
||||
break;
|
||||
case DISABLE:
|
||||
message = getString(R.string.account_disabled);
|
||||
break;
|
||||
case ENABLE:
|
||||
message = getString(R.string.account_undisabled);
|
||||
break;
|
||||
case SUSPEND:
|
||||
message = getString(R.string.account_suspended);
|
||||
break;
|
||||
case UNSUSPEND:
|
||||
message = getString(R.string.account_unsuspended);
|
||||
break;
|
||||
case NONE:
|
||||
message = getString(R.string.account_warned);
|
||||
break;
|
||||
case APPROVE:
|
||||
case SILENCE -> message = getString(R.string.account_silenced);
|
||||
case UNSILENCE -> message = getString(R.string.account_unsilenced);
|
||||
case DISABLE -> message = getString(R.string.account_disabled);
|
||||
case ENABLE -> message = getString(R.string.account_undisabled);
|
||||
case SUSPEND -> message = getString(R.string.account_suspended);
|
||||
case UNSUSPEND -> message = getString(R.string.account_unsuspended);
|
||||
case NONE -> message = getString(R.string.account_warned);
|
||||
case APPROVE -> {
|
||||
binding.allowRejectGroup.setVisibility(View.GONE);
|
||||
message = getString(R.string.account_approved);
|
||||
break;
|
||||
case REJECT:
|
||||
}
|
||||
case REJECT -> {
|
||||
binding.allowRejectGroup.setVisibility(View.GONE);
|
||||
message = getString(R.string.account_rejected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (message != null) {
|
||||
Toasty.success(AccountReportActivity.this, message, Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -73,73 +73,73 @@ public class BaseActivity extends AppCompatActivity {
|
|||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_NO -> {
|
||||
String defaultLight = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_LIGHT), "LIGHT");
|
||||
switch (defaultLight) {
|
||||
case "LIGHT":
|
||||
case "LIGHT" -> {
|
||||
setTheme(R.style.AppTheme);
|
||||
currentThemeId = R.style.AppTheme;
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
}
|
||||
case "SOLARIZED_LIGHT" -> {
|
||||
setTheme(R.style.SolarizedAppTheme);
|
||||
currentThemeId = R.style.SolarizedAppTheme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
}
|
||||
case Configuration.UI_MODE_NIGHT_YES -> {
|
||||
String defaultDark = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_DARK), "DARK");
|
||||
switch (defaultDark) {
|
||||
case "DARK":
|
||||
case "DARK" -> {
|
||||
setTheme(R.style.AppTheme);
|
||||
currentThemeId = R.style.AppTheme;
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
}
|
||||
case "SOLARIZED_DARK" -> {
|
||||
setTheme(R.style.SolarizedAppTheme);
|
||||
currentThemeId = R.style.SolarizedAppTheme;
|
||||
break;
|
||||
case "BLACK":
|
||||
}
|
||||
case "BLACK" -> {
|
||||
setTheme(R.style.BlackAppTheme);
|
||||
currentThemeId = R.style.BlackAppTheme;
|
||||
break;
|
||||
case "DRACULA":
|
||||
}
|
||||
case "DRACULA" -> {
|
||||
setTheme(R.style.DraculaAppTheme);
|
||||
currentThemeId = R.style.DraculaAppTheme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (currentTheme) {
|
||||
case "LIGHT":
|
||||
case "LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.AppTheme);
|
||||
currentThemeId = R.style.AppTheme;
|
||||
break;
|
||||
case "DARK":
|
||||
}
|
||||
case "DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.AppTheme);
|
||||
currentThemeId = R.style.AppTheme;
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
}
|
||||
case "SOLARIZED_LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.SolarizedAppTheme);
|
||||
currentThemeId = R.style.SolarizedAppTheme;
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
}
|
||||
case "SOLARIZED_DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.SolarizedAppTheme);
|
||||
currentThemeId = R.style.SolarizedAppTheme;
|
||||
break;
|
||||
case "BLACK":
|
||||
}
|
||||
case "BLACK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.BlackAppTheme);
|
||||
currentThemeId = R.style.BlackAppTheme;
|
||||
break;
|
||||
case "DRACULA":
|
||||
}
|
||||
case "DRACULA" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.DraculaAppTheme);
|
||||
currentThemeId = R.style.DraculaAppTheme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -68,62 +68,50 @@ public class BaseBarActivity extends AppCompatActivity {
|
|||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_NO -> {
|
||||
String defaultLight = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_LIGHT), "LIGHT");
|
||||
switch (defaultLight) {
|
||||
case "LIGHT":
|
||||
setTheme(R.style.AppThemeBar);
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
setTheme(R.style.SolarizedAppThemeBar);
|
||||
break;
|
||||
case "LIGHT" -> setTheme(R.style.AppThemeBar);
|
||||
case "SOLARIZED_LIGHT" -> setTheme(R.style.SolarizedAppThemeBar);
|
||||
}
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
}
|
||||
case Configuration.UI_MODE_NIGHT_YES -> {
|
||||
String defaultDark = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_DARK), "DARK");
|
||||
switch (defaultDark) {
|
||||
case "DARK":
|
||||
setTheme(R.style.AppThemeBar);
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
setTheme(R.style.SolarizedAppThemeBar);
|
||||
break;
|
||||
case "BLACK":
|
||||
setTheme(R.style.BlackAppThemeBar);
|
||||
break;
|
||||
case "DRACULA":
|
||||
setTheme(R.style.DraculaAppThemeBar);
|
||||
break;
|
||||
case "DARK" -> setTheme(R.style.AppThemeBar);
|
||||
case "SOLARIZED_DARK" -> setTheme(R.style.SolarizedAppThemeBar);
|
||||
case "BLACK" -> setTheme(R.style.BlackAppThemeBar);
|
||||
case "DRACULA" -> setTheme(R.style.DraculaAppThemeBar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (currentTheme) {
|
||||
case "LIGHT":
|
||||
case "LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.AppThemeBar);
|
||||
break;
|
||||
case "DARK":
|
||||
}
|
||||
case "DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.AppThemeBar);
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
}
|
||||
case "SOLARIZED_LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.SolarizedAppThemeBar);
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
}
|
||||
case "SOLARIZED_DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.SolarizedAppThemeBar);
|
||||
break;
|
||||
case "BLACK":
|
||||
}
|
||||
case "BLACK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.BlackAppThemeBar);
|
||||
break;
|
||||
case "DRACULA":
|
||||
}
|
||||
case "DRACULA" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.DraculaAppThemeBar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -69,62 +69,50 @@ public class BaseTransparentActivity extends AppCompatActivity {
|
|||
if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) {
|
||||
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_NO -> {
|
||||
String defaultLight = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_LIGHT), "LIGHT");
|
||||
switch (defaultLight) {
|
||||
case "LIGHT":
|
||||
setTheme(R.style.Transparent);
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
setTheme(R.style.TransparentSolarized);
|
||||
break;
|
||||
case "LIGHT" -> setTheme(R.style.Transparent);
|
||||
case "SOLARIZED_LIGHT" -> setTheme(R.style.TransparentSolarized);
|
||||
}
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
}
|
||||
case Configuration.UI_MODE_NIGHT_YES -> {
|
||||
String defaultDark = sharedpreferences.getString(getString(R.string.SET_THEME_DEFAULT_DARK), "DARK");
|
||||
switch (defaultDark) {
|
||||
case "DARK":
|
||||
setTheme(R.style.Transparent);
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
setTheme(R.style.TransparentSolarized);
|
||||
break;
|
||||
case "BLACK":
|
||||
setTheme(R.style.TransparentBlack);
|
||||
break;
|
||||
case "DRACULA":
|
||||
setTheme(R.style.TransparentDracula);
|
||||
break;
|
||||
case "DARK" -> setTheme(R.style.Transparent);
|
||||
case "SOLARIZED_DARK" -> setTheme(R.style.TransparentSolarized);
|
||||
case "BLACK" -> setTheme(R.style.TransparentBlack);
|
||||
case "DRACULA" -> setTheme(R.style.TransparentDracula);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (currentTheme) {
|
||||
case "LIGHT":
|
||||
case "LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.Transparent);
|
||||
break;
|
||||
case "DARK":
|
||||
}
|
||||
case "DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.Transparent);
|
||||
break;
|
||||
case "SOLARIZED_LIGHT":
|
||||
}
|
||||
case "SOLARIZED_LIGHT" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
setTheme(R.style.TransparentSolarized);
|
||||
break;
|
||||
case "SOLARIZED_DARK":
|
||||
}
|
||||
case "SOLARIZED_DARK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.TransparentSolarized);
|
||||
break;
|
||||
case "BLACK":
|
||||
}
|
||||
case "BLACK" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.TransparentBlack);
|
||||
break;
|
||||
case "DRACULA":
|
||||
}
|
||||
case "DRACULA" -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
setTheme(R.style.TransparentDracula);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -226,7 +226,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
|
|||
Description description = binding.chart.getDescription();
|
||||
description.setEnabled(false);
|
||||
CustomMarkerView mv = new CustomMarkerView(CheckHomeCacheActivity.this, R.layout.custom_marker_view_layout);
|
||||
binding.chart.setMarkerView(mv);
|
||||
binding.chart.setMarker(mv);
|
||||
|
||||
binding.chart.invalidate();
|
||||
});
|
||||
|
@ -391,7 +391,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
|
|||
Description description = binding.chart2.getDescription();
|
||||
description.setEnabled(true);
|
||||
CustomMarkerView2 mv = new CustomMarkerView2(CheckHomeCacheActivity.this, R.layout.custom_marker_view_layout);
|
||||
binding.chart2.setMarkerView(mv);
|
||||
binding.chart2.setMarker(mv);
|
||||
|
||||
binding.chart2.invalidate();
|
||||
});
|
||||
|
@ -450,7 +450,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
|
|||
@Override
|
||||
public void refreshContent(Entry e, Highlight highlight) {
|
||||
if (xVals.size() > (int) e.getX()) {
|
||||
tvContent.setText(getString(R.string.messages, (int) e.getY()) + "\r\n" + xVals.get((int) e.getX()));
|
||||
tvContent.setText(getString(R.string.messages, (int) e.getY()));
|
||||
}
|
||||
|
||||
// this will perform necessary layouting
|
||||
|
@ -496,7 +496,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
|
|||
text += dateDiffFull(timelineCacheLogsListToAnalyse.get((int) e.getX()).created_at);
|
||||
tvContent.setText(text);
|
||||
} else {
|
||||
tvContent.setText(getString(R.string.messages, (int) e.getY()) + "\r\n" + xVals2.get((int) e.getX()));
|
||||
tvContent.setText(getString(R.string.messages, (int) e.getY()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
@ -34,7 +34,6 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
@ -96,6 +95,31 @@ public class AdminActionActivity extends BaseBarActivity {
|
|||
binding.accounts.setOnClickListener(v -> displayTimeline(ACCOUNT));
|
||||
binding.domains.setOnClickListener(v -> displayTimeline(DOMAIN));
|
||||
|
||||
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
if (canGoBack) {
|
||||
canGoBack = false;
|
||||
ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.buttonContainer, () -> {
|
||||
if (fragmentAdminReport != null) {
|
||||
fragmentAdminReport.onDestroyView();
|
||||
fragmentAdminReport = null;
|
||||
}
|
||||
if (fragmentAdminAccount != null) {
|
||||
fragmentAdminAccount.onDestroyView();
|
||||
fragmentAdminAccount = null;
|
||||
}
|
||||
if (fragmentAdminDomain != null) {
|
||||
fragmentAdminDomain.onDestroyView();
|
||||
fragmentAdminDomain = null;
|
||||
}
|
||||
setTitle(R.string.administration);
|
||||
invalidateOptionsMenu();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void displayTimeline(AdminEnum type) {
|
||||
|
@ -141,15 +165,9 @@ public class AdminActionActivity extends BaseBarActivity {
|
|||
});
|
||||
}
|
||||
switch (type) {
|
||||
case REPORT:
|
||||
setTitle(R.string.reports);
|
||||
break;
|
||||
case ACCOUNT:
|
||||
setTitle(R.string.accounts);
|
||||
break;
|
||||
case DOMAIN:
|
||||
setTitle(R.string.domains);
|
||||
break;
|
||||
case REPORT -> setTitle(R.string.reports);
|
||||
case ACCOUNT -> setTitle(R.string.accounts);
|
||||
case DOMAIN -> setTitle(R.string.domains);
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
@ -165,7 +183,7 @@ public class AdminActionActivity extends BaseBarActivity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
getOnBackPressedDispatcher().onBackPressed();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_filter) {
|
||||
if (getTitle().toString().equalsIgnoreCase(getString(R.string.accounts))) {
|
||||
|
@ -326,31 +344,6 @@ public class AdminActionActivity extends BaseBarActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (canGoBack) {
|
||||
canGoBack = false;
|
||||
ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.buttonContainer, () -> {
|
||||
if (fragmentAdminReport != null) {
|
||||
fragmentAdminReport.onDestroyView();
|
||||
fragmentAdminReport = null;
|
||||
}
|
||||
if (fragmentAdminAccount != null) {
|
||||
fragmentAdminAccount.onDestroyView();
|
||||
fragmentAdminAccount = null;
|
||||
}
|
||||
if (fragmentAdminDomain != null) {
|
||||
fragmentAdminDomain.onDestroyView();
|
||||
fragmentAdminDomain = null;
|
||||
}
|
||||
setTitle(R.string.administration);
|
||||
invalidateOptionsMenu();
|
||||
});
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum AdminEnum {
|
||||
@SerializedName("REPORT")
|
||||
|
|
|
@ -30,6 +30,8 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import app.fedilab.android.BuildConfig;
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.MainActivity;
|
||||
|
@ -98,9 +100,9 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
|
|||
binding.rejectReports.setOnCheckedChangeListener((compoundButton, checked) -> adminDomainBlock.reject_reports = checked);
|
||||
adminVM = new ViewModelProvider(AdminDomainBlockActivity.this).get(AdminVM.class);
|
||||
binding.saveChanges.setOnClickListener(v -> {
|
||||
adminDomainBlock.domain = binding.domain.getText().toString().trim();
|
||||
adminDomainBlock.public_comment = binding.publicComment.getText().toString().trim();
|
||||
adminDomainBlock.private_comment = binding.privateComment.getText().toString().trim();
|
||||
adminDomainBlock.domain = Objects.requireNonNull(binding.domain.getText()).toString().trim();
|
||||
adminDomainBlock.public_comment = Objects.requireNonNull(binding.publicComment.getText()).toString().trim();
|
||||
adminDomainBlock.private_comment = Objects.requireNonNull(binding.privateComment.getText()).toString().trim();
|
||||
adminVM.createOrUpdateDomainBlock(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock)
|
||||
.observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> {
|
||||
if (adminDomainBlockResult != null) {
|
||||
|
|
|
@ -248,9 +248,6 @@ public class AdminReportActivity extends BaseBarActivity {
|
|||
});
|
||||
|
||||
|
||||
//Retrieve relationship with the connected account
|
||||
List<String> accountListToCheck = new ArrayList<>();
|
||||
accountListToCheck.add(account.id);
|
||||
//Animate emojis
|
||||
if (account.emojis != null && account.emojis.size() > 0) {
|
||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false);
|
||||
|
|
Loading…
Reference in a new issue