Skip to content

Commit

Permalink
Merge pull request #7971 from nextcloud/textfieldDesign
Browse files Browse the repository at this point in the history
Textfield design
  • Loading branch information
AndyScherzinger authored Feb 12, 2021
2 parents 7e100e5 + e21f6ef commit b760abd
Show file tree
Hide file tree
Showing 13 changed files with 244 additions and 213 deletions.
2 changes: 1 addition & 1 deletion scripts/analysis/lint-results.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 243 warnings</span>
<span class="mdl-layout-title">Lint Report: 240 warnings</span>
3 changes: 2 additions & 1 deletion src/androidTest/java/com/owncloud/android/ui/LoginIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.action.ViewActions.typeTextIntoFocusedView;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.web.sugar.Web.onWebView;
import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement;
Expand Down Expand Up @@ -86,7 +87,7 @@ public void login() throws InterruptedException {

onView(withId(R.id.login)).perform(click());
onView(withId(R.id.host_url_input)).perform(typeText(baseUrl));
onView(withId(R.id.test_server_button)).perform(click());
onView(withId(R.id.host_url_input)).perform(typeTextIntoFocusedView("\n"));

Thread.sleep(3000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class PassCodeActivityIT : AbstractIT() {
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK))

waitForIdleSync()

sut.runOnUiThread { sut.binding.txt0.clearFocus() }

shortSleep()
screenshot(sut)
}

Expand All @@ -47,6 +51,10 @@ class PassCodeActivityIT : AbstractIT() {
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_REQUEST_WITH_RESULT))

waitForIdleSync()

sut.runOnUiThread { sut.binding.txt0.clearFocus() }

shortSleep()
screenshot(sut)
}

Expand All @@ -56,6 +64,10 @@ class PassCodeActivityIT : AbstractIT() {
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK_WITH_RESULT))

waitForIdleSync()

sut.runOnUiThread { sut.binding.txt0.clearFocus() }

shortSleep()
screenshot(sut)
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package com.owncloud.android.ui.activity;

import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import javax.inject.Inject;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;

public class PassCodeActivity extends AppCompatActivity implements Injectable {
Expand Down Expand Up @@ -174,6 +175,10 @@ public void onClick(View v) {
}
}

@VisibleForTesting
public PasscodelockBinding getBinding() {
return binding;
}

