Fix some bugs

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-12-18 22:37:09 +01:00
parent cbd96487ca
commit ce895d9662
4 changed files with 21 additions and 13 deletions

View File

@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion '27.0.0'
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.nextcloud.talk"
versionName version
@ -63,7 +63,6 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
implementation "com.android.support:percent:${supportLibraryVersion}"
implementation 'com.android.support:multidex:1.0.2'

View File

@ -33,7 +33,7 @@
android:name=".activities.MainActivity"
android:label="@string/nc_app_name"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View File

@ -87,7 +87,6 @@ public class ServerSelectionController extends BaseController {
getActionBar().hide();
}
textFieldBoxes.setLabelText(getResources().getString(R.string.nc_server_url));
textFieldBoxes.getEndIconImageButton().setBackgroundDrawable(getResources().getDrawable(R.drawable
.ic_arrow_forward_white_24px));
textFieldBoxes.getEndIconImageButton().setAlpha(0.5f);
@ -111,12 +110,9 @@ public class ServerSelectionController extends BaseController {
@Override
public void afterTextChanged(Editable editable) {
if (!textFieldBoxes.isOnError() && !TextUtils.isEmpty(serverEntry.getText())) {
textFieldBoxes.getEndIconImageButton().setEnabled(true);
textFieldBoxes.getEndIconImageButton().setAlpha(1f);
toggleProceedButton(true);
} else {
textFieldBoxes.getEndIconImageButton().setEnabled(false);
textFieldBoxes.getEndIconImageButton().setAlpha(0.5f);
toggleProceedButton(false);
}
}
});
@ -130,6 +126,15 @@ public class ServerSelectionController extends BaseController {
});
}
private void toggleProceedButton(boolean show) {
textFieldBoxes.getEndIconImageButton().setEnabled(show);
if (show) {
textFieldBoxes.getEndIconImageButton().setAlpha(1f);
} else {
textFieldBoxes.getEndIconImageButton().setAlpha(0.5f);
}
}
private void checkServerAndProceed() {
dispose();
@ -188,20 +193,22 @@ public class ServerSelectionController extends BaseController {
}
}, throwable -> {
if (checkForcedHttps && (throwable instanceof Exception)) {
if (checkForcedHttps) {
checkServer(queryUrl.replace("https://", "http://"), false);
} else {
if (throwable.getLocalizedMessage() != null) {
textFieldBoxes.setError(throwable.getLocalizedMessage(), true);
} else if (throwable.getCause() instanceof CertificateException) {
textFieldBoxes.setError(getResources().getString(R.string.nc_certificate_error),
true);
false);
}
if (serverEntry != null) {
serverEntry.setEnabled(true);
}
progressBar.setVisibility(View.GONE);
toggleProceedButton(false);
dispose();
}

View File

@ -27,11 +27,12 @@
android:fitsSystemWindows="true">
<ImageView
android:id="@+id/image_logo"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_above="@id/text_field_boxes"
android:layout_centerHorizontal="true"
android:layout_marginBottom="36dp"
android:layout_marginTop="108dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_logo"/>
@ -39,11 +40,12 @@
android:id="@+id/text_field_boxes"
android:layout_width="wrap_content"
android:layout_height="72dp"
android:layout_centerInParent="true"
android:layout_below="@id/image_logo"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
app:labelText="@string/nc_server_url"
app:errorColor="@color/nc_white_color_complete"
app:helperText=" "
app:panelBackgroundColor="@color/colorPrimary"