Merge pull request #2868 from yausername/fix-add-instance-dialog

fix add instance dialog
This commit is contained in:
Tobias Groza 2019-12-15 11:01:13 +01:00 committed by GitHub
commit f995ba115c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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;