/**
* Binds the appropriate listeners to the input boxes receiving each digit of the pass code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package com.owncloud.android.ui.dialog;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
Expand All @@ -30,9 +29,8 @@
import android.view.Window;
import android.view.WindowManager.LayoutParams;

import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.owncloud.android.R;
import com.owncloud.android.databinding.NoteDialogBinding;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.utils.DisplayUtils;
Expand All @@ -42,9 +40,6 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
* Dialog to input a multiline note for a share
Expand All @@ -56,13 +51,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
public static final String NOTE_FRAGMENT = "NOTE_FRAGMENT";

private OCShare share;
private Unbinder unbinder;

@BindView(R.id.user_input_container)
public TextInputLayout noteEditTextInputLayout;

@BindView(R.id.user_input)
public TextInputEditText noteEditText;
private NoteDialogBinding binding;

public static NoteDialogFragment newInstance(OCShare share) {
NoteDialogFragment frag = new NoteDialogFragment();
Expand Down Expand Up @@ -103,15 +92,14 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

// Inflate the layout for the dialog
LayoutInflater inflater = requireActivity().getLayoutInflater();
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.note_dialog, null, false);

unbinder = ButterKnife.bind(this, view);
binding = NoteDialogBinding.inflate(inflater, null, false);
View view = binding.getRoot();

// Setup layout
noteEditText.setText(share.getNote());
noteEditText.setHighlightColor(ThemeUtils.primaryColor(getActivity()));
noteEditText.requestFocus();
ThemeUtils.colorTextInputLayout(noteEditTextInputLayout, accentColor);
binding.noteText.setText(share.getNote());
binding.noteText.setHighlightColor(ThemeUtils.primaryColor(getActivity()));
binding.noteText.requestFocus();
ThemeUtils.colorTextInputLayout(binding.noteContainer, accentColor);

// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
Expand All @@ -138,8 +126,8 @@ public void onClick(DialogInterface dialog, int which) {
if (componentsGetter != null) {
String note = "";

if (noteEditText.getText() != null) {
note = noteEditText.getText().toString().trim();
if (binding.noteText.getText() != null) {
note = binding.noteText.getText().toString().trim();
}

componentsGetter.getFileOperationsHelper().updateNoteToShare(share, note);
Expand All @@ -150,9 +138,8 @@ public void onClick(DialogInterface dialog, int which) {
}

@Override
public void onStop() {
unbinder.unbind();

super.onStop();
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
86 changes: 43 additions & 43 deletions src/main/res/layout-land/account_setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,83 +55,83 @@
<FrameLayout
android:id="@+id/host_url_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/zero"
android:background="@color/primary">
android:layout_height="wrap_content">

<LinearLayout
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/host_url_container"
style="@style/Widget.App.Login.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="@string/auth_host_url"
android:labelFor="@+id/host_url_input"
android:textColor="@color/login_text_color" />
android:layout_height="wrap_content"
android:hint="@string/auth_host_url"
android:theme="@style/TextInputLayoutLogin"
app:endIconContentDescription="@string/test_server_button"
app:endIconDrawable="@drawable/arrow_right"
app:endIconMode="custom"
app:endIconTint="@color/login_text_color">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/host_url_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/minimum_size_for_touchable_area"
android:layout_gravity="bottom"
android:drawablePadding="@dimen/alternate_half_padding"
android:inputType="textUri"
android:paddingStart="@dimen/zero"
android:gravity="top"
android:importantForAutofill="no"
android:inputType="textCapSentences|textMultiLine|textNoSuggestions"
android:lines="1"
android:minLines="1"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="@dimen/alternate_padding_right"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color">
android:scrollbars="vertical">

<requestFocus />

</com.google.android.material.textfield.TextInputEditText>

</LinearLayout>

<ImageButton
android:id="@+id/test_server_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:background="@android:color/transparent"
android:contentDescription="@string/test_server_button"
android:onClick="onTestServerConnectionClick"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/login_btn_tint" />

</com.google.android.material.textfield.TextInputLayout>
</FrameLayout>

<TextView
android:id="@+id/host_url_input_helper_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.2"
android:paddingStart="@dimen/standard_padding"
android:paddingTop="@dimen/standard_quarter_padding"
android:paddingEnd="@dimen/standard_half_padding"
android:paddingBottom="@dimen/standard_eight_padding"
android:text="@string/login_url_helper_text"
android:textColor="@color/white_helper_text" />

<TextView
android:id="@+id/server_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_half_margin"
android:contentDescription="@string/auth_testing_connection"
app:drawableStartCompat="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:minHeight="@dimen/display_text_min_height"
android:paddingStart="@dimen/standard_padding"
android:paddingTop="@dimen/standard_eight_padding"
android:paddingEnd="@dimen/standard_eight_padding"
android:paddingBottom="@dimen/standard_eight_padding"
android:text="@string/auth_testing_connection"
android:textColor="@color/login_text_color"
android:visibility="invisible" />
android:visibility="invisible"
app:drawableStartCompat="@android:drawable/stat_notify_sync" />

<TextView
android:id="@+id/auth_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/auth_unauthorized"
app:drawableStartCompat="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:paddingStart="@dimen/standard_padding"
android:paddingTop="@dimen/standard_eight_padding"
android:paddingEnd="@dimen/standard_eight_padding"
android:paddingBottom="@dimen/standard_eight_padding"
android:text="@string/auth_unauthorized"
android:textColor="@color/login_text_color" />
android:textColor="@color/login_text_color"
app:drawableStartCompat="@android:drawable/stat_notify_sync" />

<ImageButton
android:id="@+id/scan_qr"
Expand Down
Loading

0 comments on commit b760abd

Please sign in to comment.