Skip to content

Commit affac61

Browse files
committed
* Synchronization over (Next/Own)cloud
Synchronize now added * Signing apk before deploying * Use the version from the crates.io
1 parent 532159a commit affac61

File tree

13 files changed

+210
-71
lines changed

13 files changed

+210
-71
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/buildallandrun.sh
44
/android-toolchain/
55
/tools/
6+
/ks/

.travis.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
dist: trusty
22
language: android
3-
43
jdk:
5-
- oraclejdk8
4+
- oraclejdk8
65
addons:
76
apt:
87
packages:
98
- oracle-java8-installer
109
android:
1110
components:
12-
- platform-tools
13-
- tools
14-
- build-tools-26.0.2
15-
- android-16
16-
11+
- platform-tools
12+
- tools
13+
- build-tools-26.0.2
14+
- android-16
1715
before_install:
18-
- sudo apt-get update -qq
19-
- sudo apt-get install -qq gcc-arm-linux-androideabi
20-
- sh rust-build/pre_build_rust_keylock_android.sh
21-
- sh rust-build/build_rust_for_rust_keylock_android.sh
22-
16+
- openssl aes-256-cbc -K $encrypted_2f32dd076c5d_key -iv $encrypted_2f32dd076c5d_iv
17+
-in rkl.jks.enc -out ks/rkl.jks -d
18+
- sudo apt-get update -qq
19+
- sudo apt-get install -qq gcc-arm-linux-androideabi
20+
- sh rust-build/pre_build_rust_keylock_android.sh
21+
- sh rust-build/build_rust_for_rust_keylock_android.sh
2322
script:
24-
- mvn -f java/pom.xml clean install
25-
23+
- mvn -f java/pom.xml clean install
24+
before_deploy:
25+
- jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ks/rkl.jks -storepass $storepass -keypass $keypass java/target/rust-keylock-android-0.4.0.apk rustkeylock
26+
- mv rust-keylock-android-0.4.0.apk rust-keylock-android-0.4.0.apk.tmp
27+
- "${ANDROID_HOME}/build-tools/24.0.2/zipalign -v 4 rust-keylock-android-0.4.0.apk.tmp rust-keylock-android-0.4.0.apk"
2628
deploy:
2729
provider: releases
2830
api_key:
2931
secure: QAFSbUoyNv/1/lkSzS4SBXwozKkk3Hnjlio6aH6akEniFBhkG93+8SUHLFl/O7MR74IpCG4iIm+E7Lo8sZR/xkk5SJgvw2ts4se06b5QmSy0AFjdWuaPJvJpF3WCnOmNiOa/MNBQdnQGoBHDtkmiZM/k4TX4sZfOKN5JEzItt9rSF23koAdnGvwwiaihjIcA1kOLFcGYmzNQF3qwBsnwwhsTHINGwvXcpbLWF6/3pYWXcnPDL/h2Vb+iTg+fG4KBHLK3l7jXarJmqy2uOHs6Nabz1e0KDEoWrUH1GXKzPBfxyXpTXhwIek7iI95QF/eiFgsHlYuX0fAwSRqs5zVEwmx+vmoi5GwaTId1DeY82yn6jl+a5fPFRFVz6DRBQwIu6GgQnMHuijnDrNGim4jrYmDaKHSA+9eK9luXZsXFCxHwTAHRdeWWebK0CdHDr+r3BP9kCzHxmOopwvxt/x3/AZwEAPlNPfLKVFdnKSx7J71lUkiJIjxDOnijWBhmFeOgb7VlHc2Fhg9EZ+/+DD0g+o6IfVqvdBSInD39ynnU8KJVJDWyykyjK45hmZDRCNdN3ns2pSTU7KPS5orTtAOMKs0VPh66/S9aP2TO0W2IUtaY3oyg83g8hCr+BIamyLhA1QQDdlHd7wgy2sNdmt+vVi/KEHGxSw2f/3U3y2XmQMY=
30-
3132
file: java/target/rust-keylock-android-0.3.0.apk
3233
skip_cleanup: true
3334
on:
3435
repo: rust-keylock/rust-keylock-android
3536
tags: true
37+
env:
38+
global:
39+
- secure: FbNZegeBAEOx1xolpsTBZX8M4CyTRCYaVXEkMdwFjQCirjpn8S8CdLhqzzvp/NBHVAHu+UwAGCCWkwmVwdVDNxPWOfsm8E5JCq0vku7k1wTGDNtliVs5aVgSv6IyhbSaUY5Sa+l6Dyko/Al0UsLnKMTADkY6hGwNRfD6myrOr7ByfZCvy+K99wEyhBRuoT1RwLat2UlbzTxXDrjzPt1kE0J/Lrmqkc57zODxGo5RQto9cIELU2tX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0EHkbX7OYQptHoK8YzAY9nnOLHwDitj900aWcENYmtKsaLF7HShu3yI7mQq7RUi5yXgmDF4XrFw=

