diff options
3 files changed, 15 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java index 703b6ef0..ca848f2e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java @@ -1,6 +1,7 @@ package se.leap.bitmaskclient; import android.content.Intent; +import android.os.Bundle; import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputLayout; import android.text.Editable; @@ -10,6 +11,8 @@ import android.widget.Button; import butterknife.InjectView; +import static se.leap.bitmaskclient.ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL; + /** * Created by cyberta on 30.06.18. */ @@ -27,10 +30,15 @@ public abstract class AddProviderBaseActivity extends ConfigWizardBaseActivity { @InjectView(R.id.button_cancel) Button cancelButton; + @InjectView(R.id.button_save) + Button saveButton; + protected void init() { - if (this.getIntent().getExtras() != null) { - editUrl.setText(this.getIntent().getExtras().getString(ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL)); + Bundle extras = this.getIntent().getExtras(); + if (extras != null && extras.containsKey(EXTRAS_KEY_INVALID_URL)) { + editUrl.setText(extras.getString(EXTRAS_KEY_INVALID_URL)); + saveButton.setEnabled(true); } setupSaveButton(); @@ -82,8 +90,11 @@ public abstract class AddProviderBaseActivity extends ConfigWizardBaseActivity { public void afterTextChanged(Editable s) { if (!validURL(getURL())) { urlError.setError(getString(R.string.not_valid_url_entered)); + saveButton.setEnabled(false); + } else { urlError.setError(null); + saveButton.setEnabled(true); } } }); diff --git a/app/src/main/res/layout/a_add_provider.xml b/app/src/main/res/layout/a_add_provider.xml index 7d14ea96..c1322bef 100644 --- a/app/src/main/res/layout/a_add_provider.xml +++ b/app/src/main/res/layout/a_add_provider.xml @@ -76,6 +76,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="@dimen/add_button_margin" android:layout_marginStart="@dimen/add_button_margin" + android:enabled="false" android:text="@string/save" /> </LinearLayout> diff --git a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml index 220aabeb..132deba0 100644 --- a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml +++ b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml @@ -84,6 +84,7 @@ android:minWidth="80dp" android:layout_marginLeft="@dimen/add_button_margin" android:layout_marginStart="@dimen/add_button_margin" + android:enabled="false" android:text="@string/save" /> </LinearLayout> </RelativeLayout> |