Skip to content

Commit 68779e0

Browse files
committed
Ability to clear the configurations.
1 parent b128385 commit 68779e0

File tree

8 files changed

+37
-0
lines changed

8 files changed

+37
-0
lines changed

java/res/drawable-hdpi/clean.png

1.04 KB
Loading

java/res/drawable-mdpi/clean.png

507 Bytes
Loading

java/res/drawable-xhdpi/clean.png

1.32 KB
Loading

java/res/drawable-xxhdpi/clean.png

3.02 KB
Loading
4.82 KB
Loading

java/res/layout/fragment_edit_configuration.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,33 @@
119119
android:drawableTop="@drawable/dropbox_circle_black_64"/>
120120
</GridLayout>
121121

122+
<GridLayout
123+
android:layout_width="match_parent"
124+
android:layout_height="wrap_content"
125+
android:layout_gravity="center"
126+
android:layout_marginTop="20sp"
127+
android:columnCount="1"
128+
android:gravity="center|top"
129+
android:orientation="horizontal">
130+
131+
<TextView
132+
android:id="@+id/clearConfigurationsLabel"
133+
android:layout_width="wrap_content"
134+
android:layout_height="wrap_content"
135+
android:layout_gravity="center"
136+
android:text="@string/clear_all_configurations"
137+
android:textAppearance="?android:attr/textAppearanceSmall"/>
138+
139+
<Button
140+
android:id="@+id/clearConfigurationsButton"
141+
android:layout_marginTop="18sp"
142+
android:layout_width="wrap_content"
143+
android:layout_height="wrap_content"
144+
android:layout_gravity="center"
145+
android:background="@android:color/transparent"
146+
android:drawableTop="@drawable/clean"/>
147+
</GridLayout>
148+
122149
<GridLayout
123150
android:layout_width="match_parent"
124151
android:layout_height="wrap_content"

java/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
<string name="welcome">Welcome to rust-keylock</string>
66
<string name="action_settings">Settings</string>
77
<string name="dbx_app_key">7git6ovjwtdbfvm</string>
8+
<string name="clear_all_configurations">Clear all configurations</string>
89

910
</resources>

java/src/main/java/org/astonbitecode/rustkeylock/fragments/EditConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public void onClick(View view) {
8383
String appKey = getString(R.string.dbx_app_key);
8484
Log.d(TAG, "Clicked Get Dropbox token in configuration. App key: " + appKey);
8585
Auth.startOAuth2Authentication(getActivity(), appKey);
86+
} else if (view.getId() == R.id.clearConfigurationsButton) {
87+
Log.d(TAG, "Clicked clear configurations in configuration.");
88+
nextcloudUrlText.setText("");
89+
nextcloudUsernameText.setText("");
90+
nextcloudPasswordText.setText("");
91+
useSelfSignedCert.setChecked(false);
92+
strings.set(5, "");
8693
}
8794
}
8895

@@ -107,6 +114,8 @@ private void prepareUiElements(View v) {
107114
cb.setOnClickListener(this);
108115
Button gt = (Button) v.findViewById(R.id.editConfigurationGetTokenButton);
109116
gt.setOnClickListener(this);
117+
Button cc = (Button) v.findViewById(R.id.clearConfigurationsButton);
118+
cc.setOnClickListener(this);
110119

111120
EditText urlText = (EditText) v.findViewById(R.id.editNextcloudUrl);
112121
urlText.setText(strings.get(0));

0 commit comments

Comments
 (0)