java/pom.xml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.astonbitecode.rustkeylock</groupId>
66
<artifactId>rust-keylock-android</artifactId>
7-
<version>0.4.0-SNAPSHOT</version>
7+
<version>0.4.0</version>
88
<packaging>apk</packaging>
99

1010
<name>rust-keylock-android</name>
@@ -144,4 +144,53 @@
144144
</plugins>
145145
</pluginManagement>
146146
</build>
147+
<profiles>
148+
<profile>
149+
<id>sign</id>
150+
<build>
151+
<plugins>
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-jarsigner-plugin</artifactId>
155+
<executions>
156+
<execution>
157+
<id>signing</id>
158+
<goals>
159+
<goal>sign</goal>
160+
</goals>
161+
<phase>package</phase>
162+
<inherited>true</inherited>
163+
<configuration>
164+
<archiveDirectory></archiveDirectory>
165+
<includes>
166+
<include>target/*.apk</include>
167+
</includes>
168+
<keystore>../ks/rkl.jks</keystore>
169+
<storepass>${storepass}</storepass>
170+
<keypass>${keypass}</keypass>
171+
<alias>${alias}</alias>
172+
<arguments>
173+
<argument>-sigalg</argument>
174+
<argument>MD5withRSA</argument>
175+
<argument>-digestalg</argument>
176+
<argument>SHA1</argument>
177+
</arguments>
178+
</configuration>
179+
</execution>
180+
</executions>
181+
</plugin>
182+
<plugin>
183+
<groupId>com.simpligility.maven.plugins</groupId>
184+
<artifactId>android-maven-plugin</artifactId>
185+
<inherited>true</inherited>
186+
<configuration>
187+
<sign>
188+
<debug>false</debug>
189+
</sign>
190+
</configuration>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
</profile>
195+
</profiles>
147196
</project>
661 Bytes
Loading

java/res/layout/fragment_edit_configuration.xml

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

33-
<TextView
34-
android:id="@+id/nextcloudLabel"
35-
android:layout_width="wrap_content"
33+
<GridLayout
34+
android:layout_width="match_parent"
3635
android:layout_height="wrap_content"
37-
android:layout_gravity="left"
38-
android:text="Nextcloud"
39-
android:textAppearance="?android:attr/textAppearanceMedium"/>
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>
4060

4161
<TextView
4262
android:id="@+id/urlLabel"
@@ -78,7 +98,7 @@
7898
android:id="@+id/editNextcloudPassword"
7999
android:layout_width="match_parent"
80100
android:layout_height="wrap_content"
81-
android:inputType="text"/>
101+
android:inputType="textPassword"/>
82102

83103
<CheckBox android:id="@+id/editNextcloudUseSelfSignedCert" android:layout_width="match_parent"
84104
android:layout_height="match_parent"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:id="@+id/PasswordLayout"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:gravity="center"
7+
android:orientation="vertical"
8+
android:paddingBottom="@dimen/activity_vertical_margin"
9+
android:paddingLeft="@dimen/activity_horizontal_margin"
10+
android:paddingRight="@dimen/activity_horizontal_margin"
11+
android:paddingTop="@dimen/activity_vertical_margin"
12+
tools:context="org.astonbitecode.rustkeylock.MainActivity">
13+
14+
<ScrollView
15+
android:id="@+id/scrollViewChangePassword"
16+
android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:gravity="center|top">
19+
20+
<TextView
21+
android:id="@+id/nextcloudLabel"
22+
android:layout_width="wrap_content"
23+
android:layout_height="wrap_content"
24+
android:layout_gravity="center"
25+
android:text="Please wait..."
26+
android:textAppearance="?android:attr/textAppearanceLarge"/>
27+
28+
</ScrollView>
29+
30+
</LinearLayout>

java/src/main/java/org/astonbitecode/rustkeylock/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private void copyCerts(MainActivity mainActivity) {
148148
in.close();
149149
}
150150
} catch (IOException error) {
151-
Log.e(TAG, "Could not copy the certificates", error);
151+
Log.e(TAG, "Could not copy the certificates...", error);
152152
}
153153
}
154154

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

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
package org.astonbitecode.rustkeylock.fragments;
22

3-
import java.util.ArrayList;
4-
import java.util.Arrays;
5-
import java.util.LinkedList;
6-
import java.util.List;
7-
3+
import android.app.Fragment;
4+
import android.os.Bundle;
5+
import android.util.Log;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.View.OnClickListener;
9+
import android.view.ViewGroup;
810
import android.widget.Button;
911
import android.widget.CheckBox;
12+
import android.widget.EditText;
1013
import com.sun.jna.StringArray;
14+
import org.astonbitecode.rustkeylock.MainActivity;
1115
import org.astonbitecode.rustkeylock.R;
1216
import org.astonbitecode.rustkeylock.api.InterfaceWithRust;
1317
import org.astonbitecode.rustkeylock.api.StringList;
1418
import org.astonbitecode.rustkeylock.handlers.back.BackButtonHandler;
1519
import org.astonbitecode.rustkeylock.utils.Defs;
1620

17-
import android.app.Fragment;
18-
import android.os.Bundle;
19-
import android.util.Log;
20-
import android.view.LayoutInflater;
21-
import android.view.View;
22-
import android.view.View.OnClickListener;
23-
import android.view.ViewGroup;
24-
import android.widget.EditText;
21+
import java.util.ArrayList;
22+
import java.util.List;
2523

2624
public class EditConfiguration extends Fragment implements OnClickListener, BackButtonHandler {
2725
private final String TAG = getClass().getName();
@@ -51,26 +49,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
5149
@Override
5250
public void onClick(View view) {
5351
if (view.getId() == R.id.editConfigurationOkButton) {
54-
Log.d(TAG, "Clicked Ok in configuration ");
52+
Log.d(TAG, "Clicked Ok in configuration");
5553
String url = nextcloudUrlText.getText() != null ? nextcloudUrlText.getText().toString() : "";
5654
String user = nextcloudUsernameText.getText() != null ? nextcloudUsernameText.getText().toString() : "";
5755
String password = nextcloudPasswordText.getText() != null ? nextcloudPasswordText.getText().toString() : "";
5856
String useSelfSignedCertString = new Boolean(useSelfSignedCert.isChecked()).toString();
5957
Log.d(TAG, "Saving configuration (password not shown here): " + url + ", " + user + ", " + useSelfSignedCertString);
6058

6159
boolean errorsOccured = false;
62-
if (url.isEmpty()) {
63-
nextcloudUrlText.setError("Required field");
64-
errorsOccured = true;
65-
}
66-
if (user.isEmpty()) {
67-
nextcloudUsernameText.setError("Required field");
68-
errorsOccured = true;
69-
}
70-
if (password.isEmpty()) {
71-
nextcloudPasswordText.setError("Required field");
72-
errorsOccured = true;
73-
}
60+
7461
if (!errorsOccured) {
7562
String[] stringsToSave = {url, user, password, useSelfSignedCertString};
7663
StringList sl = new StringList.ByReference();
@@ -79,8 +66,16 @@ public void onClick(View view) {
7966
InterfaceWithRust.INSTANCE.set_configuration(sl);
8067
}
8168
} else if (view.getId() == R.id.editConfigurationCancelButton) {
82-
Log.d(TAG, "Clicked Cancel in configuration ");
69+
Log.d(TAG, "Clicked Cancel in configuration");
8370
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);
8479
}
8580
}
8681

@@ -89,6 +84,8 @@ private void prepareUiElements(View v) {
8984
ob.setOnClickListener(this);
9085
Button cb = (Button) v.findViewById(R.id.editConfigurationCancelButton);
9186
cb.setOnClickListener(this);
87+
Button sb = (Button) v.findViewById(R.id.synchronizeButton);
88+
sb.setOnClickListener(this);
9289

9390
EditText urlText = (EditText) v.findViewById(R.id.editNextcloudUrl);
9491
urlText.setText(strings.get(0));
@@ -107,7 +104,7 @@ private void prepareUiElements(View v) {
107104
@Override
108105
public void onBackButton() {
109106
Log.d(TAG, "Back button pressed");
110-
InterfaceWithRust.INSTANCE.go_to_menu_plus_arg(Defs.MENU_ENTRIES_LIST, Defs.EMPTY_ARG, "");
107+
InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_MAIN);
111108
}
112109

113110
@Override
@@ -120,4 +117,19 @@ private void restore(Bundle state) {
120117
this.strings = state.getStringArrayList("strings");
121118
}
122119
}
120+
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+
}
123135
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.astonbitecode.rustkeylock.fragments;
2+
3+
import android.app.Fragment;
4+
import android.os.Bundle;
5+
import android.view.LayoutInflater;
6+
import android.view.View;
7+
import android.view.ViewGroup;
8+
import org.astonbitecode.rustkeylock.R;
9+
10+
public class PleaseWait extends Fragment {
11+
@Override
12+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
13+
View rootView = inflater.inflate(R.layout.fragment_please_wait, container, false);
14+
return rootView;
15+
}
16+
}
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package org.astonbitecode.rustkeylock.utils;
22

33
public class Defs {
4-
public static final String MENU_TRY_PASS = "TryPass";
5-
public static final String MENU_CHANGE_PASS = "ChangePass";
6-
public static final String MENU_MAIN = "Main";
7-
public static final String MENU_ENTRIES_LIST = "EntriesList";
8-
public static final String MENU_SHOW_ENTRY = "ShowEntry";
9-
public static final String MENU_SAVE = "Save";
10-
public static final String MENU_EXIT = "Exit";
11-
public static final String MENU_FORCE_EXIT = "ForceExit";
12-
public static final String MENU_EDIT_ENTRY = "EditEntry";
13-
public static final String MENU_DELETE_ENTRY = "DeleteEntry";
14-
public static final String MENU_NEW_ENTRY = "NewEntry";
15-
public static final String MENU_EXPORT_ENTRIES = "ExportEntries";
16-
public static final String MENU_IMPORT_ENTRIES = "ImportEntries";
17-
public static final String MENU_SHOW_CONFIGURATION = "ShowConfiguration";
18-
public static final String EMPTY_ARG = "null";
4+
public static final String MENU_TRY_PASS = "TryPass";
5+
public static final String MENU_CHANGE_PASS = "ChangePass";
6+
public static final String MENU_MAIN = "Main";
7+
public static final String MENU_ENTRIES_LIST = "EntriesList";
8+
public static final String MENU_SHOW_ENTRY = "ShowEntry";
9+
public static final String MENU_SAVE = "Save";
10+
public static final String MENU_EXIT = "Exit";
11+
public static final String MENU_FORCE_EXIT = "ForceExit";
12+
public static final String MENU_EDIT_ENTRY = "EditEntry";
13+
public static final String MENU_DELETE_ENTRY = "DeleteEntry";
14+
public static final String MENU_NEW_ENTRY = "NewEntry";
15+
public static final String MENU_EXPORT_ENTRIES = "ExportEntries";
16+
public static final String MENU_IMPORT_ENTRIES = "ImportEntries";
17+
public static final String MENU_SHOW_CONFIGURATION = "ShowConfiguration";
18+
public static final String MENU_SYNCHRONIZE = "Synchronize";
19+
public static final String EMPTY_ARG = "null";
1920
}

0 commit comments

Comments
 (0)