Prepares registrations
This commit is contained in:
parent
819edab378
commit
b21c94e763
|
@ -235,6 +235,11 @@
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name" />
|
android:label="@string/app_name" />
|
||||||
|
<activity
|
||||||
|
android:name="app.fedilab.android.activities.PeertubeRegisterActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name" />
|
||||||
<activity
|
<activity
|
||||||
android:name="app.fedilab.android.activities.MastodonShareRegisterActivity"
|
android:name="app.fedilab.android.activities.MastodonShareRegisterActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
|
|
@ -218,6 +218,7 @@ public class LoginActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView create_an_account_message = findViewById(R.id.create_an_account);
|
TextView create_an_account_message = findViewById(R.id.create_an_account);
|
||||||
|
TextView create_an_account_peertube = findViewById(R.id.create_an_account_peertube);
|
||||||
SpannableString content_create = new SpannableString(getString(R.string.join_mastodon));
|
SpannableString content_create = new SpannableString(getString(R.string.join_mastodon));
|
||||||
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||||
if (theme == Helper.THEME_DARK)
|
if (theme == Helper.THEME_DARK)
|
||||||
|
@ -236,6 +237,25 @@ public class LoginActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
content_create = new SpannableString(getString(R.string.join_peertube));
|
||||||
|
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||||
|
if (theme == Helper.THEME_DARK)
|
||||||
|
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.dark_link_toot)), 0, content_create.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
else if (theme == Helper.THEME_BLACK)
|
||||||
|
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.black_link_toot)), 0, content_create.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
else if (theme == Helper.THEME_LIGHT)
|
||||||
|
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.mastodonC4)), 0, content_create.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
create_an_account_peertube.setText(content_create);
|
||||||
|
create_an_account_peertube.setOnClickListener(v -> {
|
||||||
|
Intent mainActivity = new Intent(LoginActivity.this, PeertubeRegisterActivity.class);
|
||||||
|
startActivity(mainActivity);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
login_instance = findViewById(R.id.login_instance);
|
login_instance = findViewById(R.id.login_instance);
|
||||||
login_uid = findViewById(R.id.login_uid);
|
login_uid = findViewById(R.id.login_uid);
|
||||||
login_passwd = findViewById(R.id.login_passwd);
|
login_passwd = findViewById(R.id.login_passwd);
|
||||||
|
|
|
@ -165,12 +165,12 @@ public class MastodonRegisterActivity extends BaseActivity implements OnRetrieve
|
||||||
reg_category.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
|
reg_category.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
|
public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
|
||||||
new RetrieveInstanceRegAsyncTask(MastodonRegisterActivity.this, itemA[position], MastodonRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
new RetrieveInstanceRegAsyncTask(MastodonRegisterActivity.this, RetrieveInstanceRegAsyncTask.instanceType.MASTODON, itemA[position], MastodonRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
new RetrieveInstanceRegAsyncTask(MastodonRegisterActivity.this, "general", MastodonRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
new RetrieveInstanceRegAsyncTask(MastodonRegisterActivity.this, RetrieveInstanceRegAsyncTask.instanceType.MASTODON,"general", MastodonRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
signup = findViewById(R.id.signup);
|
signup = findViewById(R.id.signup);
|
||||||
EditText username = findViewById(R.id.username);
|
EditText username = findViewById(R.id.username);
|
||||||
|
|
|
@ -0,0 +1,308 @@
|
||||||
|
/* Copyright 2017 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>. */
|
||||||
|
package app.fedilab.android.activities;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.asynctasks.CreateMastodonAccountAsyncTask;
|
||||||
|
import app.fedilab.android.asynctasks.RetrieveInstanceRegAsyncTask;
|
||||||
|
import app.fedilab.android.client.APIResponse;
|
||||||
|
import app.fedilab.android.client.Entities.AccountCreation;
|
||||||
|
import app.fedilab.android.client.Entities.InstanceReg;
|
||||||
|
import app.fedilab.android.drawers.InstancePeertubeRegAdapter;
|
||||||
|
import app.fedilab.android.helper.Helper;
|
||||||
|
import app.fedilab.android.interfaces.OnPostStatusActionInterface;
|
||||||
|
import app.fedilab.android.interfaces.OnRetrieveInstanceInterface;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static android.os.AsyncTask.THREAD_POOL_EXECUTOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 04/11/2019.
|
||||||
|
* Register activity class
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PeertubeRegisterActivity extends BaseActivity implements OnRetrieveInstanceInterface, OnPostStatusActionInterface {
|
||||||
|
|
||||||
|
|
||||||
|
private Button signup;
|
||||||
|
private String instance;
|
||||||
|
private TextView error_message;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
switch (theme) {
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
setTheme(R.style.AppTheme);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
setTheme(R.style.AppThemeBlack);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
}
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_register_peertube);
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
assert inflater != null;
|
||||||
|
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
|
||||||
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
|
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
||||||
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbar_title.setText(R.string.sign_up);
|
||||||
|
if (theme == Helper.THEME_LIGHT) {
|
||||||
|
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||||
|
Helper.colorizeToolbar(toolbar, R.color.black, PeertubeRegisterActivity.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new RetrieveInstanceRegAsyncTask(PeertubeRegisterActivity.this,RetrieveInstanceRegAsyncTask.instanceType.PEERTUBE, null, PeertubeRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
|
signup = findViewById(R.id.signup);
|
||||||
|
EditText username = findViewById(R.id.username);
|
||||||
|
EditText email = findViewById(R.id.email);
|
||||||
|
EditText password = findViewById(R.id.password);
|
||||||
|
EditText password_confirm = findViewById(R.id.password_confirm);
|
||||||
|
CheckBox agreement = findViewById(R.id.agreement);
|
||||||
|
error_message = findViewById(R.id.error_message);
|
||||||
|
|
||||||
|
signup.setOnClickListener(view -> {
|
||||||
|
error_message.setVisibility(View.GONE);
|
||||||
|
if (username.getText().toString().trim().length() == 0 || email.getText().toString().trim().length() == 0 ||
|
||||||
|
password.getText().toString().trim().length() == 0 || password_confirm.getText().toString().trim().length() == 0 || !agreement.isChecked()) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.all_field_filled)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!password.getText().toString().trim().equals(password_confirm.getText().toString().trim())) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.password_error)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!android.util.Patterns.EMAIL_ADDRESS.matcher(email.getText().toString().trim()).matches()) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.email_error)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (password.getText().toString().trim().length() < 8) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.password_too_short)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (username.getText().toString().matches("[a-zA-Z0-9_]")) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.username_error)).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
signup.setEnabled(false);
|
||||||
|
AccountCreation accountCreation = new AccountCreation();
|
||||||
|
accountCreation.setEmail(email.getText().toString().trim());
|
||||||
|
accountCreation.setPassword(password.getText().toString().trim());
|
||||||
|
accountCreation.setPasswordConfirm(password_confirm.getText().toString().trim());
|
||||||
|
accountCreation.setUsername(username.getText().toString().trim());
|
||||||
|
new CreateMastodonAccountAsyncTask(PeertubeRegisterActivity.this, accountCreation, instance, PeertubeRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRetrieveInstance(APIResponse apiResponse) {
|
||||||
|
if (apiResponse.getError() != null) {
|
||||||
|
Toasty.error(getApplicationContext(), getString(R.string.toast_error_instance_reg), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<InstanceReg> instanceRegs = apiResponse.getInstanceRegs();
|
||||||
|
RecyclerView lv_instances = findViewById(R.id.reg_category_view);
|
||||||
|
InstancePeertubeRegAdapter instanceRegAdapter = new InstancePeertubeRegAdapter(PeertubeRegisterActivity.this, instanceRegs);
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeRegisterActivity.this);
|
||||||
|
lv_instances.setLayoutManager(mLayoutManager);
|
||||||
|
lv_instances.setNestedScrollingEnabled(false);
|
||||||
|
lv_instances.setAdapter(instanceRegAdapter);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pickupInstance(String instance) {
|
||||||
|
|
||||||
|
LinearLayout form_container = findViewById(R.id.form_container);
|
||||||
|
LinearLayout drawer_layout = findViewById(R.id.drawer_layout);
|
||||||
|
|
||||||
|
TextView host_reg = findViewById(R.id.host_reg);
|
||||||
|
host_reg.setText(instance);
|
||||||
|
this.instance = instance;
|
||||||
|
|
||||||
|
drawer_layout.animate()
|
||||||
|
.translationY(0)
|
||||||
|
.alpha(0.0f)
|
||||||
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
drawer_layout.setVisibility(View.GONE);
|
||||||
|
form_container.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TextView change_instance = findViewById(R.id.change_instance);
|
||||||
|
final SpannableString change = new SpannableString(String.format("(%s)", getString(R.string.change)));
|
||||||
|
change.setSpan(new UnderlineSpan(), 0, change.length(), 0);
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
if (theme == Helper.THEME_DARK)
|
||||||
|
change.setSpan(new ForegroundColorSpan(ContextCompat.getColor(PeertubeRegisterActivity.this, R.color.dark_link_toot)), 0, change.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
else if (theme == Helper.THEME_BLACK)
|
||||||
|
change.setSpan(new ForegroundColorSpan(ContextCompat.getColor(PeertubeRegisterActivity.this, R.color.black_link_toot)), 0, change.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
else if (theme == Helper.THEME_LIGHT)
|
||||||
|
change.setSpan(new ForegroundColorSpan(ContextCompat.getColor(PeertubeRegisterActivity.this, R.color.mastodonC4)), 0, change.length(),
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
change_instance.setText(change);
|
||||||
|
change_instance.setOnClickListener(view -> {
|
||||||
|
drawer_layout.setVisibility(View.VISIBLE);
|
||||||
|
drawer_layout.animate()
|
||||||
|
.translationY(0)
|
||||||
|
.alpha(1.f)
|
||||||
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
form_container.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
TextView agreement_text = findViewById(R.id.agreement_text);
|
||||||
|
|
||||||
|
TextView username_indicator = findViewById(R.id.username_indicator);
|
||||||
|
username_indicator.setText(getString(R.string.username_indicator, instance));
|
||||||
|
|
||||||
|
String tos = getString(R.string.tos);
|
||||||
|
String serverrules = getString(R.string.server_rules);
|
||||||
|
String content_agreement = getString(R.string.agreement_check,
|
||||||
|
"<a href='https://" + instance + "/about/more' >" + serverrules + "</a>",
|
||||||
|
"<a href='https://" + instance + "/terms' >" + tos + "</a>"
|
||||||
|
);
|
||||||
|
agreement_text.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
agreement_text.setText(Html.fromHtml(content_agreement));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPostStatusAction(APIResponse apiResponse) {
|
||||||
|
if (apiResponse.getError() != null) {
|
||||||
|
String errorMessage;
|
||||||
|
if (apiResponse.getError().getError() != null) {
|
||||||
|
try {
|
||||||
|
String[] resp = apiResponse.getError().getError().split(":");
|
||||||
|
if (resp.length == 2)
|
||||||
|
errorMessage = apiResponse.getError().getError().split(":")[1];
|
||||||
|
else if (resp.length == 3)
|
||||||
|
errorMessage = apiResponse.getError().getError().split(":")[2];
|
||||||
|
else
|
||||||
|
errorMessage = getString(R.string.toast_error);
|
||||||
|
} catch (Exception e) {
|
||||||
|
errorMessage = getString(R.string.toast_error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errorMessage = getString(R.string.toast_error);
|
||||||
|
}
|
||||||
|
error_message.setText(errorMessage);
|
||||||
|
error_message.setVisibility(View.VISIBLE);
|
||||||
|
signup.setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
int style;
|
||||||
|
if (theme == Helper.THEME_DARK) {
|
||||||
|
style = R.style.DialogDark;
|
||||||
|
} else if (theme == Helper.THEME_BLACK) {
|
||||||
|
style = R.style.DialogBlack;
|
||||||
|
} else {
|
||||||
|
style = R.style.Dialog;
|
||||||
|
}
|
||||||
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeRegisterActivity.this, style);
|
||||||
|
dialogBuilder.setCancelable(false);
|
||||||
|
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
|
alertDialog.setTitle(getString(R.string.account_created));
|
||||||
|
alertDialog.setMessage(getString(R.string.account_created_message, this.instance));
|
||||||
|
alertDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import app.fedilab.android.client.API;
|
import app.fedilab.android.client.API;
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
|
import app.fedilab.android.client.PeertubeAPI;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveInstanceInterface;
|
import app.fedilab.android.interfaces.OnRetrieveInstanceInterface;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,16 +36,27 @@ public class RetrieveInstanceRegAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
private APIResponse apiResponse;
|
private APIResponse apiResponse;
|
||||||
private WeakReference<Context> contextReference;
|
private WeakReference<Context> contextReference;
|
||||||
private String category;
|
private String category;
|
||||||
|
private instanceType type;
|
||||||
|
|
||||||
public RetrieveInstanceRegAsyncTask(Context context, String category, OnRetrieveInstanceInterface onRetrieveInstanceInterface) {
|
public enum instanceType{
|
||||||
|
MASTODON,
|
||||||
|
PEERTUBE
|
||||||
|
}
|
||||||
|
|
||||||
|
public RetrieveInstanceRegAsyncTask(Context context, instanceType type, String category, OnRetrieveInstanceInterface onRetrieveInstanceInterface) {
|
||||||
this.contextReference = new WeakReference<>(context);
|
this.contextReference = new WeakReference<>(context);
|
||||||
this.listener = onRetrieveInstanceInterface;
|
this.listener = onRetrieveInstanceInterface;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
apiResponse = new API(this.contextReference.get()).getInstanceReg(category);
|
if( type == instanceType.MASTODON) {
|
||||||
|
apiResponse = new API(this.contextReference.get()).getInstanceReg(category);
|
||||||
|
}else if( type == instanceType.PEERTUBE){
|
||||||
|
apiResponse = new PeertubeAPI(this.contextReference.get()).getInstanceReg();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,10 @@ public class InstanceReg {
|
||||||
private int total_users;
|
private int total_users;
|
||||||
private int last_week_users;
|
private int last_week_users;
|
||||||
private boolean selected = false;
|
private boolean selected = false;
|
||||||
|
private int totalVideos;
|
||||||
|
private String country;
|
||||||
|
private int totalInstanceFollowers;
|
||||||
|
private int totalInstanceFollowing;
|
||||||
|
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return domain;
|
return domain;
|
||||||
|
@ -97,4 +101,36 @@ public class InstanceReg {
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean selected) {
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTotalVideos() {
|
||||||
|
return totalVideos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalVideos(int totalVideos) {
|
||||||
|
this.totalVideos = totalVideos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalInstanceFollowers() {
|
||||||
|
return totalInstanceFollowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalInstanceFollowers(int totalInstanceFollowers) {
|
||||||
|
this.totalInstanceFollowers = totalInstanceFollowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalInstanceFollowing() {
|
||||||
|
return totalInstanceFollowing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalInstanceFollowing(int totalInstanceFollowing) {
|
||||||
|
this.totalInstanceFollowing = totalInstanceFollowing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import app.fedilab.android.client.Entities.Filters;
|
||||||
import app.fedilab.android.client.Entities.HowToVideo;
|
import app.fedilab.android.client.Entities.HowToVideo;
|
||||||
import app.fedilab.android.client.Entities.Instance;
|
import app.fedilab.android.client.Entities.Instance;
|
||||||
import app.fedilab.android.client.Entities.InstanceNodeInfo;
|
import app.fedilab.android.client.Entities.InstanceNodeInfo;
|
||||||
|
import app.fedilab.android.client.Entities.InstanceReg;
|
||||||
import app.fedilab.android.client.Entities.Peertube;
|
import app.fedilab.android.client.Entities.Peertube;
|
||||||
import app.fedilab.android.client.Entities.PeertubeAccountNotification;
|
import app.fedilab.android.client.Entities.PeertubeAccountNotification;
|
||||||
import app.fedilab.android.client.Entities.PeertubeActorFollow;
|
import app.fedilab.android.client.Entities.PeertubeActorFollow;
|
||||||
|
@ -381,6 +382,27 @@ public class PeertubeAPI {
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get instance for registering an account *synchronously*
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public APIResponse getInstanceReg() {
|
||||||
|
apiResponse = new APIResponse();
|
||||||
|
try {
|
||||||
|
String response = new HttpsConnection(context, null).get("https://instances.joinpeertube.org/api/v1/instances?start=0&count=50&signup=true&health=100&sort=-totalUsers");
|
||||||
|
JSONObject result = new JSONObject(response);
|
||||||
|
List<InstanceReg> instanceRegs = parseInstanceReg(result.getJSONArray("data"));
|
||||||
|
apiResponse.setInstanceRegs(instanceRegs);
|
||||||
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
setError(e.getStatusCode(), e);
|
||||||
|
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Verifiy credential of the authenticated user *synchronously*
|
* Verifiy credential of the authenticated user *synchronously*
|
||||||
* @return Account
|
* @return Account
|
||||||
|
@ -1644,6 +1666,56 @@ public class PeertubeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse json response for several instance reg
|
||||||
|
*
|
||||||
|
* @param jsonArray JSONArray
|
||||||
|
* @return List<Status>
|
||||||
|
*/
|
||||||
|
public List<InstanceReg> parseInstanceReg(JSONArray jsonArray) {
|
||||||
|
|
||||||
|
List<InstanceReg> instanceRegs = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
int i = 0;
|
||||||
|
while (i < jsonArray.length()) {
|
||||||
|
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||||
|
InstanceReg instanceReg = parseInstanceReg(resobj);
|
||||||
|
i++;
|
||||||
|
instanceRegs.add(instanceReg);
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return instanceRegs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse json response an unique instance for registering
|
||||||
|
*
|
||||||
|
* @param resobj JSONObject
|
||||||
|
* @return InstanceReg
|
||||||
|
*/
|
||||||
|
private InstanceReg parseInstanceReg(JSONObject resobj) {
|
||||||
|
InstanceReg instanceReg = new InstanceReg();
|
||||||
|
try {
|
||||||
|
instanceReg.setDomain(resobj.getString("host"));
|
||||||
|
instanceReg.setVersion(resobj.getString("version"));
|
||||||
|
instanceReg.setDescription(resobj.getString("shortDescription"));
|
||||||
|
instanceReg.setLanguage(resobj.getString("country"));
|
||||||
|
instanceReg.setCategory("");
|
||||||
|
instanceReg.setProxied_thumbnail("");
|
||||||
|
instanceReg.setTotal_users(resobj.getInt("totalUsers"));
|
||||||
|
instanceReg.setTotalInstanceFollowers(resobj.getInt("totalInstanceFollowers"));
|
||||||
|
instanceReg.setTotalInstanceFollowing(resobj.getInt("totalInstanceFollowing"));
|
||||||
|
instanceReg.setLast_week_users(0);
|
||||||
|
instanceReg.setCountry(resobj.getString("country"));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return instanceReg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse json response for several howto
|
* Parse json response for several howto
|
||||||
*
|
*
|
||||||
|
@ -1661,7 +1733,6 @@ public class PeertubeAPI {
|
||||||
i++;
|
i++;
|
||||||
peertubes.add(peertube);
|
peertubes.add(peertube);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
setDefaultError(e);
|
setDefaultError(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
package app.fedilab.android.drawers;
|
||||||
|
/* Copyright 2019 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.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.FitCenter;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.activities.PeertubeRegisterActivity;
|
||||||
|
import app.fedilab.android.client.Entities.InstanceReg;
|
||||||
|
import app.fedilab.android.helper.Helper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 04/11/2019.
|
||||||
|
* Adapter to display instances
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class InstancePeertubeRegAdapter extends RecyclerView.Adapter {
|
||||||
|
private Context context;
|
||||||
|
private List<InstanceReg> instanceRegs;
|
||||||
|
private LayoutInflater layoutInflater;
|
||||||
|
|
||||||
|
public InstancePeertubeRegAdapter(Context context, List<InstanceReg> instanceRegs) {
|
||||||
|
this.context = context;
|
||||||
|
this.instanceRegs = instanceRegs;
|
||||||
|
this.layoutInflater = LayoutInflater.from(this.context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return instanceRegs.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InstanceReg getItem(int position) {
|
||||||
|
return instanceRegs.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_instance_reg_peertube, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
InstanceReg instanceReg = instanceRegs.get(position);
|
||||||
|
|
||||||
|
final InstancePeertubeRegAdapter.ViewHolder holder = (InstancePeertubeRegAdapter.ViewHolder) viewHolder;
|
||||||
|
|
||||||
|
holder.instance_choose.setOnClickListener(v -> {
|
||||||
|
((PeertubeRegisterActivity) context).pickupInstance(instanceReg.getDomain());
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.instance_count_user.setText(context.getString(R.string.users, Helper.withSuffix(instanceReg.getTotal_users())));
|
||||||
|
holder.instance_description.setText(instanceReg.getDescription());
|
||||||
|
holder.instance_host.setText(instanceReg.getDomain());
|
||||||
|
holder.instance_version.setText(String.format("%s - %s", instanceReg.getCategory(), instanceReg.getVersion()));
|
||||||
|
Glide.with(context)
|
||||||
|
.load(instanceReg.getProxied_thumbnail())
|
||||||
|
.apply(new RequestOptions().transforms(new FitCenter(), new RoundedCorners(10)))
|
||||||
|
.into(holder.instance_pp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return instanceRegs.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView instance_pp;
|
||||||
|
TextView instance_host, instance_version, instance_description, instance_count_user;
|
||||||
|
ImageButton instance_choose;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
instance_pp = itemView.findViewById(R.id.instance_pp);
|
||||||
|
instance_host = itemView.findViewById(R.id.instance_host);
|
||||||
|
instance_version = itemView.findViewById(R.id.instance_version);
|
||||||
|
instance_description = itemView.findViewById(R.id.instance_description);
|
||||||
|
instance_count_user = itemView.findViewById(R.id.instance_count_user);
|
||||||
|
instance_choose = itemView.findViewById(R.id.instance_choose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -115,6 +115,15 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/create_an_account_peertube"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:text="@string/join_peertube"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2019 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>.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<!-- category -->
|
||||||
|
<TextView
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/pickup_instance_peertube" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/reg_category_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/form_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
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_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:id="@+id/host_reg"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:id="@+id/change_instance"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:id="@+id/error_message"
|
||||||
|
android:textColor="@color/red_1"
|
||||||
|
android:background="@drawable/red_border"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:labelFor="@+id/username"
|
||||||
|
android:text="@string/username"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/username"
|
||||||
|
android:inputType="text"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:maxLength="30"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/username_indicator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:labelFor="@+id/email"
|
||||||
|
android:text="@string/email"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/email"
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/email_indicator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:text="@string/email_indicator"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:labelFor="@+id/password"
|
||||||
|
android:text="@string/password"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/password_indicator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:text="@string/password_indicator"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:labelFor="@+id/password_confirm"
|
||||||
|
android:text="@string/password_confirm"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password_confirm"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/signup"
|
||||||
|
android:text="@string/sign_up"
|
||||||
|
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2019 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>.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/main_container"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/border_bottom"
|
||||||
|
android:divider="@null"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:baselineAligned="false">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/instance_pp"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:contentDescription="@string/instance_logo" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/instance_host"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/instance_version"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/instance_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:id="@+id/instance_choose"
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:background="@color/mastodonC4"
|
||||||
|
android:contentDescription="@string/validate"
|
||||||
|
android:src="@drawable/ic_check"
|
||||||
|
android:tooltipText="@string/validate" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:id="@+id/instance_count_user"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
|
@ -1004,6 +1004,7 @@
|
||||||
<string name="toast_error_instance_reg">Something went wrong when checking available instances!</string>
|
<string name="toast_error_instance_reg">Something went wrong when checking available instances!</string>
|
||||||
<string name="join_mastodon">Join Mastodon</string>
|
<string name="join_mastodon">Join Mastodon</string>
|
||||||
<string name="pickup_instance_category">Choose an instance by picking up a category, then tap on a check button.</string>
|
<string name="pickup_instance_category">Choose an instance by picking up a category, then tap on a check button.</string>
|
||||||
|
<string name="pickup_instance_peertube">Choose an instance by tapping on a check button.</string>
|
||||||
<string name="users">%1$s users</string>
|
<string name="users">%1$s users</string>
|
||||||
<string name="password_confirm">Confirm password</string>
|
<string name="password_confirm">Confirm password</string>
|
||||||
<string name="agreement_check">I agree to %1$s and %2$s</string>
|
<string name="agreement_check">I agree to %1$s and %2$s</string>
|
||||||
|
@ -1244,4 +1245,5 @@
|
||||||
<string name="fetch_conversation">Fetching conversation</string>
|
<string name="fetch_conversation">Fetching conversation</string>
|
||||||
<string name="order_by">Order by</string>
|
<string name="order_by">Order by</string>
|
||||||
<string name="title_video_peertube">Title for the video</string>
|
<string name="title_video_peertube">Title for the video</string>
|
||||||
|
<string name="join_peertube">Join Peertube</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue