Skip to content

Commit

Permalink
replace text filed
Browse files Browse the repository at this point in the history
Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Jan 22, 2018
1 parent 0e2b410 commit 8264d2a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
Expand Up @@ -28,8 +28,6 @@
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.DialogFragment;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.AlertDialog;
Expand Down Expand Up @@ -84,9 +82,8 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
private ArbitraryDataProvider arbitraryDataProvider;
private Button positiveButton;
private Button negativeButton;
private TextInputLayout passwordLayout;
private DownloadKeysAsyncTask task;
private TextInputEditText passwordField;
private TextView passwordField;
private String keyResult;
private ArrayList<String> keyWords;

Expand Down Expand Up @@ -136,7 +133,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.setup_encryption_dialog, null);
textView = v.findViewById(R.id.encryption_status);
passphraseTextView = v.findViewById(R.id.encryption_passphrase);
passwordLayout = v.findViewById(R.id.encryption_passwordLayout);
passwordField = v.findViewById(R.id.encryption_passwordInput);
passwordField.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);

Expand Down Expand Up @@ -307,7 +303,7 @@ protected void onPostExecute(String privateKey) {
}
} else if (!privateKey.isEmpty()) {
textView.setText(R.string.end_to_end_encryption_enter_password);
passwordLayout.setVisibility(View.VISIBLE);
passwordField.setVisibility(View.VISIBLE);
positiveButton.setVisibility(View.VISIBLE);
} else {
Log_OC.e(TAG, "Got empty private key string");
Expand Down
59 changes: 26 additions & 33 deletions src/main/res/layout/setup_encryption_dialog.xml
@@ -1,24 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
ownCloud Android client application
<?xml version="1.0" encoding="utf-8"?><!--
Nextcloud Android client application
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2015 ownCloud Inc.
Copyright (C) 2018 Tobias Kaminsky
Copyright (C) 2018 Nextcloud
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
License as published by the Free Software Foundation; either
version 3 of the License, or any later version.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU AFFERO GENERAL PUBLIC LICENSE for more details.
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="clip_horizontal"
Expand All @@ -29,32 +28,26 @@
android:id="@+id/encryption_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
android:layout_margin="@dimen/standard_margin" />

<TextView
android:id="@+id/encryption_passphrase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_margin="@dimen/standard_margin"
android:background="@drawable/e2e_border"
android:textIsSelectable="true"
android:gravity="center"
android:padding="5dp"
android:visibility="gone"/>
android:textIsSelectable="true"
android:visibility="gone" />

<android.support.design.widget.TextInputLayout
android:id="@+id/encryption_passwordLayout"
<EditText
android:id="@+id/encryption_passwordInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:passwordToggleEnabled="true">

<android.support.design.widget.TextInputEditText
android:id="@+id/encryption_passwordInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/end_to_end_encryption_password"
android:ems="10"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
android:ems="10"
android:hint="@string/end_to_end_encryption_password"
android:inputType="textPassword"
android:textCursorDrawable="@null"
android:visibility="gone" />
</LinearLayout>

0 comments on commit 8264d2a

Please sign in to comment.