Register + login
This commit is contained in:
parent
943445807d
commit
515740d889
|
@ -58,6 +58,17 @@
|
|||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".PeertubeRegisterActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<receiver
|
||||
android:name=".services.PeertubeUploadReceiver"
|
||||
android:exported="false">
|
||||
|
|
|
@ -0,0 +1,255 @@
|
|||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
|
||||
import app.fedilab.fedilabtube.asynctasks.UpdateAccountInfoAsyncTask;
|
||||
import app.fedilab.fedilabtube.client.HttpsConnection;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
private static String client_id;
|
||||
private static String client_secret;
|
||||
private static String instance;
|
||||
private static String host;
|
||||
private EditText login_uid;
|
||||
private EditText login_passwd;
|
||||
private Button connectionButton;
|
||||
private String actionToken;
|
||||
private Spinner info_instance;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
setContentView(R.layout.activity_login);
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
TextView create_an_account_peertube = findViewById(R.id.create_an_account_peertube);
|
||||
|
||||
SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
|
||||
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.colorAccent)), 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);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("instance", host);
|
||||
mainActivity.putExtras(b);
|
||||
startActivity(mainActivity);
|
||||
});
|
||||
|
||||
|
||||
login_uid = findViewById(R.id.login_uid);
|
||||
login_passwd = findViewById(R.id.login_passwd);
|
||||
connectionButton = findViewById(R.id.login_button);
|
||||
info_instance = findViewById(R.id.info_instance);
|
||||
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, Helper.academies);
|
||||
info_instance.setAdapter(arrayAdapter);
|
||||
|
||||
info_instance.setSelection(0);
|
||||
info_instance.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
host = Helper.academies[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ImageView main_logo = findViewById(R.id.main_logo);
|
||||
main_logo.setImageResource(R.drawable.ic_launcher);
|
||||
|
||||
connectionButton.setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
retrievesClientId();
|
||||
}
|
||||
|
||||
private void retrievesClientId() {
|
||||
String instanceFromField = info_instance.getSelectedItem().toString();
|
||||
if (instanceFromField.startsWith("http://")) {
|
||||
instanceFromField = instanceFromField.replace("http://", "");
|
||||
}
|
||||
if (instanceFromField.startsWith("https://")) {
|
||||
instanceFromField = instanceFromField.replace("https://", "");
|
||||
}
|
||||
String host = instanceFromField;
|
||||
try {
|
||||
URL url = new URL(instanceFromField);
|
||||
host = url.getHost();
|
||||
} catch (MalformedURLException ignored) {
|
||||
}
|
||||
host = Helper.getPeertubeUrl(host);
|
||||
try {
|
||||
instance = URLEncoder.encode(host, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Toasty.error(LoginActivity.this, getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
actionToken = "/api/v1/oauth-clients/local";
|
||||
final HashMap<String, String> parameters = new HashMap<>();
|
||||
parameters.put(Helper.CLIENT_NAME, Helper.CLIENT_NAME_VALUE);
|
||||
parameters.put(Helper.REDIRECT_URIS, Helper.REDIRECT_CONTENT);
|
||||
parameters.put(Helper.SCOPES, Helper.OAUTH_SCOPES_PEERTUBE);
|
||||
parameters.put(Helper.WEBSITE, Helper.WEBSITE_VALUE);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
String response = new HttpsConnection(LoginActivity.this, instance).get("https://" + instance + actionToken, 30, parameters, null);
|
||||
runOnUiThread(() -> {
|
||||
JSONObject resobj;
|
||||
try {
|
||||
resobj = new JSONObject(response);
|
||||
client_id = resobj.get(Helper.CLIENT_ID).toString();
|
||||
client_secret = resobj.get(Helper.CLIENT_SECRET).toString();
|
||||
manageClient(client_id, client_secret);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
runOnUiThread(() -> {
|
||||
|
||||
String message = null;
|
||||
if (e.getLocalizedMessage() != null) {
|
||||
message = e.getMessage();
|
||||
}
|
||||
if (message == null) {
|
||||
message = getString(R.string.client_error);
|
||||
}
|
||||
|
||||
Toasty.error(LoginActivity.this, message, Toast.LENGTH_LONG).show();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
connectionButton.setOnClickListener(v -> {
|
||||
connectionButton.setEnabled(false);
|
||||
parameters.clear();
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
parameters.put(Helper.CLIENT_ID, sharedpreferences.getString(Helper.CLIENT_ID, null));
|
||||
parameters.put(Helper.CLIENT_SECRET, sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
||||
parameters.put("grant_type", "password");
|
||||
try {
|
||||
parameters.put("username", URLEncoder.encode(login_uid.getText().toString().trim().toLowerCase(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
parameters.put("username", login_uid.getText().toString().trim().toLowerCase());
|
||||
}
|
||||
try {
|
||||
parameters.put("password", URLEncoder.encode(login_passwd.getText().toString(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
parameters.put("password", login_passwd.getText().toString());
|
||||
}
|
||||
parameters.put("scope", "user");
|
||||
String oauthUrl = "/api/v1/users/token";
|
||||
new Thread(() -> {
|
||||
try {
|
||||
String response = new HttpsConnection(LoginActivity.this, instance).post("https://" + instance + oauthUrl, 30, parameters, null);
|
||||
runOnUiThread(() -> {
|
||||
JSONObject resobj;
|
||||
try {
|
||||
resobj = new JSONObject(response);
|
||||
String token = resobj.get("access_token").toString();
|
||||
String refresh_token = null;
|
||||
if (resobj.has("refresh_token"))
|
||||
refresh_token = resobj.getString("refresh_token");
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token);
|
||||
editor.apply();
|
||||
//Update the account with the token;
|
||||
if (instance != null) {
|
||||
new UpdateAccountInfoAsyncTask(LoginActivity.this, token, client_id, client_secret, refresh_token, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
connectionButton.setEnabled(true);
|
||||
Toasty.error(LoginActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
runOnUiThread(() -> {
|
||||
connectionButton.setEnabled(true);
|
||||
runOnUiThread(() -> {
|
||||
String message;
|
||||
if (e.getLocalizedMessage() != null && e.getLocalizedMessage().trim().length() > 0)
|
||||
message = e.getLocalizedMessage();
|
||||
else if (e.getMessage() != null && e.getMessage().trim().length() > 0)
|
||||
message = e.getMessage();
|
||||
else
|
||||
message = getString(R.string.client_error);
|
||||
Toasty.error(LoginActivity.this, message, Toast.LENGTH_LONG).show();
|
||||
});
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
|
||||
private void manageClient(String client_id, String client_secret) {
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.CLIENT_ID, client_id);
|
||||
editor.putString(Helper.CLIENT_SECRET, client_secret);
|
||||
editor.apply();
|
||||
connectionButton.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -51,7 +51,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main_menu, menu);
|
||||
MenuItem myActionMenuItem = menu.findItem( R.id.action_search);
|
||||
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
|
||||
SearchView searchView = (SearchView) myActionMenuItem.getActionView();
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
|
@ -61,12 +61,13 @@ public class MainActivity extends AppCompatActivity {
|
|||
b.putString("search", query.trim());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
if( ! searchView.isIconified()) {
|
||||
if (!searchView.isIconified()) {
|
||||
searchView.setIconified(true);
|
||||
}
|
||||
myActionMenuItem.collapseActionView();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
|
@ -81,10 +82,27 @@ public class MainActivity extends AppCompatActivity {
|
|||
showRadioButtonDialog();
|
||||
return true;
|
||||
}
|
||||
if (item.getItemId() == R.id.action_account) {
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
if (intent == null)
|
||||
return;
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras != null && extras.containsKey(Helper.INTENT_ACTION)) {
|
||||
if (extras.getInt(Helper.INTENT_ACTION) == Helper.ADD_USER_INTENT) {
|
||||
recreate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showRadioButtonDialog() {
|
||||
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import app.fedilab.fedilabtube.asynctasks.CreatePeertubeAccountAsyncTask;
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.interfaces.OnPostStatusActionInterface;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static android.os.AsyncTask.THREAD_POOL_EXECUTOR;
|
||||
|
||||
public class PeertubeRegisterActivity extends AppCompatActivity implements OnPostStatusActionInterface {
|
||||
|
||||
|
||||
private Button signup;
|
||||
private TextView error_message;
|
||||
private String instance;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_register_peertube);
|
||||
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
Bundle b = getIntent().getExtras();
|
||||
if (b != null) {
|
||||
instance = b.getString("instance");
|
||||
}
|
||||
if (instance == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
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(PeertubeRegisterActivity.this, getString(R.string.all_field_filled)).show();
|
||||
return;
|
||||
}
|
||||
if (!password.getText().toString().trim().equals(password_confirm.getText().toString().trim())) {
|
||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_error)).show();
|
||||
return;
|
||||
}
|
||||
if (!android.util.Patterns.EMAIL_ADDRESS.matcher(email.getText().toString().trim()).matches()) {
|
||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.email_error)).show();
|
||||
return;
|
||||
}
|
||||
if (password.getText().toString().trim().length() < 8) {
|
||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.password_too_short)).show();
|
||||
return;
|
||||
}
|
||||
if (username.getText().toString().matches("[a-zA-Z0-9_]")) {
|
||||
Toasty.error(PeertubeRegisterActivity.this, 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 CreatePeertubeAccountAsyncTask(PeertubeRegisterActivity.this, accountCreation, Helper.getPeertubeUrl(instance), PeertubeRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||
});
|
||||
|
||||
TextView agreement_text = findViewById(R.id.agreement_text);
|
||||
String tos = getString(R.string.tos);
|
||||
String serverrules = getString(R.string.server_rules);
|
||||
String content_agreement = getString(R.string.agreement_check,
|
||||
"<a href='https://" + Helper.getPeertubeUrl(instance) + "/about/more' >" + serverrules + "</a>",
|
||||
"<a href='https://" + Helper.getPeertubeUrl(instance) + "/terms' >" + tos + "</a>"
|
||||
);
|
||||
agreement_text.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
agreement_text.setText(Html.fromHtml(content_agreement));
|
||||
setTitle(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeRegisterActivity.this);
|
||||
dialogBuilder.setCancelable(false);
|
||||
dialogBuilder.setPositiveButton(R.string.validate, (dialog, 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();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@ -14,7 +13,6 @@ import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
|||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
||||
|
||||
public class SearchActivity extends AppCompatActivity implements OnRetrieveFeedsInterface {
|
||||
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
|
||||
SpannableString spannableString;
|
||||
|
||||
if( account.getNote() != null && account.getNote().compareTo("null") != 0 && account.getNote().trim().length() > 0 ) {
|
||||
if (account.getNote() != null && account.getNote().compareTo("null") != 0 && account.getNote().trim().length() > 0) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
spannableString = new SpannableString(Html.fromHtml(account.getNote(), FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
|
@ -278,7 +278,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE);
|
||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
account_note.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
account_note.setVisibility(View.GONE);
|
||||
}
|
||||
Helper.loadGiF(ShowAccountActivity.this, account, account_pp);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package app.fedilab.fedilabtube.asynctasks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
||||
import app.fedilab.fedilabtube.interfaces.OnPostStatusActionInterface;
|
||||
|
||||
|
||||
public class CreatePeertubeAccountAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private OnPostStatusActionInterface listener;
|
||||
private APIResponse apiResponse;
|
||||
private app.fedilab.fedilabtube.client.entities.Status status;
|
||||
private AccountCreation accountCreation;
|
||||
private WeakReference<Context> contextReference;
|
||||
private String instance;
|
||||
|
||||
public CreatePeertubeAccountAsyncTask(Context context, AccountCreation accountCreation, String instance, OnPostStatusActionInterface onPostStatusActionInterface) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.listener = onPostStatusActionInterface;
|
||||
this.accountCreation = accountCreation;
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
apiResponse = new PeertubeAPI(contextReference.get(), instance, null).createAccount(accountCreation);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onPostStatusAction(apiResponse);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ public class RetrievePeertubeSearchAsyncTask extends AsyncTask<Void, Void, Void>
|
|||
private OnRetrieveFeedsInterface listener;
|
||||
private WeakReference<Context> contextReference;
|
||||
|
||||
public RetrievePeertubeSearchAsyncTask(Context context, String max_id, String query, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
|
||||
public RetrievePeertubeSearchAsyncTask(Context context, String max_id, String query, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.query = query;
|
||||
this.listener = onRetrieveFeedsInterface;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package app.fedilab.fedilabtube.asynctasks;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.entities.Account;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
|
||||
|
||||
public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private String token, client_id, client_secret, refresh_token;
|
||||
private String instance;
|
||||
private WeakReference<Context> contextReference;
|
||||
|
||||
public UpdateAccountInfoAsyncTask(Context context, String token, String client_id, String client_secret, String refresh_token, String instance) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.token = token;
|
||||
this.instance = instance;
|
||||
this.client_id = client_id;
|
||||
this.client_secret = client_secret;
|
||||
this.refresh_token = refresh_token;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
Account account;
|
||||
if (this.contextReference == null) {
|
||||
return null;
|
||||
}
|
||||
account = new PeertubeAPI(this.contextReference.get(), instance, null).verifyCredentials();
|
||||
if (account == null)
|
||||
return null;
|
||||
try {
|
||||
//At the state the instance can be encoded
|
||||
instance = URLDecoder.decode(instance, "utf-8");
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
}
|
||||
|
||||
SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
account.setToken(token);
|
||||
account.setClient_id(client_id);
|
||||
account.setClient_secret(client_secret);
|
||||
account.setRefresh_token(refresh_token);
|
||||
account.setInstance(instance);
|
||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
boolean userExists = new AccountDAO(this.contextReference.get(), db).userExist(account);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||
editor.putBoolean(Helper.PREF_IS_MODERATOR, account.isModerator());
|
||||
editor.putBoolean(Helper.PREF_IS_ADMINISTRATOR, account.isAdmin());
|
||||
editor.putString(Helper.PREF_INSTANCE, instance);
|
||||
editor.apply();
|
||||
if (userExists)
|
||||
new AccountDAO(this.contextReference.get(), db).updateAccountCredential(account);
|
||||
else {
|
||||
if (account.getUsername() != null && account.getCreated_at() != null)
|
||||
new AccountDAO(this.contextReference.get(), db).insertAccount(account);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
|
||||
if (this.contextReference.get() != null) {
|
||||
Intent mainActivity = new Intent(this.contextReference.get(), MainActivity.class);
|
||||
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.ADD_USER_INTENT);
|
||||
this.contextReference.get().startActivity(mainActivity);
|
||||
((Activity) this.contextReference.get()).finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -59,6 +59,7 @@ public class Helper {
|
|||
public static final int VIDEO_MODE_TORRENT = 0;
|
||||
public static final int VIDEO_MODE_WEBVIEW = 1;
|
||||
public static final int VIDEO_MODE_DIRECT = 2;
|
||||
public static final int ADD_USER_INTENT = 5;
|
||||
public static final String SET_SHARE_DETAILS = "set_share_details";
|
||||
public static final int DEFAULT_VIDEO_CACHE_MB = 100;
|
||||
public static final String TAG = "mastodon_etalab";
|
||||
|
@ -159,7 +160,7 @@ public class Helper {
|
|||
* @param acad String academic domain name
|
||||
* @return String the peertube URL
|
||||
*/
|
||||
private static String getPeertubeUrl(String acad) {
|
||||
public static String getPeertubeUrl(String acad) {
|
||||
return "tube-" + acad.replaceAll("ac-|\\.fr", "") + ".beta.education.fr";
|
||||
}
|
||||
|
||||
|
@ -362,7 +363,7 @@ public class Helper {
|
|||
if (url.startsWith("/")) {
|
||||
url = Helper.getLiveInstance(context) + url;
|
||||
}
|
||||
if( !url.startsWith("http")){
|
||||
if (!url.startsWith("http")) {
|
||||
url = "https://" + url;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package app.fedilab.fedilabtube.interfaces;
|
||||
|
||||
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
|
||||
public interface OnPostStatusActionInterface {
|
||||
void onPostStatusAction(APIResponse apiResponse);
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" />
|
||||
</vector>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
|
||||
</vector>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z" />
|
||||
</vector>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19.07,4.93l-1.41,1.41C19.1,7.79 20,9.79 20,12c0,4.42 -3.58,8 -8,8s-8,-3.58 -8,-8c0,-4.08 3.05,-7.44 7,-7.93v2.02C8.16,6.57 6,9.03 6,12c0,3.31 2.69,6 6,6s6,-2.69 6,-6c0,-1.66 -0.67,-3.16 -1.76,-4.24l-1.41,1.41C15.55,9.9 16,10.9 16,12c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4c0,-1.86 1.28,-3.41 3,-3.86v2.14c-0.6,0.35 -1,0.98 -1,1.72 0,1.1 0.9,2 2,2s2,-0.9 2,-2c0,-0.74 -0.4,-1.38 -1,-1.72V2h-1C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-2.76 -1.12,-5.26 -2.93,-7.07z"/>
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19.07,4.93l-1.41,1.41C19.1,7.79 20,9.79 20,12c0,4.42 -3.58,8 -8,8s-8,-3.58 -8,-8c0,-4.08 3.05,-7.44 7,-7.93v2.02C8.16,6.57 6,9.03 6,12c0,3.31 2.69,6 6,6s6,-2.69 6,-6c0,-1.66 -0.67,-3.16 -1.76,-4.24l-1.41,1.41C15.55,9.9 16,10.9 16,12c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4c0,-1.86 1.28,-3.41 3,-3.86v2.14c-0.6,0.35 -1,0.98 -1,1.72 0,1.1 0.9,2 2,2s2,-0.9 2,-2c0,-0.74 -0.4,-1.38 -1,-1.72V2h-1C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-2.76 -1.12,-5.26 -2.93,-7.07z" />
|
||||
</vector>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -1,15 +1,16 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:tint="#9C27B0"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
android:tint="#9C27B0">
|
||||
<group android:scaleX="2.61"
|
||||
android:scaleY="2.61"
|
||||
android:translateX="22.68"
|
||||
android:translateY="22.68">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||
</group>
|
||||
android:viewportHeight="108">
|
||||
<group
|
||||
android:scaleX="2.61"
|
||||
android:scaleY="2.61"
|
||||
android:translateX="22.68"
|
||||
android:translateY="22.68">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z" />
|
||||
</group>
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@color/red_1" />
|
||||
<corners android:radius="2dp" />
|
||||
<padding
|
||||
android:bottom="1dip"
|
||||
android:left="4dip"
|
||||
android:right="4dip"
|
||||
android:top="1dip" />
|
||||
</shape>
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/step_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_logo"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:contentDescription="@string/app_logo"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/info_instance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_logo" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_instance_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="info_instance" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_an_account_peertube"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/join_peertube"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_instance_bottom" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="50dp"
|
||||
android:paddingEnd="50dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/instance_chosen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/login_uid_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/instance_chosen">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/username"
|
||||
android:inputType="textEmailAddress"
|
||||
android:singleLine="true" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/login_passwd_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_uid_container"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/login_passwd"
|
||||
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>
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_button"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/login"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_passwd_container" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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:id="@+id/host_reg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/change_instance"
|
||||
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="@color/red_1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:labelFor="@+id/username"
|
||||
android:text="@string/username" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:labelFor="@+id/email"
|
||||
android:text="@string/email" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textEmailAddress"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/email_indicator"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:labelFor="@+id/password"
|
||||
android:text="@string/password" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/password_indicator"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:labelFor="@+id/password_confirm"
|
||||
android:text="@string/password_confirm" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
|
||||
<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"
|
||||
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:text="@string/sign_up" />
|
||||
</LinearLayout>
|
|
@ -2,5 +2,4 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</RelativeLayout>
|
||||
android:layout_height="match_parent"></RelativeLayout>
|
|
@ -12,6 +12,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -45,10 +46,10 @@
|
|||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/account_pp_border"
|
||||
android:contentDescription="@string/profile_picture"
|
||||
android:padding="2dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/banner_pp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/banner_pp"
|
||||
|
@ -57,12 +58,13 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:padding="2dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/banner_pp"
|
||||
app:layout_constraintTop_toBottomOf="@id/banner_pp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:padding="2dp">
|
||||
app:layout_constraintTop_toBottomOf="@id/banner_pp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/names_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -71,6 +73,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -79,6 +82,7 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_un"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -89,6 +93,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/account_follow"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
|
@ -150,16 +155,17 @@
|
|||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textIsSelectable="true" />
|
||||
android:textIsSelectable="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -167,6 +173,7 @@
|
|||
android:layout_marginBottom="2dp"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -237,19 +244,20 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/account_tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
app:tabTextColor="@android:color/white"
|
||||
app:tabSelectedTextColor="?colorAccent" />
|
||||
app:tabSelectedTextColor="?colorAccent"
|
||||
app:tabTextColor="@android:color/white" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
|
|
|
@ -150,8 +150,7 @@
|
|||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="?colorAccent"
|
||||
app:fabSize="mini"
|
||||
/>
|
||||
app:fabSize="mini" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_container"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
android:paddingRight="4dp"
|
||||
android:textColor="#FFBEBEBE"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@id/exo_position"
|
||||
|
@ -86,8 +86,7 @@
|
|||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:textColor="#FFBEBEBE"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
android:textSize="12sp" />
|
||||
|
||||
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||
android:id="@id/exo_progress"
|
||||
|
@ -103,8 +102,7 @@
|
|||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:textColor="#FFBEBEBE"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
android:textSize="12sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/exo_fullscreen_button"
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:icon="@android:drawable/ic_menu_search"
|
||||
app:showAsAction="always|collapseActionView"
|
||||
android:title="@string/search"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
android:title="@string/search"/>
|
||||
app:showAsAction="always|collapseActionView" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_change_instance"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -115,5 +115,33 @@
|
|||
<string name="search">Chercher</string>
|
||||
<string name="toast_error_search">Une erreur s’est produite lors de la recherche !</string>
|
||||
<string name="no_result">Aucun résultat !</string>
|
||||
<string name="app_logo">Logo de l’application</string>
|
||||
|
||||
<string name="join_peertube">Rejoignez Peertube</string>
|
||||
<string name="username">Nom d’utilisateur</string>
|
||||
<string name="password">Mot de passe</string>
|
||||
<string name="add_account">Ajouter un compte</string>
|
||||
<string name="login">Connexion</string>
|
||||
<string name="client_error">Impossible d’obtenir l’id du client !</string>
|
||||
<string name="email">Email</string>
|
||||
<string name="email_indicator">Vous recevrez un e-mail de confirmation</string>
|
||||
<string name="password_indicator">Utilisez au moins 8 caractères</string>
|
||||
<string name="password_confirm">Confirmer le mot de passe</string>
|
||||
<string name="agreement_check_peertube">J\'ai au moins 16 ans et je suis d\'accord avec les %1$s de cette instance</string>
|
||||
<string name="sign_up">S’inscrire</string>
|
||||
<string name="account_created">Compte créé !</string>
|
||||
<string name="account_created_message"> Your account has been created!\n\n
|
||||
Think to validate your email within the 48 next hours.\n\n
|
||||
You can now connect your account by writing <b>%1$s</b> in the first field and click on <b>Connect</b>.\n\n
|
||||
<b>Important</b>: If your instance required validation, you will receive an email once it is validated!
|
||||
</string>
|
||||
<string name="all_field_filled">Veuillez remplir tous les champs !</string>
|
||||
<string name="password_error">Les mots de passe ne sont pas identiques !</string>
|
||||
<string name="email_error">L\'e-mail ne semble pas être valide !</string>
|
||||
<string name="password_too_short">Le mot de passe doit contenir au moins 8 caractères</string>
|
||||
<string name="username_error">Le nom d\'utilisateur·rice doit contenir uniquement des lettres, des chiffres et des caractères de soulignement</string>
|
||||
<string name="tos">conditions de service</string>
|
||||
<string name="server_rules">règles du serveur</string>
|
||||
<string name="agreement_check">J\'accepte les %1$s et les %2$s</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue