Skip to content

Commit

Permalink
Merge pull request #1050 from zhwanng/feat-sdoc-transferlist
Browse files Browse the repository at this point in the history
Some new features
  • Loading branch information
zhwanng authored Jan 7, 2025
2 parents e346f5f + 3f485c2 commit e33a89c
Show file tree
Hide file tree
Showing 297 changed files with 12,282 additions and 3,659 deletions.
31 changes: 22 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdk rootProject.ext.compileSdkVersion

versionCode 157
versionName "3.0.6"
versionCode 160
versionName "3.0.7"
multiDexEnabled true

resValue "string", "authorities", defaultConfig.applicationId + '.debug.cameraupload.provider'
Expand Down Expand Up @@ -184,7 +184,6 @@ android {
// Firebase
implementation platform('com.google.firebase:firebase-bom:33.2.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'

//media3
final def media3_version = '1.4.1'
Expand All @@ -204,6 +203,9 @@ android {
implementation "androidx.webkit:webkit:1.12.1"
implementation 'com.google.android.flexbox:flexbox:3.0.0'

// implementation "androidx.paging:paging-runtime:3.3.5"
// implementation "androidx.paging:paging-rxjava3:3.3.5"

//https://github.com/material-components/material-components-android
implementation "com.google.android.material:material:1.12.0"

Expand Down Expand Up @@ -237,6 +239,17 @@ android {
//https://github.com/KunMinX/UnPeek-LiveData
implementation 'com.kunminx.arch:unpeek-livedata:7.8.0'

implementation 'org.commonmark:commonmark:0.21.0'
// implementation 'org.commonmark:commonmark-ext-gfm-tables:0.21.0' // 如果需要表格支持
implementation 'org.commonmark:commonmark-ext-autolink:0.21.0' // 如果需要自动链接支持

//https://github.com/lzyzsd/JsBridge
implementation 'com.github.lzyzsd:jsbridge:1.0.4'

// https://github.com/rubensousa/GravitySnapHelper
// implementation 'com.github.rubensousa:gravitysnaphelper:2.2.2'


//
implementation 'com.blankj:utilcode:1.30.7'

Expand All @@ -246,8 +259,8 @@ android {
//https://github.com/panpf/stickyitemdecoration
implementation "io.github.panpf.stickyitemdecoration:stickyitemdecoration:1.0.2"

//preference
implementation 'dev.rikka.rikkax.preference:simplemenu-preference:1.0.3'
//Thanks: https://github.com/RikkaApps
//implementation 'dev.rikka.rikkax.preference:simplemenu-preference:1.0.3'

//https://github.com/michaellee123/LiveEventBus
implementation 'com.github.michaellee123:LiveEventBus:1.8.14'
Expand Down Expand Up @@ -287,20 +300,20 @@ android {
implementation 'com.github.yydcdut.RxMarkdown:markdown-processor:v0.1.3'


// //markdown
//https://noties.io/Markwon/
// final def markwon_version = '4.6.2'
// implementation "io.noties.markwon:core:$markwon_version"
// implementation "io.noties.markwon:editor:$markwon_version"
// implementation "io.noties.markwon:ext-latex:$markwon_version"
// implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
// implementation "io.noties.markwon:ext-tables:$markwon_version"
// implementation "io.noties.markwon:ext-tasklist:$markwon_version"
// implementation "io.noties.markwon:ext-latex:$markwon_version"
// implementation "io.noties.markwon:html:$markwon_version"
// implementation "io.noties.markwon:image:$markwon_version"
// implementation "io.noties.markwon:image-glide:$markwon_version"
// implementation "io.noties.markwon:inline-parser:$markwon_version"
// implementation "io.noties.markwon:linkify:$markwon_version"
// implementation "io.noties.markwon:syntax-highlight:$markwon_version"
// implementation "io.noties.markwon:inline-parser:$markwon_version"
// implementation "io.noties.markwon:recycler:$markwon_version"


implementation 'com.madgag.spongycastle:core:1.54.0.0'
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@
<activity android:name=".ui.webview.SeaWebViewActivity" />
<activity android:name=".ui.data_migrate.DataMigrationActivity" />
<activity android:name=".ui.selector.ObjSelectorActivity" />
<activity android:name=".ui.media.image_preview.ImagePreviewActivity" />
<activity android:name=".ui.transfer_list.TransferActivity" />
<activity android:name=".ui.BugHandlerActivity" />
<activity android:name=".ui.settings.SettingsAlbumBackupAdvancedActivity" />
<activity android:name=".ui.data_migrate.DataMigrationV303Activity" />
<activity android:name=".ui.sdoc.SDocWebViewActivity" />
<activity android:name=".ui.sdoc.comments.SDocCommentsActivity" />
<activity android:name=".ui.docs_comment.DocsCommentsActivity" />
<activity android:name=".ui.media.image_preview2.CarouselImagePreviewActivity" />
<activity android:name=".ui.media.image_preview2.OnlyImagePreviewActivity" />

<provider
android:name=".provider.SeafileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public void onCreate() {


// set gesture lock if available
AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
//
// AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);

LiveEventBus.config()
.autoClear(true)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/seafile/seadroid2/SeafException.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class SeafException extends Exception {
public static final SeafException notFoundException = new SeafException(404, "Not found");
public static final SeafException notFoundUserException = new SeafException(20, "Not logged in");
public static final SeafException notLoggedInException = new SeafException(21, "Not logged in");
public static final SeafException transferFileException = new SeafException(22, "The file transfer is abnormal");

public static final SeafException OUT_OF_QUOTA = new SeafException(HTTP_ABOVE_QUOTA, SeadroidApplication.getAppContext().getString(R.string.above_quota));
public static final SeafException REQUEST_EXCEPTION = new SeafException(400, "Request Failed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String getSpaceUsed() {

/**
* in fact, the value should be less than 0.
* however, in some cases, it may be 0, and should also return unlimited.
* however, in some cases, it may be 0, and should also return non-limit.
* even if the non-limit is returned, App does not need to verify "Out of quota" status.
* and the "Out of quota" error will be returned in the file upload result.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@
import com.seafile.seadroid2.framework.http.HttpIO;
import com.seafile.seadroid2.framework.util.SLogs;
import com.seafile.seadroid2.framework.worker.BackgroundJobManagerImpl;
import com.seafile.seadroid2.preferences.ContextStackPreferenceHelper;
import com.seafile.seadroid2.preferences.Settings;
import com.seafile.seadroid2.ssl.CertsManager;
import com.seafile.seadroid2.ui.camera_upload.CameraUploadManager;

public class AccountUtils {

public static void logout(Account account) {

// turn off the gesture lock anyway
// turn off the gesture lock
GestureLockSharePreferenceHelper.disable();

Settings.initUserSettings();

// clear
ContextStackPreferenceHelper.clearStack();

//
CertsManager.instance().deleteCertForAccount(account);

NotificationUtils.cancelAll();

// sign out operations
Expand Down Expand Up @@ -56,6 +64,9 @@ public static void switchAccount(Account account) {

NotificationUtils.cancelAll();

// clear
ContextStackPreferenceHelper.clearStack();

//
Settings.initUserSettings();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ private SupportAccountManager() {
accountManager = android.accounts.AccountManager.get(SeadroidApplication.getAppContext());
}

public boolean isLogin() {
return getCurrentAccount() != null;
}

@NonNull
public List<Account> getAccountList() {
List<Account> list = new ArrayList<>();
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/seafile/seadroid2/annotation/NotSupport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.seafile.seadroid2.annotation;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Target;

/**
* There are no plans to develop this feature.
*/
@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
public @interface NotSupport {
}
54 changes: 41 additions & 13 deletions app/src/main/java/com/seafile/seadroid2/config/GlideLoadConfig.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
package com.seafile.seadroid2.config;

import androidx.annotation.DrawableRes;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.load.model.LazyHeaders;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.seafile.seadroid2.R;
import com.seafile.seadroid2.account.Account;
import com.seafile.seadroid2.account.SupportAccountManager;
import com.seafile.seadroid2.ui.WidgetUtils;

public class GlideLoadConfig {

// public static GlideUrl getGlideUrl(String url) {
//
// Account account = SupportAccountManager.getInstance().getCurrentAccount();
// if (account == null) {
// return new GlideUrl(url, new LazyHeaders.Builder().build());
// }
//
// String token = account.token;
//
// return new GlideUrl(url, new LazyHeaders.Builder()
// .addHeader("Authorization", "Token " + token)
// .build());
// }
public static GlideUrl getGlideUrl(String url) {

Account account = SupportAccountManager.getInstance().getCurrentAccount();
if (account == null) {
return new GlideUrl(url, new LazyHeaders.Builder().build());
}

String token = account.token;

return new GlideUrl(url, new LazyHeaders.Builder()
.addHeader("Authorization", "Token " + token)
.build());
}
//
// public static GlideUrl getGlideUrl(String url, String token) {
// return new GlideUrl(url, new LazyHeaders.Builder()
Expand All @@ -34,12 +41,33 @@ public static RequestOptions getAvatarOptions() {
.override(WidgetUtils.getThumbnailWidth(), WidgetUtils.getThumbnailWidth());
}

private final static RequestOptions _cacheableThumbnailOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.error(R.drawable.icon_image_error_filled)
.override(128);

/**
* Get cacheable thumbnail options, width and height are both 128
*/
public static RequestOptions getCacheableThumbnailOptions() {
return _cacheableThumbnailOptions;
}

public static RequestOptions getOptions() {
return new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.fallback(R.drawable.file_image)
.placeholder(R.drawable.file_image);
}


public static RequestOptions getCustomDrawableOptions(@DrawableRes int resId) {
return new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.fallback(resId)
.placeholder(resId);
}

public static RequestOptions getOptions(String key) {
return new RequestOptions()
.fallback(R.drawable.file_image)
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/java/com/seafile/seadroid2/config/OriGlideUrl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.seafile.seadroid2.config;

import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.load.model.Headers;
import com.seafile.seadroid2.framework.util.SLogs;

import java.net.URL;

public class OriGlideUrl extends GlideUrl {
private String oriCacheKey;

public OriGlideUrl(URL url) {
super(url);
}

public OriGlideUrl(String url) {
super(url);
}

public OriGlideUrl(String url, String oriCacheKey) {
super(url);
this.oriCacheKey = oriCacheKey;
}


public OriGlideUrl(URL url, Headers headers) {
super(url, headers);
}

public OriGlideUrl(String url, Headers headers) {
super(url, headers);
}

@Override
public String getCacheKey() {
return oriCacheKey;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.seafile.seadroid2.config;

public class WebViewActionConstant {
public final static String APP_VERSION_GET = "app.version.get";
public final static String APP_TOAST_SHOW = "app.toast.show";
public final static String PAGE_FINISH = "page.finish";
public final static String PAGE_STATUS_COLOR_SET = "page.status.color.set";
public final static String PAGE_STATUS_HEIGHT_GET = "page.status.height.get";

public static class CallJsFunction {
public final static String SDOC_OUTLINES_DATA_GET = "sdoc.outline.data.get";
public final static String SDOC_OUTLINES_DATA_SELECT = "sdoc.outline.data.select";

public static class CallJsFunctionRequestCode {
public final static int REQ = 1001;
}
}

}
Loading

0 comments on commit e33a89c

Please sign in to comment.