mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Update some dialogs
This commit is contained in:
parent
e50c0fa9fe
commit
5b4f7d70b6
15 changed files with 656 additions and 798 deletions
|
@ -418,15 +418,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
Intent intent = new Intent(BaseMainActivity.this, CacheActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (id == R.id.nav_about_instance) {
|
||||
Intent intent = new Intent(BaseMainActivity.this, InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
(new InstanceActivity()).show(getSupportFragmentManager(), null);
|
||||
}
|
||||
binding.drawerLayout.close();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
headerMainBinding.instanceInfo.setOnClickListener(v -> startActivity(new Intent(BaseMainActivity.this, InstanceHealthActivity.class)));
|
||||
headerMainBinding.instanceInfo.setOnClickListener(v -> (new InstanceHealthActivity()).show(getSupportFragmentManager(), null));
|
||||
headerMainBinding.accountProfilePicture.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
|
@ -585,8 +583,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
alert.show();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_proxy) {
|
||||
Intent intent = new Intent(BaseMainActivity.this, ProxyActivity.class);
|
||||
startActivity(intent);
|
||||
(new ProxyActivity()).show(getSupportFragmentManager(), null);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -15,9 +15,9 @@ package app.fedilab.android.activities;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -26,18 +26,16 @@ import android.text.SpannableString;
|
|||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import app.fedilab.android.BaseMainActivity;
|
||||
import app.fedilab.android.R;
|
||||
|
@ -48,42 +46,38 @@ import app.fedilab.android.helper.ThemeHelper;
|
|||
import app.fedilab.android.viewmodel.mastodon.InstancesVM;
|
||||
|
||||
|
||||
public class InstanceActivity extends BaseAlertDialogActivity {
|
||||
|
||||
public class InstanceActivity extends DialogFragment {
|
||||
|
||||
ActivityInstanceBinding binding;
|
||||
private boolean applyMaxChar = false;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
binding = ActivityInstanceBinding.inflate(getLayoutInflater());
|
||||
|
||||
setContentView(binding.getRoot());
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||
|
||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().hide();
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(InstanceActivity.this);
|
||||
Dialog dialog = materialAlertDialogBuilder.create();
|
||||
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||
|
||||
final SpannableString contentAbout = new SpannableString(getString(R.string.action_about_instance));
|
||||
contentAbout.setSpan(new UnderlineSpan(), 0, contentAbout.length(), 0);
|
||||
contentAbout.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(this, R.attr.colorPrimary)), 0, contentAbout.length(),
|
||||
contentAbout.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(requireContext(), R.attr.colorPrimary)), 0, contentAbout.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
binding.tos.setText(contentAbout);
|
||||
binding.about.setText(contentAbout);
|
||||
|
||||
final SpannableString contentPrivacy = new SpannableString(getString(R.string.action_privacy_policy));
|
||||
contentPrivacy.setSpan(new UnderlineSpan(), 0, contentPrivacy.length(), 0);
|
||||
contentPrivacy.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(this, R.attr.colorPrimary)), 0, contentPrivacy.length(),
|
||||
contentPrivacy.setSpan(new ForegroundColorSpan(ThemeHelper.getAttColor(requireContext(), R.attr.colorPrimary)), 0, contentPrivacy.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
binding.privacy.setText(contentPrivacy);
|
||||
|
||||
binding.tos.setOnClickListener(v -> Helper.openBrowser(InstanceActivity.this, "https://" + MainActivity.currentInstance + "/about"));
|
||||
binding.privacy.setOnClickListener(v -> Helper.openBrowser(InstanceActivity.this, "https://" + MainActivity.currentInstance + "/privacy-policy"));
|
||||
binding.close.setOnClickListener(
|
||||
|
||||
view -> {
|
||||
binding.about.setOnClickListener(v -> Helper.openBrowser(requireActivity(), "https://" + MainActivity.currentInstance + "/about"));
|
||||
binding.privacy.setOnClickListener(v -> Helper.openBrowser(requireActivity(), "https://" + MainActivity.currentInstance + "/privacy-policy"));
|
||||
binding.close.setOnClickListener( view -> {
|
||||
if (applyMaxChar) {
|
||||
String max_char = binding.maxChar.getText().toString();
|
||||
|
||||
|
@ -96,25 +90,18 @@ public class InstanceActivity extends BaseAlertDialogActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
finish();
|
||||
requireDialog().dismiss();
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
InstancesVM instancesVM = new ViewModelProvider(InstanceActivity.this).get(InstancesVM.class);
|
||||
instancesVM.getInstance(BaseMainActivity.currentInstance).observe(InstanceActivity.this, instanceInfo -> {
|
||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
|
||||
if (instanceInfo == null || instanceInfo.info == null || instanceInfo.info.description == null) {
|
||||
binding.maxCharContainer.setVisibility(View.VISIBLE);
|
||||
binding.instanceContainer.setVisibility(View.GONE);
|
||||
binding.instanceContact.setVisibility(View.GONE);
|
||||
binding.instanceData.setVisibility(View.GONE);
|
||||
binding.contact.setVisibility(View.GONE);
|
||||
int val = sharedpreferences.getInt(getString(R.string.SET_MAX_INSTANCE_CHAR) + MainActivity.currentInstance, -1);
|
||||
if (val != -1) {
|
||||
binding.maxChar.setText(String.valueOf(val));
|
||||
|
@ -123,51 +110,48 @@ public class InstanceActivity extends BaseAlertDialogActivity {
|
|||
|
||||
} else {
|
||||
Instance instance = instanceInfo.info;
|
||||
binding.instanceTitle.setText(instance.title);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
binding.instanceDescription.setText(Html.fromHtml(instance.description, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
binding.instanceDescription.setText(Html.fromHtml(instance.description));
|
||||
if (instance.description == null || instance.description.trim().length() == 0)
|
||||
binding.instanceDescription.setText(getString(R.string.instance_no_description));
|
||||
binding.instanceVersion.setText(instance.version);
|
||||
binding.instanceUri.setText(instance.uri);
|
||||
if (instance.email == null) {
|
||||
binding.instanceContact.hide();
|
||||
}
|
||||
|
||||
Glide.with(InstanceActivity.this)
|
||||
.asDrawable()
|
||||
.placeholder(R.drawable.default_banner)
|
||||
.load(instance.thumbnail)
|
||||
.into(new CustomTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
binding.background.setAlpha(0.2f);
|
||||
binding.background.setBackground(resource);
|
||||
.into(binding.backgroundImage);
|
||||
|
||||
binding.name.setText(instance.title);
|
||||
|
||||
if (instance.description == null || instance.description.trim().length() == 0)
|
||||
binding.description.setText(getString(R.string.instance_no_description));
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
binding.description.setText(Html.fromHtml(instance.description, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
binding.description.setText(Html.fromHtml(instance.description));
|
||||
|
||||
binding.version.setText(instance.version);
|
||||
|
||||
binding.uri.setText(instance.uri);
|
||||
|
||||
if (instance.email == null) {
|
||||
binding.contact.setVisibility(View.GONE);
|
||||
} else {
|
||||
binding.contact.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.instanceContact.setOnClickListener(v -> {
|
||||
binding.contact.setOnClickListener(v -> {
|
||||
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", instance.email, null));
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[Mastodon] - " + instance.uri);
|
||||
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)));
|
||||
});
|
||||
|
||||
binding.instanceData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
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 android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import app.fedilab.android.BaseMainActivity;
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.client.entities.app.InstanceSocial;
|
||||
import app.fedilab.android.databinding.ActivityInstanceSocialBinding;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.helper.ThemeHelper;
|
||||
import app.fedilab.android.viewmodel.mastodon.InstanceSocialVM;
|
||||
|
||||
|
||||
public class InstanceHealthActivity extends BaseAlertDialogActivity {
|
||||
|
||||
private ActivityInstanceSocialBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityInstanceSocialBinding.inflate(getLayoutInflater());
|
||||
|
||||
setContentView(binding.getRoot());
|
||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().hide();
|
||||
|
||||
binding.close.setOnClickListener(view -> finish());
|
||||
|
||||
SpannableString content = new SpannableString(binding.refInstance.getText().toString());
|
||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
||||
binding.refInstance.setText(content);
|
||||
binding.refInstance.setOnClickListener(view -> {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social"));
|
||||
startActivity(browserIntent);
|
||||
});
|
||||
|
||||
checkInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
private void checkInstance() {
|
||||
|
||||
|
||||
InstanceSocialVM instanceSocialVM = new ViewModelProvider(InstanceHealthActivity.this).get(InstanceSocialVM.class);
|
||||
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim()).observe(InstanceHealthActivity.this, instanceSocialList -> {
|
||||
if (instanceSocialList != null && instanceSocialList.instances.size() > 0) {
|
||||
InstanceSocial.Instance instanceSocial = instanceSocialList.instances.get(0);
|
||||
for (InstanceSocial.Instance instance : instanceSocialList.instances) {
|
||||
if (instance.name.equalsIgnoreCase(BaseMainActivity.currentInstance.trim())) {
|
||||
instanceSocial = instance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (instanceSocial.thumbnail != null && !instanceSocial.thumbnail.equals("null"))
|
||||
Glide.with(InstanceHealthActivity.this)
|
||||
.asBitmap()
|
||||
.load(instanceSocial.thumbnail)
|
||||
.into(binding.backGroundImage);
|
||||
binding.name.setText(instanceSocial.name);
|
||||
if (instanceSocial.up) {
|
||||
binding.up.setText(R.string.is_up);
|
||||
binding.up.setTextColor(ThemeHelper.getAttColor(this, R.attr.colorPrimary));
|
||||
} else {
|
||||
binding.up.setText(R.string.is_down);
|
||||
binding.up.setTextColor(ThemeHelper.getAttColor(this, R.attr.colorError));
|
||||
}
|
||||
binding.uptime.setText(getString(R.string.instance_health_uptime, (instanceSocial.uptime * 100)));
|
||||
if (instanceSocial.checked_at != null)
|
||||
binding.checkedAt.setText(getString(R.string.instance_health_checkedat, Helper.dateToString(instanceSocial.checked_at)));
|
||||
binding.values.setText(getString(R.string.instance_health_indication, instanceSocial.version, Helper.withSuffix(instanceSocial.active_users), Helper.withSuffix(instanceSocial.statuses)));
|
||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
||||
binding.mainContainer.setVisibility(View.GONE);
|
||||
binding.noInstance.setVisibility(View.VISIBLE);
|
||||
}
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package app.fedilab.android.activities
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.style.UnderlineSpan
|
||||
import android.view.Window
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import app.fedilab.android.BaseMainActivity
|
||||
import app.fedilab.android.R
|
||||
import app.fedilab.android.client.entities.app.InstanceSocial
|
||||
import app.fedilab.android.databinding.ActivityInstanceSocialBinding
|
||||
import app.fedilab.android.helper.Helper
|
||||
import app.fedilab.android.helper.ThemeHelper
|
||||
import app.fedilab.android.viewmodel.mastodon.InstanceSocialVM
|
||||
import com.bumptech.glide.Glide
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
/* 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>. */
|
||||
class InstanceHealthActivity : DialogFragment() {
|
||||
private var _binding: ActivityInstanceSocialBinding? = null
|
||||
private val binding: ActivityInstanceSocialBinding get() = _binding!!
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
_binding = ActivityInstanceSocialBinding.inflate(layoutInflater)
|
||||
binding.close.setOnClickListener { dialog?.dismiss() }
|
||||
val content = SpannableString(binding.refInstance.text.toString())
|
||||
content.setSpan(UnderlineSpan(), 0, content.length, 0)
|
||||
binding.refInstance.text = content
|
||||
binding.refInstance.setOnClickListener {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social")))
|
||||
}
|
||||
|
||||
val materialAlertDialogBuilder = MaterialAlertDialogBuilder(requireContext())
|
||||
materialAlertDialogBuilder.setView(binding.root)
|
||||
|
||||
val dialog = materialAlertDialogBuilder.create()
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
dialog.setOnShowListener { checkInstance() }
|
||||
|
||||
return dialog
|
||||
}
|
||||
|
||||
private fun checkInstance() {
|
||||
val instanceSocialVM = ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java]
|
||||
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim { it <= ' ' })
|
||||
.observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? ->
|
||||
val instance = instanceSocialList?.instances?.firstOrNull { instance ->
|
||||
instance.name.equals(BaseMainActivity.currentInstance.trim { it <= ' ' }, ignoreCase = true)
|
||||
}
|
||||
if (instance != null) {
|
||||
instance.thumbnail?.takeIf { it != "null" }?.let { thumbnail ->
|
||||
Glide.with(this@InstanceHealthActivity)
|
||||
.asBitmap()
|
||||
.placeholder(R.drawable.default_banner)
|
||||
.load(thumbnail)
|
||||
.into(binding.backgroundImage)
|
||||
}
|
||||
binding.name.text = instance.name
|
||||
if (instance.up) {
|
||||
binding.up.setText(app.fedilab.android.R.string.is_up)
|
||||
binding.up.setTextColor(ThemeHelper.getAttColor(requireContext(), app.fedilab.android.R.attr.colorPrimary))
|
||||
} else {
|
||||
binding.up.setText(app.fedilab.android.R.string.is_down)
|
||||
binding.up.setTextColor(ThemeHelper.getAttColor(requireContext(), app.fedilab.android.R.attr.colorError))
|
||||
}
|
||||
binding.uptime.text = getString(app.fedilab.android.R.string.instance_health_uptime, instance.uptime * 100)
|
||||
if (instance.checked_at != null)
|
||||
binding.checkedAt.text =
|
||||
getString(app.fedilab.android.R.string.instance_health_checkedat, Helper.dateToString(instance.checked_at))
|
||||
binding.values.text = getString(
|
||||
app.fedilab.android.R.string.instance_health_indication,
|
||||
instance.version,
|
||||
Helper.withSuffix(instance.active_users.toLong()),
|
||||
Helper.withSuffix(instance.statuses.toLong())
|
||||
)
|
||||
} else {
|
||||
binding.instanceData.isVisible = false
|
||||
binding.noInstance.isVisible = true
|
||||
}
|
||||
binding.loader.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
|
@ -15,72 +15,64 @@ package app.fedilab.android.activities;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.databinding.ActivityInstanceProfileBinding;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.viewmodel.mastodon.NodeInfoVM;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
public class InstanceProfileActivity extends BaseAlertDialogActivity {
|
||||
|
||||
public class InstanceProfileActivity extends DialogFragment {
|
||||
|
||||
private String instance;
|
||||
private ActivityInstanceProfileBinding binding;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
binding = ActivityInstanceProfileBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
Bundle b = getIntent().getExtras();
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().hide();
|
||||
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||
|
||||
Dialog dialog = materialAlertDialogBuilder.create();
|
||||
|
||||
Bundle b = getArguments();
|
||||
if (b != null)
|
||||
instance = b.getString(Helper.ARG_INSTANCE, null);
|
||||
if (instance == null) {
|
||||
finish();
|
||||
requireDialog().dismiss();
|
||||
}
|
||||
Button close = findViewById(R.id.close);
|
||||
close.setOnClickListener(view -> finish());
|
||||
|
||||
binding.close.setOnClickListener(v -> requireDialog().dismiss());
|
||||
|
||||
NodeInfoVM nodeInfoVM = new ViewModelProvider(InstanceProfileActivity.this).get(NodeInfoVM.class);
|
||||
nodeInfoVM.getNodeInfo(instance).observe(InstanceProfileActivity.this, nodeInfo -> {
|
||||
if (nodeInfo == null) {
|
||||
Toasty.error(InstanceProfileActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
Toasty.error(requireContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
requireDialog().dismiss();
|
||||
return;
|
||||
}
|
||||
binding.name.setText(instance);
|
||||
SpannableString descriptionSpan;
|
||||
binding.userCount.setText(Helper.withSuffix((nodeInfo.usage.users.total)));
|
||||
binding.statusCount.setText(Helper.withSuffix(((nodeInfo.usage.localPosts))));
|
||||
String softwareStr = nodeInfo.software.name + " - ";
|
||||
binding.software.setText(softwareStr);
|
||||
binding.version.setText(nodeInfo.software.version);
|
||||
binding.instanceContainer.setVisibility(View.VISIBLE);
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
return dialog;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -179,8 +179,7 @@ public class LoginActivity extends BaseActivity {
|
|||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_proxy) {
|
||||
Intent intent = new Intent(LoginActivity.this, ProxyActivity.class);
|
||||
startActivity(intent);
|
||||
(new ProxyActivity()).show(getSupportFragmentManager(), null);
|
||||
} else if (id == R.id.action_request_admin) {
|
||||
item.setChecked(!item.isChecked());
|
||||
requestedAdmin = item.isChecked();
|
||||
|
|
|
@ -532,12 +532,11 @@ public class ProfileActivity extends BaseActivity {
|
|||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.instanceInfo.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(ProfileActivity.this, InstanceProfileActivity.class);
|
||||
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||
Bundle b = new Bundle();
|
||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
|
||||
instanceProfileActivity.setArguments(b);
|
||||
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,39 +15,45 @@ package app.fedilab.android.activities;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.databinding.ActivityProxyBinding;
|
||||
|
||||
|
||||
public class ProxyActivity extends BaseAlertDialogActivity {
|
||||
public class ProxyActivity extends DialogFragment {
|
||||
|
||||
private ActivityProxyBinding binding;
|
||||
private int position;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ProxyActivity.this);
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
binding = ActivityProxyBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().hide();
|
||||
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(requireContext());
|
||||
materialAlertDialogBuilder.setView(binding.getRoot());
|
||||
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||
|
||||
//Enable proxy
|
||||
boolean enable_proxy = sharedpreferences.getBoolean(getString(R.string.SET_PROXY_ENABLED), false);
|
||||
binding.enableProxy.setChecked(enable_proxy);
|
||||
position = 0;
|
||||
position = sharedpreferences.getInt(getString(R.string.SET_PROXY_TYPE), 0);
|
||||
String hostVal = sharedpreferences.getString(getString(R.string.SET_PROXY_HOST), "127.0.0.1");
|
||||
int portVal = sharedpreferences.getInt(getString(R.string.SET_PROXY_PORT), 8118);
|
||||
final String login = sharedpreferences.getString(getString(R.string.SET_PROXY_LOGIN), null);
|
||||
|
@ -62,22 +68,17 @@ public class ProxyActivity extends BaseAlertDialogActivity {
|
|||
if (pwd != null && binding.proxyPassword.length() > 0) {
|
||||
binding.proxyPassword.setText(pwd);
|
||||
}
|
||||
ArrayAdapter<CharSequence> adapterTrans = ArrayAdapter.createFromResource(ProxyActivity.this,
|
||||
R.array.proxy_type_choice, android.R.layout.simple_spinner_dropdown_item);
|
||||
binding.type.setAdapter(adapterTrans);
|
||||
binding.type.setSelection(sharedpreferences.getInt(getString(R.string.SET_PROXY_TYPE), 0), false);
|
||||
binding.type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int p, long id) {
|
||||
position = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
if (position == 1) binding.protocol.check(R.id.protocol_socks);
|
||||
binding.protocol.addOnButtonCheckedListener((group, checkedId, isChecked) -> {
|
||||
if (isChecked) {
|
||||
if (checkedId == R.id.protocol_http)
|
||||
position = 0;
|
||||
else
|
||||
position = 1;
|
||||
}
|
||||
});
|
||||
binding.setProxySave.setOnClickListener(view -> {
|
||||
|
||||
materialAlertDialogBuilder.setPositiveButton(R.string.save, (dialog1, which) -> {
|
||||
String hostVal1 = binding.host.getText().toString().trim();
|
||||
String portVal1 = binding.port.getText().toString().trim();
|
||||
String proxy_loginVal = binding.proxyLogin.getText().toString().trim();
|
||||
|
@ -91,18 +92,24 @@ public class ProxyActivity extends BaseAlertDialogActivity {
|
|||
editor.putString(getString(R.string.SET_PROXY_LOGIN), proxy_loginVal);
|
||||
editor.putString(getString(R.string.SET_PROXY_PASSWORD), proxy_passwordVal);
|
||||
editor.apply();
|
||||
finish();
|
||||
});
|
||||
materialAlertDialogBuilder.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
Dialog dialog = materialAlertDialogBuilder.create();
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -365,12 +365,11 @@ public class AdminAccountActivity extends BaseActivity {
|
|||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.instanceInfo.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(AdminAccountActivity.this, InstanceProfileActivity.class);
|
||||
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||
Bundle b = new Bundle();
|
||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
|
||||
instanceProfileActivity.setArguments(b);
|
||||
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -383,12 +383,11 @@ public class AdminReportActivity extends BaseBarActivity {
|
|||
binding.instanceInfo.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.instanceInfo.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(AdminReportActivity.this, InstanceProfileActivity.class);
|
||||
InstanceProfileActivity instanceProfileActivity = new InstanceProfileActivity();
|
||||
Bundle b = new Bundle();
|
||||
b.putString(Helper.ARG_INSTANCE, finalAccountInstance);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
|
||||
instanceProfileActivity.setArguments(b);
|
||||
instanceProfileActivity.show(getSupportFragmentManager(), null);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,173 +14,172 @@
|
|||
You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/background"
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/background_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="0dp"
|
||||
android:alpha="0.2"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/instance_container"
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<!-- Instance title -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/instance_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="20sp" />
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
app:layout_constraintBottom_toTopOf="@id/description"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="Instance" />
|
||||
|
||||
<!-- Instance description -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/instance_description"
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:autoLink="web"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="16sp" />
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
app:layout_constraintBottom_toTopOf="@id/version"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
tools:maxLines="6"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
<!-- Instance version -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/instance_version"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
app:layout_constraintBottom_toTopOf="@id/uri"
|
||||
app:layout_constraintTop_toBottomOf="@id/description"
|
||||
tools:text="4.0" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/uri"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_open_external"
|
||||
app:iconGravity="end"
|
||||
app:layout_constraintBottom_toTopOf="@id/contact"
|
||||
tools:text="instance.test" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/contact"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="@string/contact_instance_admin"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_baseline_mail_outline_24"
|
||||
app:iconGravity="end"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background_image" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/instance_data"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic" />
|
||||
<!-- Instance URI -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/instance_uri"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="name,description,version,uri,contact"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/loader"
|
||||
style="@style/Widget.Material3.LinearProgressIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/background_image"
|
||||
app:layout_constraintStart_toStartOf="@id/background_image"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image" />
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/max_char_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/instance_container"
|
||||
tools:visibility="visible">
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:hint="@string/set_your_max_char_count"
|
||||
app:layout_constraintTop_toBottomOf="@id/background_image">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_your_max_char_count"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/max_char"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:hint="500"
|
||||
android:inputType="number"
|
||||
android:textSize="18sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loader"
|
||||
style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible">
|
||||
android:inputType="number"
|
||||
tools:text="500" />
|
||||
|
||||
<ProgressBar
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/about"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/instance_contact"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:contentDescription="@string/contact_instance_admin"
|
||||
android:src="@drawable/ic_baseline_mail_outline_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/action_about_instance"
|
||||
android:textSize="16sp"
|
||||
app:icon="@drawable/ic_open_external"
|
||||
app:iconGravity="end"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/max_char_container" />
|
||||
app:layout_constraintTop_toBottomOf="@id/max_char_container" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/privacy"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/action_privacy_policy"
|
||||
android:textSize="16sp"
|
||||
app:icon="@drawable/ic_open_external"
|
||||
app:iconGravity="end"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tos" />
|
||||
app:layout_constraintTop_toBottomOf="@id/about" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/close"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:text="@string/close"
|
||||
android:textAlignment="textStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/privacy"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/close" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
@ -1,198 +1,111 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="450dp"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activities.InstanceProfileActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_ground_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.2"
|
||||
android:contentDescription="@string/logo_of_the_instance"
|
||||
android:scaleType="centerCrop" />
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/instance_container"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:visibility="gone">
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/blue_border"
|
||||
android:gravity="center"
|
||||
android:textColor="?colorPrimary"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
tools:text="Instance" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="0dp"
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/name" />
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
tools:text="4.0" />
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/software"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
tools:text="Mastodon" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/user_count_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/user_count"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toStartOf="@id/status_count_label"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/description" />
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status_count_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/status_count"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toStartOf="@id/instance_count_label"
|
||||
app:layout_constraintStart_toEndOf="@id/user_count_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/description" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/instance_count_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/instance_count"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/status_count_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/description" />
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/user_count"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="@id/user_count_label"
|
||||
app:layout_constraintStart_toStartOf="@id/user_count_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/user_count_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status_count"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="@id/status_count_label"
|
||||
app:layout_constraintStart_toStartOf="@id/status_count_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_count_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/instance_count"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="@id/instance_count_label"
|
||||
app:layout_constraintStart_toStartOf="@id/instance_count_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/instance_count_label" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_counters_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="user_count,status_count,instance_count" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/software"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toStartOf="@id/version"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_counters_bottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/software"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_counters_bottom" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_software_version_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="software,version" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lv_accounts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_software_version_bottom" />
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
|
||||
tools:text="500" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/status_count_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/status_count"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/status_count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
|
||||
tools:text="500" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/loader"
|
||||
style="@style/Widget.Material3.LinearProgressIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/close"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/close"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/lv_accounts" />
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/close" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
@ -1,130 +1,112 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="300dp"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activities.InstanceHealthActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:alpha="0.2">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_ground_image"
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/background_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:contentDescription="@string/logo_of_the_instance"
|
||||
android:scaleType="centerCrop" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/instance_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/values"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/checked_at"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uptime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ref_instance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:alpha="0.2"
|
||||
android:contentDescription="@string/logo_of_the_instance"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
tools:text="instance.test" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/values"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
tools:text="version: 4.0\n100 users - 10 k statuses" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/checked_at"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
tools:text="Checked at: 2023-01-01 00:00:00" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/up"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
|
||||
tools:text="Is up!" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/uptime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
|
||||
tools:text="Uptime: 100.00 %" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/ref_instance"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="via instances.social"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/instance_data"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:constraint_referenced_ids="name,values,checked_at,up,uptime,ref_instance"
|
||||
app:flow_verticalGap="12dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/close"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/no_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_instance_reccord"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@id/close"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/loader"
|
||||
style="@style/Widget.Material3.LinearProgressIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/background_image"
|
||||
app:layout_constraintStart_toStartOf="@id/background_image"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/close"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:text="@string/close"
|
||||
android:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/background_image" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,51 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activities.ProxyActivity">
|
||||
android:padding="12dp">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/enable_proxy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:text="@string/proxy_enable" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/enable_proxy"
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/proxy_protocol"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelSmall" />
|
||||
|
||||
<com.google.android.material.button.MaterialButtonToggleGroup
|
||||
android:id="@+id/protocol"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
app:checkedButton="@id/protocol_http"
|
||||
app:selectionRequired="true"
|
||||
app:singleSelection="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/protocol_http"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:checked="false"
|
||||
android:text="@string/proxy_enable"
|
||||
android:textSize="16sp" />
|
||||
android:text="@string/proxy_protocol_http" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/type"
|
||||
android:layout_width="wrap_content"
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/protocol_socks"
|
||||
style="@style/Fedilab.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
android:text="@string/proxy_protocol_socks" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/host_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="3">
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/host"
|
||||
style="@style/Widget.Material3.TextInputEditText.FilledBox"
|
||||
style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dropDownAnchor="@id/login_instance_layout"
|
||||
|
@ -53,18 +64,18 @@
|
|||
android:imeOptions="actionNext"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/port_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1">
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/port"
|
||||
style="@style/Widget.Material3.TextInputEditText.FilledBox"
|
||||
style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dropDownAnchor="@id/login_instance_layout"
|
||||
|
@ -72,36 +83,36 @@
|
|||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/proxy_login_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="10dp">
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/proxy_login"
|
||||
style="@style/Widget.Material3.TextInputEditText.FilledBox"
|
||||
style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dropDownAnchor="@id/login_instance_layout"
|
||||
android:hint="@string/poxy_login"
|
||||
android:imeOptions="actionNext"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/proxy_password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/proxy_password"
|
||||
style="@style/Widget.Material3.TextInputEditText.FilledBox"
|
||||
style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dropDownAnchor="@id/login_instance_layout"
|
||||
|
@ -109,17 +120,7 @@
|
|||
android:imeOptions="actionNext"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/set_proxy_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:maxWidth="150dp"
|
||||
android:text="@string/set_save_changes"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
|
@ -275,6 +275,9 @@
|
|||
<!-- Proxy -->
|
||||
<string name="proxy_set">Proxy</string>
|
||||
<string name="proxy_enable">Enable proxy?</string>
|
||||
<string name="proxy_protocol">Protocol</string>
|
||||
<string name="proxy_protocol_http">HTTP</string>
|
||||
<string name="proxy_protocol_socks">SOCKS</string>
|
||||
<string name="poxy_host">Host</string>
|
||||
<string name="poxy_port">Port</string>
|
||||
<string name="poxy_login">Login</string>
|
||||
|
@ -311,10 +314,6 @@
|
|||
<string name="action_update_filter">Update filter</string>
|
||||
<string name="action_list_add">You have not created a list yet. Tap on the \"+\" button to add a new one.</string>
|
||||
<string name="expand_image">Automatically expand hidden media</string>
|
||||
<string-array name="proxy_type_choice" translatable="false">
|
||||
<item>HTTP</item>
|
||||
<item>SOCKS</item>
|
||||
</string-array>
|
||||
<string name="channel_notif_follow">New follow</string>
|
||||
<string name="channel_notif_boost">New Boost</string>
|
||||
<string name="channel_notif_fav">New Favourite</string>
|
||||
|
|
Loading…
Reference in a new issue