mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-19 16:46:20 +01:00
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.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.InputType;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -203,17 +204,18 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||
|
||||
private void showAddItemDialog(Context 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);
|
||||
AlertDialog dialog = new AlertDialog.Builder(c)
|
||||
.setTitle(R.string.peertube_instance_add_title)
|
||||
.setIcon(R.drawable.place_holder_peertube)
|
||||
.setView(urlET)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.finish, (dialog1, which) -> {
|
||||
String url = urlET.getText().toString();
|
||||
addInstance(url);
|
||||
})
|
||||
.create();
|
||||
dialog.setView(urlET, 50, 0, 50, 0);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@ -237,6 +239,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
private String cleanUrl(String url){
|
||||
url = url.trim();
|
||||
// if protocol not present, add https
|
||||
if(!url.startsWith("http")){
|
||||
url = "https://" + url;
|
||||
|
Loading…
Reference in New Issue
Block a user