Skip to content

Commit 8511386

Browse files
committed
Moved synchronize now in the main menu
1 parent affac61 commit 8511386

File tree

7 files changed

+46
-52
lines changed

7 files changed

+46
-52
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android:
1414
- android-16
1515
before_install:
1616
- openssl aes-256-cbc -K $encrypted_2f32dd076c5d_key -iv $encrypted_2f32dd076c5d_iv
17-
-in rkl.jks.enc -out ks/rkl.jks -d
17+
-in ./rkl.jks.enc -out ks/rkl.jks -d
1818
- sudo apt-get update -qq
1919
- sudo apt-get install -qq gcc-arm-linux-androideabi
2020
- sh rust-build/pre_build_rust_keylock_android.sh

java/res/drawable-hdpi/cloudsync.png

1.32 KB
Loading
-661 Bytes
Binary file not shown.

java/res/layout/fragment_edit_configuration.xml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,13 @@
3030
android:text="Configuration"
3131
android:textAppearance="?android:attr/textAppearanceLarge"/>
3232

33-
<GridLayout
34-
android:layout_width="match_parent"
33+
<TextView
34+
android:id="@+id/nextcloudLabel"
35+
android:layout_width="wrap_content"
3536
android:layout_height="wrap_content"
36-
android:layout_gravity="center"
37-
android:layout_marginTop="20sp"
38-
android:columnCount="2"
39-
android:gravity="center|top"
40-
android:orientation="horizontal">
41-
42-
<TextView
43-
android:id="@+id/nextcloudLabel"
44-
android:layout_width="wrap_content"
45-
android:layout_height="wrap_content"
46-
android:layout_gravity="left|center"
47-
android:text="Nextcloud"
48-
android:textAppearance="?android:attr/textAppearanceMedium"/>
49-
50-
<Button
51-
android:id="@+id/synchronizeButton"
52-
android:layout_width="wrap_content"
53-
android:layout_height="wrap_content"
54-
android:layout_gravity="center_horizontal"
55-
android:background="@android:color/transparent"
56-
android:drawableTop="@drawable/synchronizesmall"
57-
android:text="Synchronize now"
58-
android:textAppearance="?android:textAppearanceSmall"/>
59-
</GridLayout>
37+
android:layout_gravity="left|center"
38+
android:text="Nextcloud"
39+
android:textAppearance="?android:attr/textAppearanceMedium"/>
6040

6141
<TextView
6242
android:id="@+id/urlLabel"

java/res/layout/fragment_main_menu.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@
8484
android:drawableTop="@drawable/settings"
8585
android:text="Configuration"/>
8686

87+
<Button
88+
android:id="@+id/synchronizeButton"
89+
android:layout_width="wrap_content"
90+
android:layout_height="wrap_content"
91+
android:layout_gravity="fill_horizontal"
92+
android:layout_marginTop="20sp"
93+
android:background="@android:color/transparent"
94+
android:drawableTop="@drawable/cloudsync"
95+
android:text="Synchronize now"/>
96+
8797
<Button
8898
android:id="@+id/exitButton"
8999
android:layout_width="wrap_content"
@@ -93,6 +103,8 @@
93103
android:background="@android:color/transparent"
94104
android:drawableTop="@drawable/close"
95105
android:text="Exit"/>
106+
107+
96108
</GridLayout>
97109
</ScrollView>
98110

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ public void onClick(View view) {
6868
} else if (view.getId() == R.id.editConfigurationCancelButton) {
6969
Log.d(TAG, "Clicked Cancel in configuration");
7070
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_MAIN);
71-
} else if (view.getId() == R.id.synchronizeButton) {
72-
Log.d(TAG, "Clicked Synchronize now in configuration");
73-
74-
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_SYNCHRONIZE);
75-
76-
MainActivity mainActivity = MainActivity.getActiveActivity();
77-
Runnable uiRunnable = new UiThreadRunnable(mainActivity);
78-
mainActivity.runOnUiThread(uiRunnable);
7971
}
8072
}
8173

@@ -84,8 +76,6 @@ private void prepareUiElements(View v) {
8476
ob.setOnClickListener(this);
8577
Button cb = (Button) v.findViewById(R.id.editConfigurationCancelButton);
8678
cb.setOnClickListener(this);
87-
Button sb = (Button) v.findViewById(R.id.synchronizeButton);
88-
sb.setOnClickListener(this);
8979

9080
EditText urlText = (EditText) v.findViewById(R.id.editNextcloudUrl);
9181
urlText.setText(strings.get(0));
@@ -118,18 +108,4 @@ private void restore(Bundle state) {
118108
}
119109
}
120110

121-
private class UiThreadRunnable implements Runnable {
122-
private MainActivity mainActivity = null;
123-
124-
public UiThreadRunnable(MainActivity mainActivity) {
125-
this.mainActivity = mainActivity;
126-
}
127-
128-
@Override
129-
public void run() {
130-
PleaseWait pw = new PleaseWait();
131-
mainActivity.setBackButtonHandler(null);
132-
mainActivity.getFragmentManager().beginTransaction().replace(R.id.container, pw).commitAllowingStateLoss();
133-
}
134-
}
135111
}

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.astonbitecode.rustkeylock.fragments;
22

3+
import org.astonbitecode.rustkeylock.MainActivity;
34
import org.astonbitecode.rustkeylock.R;
45
import org.astonbitecode.rustkeylock.api.InterfaceWithRust;
56
import org.astonbitecode.rustkeylock.handlers.back.BackButtonHandler;
@@ -48,6 +49,8 @@ private void addButtonListeners(View rootView) {
4849
binp.setOnClickListener(this);
4950
Button bcfg = (Button) rootView.findViewById(R.id.mmEditConfigurationButton);
5051
bcfg.setOnClickListener(this);
52+
Button sb = (Button) rootView.findViewById(R.id.synchronizeButton);
53+
sb.setOnClickListener(this);
5154
}
5255

5356
@Override
@@ -73,7 +76,15 @@ public void onClick(View view) {
7376
} else if (view.getId() == R.id.mmEditConfigurationButton) {
7477
Log.d(TAG, "The User Selected to edit the configuration");
7578
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_SHOW_CONFIGURATION);
76-
} else {
79+
} else if (view.getId() == R.id.synchronizeButton) {
80+
Log.d(TAG, "Clicked Synchronize now in configuration");
81+
82+
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_SYNCHRONIZE);
83+
84+
MainActivity mainActivity = MainActivity.getActiveActivity();
85+
Runnable uiRunnable = new UiThreadRunnable(mainActivity);
86+
mainActivity.runOnUiThread(uiRunnable);
87+
}else {
7788
Log.e(TAG, "The User selected a Menu that is not implemented yet in Rust");
7889
}
7990
}
@@ -83,4 +94,19 @@ public void onBackButton() {
8394
Log.d(TAG, "Back button pressed");
8495
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_EXIT);
8596
}
97+
98+
private class UiThreadRunnable implements Runnable {
99+
private MainActivity mainActivity = null;
100+
101+
public UiThreadRunnable(MainActivity mainActivity) {
102+
this.mainActivity = mainActivity;
103+
}
104+
105+
@Override
106+
public void run() {
107+
PleaseWait pw = new PleaseWait();
108+
mainActivity.setBackButtonHandler(null);
109+
mainActivity.getFragmentManager().beginTransaction().replace(R.id.container, pw).commitAllowingStateLoss();
110+
}
111+
}
86112
}

0 commit comments

Comments
 (0)