fix add instance dialog
This commit is contained in:
parent
88a6e5981f
commit
c8c7d23971
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.text.InputType;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -203,17 +204,18 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||||
|
|
||||||
private void showAddItemDialog(Context c) {
|
private void showAddItemDialog(Context c) {
|
||||||
final EditText urlET = new EditText(c);
|
final EditText urlET = new EditText(c);
|
||||||
|
urlET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||||
urlET.setHint(R.string.peertube_instance_add_help);
|
urlET.setHint(R.string.peertube_instance_add_help);
|
||||||
AlertDialog dialog = new AlertDialog.Builder(c)
|
AlertDialog dialog = new AlertDialog.Builder(c)
|
||||||
.setTitle(R.string.peertube_instance_add_title)
|
.setTitle(R.string.peertube_instance_add_title)
|
||||||
.setIcon(R.drawable.place_holder_peertube)
|
.setIcon(R.drawable.place_holder_peertube)
|
||||||
.setView(urlET)
|
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.finish, (dialog1, which) -> {
|
.setPositiveButton(R.string.finish, (dialog1, which) -> {
|
||||||
String url = urlET.getText().toString();
|
String url = urlET.getText().toString();
|
||||||
addInstance(url);
|
addInstance(url);
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
|
dialog.setView(urlET, 50, 0, 50, 0);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +239,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String cleanUrl(String url){
|
private String cleanUrl(String url){
|
||||||
|
url = url.trim();
|
||||||
// if protocol not present, add https
|
// if protocol not present, add https
|
||||||
if(!url.startsWith("http")){
|
if(!url.startsWith("http")){
|
||||||
url = "https://" + url;
|
url = "https://" + url;
|
||||||
|
|
Loading…
Reference in New Issue