mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-24 09:00:31 +00:00
Merge pull request #2868 from yausername/fix-add-instance-dialog
fix add instance dialog
This commit is contained in:
commit
f995ba115c
@ -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
Block a user