update peertube register ui

This commit is contained in:
0xd9a 2023-01-26 22:32:31 +05:30
parent 98385aa706
commit 557e973fca
13 changed files with 626 additions and 769 deletions

View File

@ -355,9 +355,6 @@
</receiver>
<activity
android:name=".peertube.activities.PeertubeMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".peertube.activities.PeertubeMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
@ -402,11 +399,6 @@
android:name=".peertube.activities.AllLocalPlaylistsActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".peertube.activities.InstancePickerActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".peertube.activities.PlaylistsActivity"
android:configChanges="orientation|screenSize"
@ -450,11 +442,6 @@
android:configChanges="orientation|screenSize"
android:label="@string/settings"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".peertube.activities.PeertubeRegisterActivity"
android:configChanges="orientation|screenSize"
android:label="@string/register_account"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".peertube.activities.PeertubeUploadActivity"
android:configChanges="orientation|screenSize"

View File

@ -14,21 +14,31 @@ package app.fedilab.android.peertube.activities;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.PICK_INSTANCE_SURF;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.showRadioButtonDialogFullInstances;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.addFragment;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.INSTANCE_ADDRESS;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.PICK_INSTANCE;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@ -37,11 +47,15 @@ import app.fedilab.android.databinding.ActivityManageInstancesPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.peertube.client.RetrofitPeertubeAPI;
import app.fedilab.android.peertube.client.data.InstanceData;
import app.fedilab.android.peertube.client.entities.WellKnownNodeinfo;
import app.fedilab.android.peertube.drawer.AboutInstanceAdapter;
import app.fedilab.android.peertube.fragment.FragmentLoginPickInstancePeertube;
import app.fedilab.android.peertube.helper.Helper;
import app.fedilab.android.peertube.helper.HelperInstance;
import app.fedilab.android.peertube.sqlite.StoredInstanceDAO;
import app.fedilab.android.peertube.viewmodel.InfoInstanceVM;
import app.fedilab.android.sqlite.Sqlite;
import es.dmoral.toasty.Toasty;
public class ManageInstancesActivity extends BaseBarActivity implements AboutInstanceAdapter.AllInstancesRemoved {
@ -64,7 +78,7 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
binding.loader.setVisibility(View.VISIBLE);
binding.noAction.setVisibility(View.GONE);
binding.lvInstances.setVisibility(View.GONE);
binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this, true));
binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this));
aboutInstances = new ArrayList<>();
aboutInstanceAdapter = new AboutInstanceAdapter(this.aboutInstances);
aboutInstanceAdapter.allInstancesRemoved = this;
@ -76,6 +90,70 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
}
@SuppressLint("ApplySharedPref")
private void showRadioButtonDialogFullInstances(Activity activity) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.instance_choice);
String instance = HelperInstance.getLiveInstance(activity);
final EditText input = new EditText(activity);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
alt_bld.setView(input);
input.setText(instance);
alt_bld.setPositiveButton(R.string.validate,
(dialog, which) -> new Thread(() -> {
try {
String newInstance = input.getText().toString().trim();
if (!newInstance.startsWith("http")) {
newInstance = "http://" + newInstance;
}
URL url = new URL(newInstance);
newInstance = url.getHost();
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(PREF_USER_INSTANCE, newInstance);
editor.commit();
newInstance = newInstance.trim().toLowerCase();
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
activity.runOnUiThread(() -> {
dialog.dismiss();
Helper.logoutNoRemoval(activity);
});
} else {
activity.runOnUiThread(() -> Toasty.error(activity, activity.getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
}
} catch (Exception e) {
e.printStackTrace();
}
}).start());
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
getSupportFragmentManager().setFragmentResultListener(PICK_INSTANCE, this, (requestKey, result) -> {
new Thread(() -> {
String newInstance = result.getString(INSTANCE_ADDRESS);
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(ManageInstancesActivity.this, newInstance, null).getAboutInstance();
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
new StoredInstanceDAO(ManageInstancesActivity.this, db).insertInstance(aboutInstance, newInstance);
runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(ManageInstancesActivity.this)));
}).start();
getSupportFragmentManager().clearFragmentResultListener(PICK_INSTANCE);
});
addFragment(
getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
null, null, FragmentLoginPickInstancePeertube.class.getName());
});
AlertDialog alert = alt_bld.create();
alert.show();
}
private void manageVIewInfoInstance(List<InstanceData.AboutInstance> aboutInstances) {
binding.loader.setVisibility(View.GONE);
if (aboutInstances == null || aboutInstances.size() == 0) {
@ -106,24 +184,6 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
return super.onOptionsItemSelected(item);
}
@SuppressLint("ApplySharedPref")
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_INSTANCE_SURF && resultCode == Activity.RESULT_OK) {
if (data != null && data.getData() != null) {
new Thread(() -> {
String newInstance = data.getData().toString().trim().toLowerCase();
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(ManageInstancesActivity.this, newInstance, null).getAboutInstance();
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
new StoredInstanceDAO(ManageInstancesActivity.this, db).insertInstance(aboutInstance, newInstance);
runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(ManageInstancesActivity.this)));
}).start();
}
}
}
@Override
public void onAllInstancesRemoved() {
binding.noAction.setVisibility(View.VISIBLE);

View File

@ -25,14 +25,13 @@ import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.addFragment;
import static app.fedilab.android.peertube.helper.Helper.peertubeInformation;
import static app.fedilab.android.peertube.helper.SwitchAccountHelper.switchDialog;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -42,11 +41,8 @@ import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
@ -66,7 +62,6 @@ import com.kobakei.ratethisapp.RateThisApp;
import org.jetbrains.annotations.NotNull;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
@ -92,24 +87,18 @@ import app.fedilab.android.peertube.client.entities.PeertubeInformation;
import app.fedilab.android.peertube.client.entities.Token;
import app.fedilab.android.peertube.client.entities.UserMe;
import app.fedilab.android.peertube.client.entities.UserSettings;
import app.fedilab.android.peertube.client.entities.WellKnownNodeinfo;
import app.fedilab.android.peertube.fragment.DisplayOverviewFragment;
import app.fedilab.android.peertube.fragment.DisplayVideosFragment;
import app.fedilab.android.peertube.fragment.FragmentLoginPickInstancePeertube;
import app.fedilab.android.peertube.helper.Helper;
import app.fedilab.android.peertube.helper.HelperInstance;
import app.fedilab.android.peertube.services.RetrieveInfoService;
import app.fedilab.android.peertube.sqlite.StoredInstanceDAO;
import app.fedilab.android.peertube.viewmodel.TimelineVM;
import app.fedilab.android.sqlite.Sqlite;
import es.dmoral.toasty.Toasty;
public class PeertubeMainActivity extends PeertubeBaseMainActivity {
public static int PICK_INSTANCE = 5641;
public static int PICK_INSTANCE_SURF = 5642;
public static String PICK_INSTANCE = "pick_instance";
public static String INSTANCE_ADDRESS = "instance_address";
public static UserMe userMe;
public static InstanceData.InstanceConfig instanceConfig;
public static TypeOfConnection typeOfConnection = TypeOfConnection.NORMAL;
@ -143,71 +132,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
return true;
};
@SuppressLint("ApplySharedPref")
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.instance_choice);
String instance = HelperInstance.getLiveInstance(activity);
final EditText input = new EditText(activity);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
alt_bld.setView(input);
input.setText(instance);
alt_bld.setPositiveButton(R.string.validate,
(dialog, which) -> new Thread(() -> {
try {
String newInstance = input.getText().toString().trim();
if (!newInstance.startsWith("http")) {
newInstance = "http://" + newInstance;
}
URL url = new URL(newInstance);
newInstance = url.getHost();
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(PREF_USER_INSTANCE, newInstance);
editor.commit();
if (storeInDb) {
newInstance = newInstance.trim().toLowerCase();
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
activity.runOnUiThread(() -> {
dialog.dismiss();
Helper.logoutNoRemoval(activity);
});
} else {
activity.runOnUiThread(() -> {
dialog.dismiss();
Intent intent = new Intent(activity, PeertubeMainActivity.class);
activity.startActivity(intent);
});
}
} else {
activity.runOnUiThread(() -> Toasty.error(activity, activity.getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
}
} catch (Exception e) {
e.printStackTrace();
}
}).start());
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
Intent intent = new Intent(activity, InstancePickerActivity.class);
if (storeInDb) {
activity.startActivityForResult(intent, PICK_INSTANCE_SURF);
} else {
activity.startActivityForResult(intent, PICK_INSTANCE);
}
});
AlertDialog alert = alt_bld.create();
alert.show();
}
private void setTitleCustom(int titleRId) {
Toolbar toolbar = findViewById(R.id.toolbar);
@ -224,6 +148,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
binding = null;
}
@SuppressLint("ApplySharedPref")
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -448,8 +373,19 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
//Instance
if (HelperInstance.getLiveInstance(PeertubeMainActivity.this) == null) {
Intent intent = new Intent(PeertubeMainActivity.this, InstancePickerActivity.class);
startActivityForResult(intent, PICK_INSTANCE);
getSupportFragmentManager().setFragmentResultListener(PICK_INSTANCE, this, (requestKey, result) -> {
String instance = result.getString(INSTANCE_ADDRESS, null);
if (instance != null) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(PREF_USER_INSTANCE, instance);
editor.commit();
PeertubeMainActivity.this.recreate();
}
getSupportFragmentManager().clearFragmentResultListener(requestKey);
});
addFragment(
getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
null, null, FragmentLoginPickInstancePeertube.class.getName());
}
fetchRecentAccounts(PeertubeMainActivity.this, headerMainBinding);
@ -758,22 +694,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
}
}
@SuppressLint("ApplySharedPref")
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_INSTANCE && resultCode == Activity.RESULT_OK) {
if (data != null && data.getData() != null) {
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(PeertubeMainActivity.this);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(PREF_USER_INSTANCE, String.valueOf(data.getData()));
editor.commit();
recreate();
}
}
}
public enum TypeOfConnection {
NORMAL,
SURFING

View File

@ -15,14 +15,10 @@ package app.fedilab.android.peertube.drawer;
* see <http://www.gnu.org/licenses>. */
import static android.app.Activity.RESULT_OK;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
import static app.fedilab.android.peertube.helper.Helper.peertubeInformation;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.Html;
import android.text.SpannableString;
@ -52,6 +48,8 @@ public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private Context context;
public ActionClick actionClick;
public InstanceAdapter(List<Instance> instances) {
this.instances = instances;
}
@ -146,11 +144,7 @@ public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.binding.followersInstance.setText(context.getString(R.string.followers_instance, String.valueOf(instance.getTotalInstanceFollowers())));
holder.binding.pickup.setOnClickListener(v -> {
Intent data = new Intent();
String instanceHost = instance.getHost();
data.setData(Uri.parse(instanceHost));
((Activity) context).setResult(RESULT_OK, data);
((Activity) context).finish();
actionClick.instance(instance.getHost());
});
}
@ -174,4 +168,7 @@ public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}
}
public interface ActionClick {
void instance(String instance);
}
}

