소스 검색

Fix some bugs

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 년 전
부모
커밋
ce895d9662

+ 1 - 2
app/build.gradle

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

+ 1 - 1
app/src/main/AndroidManifest.xml

@@ -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"/>

+ 15 - 8
app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.java

@@ -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();
                     }

+ 4 - 2
app/src/main/res/layout/controller_server_selection.xml

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