Skip to content

Commit

Permalink
Write logs to file, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Jan 10, 2021
1 parent ee57c75 commit 037117b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
def abi = project.properties['ABI']
VERSION_CODE = 81
VERSION_CODE = 82
VERSION_NAME = "1.7.3"
SDK_MIN_VERSION = 23
SDK_TARGET_VERSION = 30
Expand Down
6 changes: 6 additions & 0 deletions fermata/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
android:name="android.hardware.touchscreen"
android:required="false" />

<queries>
<intent>
<action android:name="android.intent.action.OPEN_DOCUMENT_TREE" />
</intent>
</queries>

<application
android:name="me.aap.fermata.FermataApplication"
android:allowBackup="true"
Expand Down
10 changes: 10 additions & 0 deletions fermata/src/main/java/me/aap/fermata/FermataApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import android.content.SharedPreferences;

import androidx.annotation.Nullable;

import java.io.File;

import me.aap.fermata.addon.AddonManager;
import me.aap.utils.app.App;
import me.aap.utils.app.NetSplitCompatApp;
Expand Down Expand Up @@ -55,4 +59,10 @@ public AddonManager getAddonManager() {
protected int getMaxNumberOfThreads() {
return 5;
}

@Nullable
@Override
public File getLogFile() {
return BuildConfig.AUTO ? new File(getFilesDir(), "Fermata.log") : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
Expand Down Expand Up @@ -156,8 +155,8 @@ public void addFolder() {
menu.show(b -> {
b.setTitle(R.string.add_folder);
b.setSelectionHandler(this::addFolder);
if (!a.isCarActivity()) b.addItem(R.id.vfs_content, R.string.vfs_content);
b.addItem(R.id.vfs_file_system, R.string.vfs_file_system);
if (isContentSupported()) b.addItem(R.id.vfs_content, R.string.vfs_content);
b.addItem(R.id.vfs_sftp, R.string.vfs_sftp);
b.addItem(R.id.vfs_smb, R.string.vfs_smb);
b.addItem(R.id.vfs_gdrive, R.string.vfs_gdrive);
Expand All @@ -166,12 +165,12 @@ public void addFolder() {

private boolean addFolder(OverlayMenuItem item) {
switch (item.getItemId()) {
case R.id.vfs_content:
addFolderIntent();
return true;
case R.id.vfs_file_system:
addFolderPicker();
return true;
case R.id.vfs_content:
addFolderIntent();
return true;
case R.id.vfs_gdrive:
addFolderVfs(GDRIVE_ID, R.string.vfs_gdrive);
return true;
Expand All @@ -186,6 +185,13 @@ private boolean addFolder(OverlayMenuItem item) {
}
}

private boolean isContentSupported() {
MainActivityDelegate a = getMainActivity();
if (a.isCarActivity()) return false;
Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
return (i.resolveActivity(getContext().getPackageManager()) != null);
}

private void addFolderIntent() {
try {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
public void onPageFinished(WebView view, String url) {
FermataWebView v = (FermataWebView) view;
MainActivityDelegate a = MainActivityDelegate.get(view.getContext());
if (a == null) return;
a.setContentLoading(Completed.completedVoid());

if (loading != null) {
Expand Down

0 comments on commit 037117b

Please sign in to comment.