View File

@ -1,4 +1,4 @@
package app.fedilab.android.peertube.activities;
package app.fedilab.android.peertube.fragment;
/* Copyright 2023 Thomas Schneider
*
* This file is a part of Fedilab
@ -15,22 +15,26 @@ package app.fedilab.android.peertube.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.INSTANCE_ADDRESS;
import static app.fedilab.android.peertube.helper.Helper.peertubeInformation;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
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.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@ -41,8 +45,8 @@ import java.util.List;
import java.util.Map;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityInstancePickerPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.databinding.FragmentLoginPickInstancePeertubeBinding;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.peertube.client.APIResponse;
import app.fedilab.android.peertube.client.data.InstanceData;
import app.fedilab.android.peertube.client.entities.InstanceParams;
@ -52,7 +56,7 @@ import app.fedilab.android.peertube.viewmodel.InstancesVM;
import es.dmoral.toasty.Toasty;
public class InstancePickerActivity extends BaseBarActivity {
public class FragmentLoginPickInstancePeertube extends Fragment implements InstanceAdapter.ActionClick {
boolean[] checkedItemsCategory;
@ -63,28 +67,24 @@ public class InstancePickerActivity extends BaseBarActivity {
String[] itemsLabelLanguage;
InstanceParams instanceParams;
private InstancesVM viewModel;
private ActivityInstancePickerPeertubeBinding binding;
private FragmentLoginPickInstancePeertubeBinding binding;
@Nullable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
binding = ActivityInstancePickerPeertubeBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentLoginPickInstancePeertubeBinding.inflate(inflater, container, false);
binding.loader.setVisibility(View.VISIBLE);
String[] channelSensitive = new String[]{"do_not_list", "blur", "display", "no_opinion"};
String[] channelSensitivesLabel = new String[]{getString(R.string.do_not_list), getString(R.string.blur), getString(R.string.display), getString(R.string.no_opinion)};
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(InstancePickerActivity.this,
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(requireActivity(),
android.R.layout.simple_spinner_dropdown_item, channelSensitivesLabel);
binding.sensitive.setAdapter(adapterChannel);
viewModel = new ViewModelProvider(InstancePickerActivity.this).get(InstancesVM.class);
viewModel = new ViewModelProvider(this).get(InstancesVM.class);
binding.sensitive.setSelection(1, false);
binding.sensitive.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@ -92,7 +92,7 @@ public class InstancePickerActivity extends BaseBarActivity {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
instanceParams.setNsfwPolicy(channelSensitive[position]);
binding.loader.setVisibility(View.VISIBLE);
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, apiResponse -> manageVIewInstance(apiResponse));
viewModel.getInstances(instanceParams).observe(getViewLifecycleOwner(), apiResponse -> manageVIewInstance(apiResponse));
}
@Override
@ -108,7 +108,7 @@ public class InstancePickerActivity extends BaseBarActivity {
itemsKeyLanguage = new String[languages.size()];
binding.pickupLanguages.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(InstancePickerActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(requireContext(), app.fedilab.android.mastodon.helper.Helper.dialogStyle());
int i = 0;
if (languages.size() > 0) {
@ -143,7 +143,7 @@ public class InstancePickerActivity extends BaseBarActivity {
if (between.length() == 0) between = " ";
String tag = " " + lang + " ";
stringBuilder.append(tag);
stringBuilder.setSpan(new RoundedBackgroundSpan(InstancePickerActivity.this), stringBuilder.length() - tag.length(), stringBuilder.length() - tag.length() + tag.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
stringBuilder.setSpan(new RoundedBackgroundSpan(requireContext()), stringBuilder.length() - tag.length(), stringBuilder.length() - tag.length() + tag.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
stringBuilder.append(" ");
}
}
@ -157,7 +157,7 @@ public class InstancePickerActivity extends BaseBarActivity {
binding.languagesView.setVisibility(View.GONE);
}
binding.loader.setVisibility(View.VISIBLE);
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
viewModel.getInstances(instanceParams).observe(getViewLifecycleOwner(), this::manageVIewInstance);
});
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
@ -175,7 +175,7 @@ public class InstancePickerActivity extends BaseBarActivity {
binding.pickupCategories.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(InstancePickerActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(requireContext(), app.fedilab.android.mastodon.helper.Helper.dialogStyle());
int i = 0;
if (categories.size() > 0) {
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
@ -208,7 +208,7 @@ public class InstancePickerActivity extends BaseBarActivity {
if (between.length() == 0) between = " ";
String tag = " " + cat + " ";
stringBuilder.append(tag);
stringBuilder.setSpan(new RoundedBackgroundSpan(InstancePickerActivity.this), stringBuilder.length() - tag.length(), stringBuilder.length() - tag.length() + tag.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
stringBuilder.setSpan(new RoundedBackgroundSpan(requireContext()), stringBuilder.length() - tag.length(), stringBuilder.length() - tag.length() + tag.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
stringBuilder.append(" ");
}
}
@ -222,7 +222,7 @@ public class InstancePickerActivity extends BaseBarActivity {
binding.categoriesView.setVisibility(View.GONE);
}
binding.loader.setVisibility(View.VISIBLE);
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
viewModel.getInstances(instanceParams).observe(getViewLifecycleOwner(), this::manageVIewInstance);
});
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> dialog.dismiss());
@ -235,41 +235,40 @@ public class InstancePickerActivity extends BaseBarActivity {
binding.loader.setVisibility(View.VISIBLE);
setTitle(R.string.instances_picker);
instanceParams = new InstanceParams();
instanceParams.setNsfwPolicy(channelSensitive[1]);
viewModel.getInstances(instanceParams).observe(InstancePickerActivity.this, this::manageVIewInstance);
viewModel.getInstances(instanceParams).observe(getViewLifecycleOwner(), this::manageVIewInstance);
return binding.getRoot();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
public void manageVIewInstance(APIResponse apiResponse) {
binding.loader.setVisibility(View.GONE);
if (apiResponse.getError() != null) {
Toasty.error(InstancePickerActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
Toasty.error(requireContext(), apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
return;
}
List<InstanceData.Instance> instances = apiResponse.getInstances();
RecyclerView lv_instances = findViewById(R.id.lv_instances);
if ((instances == null || instances.size() == 0)) {
binding.noAction.setVisibility(View.VISIBLE);
lv_instances.setVisibility(View.GONE);
binding.lvInstances.setVisibility(View.GONE);
} else {
binding.noAction.setVisibility(View.GONE);
lv_instances.setVisibility(View.VISIBLE);
binding.lvInstances.setVisibility(View.VISIBLE);
InstanceAdapter instanceAdapter = new InstanceAdapter(instances);
lv_instances.setAdapter(instanceAdapter);
lv_instances.setLayoutManager(new LinearLayoutManager(InstancePickerActivity.this));
instanceAdapter.actionClick = this;
binding.lvInstances.setAdapter(instanceAdapter);
binding.lvInstances.setLayoutManager(new LinearLayoutManager(requireContext()));
}
}
@Override
public void instance(String instance) {
Bundle bundle = new Bundle();
bundle.putString(INSTANCE_ADDRESS, instance);
Helper.addFragment(
getParentFragmentManager(), android.R.id.content, new PeertubeRegisterFragment(),
bundle, null, PeertubeRegisterFragment.class.getName());
}
}

View File

@ -1,4 +1,4 @@
package app.fedilab.android.peertube.activities;
package app.fedilab.android.peertube.fragment;
/* Copyright 2023 Thomas Schneider
*
* This file is a part of Fedilab
@ -14,22 +14,22 @@ package app.fedilab.android.peertube.activities;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.PICK_INSTANCE;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.INSTANCE_ADDRESS;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Patterns;
import android.view.MenuItem;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@ -37,102 +37,88 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityRegisterPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.databinding.FragmentLoginRegisterPeertubeBinding;
import app.fedilab.android.peertube.client.APIResponse;
import app.fedilab.android.peertube.client.RetrofitPeertubeAPI;
import app.fedilab.android.peertube.client.entities.AccountCreation;
import es.dmoral.toasty.Toasty;
public class PeertubeRegisterActivity extends BaseBarActivity {
public class PeertubeRegisterFragment extends Fragment {
private String instance;
private ActivityRegisterPeertubeBinding binding;
private FragmentLoginRegisterPeertubeBinding binding;
@SuppressLint("SetTextI18n")
@Nullable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityRegisterPeertubeBinding.inflate(getLayoutInflater());
View mainView = binding.getRoot();
setContentView(mainView);
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentLoginRegisterPeertubeBinding.inflate(inflater, container, false);
View root = binding.getRoot();
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
binding.titleLoginInstance.setVisibility(View.VISIBLE);
binding.loginInstanceLayout.setVisibility(View.VISIBLE);
binding.username.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.username.getText() != null) {
binding.loginUsername.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.loginUsername.getText() != null) {
Pattern patternUsername = Pattern.compile("^[a-z0-9._]{1,50}$");
Matcher matcherMaxId = patternUsername.matcher(binding.username.getText().toString());
Matcher matcherMaxId = patternUsername.matcher(binding.loginUsername.getText().toString());
if (!matcherMaxId.matches()) {
binding.username.setError(getString(R.string.username_error));
binding.loginUsername.setError(getString(R.string.username_error));
}
}
});
binding.instanceHelp.setOnClickListener(v -> {
Intent intent = new Intent(PeertubeRegisterActivity.this, InstancePickerActivity.class);
startActivityForResult(intent, PICK_INSTANCE);
});
binding.email.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.email.getText() != null) {
binding.loginEmail.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.loginEmail.getText() != null) {
Pattern patternUsername = Patterns.EMAIL_ADDRESS;
Matcher matcherMaxId = patternUsername.matcher(binding.email.getText().toString());
Matcher matcherMaxId = patternUsername.matcher(binding.loginEmail.getText().toString());
if (!matcherMaxId.matches()) {
binding.email.setError(getString(R.string.email_error));
binding.loginEmail.setError(getString(R.string.email_error));
}
}
});
binding.password.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.password.getText() != null) {
if (binding.password.getText().length() < 6) {
binding.password.setError(getString(R.string.password_length_error));
binding.loginPassword.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.loginPassword.getText() != null) {
if (binding.loginPassword.getText().length() < 6) {
binding.loginPassword.setError(getString(R.string.password_length_error));
}
}
});
binding.passwordConfirm.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.passwordConfirm.getText() != null && binding.password.getText() != null) {
if (binding.passwordConfirm.getText().toString().compareTo(binding.password.getText().toString()) != 0) {
binding.passwordConfirm.setError(getString(R.string.password));
binding.loginPasswordConfirm.setOnFocusChangeListener((view, focused) -> {
if (!focused && binding.loginPasswordConfirm.getText() != null && binding.loginPassword.getText() != null) {
if (binding.loginPasswordConfirm.getText().toString().compareTo(binding.loginPassword.getText().toString()) != 0) {
binding.loginPasswordConfirm.setError(getString(R.string.password));
}
}
});
setTextAgreement();
binding.signup.setOnClickListener(view -> {
binding.errorMessage.setVisibility(View.GONE);
if (binding.username.getText() == null || binding.email.getText() == null || binding.password.getText() == null || binding.passwordConfirm.getText() == null || binding.username.getText().toString().trim().length() == 0 || binding.email.getText().toString().trim().length() == 0 ||
binding.password.getText().toString().trim().length() == 0 || binding.passwordConfirm.getText().toString().trim().length() == 0 || !binding.agreement.isChecked()) {
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.all_field_filled)).show();
if (binding.loginUsername.getText() == null || binding.loginEmail.getText() == null || binding.loginPassword.getText() == null || binding.loginPasswordConfirm.getText() == null || binding.loginUsername.getText().toString().trim().length() == 0 || binding.loginEmail.getText().toString().trim().length() == 0 ||
binding.loginPassword.getText().toString().trim().length() == 0 || binding.loginPasswordConfirm.getText().toString().trim().length() == 0 || !binding.agreement.isChecked()) {
Toasty.error(requireContext(), getString(R.string.all_field_filled)).show();
return;
}
if (!binding.password.getText().toString().trim().equals(binding.passwordConfirm.getText().toString().trim())) {
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_error)).show();
if (!binding.loginPassword.getText().toString().trim().equals(binding.loginPasswordConfirm.getText().toString().trim())) {
Toasty.error(requireContext(), getString(R.string.password_error)).show();
return;
}
if (!Patterns.EMAIL_ADDRESS.matcher(binding.email.getText().toString().trim()).matches()) {
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.email_error)).show();
if (!Patterns.EMAIL_ADDRESS.matcher(binding.loginEmail.getText().toString().trim()).matches()) {
Toasty.error(requireContext(), getString(R.string.email_error)).show();
return;
}
String[] emailArray = binding.email.getText().toString().split("@");
String[] emailArray = binding.loginEmail.getText().toString().split("@");
if (binding.password.getText().toString().trim().length() < 8) {
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_too_short)).show();
if (binding.loginPassword.getText().toString().trim().length() < 8) {
Toasty.error(requireContext(), getString(R.string.password_too_short)).show();
return;
}
if (binding.username.getText().toString().matches("[a-z0-9_]")) {
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.username_error)).show();
if (binding.loginUsername.getText().toString().matches("[a-z0-9_]")) {
Toasty.error(requireContext(), getString(R.string.username_error)).show();
return;
}
binding.signup.setEnabled(false);
@ -152,15 +138,15 @@ public class PeertubeRegisterActivity extends BaseBarActivity {
}
AccountCreation accountCreation = new AccountCreation();
accountCreation.setEmail(binding.email.getText().toString().trim());
accountCreation.setPassword(binding.password.getText().toString().trim());
accountCreation.setPasswordConfirm(binding.passwordConfirm.getText().toString().trim());
accountCreation.setUsername(binding.username.getText().toString().trim());
accountCreation.setEmail(binding.loginEmail.getText().toString().trim());
accountCreation.setPassword(binding.loginPassword.getText().toString().trim());
accountCreation.setPasswordConfirm(binding.loginPasswordConfirm.getText().toString().trim());
accountCreation.setUsername(binding.loginUsername.getText().toString().trim());
accountCreation.setInstance(instance);
new Thread(() -> {
try {
APIResponse apiResponse = new RetrofitPeertubeAPI(PeertubeRegisterActivity.this, instance, null).createAccount(accountCreation);
APIResponse apiResponse = new RetrofitPeertubeAPI(requireContext(), instance, null).createAccount(accountCreation);
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
if (apiResponse.getError() != null) {
@ -186,11 +172,11 @@ public class PeertubeRegisterActivity extends BaseBarActivity {
return;
}
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(PeertubeRegisterActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(requireContext(), app.fedilab.android.mastodon.helper.Helper.dialogStyle());
dialogBuilder.setCancelable(false);
dialogBuilder.setPositiveButton(R.string.validate, (dialog, which) -> {
dialog.dismiss();
finish();
getParentFragmentManager().popBackStack();
});
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.setTitle(getString(R.string.account_created));
@ -205,53 +191,29 @@ public class PeertubeRegisterActivity extends BaseBarActivity {
});
setTitle(R.string.create_an_account);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
if (getArguments() != null) {
String instance = getArguments().getString(INSTANCE_ADDRESS, null);
binding.loginInstance.setText(instance);
setTextAgreement();
}
return super.onOptionsItemSelected(item);
}
@SuppressLint("ApplySharedPref")
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_INSTANCE && resultCode == Activity.RESULT_OK) {
if (data != null && data.getData() != null) {
String instance = String.valueOf(data.getData());
binding.loginInstance.setText(instance);
binding.loginInstance.setSelection(instance.length());
setTextAgreement();
}
}
return root;
}
private void setTextAgreement() {
TextView agreement_text = findViewById(R.id.agreement_text);
String tos = getString(R.string.tos);
String serverrules = getString(R.string.server_rules);
String content_agreement = null;
agreement_text.setMovementMethod(null);
agreement_text.setText(null);
binding.agreement.setMovementMethod(null);
binding.agreement.setText(null);
if (binding.loginInstance.getText() != null) {
content_agreement = getString(R.string.agreement_check_peertube,
"<a href='https://" + binding.loginInstance.getText().toString() + "/about/instance#terms-section' >" + tos + "</a>"
);
}
agreement_text.setMovementMethod(LinkMovementMethod.getInstance());
binding.agreement.setMovementMethod(LinkMovementMethod.getInstance());
if (content_agreement != null) {
agreement_text.setText(Html.fromHtml(content_agreement));
binding.agreement.setText(Html.fromHtml(content_agreement));
}
}

View File

@ -14,7 +14,6 @@ package app.fedilab.android.ui.fragment;
* 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.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -25,7 +24,7 @@ import androidx.fragment.app.Fragment;
import app.fedilab.android.databinding.FragmentLoginJoinBinding;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.peertube.activities.PeertubeRegisterActivity;
import app.fedilab.android.peertube.fragment.FragmentLoginPickInstancePeertube;
public class FragmentLoginJoin extends Fragment {
@ -41,10 +40,9 @@ public class FragmentLoginJoin extends Fragment {
getParentFragmentManager(), android.R.id.content, new FragmentLoginPickInstanceMastodon(),
null, null, FragmentLoginPickInstanceMastodon.class.getName());
});
binding.joinPeertube.setOnClickListener(v -> {
Intent mainActivity = new Intent(requireActivity(), PeertubeRegisterActivity.class);
startActivity(mainActivity);
});
binding.joinPeertube.setOnClickListener(v -> Helper.addFragment(
getParentFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
null, null, FragmentLoginPickInstancePeertube.class.getName()));
return root;
}

View File

@ -67,8 +67,8 @@ public class FragmentLoginRegisterMastodon extends Fragment {
"<a href='https://" + instance + "/about/more' >" + serverrules + "</a>",
"<a href='https://" + instance + "/terms' >" + tos + "</a>"
);
binding.agreementText.setMovementMethod(LinkMovementMethod.getInstance());
binding.agreementText.setText(Html.fromHtml(content_agreement));
binding.agreement.setMovementMethod(LinkMovementMethod.getInstance());
binding.agreement.setText(Html.fromHtml(content_agreement));
} else {
binding.loginInstance.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
@ -80,8 +80,8 @@ public class FragmentLoginRegisterMastodon extends Fragment {
"<a href='https://" + binding.loginInstance.getText() + "/about/more' >" + serverrules + "</a>",
"<a href='https://" + binding.loginInstance.getText() + "/terms' >" + tos + "</a>"
);
binding.agreementText.setMovementMethod(LinkMovementMethod.getInstance());
binding.agreementText.setText(Html.fromHtml(content_agreement));
binding.agreement.setMovementMethod(LinkMovementMethod.getInstance());
binding.agreement.setText(Html.fromHtml(content_agreement));
} else {
binding.loginInstanceLayout.setError(getString(R.string.instance_not_valid));
}

View File

@ -14,148 +14,146 @@
You should have received a copy of the GNU General Public License along with Fedilab; if not,
see <http://www.gnu.org/licenses>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView 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="match_parent"
android:background="?android:windowBackground"
android:orientation="vertical"
android:padding="12dp">
android:background="?android:windowBackground">
<TextView
android:id="@+id/error_message"
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@drawable/red_border"
android:gravity="center"
android:padding="5dp"
android:textColor="?colorError"
android:visibility="gone" />
android:orientation="vertical"
android:padding="12dp">
<TextView
android:id="@+id/invitation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/validation_needed"
android:textColor="?colorError"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_instance_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_instance"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/error_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance"
android:inputType="textPersonName"
android:maxLength="30"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_gravity="center"
android:background="@drawable/red_border"
android:gravity="center"
android:padding="6dp"
android:textColor="?colorError"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_username"
<TextView
android:id="@+id/invitation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:inputType="textPersonName"
android:maxLength="30"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_gravity="center"
android:gravity="center"
android:text="@string/validation_needed"
android:textColor="?colorError"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_email"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_instance_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_instance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance"
android:importantForAutofill="no"
android:inputType="textWebEditText"
android:singleLine="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email_indicator"
android:textSize="12sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_marginTop="12dp"
app:errorEnabled="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_indicator"
android:textSize="12sp" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:hint="@string/username"
android:inputType="text"
android:maxLength="30"
android:singleLine="true" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_confirm_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password_confirm"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password_confirm"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_marginTop="12dp"
app:errorEnabled="true"
app:helperText="@string/email_indicator">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="emailAddress"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:singleLine="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true"
app:helperText="@string/password_indicator">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_confirm_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="@string/password_confirm"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
tools:text="@string/agreement_check_peertube" />
<TextView
android:id="@+id/agreement_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/sign_up" />
<com.google.android.material.button.MaterialButton
android:id="@+id/signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sign_up" />
</androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout>
</ScrollView>

View File

@ -1,161 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2023 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>.
-->
<androidx.drawerlayout.widget.DrawerLayout 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="match_parent"
android:layout_margin="@dimen/fab_margin">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".peertube.activities.InstancePickerActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/fab_margin">
<androidx.cardview.widget.CardView
android:id="@+id/filters_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/pickup_categories"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/pickup_categories"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/pickup_languages"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/pickup_languages"
app:layout_constraintStart_toEndOf="@id/pickup_categories"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/categories_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_baseline_category_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pickup_categories" />
<TextView
android:id="@+id/languages_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_baseline_forum_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/categories_view" />
<TextView
android:id="@+id/text_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:labelFor="@+id/sensitive"
android:text="@string/sensitive_video"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/languages_view" />
<Spinner
android:id="@+id/sensitive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintStart_toEndOf="@+id/text_spinner"
app:layout_constraintTop_toBottomOf="@+id/languages_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- Main Loader -->
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lv_instances"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />
<RelativeLayout
android:id="@+id/no_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dp"
android:text="@string/action_instance_empty_content"
android:textSize="25sp" />
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -1,204 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2023 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>.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:gravity="center" />
</LinearLayout>
<TextView
android:id="@+id/error_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@drawable/red_border"
android:gravity="center"
android:padding="5dp"
android:textColor="?colorError"
android:visibility="gone" />
<LinearLayout
android:id="@+id/title_login_instance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:visibility="gone">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_instance_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:layout_constraintEnd_toEndOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_instance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/title_instance_login"
android:importantForAutofill="no"
android:inputType="textWebEditText"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/instance_help"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_gravity="center_vertical"
android:padding="2dp"
android:text="@string/help" />
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:importantForAutofill="no"
android:inputType="text"
android:maxLength="50" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email"
android:importantForAutofill="no"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/email_indicator"
android:textSize="12sp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:importantForAutofill="no"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/password_indicator"
android:textSize="12sp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password_confirm"
android:importantForAutofill="no"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<CheckBox
android:id="@+id/agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/agreement_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="@string/agreement_check_peertube" />
</LinearLayout>
<Button
android:id="@+id/signup"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/sign_up" />
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2023 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>.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:windowBackground">
<com.google.android.material.card.MaterialCardView
android:id="@+id/filters_container"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="12dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/pickup_categories"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/pickup_categories"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/pickup_languages"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/pickup_languages"
app:layout_constraintStart_toEndOf="@id/pickup_categories"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/categories_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_baseline_category_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pickup_categories" />
<TextView
android:id="@+id/languages_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_baseline_forum_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/categories_view" />
<TextView
android:id="@+id/text_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:labelFor="@+id/sensitive"
android:text="@string/sensitive_video"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/languages_view" />
<Spinner
android:id="@+id/sensitive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintStart_toEndOf="@+id/text_spinner"
app:layout_constraintTop_toBottomOf="@+id/languages_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Main Loader -->
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lv_instances"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />
<RelativeLayout
android:id="@+id/no_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dp"
android:text="@string/action_instance_empty_content"
android:textSize="25sp" />
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2023 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>.
-->
<ScrollView 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="match_parent"
android:background="?android:windowBackground">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/error_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/red_border"
android:gravity="center"
android:padding="6dp"
android:textColor="?colorError"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_instance_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_instance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/instance"
android:importantForAutofill="no"
android:inputType="textWebEditText"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:hint="@string/username"
android:inputType="text"
android:maxLength="50"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true"
app:helperText="@string/email_indicator">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="emailAddress"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true"
app:helperText="@string/password_indicator">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_password_confirm_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="@string/password_confirm"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/agreement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
tools:text="@string/agreement_check_peertube" />
<com.google.android.material.button.MaterialButton
android:id="@+id/signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/sign_up" />
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>