Skip to content

Commit

Permalink
Merge pull request #94 from kaczmarkiewiczp/dev
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
patrykcoding authored Jun 2, 2018
2 parents d75fbd7 + fb5e056 commit fe71053
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 28 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "ca.pkay.rcloneexplorer"
minSdkVersion 21
targetSdkVersion 27
versionCode 18
versionName "1.3.2-DEV"
versionCode 19
versionName "1.3.3-DEV"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/assets/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 1.3.3
* **Fix:** Infinite loading for directories with large number of files
* **Fix:** Open as not working
* **Fix:** App launching behaviour
* **Fix:** Theme of password dialog

***

### 1.3.2
* **New:** File options for individual files
* **New:** Generate public link to file/folder (rclone link)
Expand Down
Binary file removed app/src/main/ic_launcher-web.png
Binary file not shown.
Binary file removed app/src/main/ic_shortcut_onedrive-web.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,15 @@ private void showOpenAsDialog(final FileItem fileItem) {
.setOnClickListener(new OpenAsDialog.OnClickListener() {
@Override
public void onClickText() {
if (recyclerViewAdapter.getNumberOfSelectedItems() == 1) {
new DownloadAndOpen(DownloadAndOpen.OPEN_AS_TEXT).execute(fileItem);
}
new DownloadAndOpen(DownloadAndOpen.OPEN_AS_TEXT).execute(fileItem);
}
@Override
public void onClickAudio() {
if (recyclerViewAdapter.getNumberOfSelectedItems() == 1) {
new StreamTask(StreamTask.OPEN_AS_AUDIO).execute(fileItem);
}
new StreamTask(StreamTask.OPEN_AS_AUDIO).execute(fileItem);
}
@Override
public void onClickVideo() {
if (recyclerViewAdapter.getNumberOfSelectedItems() == 1) {
new StreamTask(StreamTask.OPEN_AS_VIDEO).execute(fileItem);
}
new StreamTask(StreamTask.OPEN_AS_VIDEO).execute(fileItem);
}
@Override
public void onClickImage() {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/ca/pkay/rcloneexplorer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ private void askForConfigPassword() {
.setMessage(R.string.please_enter_password)
.setNegativeButton(R.string.cancel)
.setPositiveButton(R.string.okay_confirmation)
.setDarkTheme(isDarkTheme)
.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
.setOnPositiveListener(new InputDialog.OnPositive() {
@Override
Expand Down
41 changes: 25 additions & 16 deletions app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ public List<FileItem> getDirectoryContent(String remote, String path) {
Process process;
try {
process = Runtime.getRuntime().exec(command);
process.waitFor();
if (process.exitValue() != 0) {
logErrorOutput(process);
return null;
}

BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
Expand All @@ -124,6 +119,12 @@ public List<FileItem> getDirectoryContent(String remote, String path) {
output.append(line);
}

process.waitFor();
if (process.exitValue() != 0) {
logErrorOutput(process);
return null;
}

results = new JSONArray(output.toString());

} catch (IOException | InterruptedException | JSONException e) {
Expand Down Expand Up @@ -159,19 +160,20 @@ public List<RemoteItem> getRemotes() {
JSONObject remotesJSON;
try {
process = Runtime.getRuntime().exec(command);
process.waitFor();
if (process.exitValue() != 0) {
Toasty.error(context, context.getString(R.string.error_getting_remotes), Toast.LENGTH_SHORT, true).show();
logErrorOutput(process);
return new ArrayList<>();
}

BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
output.append(line);
}

process.waitFor();
if (process.exitValue() != 0) {
Toasty.error(context, context.getString(R.string.error_getting_remotes), Toast.LENGTH_SHORT, true).show();
logErrorOutput(process);
return new ArrayList<>();
}

remotesJSON = new JSONObject(output.toString());
} catch (IOException | InterruptedException | JSONException e) {
Toasty.error(context, context.getString(R.string.error_getting_remotes), Toast.LENGTH_SHORT, true).show();
Expand Down Expand Up @@ -574,14 +576,10 @@ public Boolean decryptConfig(String password) {

try {
process = Runtime.getRuntime().exec(command, environmentalVars);
process.waitFor();
} catch (IOException | InterruptedException e) {
} catch (IOException e) {
e.printStackTrace();
return false;
}
if (process.exitValue() != 0) {
return false;
}

ArrayList<String> result = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
Expand All @@ -595,6 +593,17 @@ public Boolean decryptConfig(String password) {
return false;
}

try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
return false;
}

if (process.exitValue() != 0) {
return false;
}

String appsFileDir = context.getFilesDir().getPath();
File file = new File(appsFileDir, "rclone.conf");

Expand Down

0 comments on commit fe71053

Please sign in to comment.