mirror of
https://github.com/nuclearfog/Shitter.git
synced 2024-12-28 02:20:46 +01:00
created API settings dialog. removed API settings from LoginActivity, layout fix
This commit is contained in:
parent
b6f7011fec
commit
8c42c0f72d
@ -333,7 +333,9 @@ public class FragmentAdapter extends FragmentStatePagerAdapter {
|
||||
*/
|
||||
public void notifySettingsChanged() {
|
||||
for (ListFragment fragment : fragments) {
|
||||
fragment.reset();
|
||||
if (!fragment.isDetached()) {
|
||||
fragment.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +345,8 @@ public class FragmentAdapter extends FragmentStatePagerAdapter {
|
||||
* @param index tab position of page
|
||||
*/
|
||||
public void scrollToTop(int index) {
|
||||
fragments[index].onTabChange();
|
||||
if (!fragments[index].isDetached()) {
|
||||
fragments[index].onTabChange();
|
||||
}
|
||||
}
|
||||
}
|
@ -11,21 +11,17 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Patterns;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -34,8 +30,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.kyleduo.switchbutton.SwitchButton;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.NetworkAdapter;
|
||||
import org.nuclearfog.twidda.backend.api.ConnectionException;
|
||||
@ -44,7 +38,6 @@ import org.nuclearfog.twidda.backend.async.LoginAction;
|
||||
import org.nuclearfog.twidda.backend.utils.AppStyles;
|
||||
import org.nuclearfog.twidda.backend.utils.ErrorHandler;
|
||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
import org.nuclearfog.twidda.model.Account;
|
||||
|
||||
/**
|
||||
* Account Activity of the App
|
||||
@ -52,7 +45,7 @@ import org.nuclearfog.twidda.model.Account;
|
||||
*
|
||||
* @author nuclearfog
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity implements OnClickListener, OnCheckedChangeListener, OnItemSelectedListener, TextWatcher {
|
||||
public class LoginActivity extends AppCompatActivity implements OnClickListener, OnItemSelectedListener {
|
||||
|
||||
/**
|
||||
* request code to open {@link AccountActivity}
|
||||
@ -78,16 +71,16 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
private LoginAction loginAsync;
|
||||
private GlobalSettings settings;
|
||||
|
||||
private EditText apiHost;
|
||||
private EditText pinInput, apiKey1, apiKey2;
|
||||
private SwitchButton apiSwitch;
|
||||
private EditText pinInput;
|
||||
private Spinner hostSelector;
|
||||
private View switchLabel;
|
||||
private ViewGroup root;
|
||||
|
||||
@Nullable
|
||||
private String loginLink;
|
||||
|
||||
private String mastodonHost;
|
||||
private String apiKey1, apiKey2;
|
||||
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
@ -102,19 +95,14 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
Toolbar toolbar = findViewById(R.id.login_toolbar);
|
||||
Button linkButton = findViewById(R.id.login_get_link);
|
||||
Button loginButton = findViewById(R.id.login_verifier);
|
||||
apiHost = findViewById(R.id.login_enter_hostname);
|
||||
switchLabel = findViewById(R.id.login_enable_key_input_label);
|
||||
ImageView settingsButton = findViewById(R.id.login_network_settings);
|
||||
hostSelector = findViewById(R.id.login_network_selector);
|
||||
apiSwitch = findViewById(R.id.login_enable_key_input);
|
||||
root = findViewById(R.id.login_root);
|
||||
pinInput = findViewById(R.id.login_enter_code);
|
||||
apiKey1 = findViewById(R.id.login_enter_key1);
|
||||
apiKey2 = findViewById(R.id.login_enter_key2);
|
||||
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
toolbar.setTitle(R.string.login_info);
|
||||
setSupportActionBar(toolbar);
|
||||
pinInput.setCompoundDrawablesWithIntrinsicBounds(R.drawable.key, 0, 0, 0);
|
||||
NetworkAdapter adapter = new NetworkAdapter(this);
|
||||
hostSelector.setAdapter(adapter);
|
||||
hostSelector.setSelection(0);
|
||||
@ -123,16 +111,11 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
linkButton.setOnClickListener(this);
|
||||
loginButton.setOnClickListener(this);
|
||||
settingsButton.setOnClickListener(this);
|
||||
hostSelector.setOnItemSelectedListener(this);
|
||||
apiSwitch.setOnCheckedChangeListener(this);
|
||||
apiKey1.addTextChangedListener(this);
|
||||
apiKey2.addTextChangedListener(this);
|
||||
apiHost.addTextChangedListener(this);
|
||||
|
||||
// set default result code
|
||||
setResult(RESULT_CANCELED);
|
||||
// set input layout
|
||||
setInput();
|
||||
}
|
||||
|
||||
|
||||
@ -200,17 +183,13 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
// generate Twitter login link
|
||||
else if (hostSelector.getSelectedItemId() == NetworkAdapter.ID_TWITTER) {
|
||||
// use user defined token keys
|
||||
if (apiSwitch.isChecked()) {
|
||||
if (apiKey1.length() == 0)
|
||||
apiKey1.setError(getString(R.string.error_empty_token));
|
||||
else if (apiKey2.length() == 0)
|
||||
apiKey2.setError(getString(R.string.error_empty_token));
|
||||
else {
|
||||
String apiTxt1 = apiKey1.getText().toString();
|
||||
String apiTxt2 = apiKey2.getText().toString();
|
||||
if (apiKey1 != null && apiKey2 != null) {
|
||||
if (apiKey1.trim().isEmpty() || apiKey2.trim().isEmpty()) {
|
||||
Toast.makeText(getApplicationContext(), R.string.error_empty_token, LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), R.string.info_open_twitter_login, LENGTH_LONG).show();
|
||||
loginAsync = new LoginAction(this, LoginAction.LOGIN_TWITTER, LoginAction.MODE_REQUEST);
|
||||
loginAsync.execute(apiTxt1, apiTxt2);
|
||||
loginAsync.execute(apiKey1, apiKey2);
|
||||
}
|
||||
}
|
||||
// use system tokens
|
||||
@ -222,21 +201,23 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
// generate Mastodon login
|
||||
else if (hostSelector.getSelectedItemId() == NetworkAdapter.ID_MASTODON) {
|
||||
if (apiHost.length() > 0 && !Patterns.WEB_URL.matcher(apiHost.getText()).matches()) {
|
||||
Toast.makeText(getApplicationContext(), R.string.error_invalid_url, LENGTH_LONG).show();
|
||||
} else {
|
||||
if (mastodonHost == null || Patterns.WEB_URL.matcher(mastodonHost).matches()){
|
||||
Toast.makeText(getApplicationContext(), R.string.info_open_mastodon_login, LENGTH_LONG).show();
|
||||
loginAsync = new LoginAction(this, LoginAction.LOGIN_MASTODON, LoginAction.MODE_REQUEST);
|
||||
if (apiHost.length() > 0) {
|
||||
String link = apiHost.getText().toString();
|
||||
if (mastodonHost != null) {
|
||||
// open userdefined url
|
||||
String link = mastodonHost;
|
||||
if (!link.startsWith("https://"))
|
||||
link = "https://" + link;
|
||||
if (link.endsWith("/"))
|
||||
link = link.substring(0, link.length() - 1);
|
||||
loginAsync.execute(link);
|
||||
} else {
|
||||
// use default Mastodon url (mastodon.social)
|
||||
loginAsync.execute();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), R.string.error_invalid_url, LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -251,17 +232,13 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
// login to Twitter
|
||||
else if (hostSelector.getSelectedItemId() == NetworkAdapter.ID_TWITTER) {
|
||||
if (apiSwitch.isChecked()) {
|
||||
if (apiKey1.length() == 0)
|
||||
apiKey1.setError(getString(R.string.error_empty_token));
|
||||
else if (apiKey2.length() == 0)
|
||||
apiKey2.setError(getString(R.string.error_empty_token));
|
||||
else {
|
||||
String apiTxt1 = apiKey1.getText().toString();
|
||||
String apiTxt2 = apiKey2.getText().toString();
|
||||
if (apiKey1 != null && apiKey2 != null) {
|
||||
if (apiKey1.trim().isEmpty() || apiKey2.trim().isEmpty()) {
|
||||
Toast.makeText(getApplicationContext(), R.string.error_empty_token, LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), R.string.info_login_to_twitter, LENGTH_LONG).show();
|
||||
loginAsync = new LoginAction(this, LoginAction.LOGIN_TWITTER, LoginAction.MODE_LOGIN);
|
||||
loginAsync.execute(loginLink, code, apiTxt1, apiTxt2);
|
||||
loginAsync.execute(loginLink, code, apiKey1, apiKey2);
|
||||
}
|
||||
}
|
||||
// use system tokens
|
||||
@ -281,27 +258,10 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (buttonView.getId() == R.id.login_enable_key_input) {
|
||||
if (isChecked) {
|
||||
apiKey1.setVisibility(View.VISIBLE);
|
||||
apiKey2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
apiKey1.setVisibility(View.INVISIBLE);
|
||||
apiKey2.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
// reset login link
|
||||
loginLink = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
// reset login link after provider change
|
||||
loginLink = null;
|
||||
setInput();
|
||||
}
|
||||
|
||||
|
||||
@ -309,23 +269,6 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
// remove login link if API keys or host changes
|
||||
loginLink = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the app is registered successfully
|
||||
*/
|
||||
@ -361,51 +304,4 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener,
|
||||
Toast.makeText(getApplicationContext(), R.string.error_open_link, LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setInput() {
|
||||
long id = hostSelector.getSelectedItemId();
|
||||
if (id == NetworkAdapter.ID_TWITTER) {
|
||||
// disable Mastodon input
|
||||
apiHost.setVisibility(View.GONE);
|
||||
pinInput.setInputType(EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
|
||||
// check if app contains default API keys
|
||||
if (Tokens.USE_DEFAULT_KEYS) {
|
||||
apiSwitch.setVisibility(View.VISIBLE);
|
||||
switchLabel.setVisibility(View.VISIBLE);
|
||||
// set key input visibility depending on API switch
|
||||
if (apiSwitch.isChecked()) {
|
||||
apiKey1.setVisibility(View.VISIBLE);
|
||||
apiKey2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
apiKey1.setVisibility(View.INVISIBLE);
|
||||
apiKey2.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
// if not, force Twitter API key input
|
||||
else {
|
||||
apiKey1.setVisibility(View.VISIBLE);
|
||||
apiKey2.setVisibility(View.VISIBLE);
|
||||
apiSwitch.setVisibility(View.GONE);
|
||||
switchLabel.setVisibility(View.GONE);
|
||||
}
|
||||
// add API keys from previous Twitter login if exists
|
||||
Account login = settings.getLogin();
|
||||
if (!login.usingDefaultTokens()) {
|
||||
apiKey1.setText(login.getConsumerToken());
|
||||
apiKey2.setText(login.getConsumerSecret());
|
||||
}
|
||||
}
|
||||
// mastodon selected
|
||||
else if (id == NetworkAdapter.ID_MASTODON) {
|
||||
// setup Mastodon input
|
||||
pinInput.setInputType(EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
apiHost.setVisibility(View.VISIBLE);
|
||||
// disable Twitter input
|
||||
apiSwitch.setVisibility(View.GONE);
|
||||
switchLabel.setVisibility(View.GONE);
|
||||
apiKey1.setVisibility(View.GONE);
|
||||
apiKey2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
@ -60,7 +60,6 @@ import org.nuclearfog.twidda.backend.utils.ErrorHandler;
|
||||
import org.nuclearfog.twidda.backend.utils.PicassoBuilder;
|
||||
import org.nuclearfog.twidda.backend.utils.StringTools;
|
||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
import org.nuclearfog.twidda.model.Account;
|
||||
import org.nuclearfog.twidda.model.Card;
|
||||
import org.nuclearfog.twidda.model.Location;
|
||||
import org.nuclearfog.twidda.model.Media;
|
||||
@ -73,7 +72,6 @@ import org.nuclearfog.twidda.ui.dialogs.MetricsDialog;
|
||||
import org.nuclearfog.twidda.ui.fragments.StatusFragment;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -324,10 +322,9 @@ public class StatusActivity extends AppCompatActivity implements OnClickListener
|
||||
}
|
||||
if (status.getAuthor().isCurrentUser()) {
|
||||
optDelete.setVisible(true);
|
||||
long currentTime = new Date().getTime();
|
||||
if (settings.getLogin().getApiType() == Account.API_TWITTER && currentTime - status.getTimestamp() < 2419200000L) {
|
||||
optMetrics.setVisible(true);
|
||||
}
|
||||
}
|
||||
if (status.getMetrics() != null) {
|
||||
optMetrics.setVisible(true);
|
||||
}
|
||||
// add media link items
|
||||
// check if menu doesn't contain media links already
|
||||
|
@ -181,17 +181,15 @@ public class ConfirmDialog extends Dialog implements OnClickListener {
|
||||
* @param messageTxt override default message text
|
||||
*/
|
||||
public void show(int type, @NonNull String messageTxt) {
|
||||
if (isShowing())
|
||||
if (isShowing()) {
|
||||
return;
|
||||
|
||||
}
|
||||
// attach type to the view
|
||||
confirm.setTag(type);
|
||||
|
||||
// default visibility values
|
||||
int titleVis = View.GONE;
|
||||
int confirmVis = View.INVISIBLE;
|
||||
int cancelVis = View.VISIBLE;
|
||||
|
||||
// default resource values
|
||||
int titleRes = R.string.info_error;
|
||||
int messageRes = R.string.confirm_unknown_error;
|
||||
@ -199,7 +197,7 @@ public class ConfirmDialog extends Dialog implements OnClickListener {
|
||||
int confirmIconRes = R.drawable.check;
|
||||
int cancelRes = android.R.string.cancel;
|
||||
int cancelIconRes = R.drawable.cross;
|
||||
|
||||
// override values depending on type
|
||||
switch (type) {
|
||||
case MESSAGE_DELETE:
|
||||
messageRes = R.string.confirm_delete_message;
|
||||
@ -287,24 +285,25 @@ public class ConfirmDialog extends Dialog implements OnClickListener {
|
||||
messageRes = R.string.dialog_warning_videoview;
|
||||
break;
|
||||
}
|
||||
// setup title
|
||||
title.setVisibility(titleVis);
|
||||
title.setText(titleRes);
|
||||
|
||||
// setup cancel button
|
||||
cancel.setVisibility(cancelVis);
|
||||
cancel.setText(cancelRes);
|
||||
cancel.setCompoundDrawablesWithIntrinsicBounds(cancelIconRes, 0, 0, 0);
|
||||
|
||||
confirmCheck.setVisibility(confirmVis);
|
||||
confirmDescr.setVisibility(confirmVis);
|
||||
|
||||
// setup confirm button
|
||||
confirm.setText(confirmRes);
|
||||
confirm.setCompoundDrawablesWithIntrinsicBounds(confirmIconRes, 0, 0, 0);
|
||||
|
||||
if (messageTxt.isEmpty())
|
||||
// setup remember choice checkbox
|
||||
confirmCheck.setVisibility(confirmVis);
|
||||
confirmDescr.setVisibility(confirmVis);
|
||||
// setup message
|
||||
if (messageTxt.isEmpty()) {
|
||||
message.setText(messageRes);
|
||||
else
|
||||
} else {
|
||||
message.setText(messageTxt);
|
||||
|
||||
}
|
||||
AppStyles.setTheme(root);
|
||||
super.show();
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package org.nuclearfog.twidda.ui.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.kyleduo.switchbutton.SwitchButton;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
|
||||
public class ConnectionDialog extends Dialog implements OnCheckedChangeListener, OnClickListener {
|
||||
|
||||
public static final int TYPE_TWITTER = 1;
|
||||
|
||||
public static final int TYPE_MASTODON = 2;
|
||||
|
||||
private SwitchButton enableApi, enableV2, enableHost;
|
||||
private TextView apiLabel, v2Label, hostLabel;
|
||||
private EditText host, api1, api2;
|
||||
private Button confirm;
|
||||
|
||||
private OnConnectionSetCallback callback;
|
||||
private int type;
|
||||
|
||||
public ConnectionDialog(Context context, OnConnectionSetCallback callback) {
|
||||
super(context, R.style.ConfirmDialog);
|
||||
this.callback = callback;
|
||||
setContentView(R.layout.dialog_connection);
|
||||
enableApi = findViewById(R.id.dialog_connection_custom_api);
|
||||
enableV2 = findViewById(R.id.dialog_connection_use_v2);
|
||||
enableHost = findViewById(R.id.dialog_connection_custom_host);
|
||||
apiLabel = findViewById(R.id.dialog_connection_custom_api_label);
|
||||
v2Label = findViewById(R.id.dialog_connection_use_v2_label);
|
||||
hostLabel = findViewById(R.id.dialog_connection_custom_host_label);
|
||||
host = findViewById(R.id.dialog_connection_hostname);
|
||||
api1 = findViewById(R.id.dialog_connection_api1);
|
||||
api2 = findViewById(R.id.dialog_connection_api2);
|
||||
confirm = findViewById(R.id.dialog_connection_confirm);
|
||||
|
||||
enableApi.setOnCheckedChangeListener(this);
|
||||
enableHost.setOnCheckedChangeListener(this);
|
||||
confirm.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.dialog_connection_confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (buttonView.getId() == R.id.dialog_connection_custom_api) {
|
||||
if (isChecked) {
|
||||
enableV2.setVisibility(View.VISIBLE);
|
||||
v2Label.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
enableV2.setVisibility(View.INVISIBLE);
|
||||
v2Label.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
else if (buttonView.getId() == R.id.dialog_connection_custom_host) {
|
||||
if (isChecked) {
|
||||
host.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
host.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
}
|
||||
|
||||
|
||||
public void show(int type) {
|
||||
switch(type) {
|
||||
case TYPE_TWITTER:
|
||||
host.setVisibility(View.GONE);
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_MASTODON:
|
||||
break;
|
||||
}
|
||||
super.show();
|
||||
}
|
||||
|
||||
|
||||
public interface OnConnectionSetCallback {
|
||||
|
||||
void onConnectionSet(String key1, String key2, String hostname);
|
||||
}
|
||||
}
|
9
app/src/main/res/drawable/cog.xml
Normal file
9
app/src/main/res/drawable/cog.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M16.783,10c0,-1.049 0.646,-1.875 1.617,-2.443c-0.176,-0.584 -0.407,-1.145 -0.692,-1.672c-1.089,0.285 -1.97,-0.141 -2.711,-0.883c-0.741,-0.74 -0.968,-1.621 -0.683,-2.711c-0.527,-0.285 -1.088,-0.518 -1.672,-0.691C12.074,2.57 11.047,3.215 10,3.215c-1.048,0 -2.074,-0.645 -2.643,-1.615C6.772,1.773 6.213,2.006 5.686,2.291c0.285,1.09 0.059,1.971 -0.684,2.711C4.262,5.744 3.381,6.17 2.291,5.885C2.006,6.412 1.774,6.973 1.6,7.557C2.57,8.125 3.215,8.951 3.215,10c0,1.047 -0.645,2.074 -1.615,2.643c0.175,0.584 0.406,1.144 0.691,1.672c1.09,-0.285 1.971,-0.059 2.711,0.682c0.741,0.742 0.969,1.623 0.684,2.711c0.527,0.285 1.087,0.518 1.672,0.693c0.568,-0.973 1.595,-1.617 2.643,-1.617c1.047,0 2.074,0.645 2.643,1.617c0.584,-0.176 1.144,-0.408 1.672,-0.693c-0.285,-1.088 -0.059,-1.969 0.683,-2.711c0.741,-0.74 1.622,-1.166 2.711,-0.883c0.285,-0.527 0.517,-1.086 0.692,-1.672C17.429,11.873 16.783,11.047 16.783,10zM10,13.652c-2.018,0 -3.653,-1.635 -3.653,-3.652c0,-2.018 1.636,-3.654 3.653,-3.654c2.018,0 3.652,1.637 3.652,3.654C13.652,12.018 12.018,13.652 10,13.652z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
117
app/src/main/res/layout/dialog_connection.xml
Normal file
117
app/src/main/res/layout/dialog_connection.xml
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UseSwitchCompatOrMaterialXml">
|
||||
|
||||
<com.kyleduo.switchbutton.SwitchButton
|
||||
android:id="@+id/dialog_connection_custom_api"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/dialog_connection_custom_api_label"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_connection_custom_api_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_key_enable"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_connection_custom_api"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_connection_custom_api"
|
||||
app:layout_constraintEnd_toStartOf="@id/dialog_connection_use_v2" />
|
||||
|
||||
<com.kyleduo.switchbutton.SwitchButton
|
||||
android:id="@+id/dialog_connection_use_v2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_connection_custom_api_label"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/dialog_connection_use_v2_label"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_connection_use_v2_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_key_enable_v2"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_connection_use_v2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_connection_use_v2"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_connection_api1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/settings_key1_hint"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dialog_connection_custom_api"
|
||||
app:layout_constraintEnd_toStartOf="@id/dialog_connection_api2"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_connection_api2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/settings_key2_hint"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_connection_api1"
|
||||
app:layout_constraintTop_toBottomOf="@id/dialog_connection_custom_api"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<com.kyleduo.switchbutton.SwitchButton
|
||||
android:id="@+id/dialog_connection_custom_host"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dialog_connection_api1"
|
||||
app:layout_constraintEnd_toStartOf="@id/dialog_connection_custom_host_label"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_connection_custom_host_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_connection_custom_host"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_connection_custom_host"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_connection_custom_host"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_connection_custom_host"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_connection_hostname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/settings_mastodon_hint"
|
||||
android:lines="1"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dialog_connection_custom_host"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dialog_connection_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dialog_connection_button_height"
|
||||
android:text="@string/dialog_connection_apply"
|
||||
android:lines="1"
|
||||
android:padding="@dimen/dialog_connection_button_padding"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/dialog_connection_hostname"
|
||||
style="@style/FeedbackButton"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -25,111 +25,40 @@
|
||||
android:layout_marginEnd="@dimen/loginpage_number_margin"
|
||||
android:text="@string/login_first_opt"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/login_network_selector"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_network_selector"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_network_selector"
|
||||
app:layout_constraintHorizontal_chainStyle="packed" />
|
||||
app:layout_constraintEnd_toStartOf="@id/login_network_selector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_network_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_network_selector_label"
|
||||
app:layout_constraintStart_toStartOf="@id/login_network_selector"
|
||||
app:layout_constraintBottom_toTopOf="@id/login_network_selector"
|
||||
app:layout_constraintEnd_toEndOf="@id/login_network_selector"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/login_network_selector"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/loginpage_dropdown_margin"
|
||||
app:layout_constraintWidth_percent="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/login_first_opt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_toolbar"
|
||||
app:layout_constraintBottom_toTopOf="@id/login_get_link"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/login_first_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="top"
|
||||
app:constraint_referenced_ids="login_enable_key_input,login_enable_key_input_label,login_enter_key1,login_enter_key2" />
|
||||
|
||||
<com.kyleduo.switchbutton.SwitchButton
|
||||
android:id="@+id/login_enable_key_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/loginpage_layout_margin"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/login_enter_key1"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_enter_key1"
|
||||
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_enable_key_input_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_key_enable"
|
||||
android:textSize="@dimen/loginpage_textsize_switch"
|
||||
android:layout_marginStart="@dimen/loginpage_layout_margin"
|
||||
android:maxWidth="@dimen/loginpage_label_max_width"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toEndOf="@id/login_enable_key_input"
|
||||
app:layout_constraintTop_toTopOf="@id/login_enable_key_input"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_enable_key_input"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_enter_key1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_enter_key1"
|
||||
<ImageView
|
||||
android:id="@+id/login_network_settings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="pin"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawablePadding="@dimen/loginpage_padding_drawable"
|
||||
android:hint="@string/settings_key1_hint"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="@dimen/loginpage_textsize_api_key"
|
||||
android:layout_marginEnd="@dimen/loginpage_layout_margin"
|
||||
android:layout_marginStart="@dimen/loginpage_layout_margin"
|
||||
android:layout_marginTop="@dimen/loginpage_layout_margin"
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintHorizontal_weight="2"
|
||||
app:layout_constraintStart_toEndOf="@id/login_enable_key_input_label"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_network_selector"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_enter_key2" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_enter_key2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="pin"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawablePadding="@dimen/loginpage_padding_drawable"
|
||||
android:hint="@string/settings_key2_hint"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="@dimen/loginpage_textsize_api_key"
|
||||
android:layout_marginTop="@dimen/loginpage_layout_margin"
|
||||
android:layout_marginEnd="@dimen/loginpage_layout_margin"
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintHorizontal_weight="3"
|
||||
app:layout_constraintStart_toEndOf="@id/login_enter_key1"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_network_selector"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_enter_hostname" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_enter_hostname"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:autofillHints="pin"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawablePadding="@dimen/loginpage_padding_drawable"
|
||||
android:hint="@string/settings_mastodon_hint"
|
||||
android:textSize="@dimen/loginpage_textsize_api_key"
|
||||
android:layout_marginStart="@dimen/loginpage_layout_margin"
|
||||
android:layout_marginTop="@dimen/loginpage_layout_margin"
|
||||
android:layout_marginEnd="@dimen/loginpage_layout_margin"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toEndOf="@id/login_enter_key2"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_network_selector"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:inputType="textUri" />
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/cog"
|
||||
android:contentDescription="@string/login_network_settings"
|
||||
android:padding="@dimen/loginpage_padding_drawable"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
app:layout_constraintStart_toEndOf="@id/login_network_selector"
|
||||
app:layout_constraintTop_toTopOf="@id/login_network_selector"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_network_selector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_sec_opt"
|
||||
@ -139,7 +68,6 @@
|
||||
android:layout_marginEnd="@dimen/loginpage_number_margin"
|
||||
android:text="@string/login_sec_opt"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/login_get_link"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_get_link"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_get_link"
|
||||
@ -154,7 +82,7 @@
|
||||
android:text="@string/register_link"
|
||||
android:textSize="@dimen/loginpage_textsize_button"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toEndOf="@id/login_sec_opt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_network_selector"
|
||||
app:layout_constraintBottom_toTopOf="@id/login_enter_code"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -168,11 +96,22 @@
|
||||
android:layout_marginEnd="@dimen/loginpage_number_margin"
|
||||
android:text="@string/login_trd_opt"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintTop_toTopOf="@id/login_enter_code_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_enter_code_icon"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_enter_code_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/login_enter_code_icon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/key"
|
||||
android:layout_marginEnd="@dimen/loginpage_padding_drawable"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/login_enter_code"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_enter_code"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_enter_code"
|
||||
app:layout_constraintHorizontal_chainStyle="packed" />
|
||||
app:layout_constraintHorizontal_chainStyle="packed"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_enter_code"
|
||||
@ -180,15 +119,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="pin"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawablePadding="@dimen/loginpage_padding_drawable"
|
||||
android:hint="@string/login_pin"
|
||||
android:inputType="numberPassword"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="@dimen/loginpage_textsize_login_key"
|
||||
android:lines="1"
|
||||
android:layout_marginEnd="@dimen/loginpage_layout_margin"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintWidth_percent="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/login_third_opt"
|
||||
app:layout_constraintWidth_percent="0.3"
|
||||
app:layout_constraintStart_toEndOf="@id/login_enter_code_icon"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_get_link"
|
||||
app:layout_constraintBottom_toTopOf="@id/login_verifier"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
@ -201,7 +139,6 @@
|
||||
android:layout_marginEnd="@dimen/loginpage_number_margin"
|
||||
android:text="@string/login_4th_opt"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/login_verifier"
|
||||
app:layout_constraintBottom_toBottomOf="@id/login_verifier"
|
||||
app:layout_constraintEnd_toStartOf="@id/login_verifier"
|
||||
@ -216,7 +153,7 @@
|
||||
android:text="@string/login_verifier"
|
||||
android:textSize="@dimen/loginpage_textsize_button"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toEndOf="@id/login_4th_opt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_enter_code"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -234,6 +234,7 @@
|
||||
<string name="menu_tweet_metrics">Metriken</string>
|
||||
<string name="settings_enable_indicators">zeige zusätzliche Status Informationen an</string>
|
||||
<string name="login_key_enable">Token einfügen</string>
|
||||
<string name="login_key_enable_v2">API v2 nutzen</string>
|
||||
<string name="info_open_mastodon_login">öffne Mastodon Loginseite</string>
|
||||
<string name="info_login_to_mastodon">in Mastodon einloggen</string>
|
||||
<string name="error_service_unavailable">Service zur Zeit nicht verfügbar!</string>
|
||||
|
@ -233,6 +233,10 @@
|
||||
<dimen name="userlist_button_padding">5dp</dimen>
|
||||
<dimen name="userlist_title_textsize">20sp</dimen>
|
||||
|
||||
<!--dimens of dialog_connection.xml-->
|
||||
<dimen name="dialog_connection_button_height">24sp</dimen>
|
||||
<dimen name="dialog_connection_button_padding">5dp</dimen>
|
||||
|
||||
<!--dimens of tabitem.xml-->
|
||||
<dimen name="tabitem_icon_size">22sp</dimen>
|
||||
<dimen name="tabitem_textsize">11sp</dimen>
|
||||
|
@ -165,6 +165,7 @@
|
||||
<string name="profile_image">Profile image</string>
|
||||
<string name="login_pin">enter PIN</string>
|
||||
<string name="login_key_enable">add keys</string>
|
||||
<string name="login_key_enable_v2">use API v2</string>
|
||||
<string name="login_verifier">login</string>
|
||||
<string name="popup_tweet_hint">Status</string>
|
||||
<string name="title_settings">Settings</string>
|
||||
@ -220,6 +221,8 @@
|
||||
<string name="proxy_password">Password</string>
|
||||
<string name="settings_key1_hint">Consumer key</string>
|
||||
<string name="settings_key2_hint">Consumer secret</string>
|
||||
<string name="dialog_connection_custom_host">use custom hostname</string>
|
||||
<string name="dialog_connection_apply">apply changes</string>
|
||||
<string name="settings_mastodon_hint" translatable="false">mastodon.social</string>
|
||||
<string name="confirm_mute">mute user?</string>
|
||||
<string name="item_list_pb_desc">Profile of the list owner</string>
|
||||
@ -289,5 +292,7 @@
|
||||
<string name="description_poll_vote_icon">voted</string>
|
||||
<string name="description_attachment_icon">Status/Message attachment</string>
|
||||
<string name="notification_status_poll">vote finished</string>
|
||||
<string name="login_network_selector_label">select network</string>
|
||||
<string name="login_network_settings">network settings</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user