Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat image favorites back #126

Merged
merged 45 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b92eca1
feat: 增加图片收藏
luckyray-fan Dec 8, 2024
1ebc774
Merge branch 'dev' into my-dev
luckyray-fan Dec 8, 2024
2d52074
Merge branch 'dev' into my-dev-back
luckyray-fan Dec 9, 2024
93a53f1
feat: 主体图片收藏页面实现
luckyray-fan Dec 20, 2024
c4bfad8
Merge branch 'dev' of https://github.com/venera-app/venera into my-de…
luckyray-fan Dec 20, 2024
ca7fe11
feat: 点击打开大图浏览
luckyray-fan Dec 26, 2024
e869c4f
Merge branch 'dev' of https://github.com/venera-app/venera into my-de…
luckyray-fan Dec 26, 2024
99db974
feat: 数据结构变更
luckyray-fan Dec 30, 2024
dd4a8a8
Merge branch 'dev' of https://github.com/venera-app/venera into my-de…
luckyray-fan Dec 30, 2024
c0c5c17
feat: 基本完成
luckyray-fan Jan 1, 2025
a875c03
feat: 翻译与bug修复
luckyray-fan Jan 4, 2025
aee64a3
feat: 实机测试和问题修复
luckyray-fan Jan 5, 2025
7f5c2d0
feat: jm导入, pica历史记录nhentai有问题, 一键反转
luckyray-fan Jan 5, 2025
1e21b78
Merge branch 'dev' of https://github.com/venera-app/venera into feat-…
luckyray-fan Jan 5, 2025
4b0fd1d
fix: 大小写不一致, 一个htManga, 一个htmanga
luckyray-fan Jan 5, 2025
bfa261b
feat: 拉取收藏优化
luckyray-fan Jan 5, 2025
acc0147
feat: 改成以ep为准
luckyray-fan Jan 7, 2025
30e2f3f
Merge branch 'dev' of https://github.com/venera-app/venera into feat-…
luckyray-fan Jan 7, 2025
cdb090b
Merge branch 'dev' of https://github.com/venera-app/venera into feat-…
luckyray-fan Jan 8, 2025
9b5f1aa
feat: 兜底一些可能报错场景
luckyray-fan Jan 8, 2025
c03c3f7
chore: 没有用到
luckyray-fan Jan 8, 2025
a245cc6
feat: 尽量保证和网络收藏顺序一致
luckyray-fan Jan 9, 2025
22ae856
feat: 支持显示热点tag
luckyray-fan Jan 10, 2025
da6ed89
feat: 支持双击收藏, 不过此时禁止放大图片
luckyray-fan Jan 10, 2025
1ffa638
fix: 自动塞封面逻辑完善, 切换快速收藏图片立刻生效
luckyray-fan Jan 11, 2025
a313bd2
Refactor
wgh136 Jan 11, 2025
1233dc4
fix updateValue
wgh136 Jan 11, 2025
9b5bd24
feat: 双击功能提示
luckyray-fan Jan 11, 2025
19b260f
fix: 被确定取消收藏的才删除
luckyray-fan Jan 11, 2025
7307dbc
Refactor ImageFavoritesPage
wgh136 Jan 12, 2025
2d492ae
translate author
wgh136 Jan 12, 2025
2d59831
feat: 功能提示改到dialog中
luckyray-fan Jan 12, 2025
f538473
fix text editing
wgh136 Jan 12, 2025
6747264
fix text editing
wgh136 Jan 12, 2025
e8f695d
feat: 功能提示放到邮件或长按菜单中
luckyray-fan Jan 12, 2025
de61747
Merge branch 'feat-image-favorites-back' of https://github.com/luckyr…
luckyray-fan Jan 12, 2025
ff1aa33
fix: 修复tag过滤不生效问题
luckyray-fan Jan 12, 2025
99e5127
Improve image loading
wgh136 Jan 13, 2025
bf7260a
The default value of quickCollectImage should be false.
wgh136 Jan 13, 2025
1286d1e
Refactor DragListener
wgh136 Jan 13, 2025
a7b804b
Refactor ImageFavoriteItem & ImageFavoritePhotoView
wgh136 Jan 13, 2025
9caf583
Refactor
wgh136 Jan 14, 2025
e934870
Fix `ImageFavoriteManager.has`
wgh136 Jan 14, 2025
20115e1
Fix UI
wgh136 Jan 14, 2025
2314021
Improve UI
wgh136 Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ migrate_working_dir/
*.ipr
*.iws
.idea/
.vscode/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.nonFinalResIds=false
102 changes: 96 additions & 6 deletions assets/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"help": "帮助",
"Select": "选择",
"Selected @a comics": "已选择 @a 部漫画",
"Imported @a comics": "已导入 @a 部漫画",
"Imported @a comics, loaded @b pages, received @c comics": "已导入 @a 部漫画, 加载 @b 页, 接收到 @c 部漫画",
"Downloading": "下载中",
"Back": "后退",
"Delete": "删除",
Expand All @@ -41,6 +41,7 @@
"Select a folder": "选择一个文件夹",
"Folder": "文件夹",
"Confirm": "确认",
"Reversed successfully": "反转成功",
"Remove comic from favorite?": "从收藏中移除漫画?",
"Move": "移动",
"Move to folder": "移动到文件夹",
Expand Down Expand Up @@ -164,7 +165,7 @@
"Date Desc": "日期降序",
"Start": "开始",
"Export App Data": "导出应用数据",
"Import App Data": "导入应用数据",
"Import App Data (Please restart after success)": "导入应用数据(成功后请手动重启)",
"Export": "导出",
"Download Threads": "下载线程数",
"Update Time": "更新时间",
Expand Down Expand Up @@ -248,6 +249,47 @@
"Export as pdf": "导出为pdf",
"Export as epub": "导出为epub",
"Aggregated Search": "聚合搜索",
"Local comic collection is not supported at present": "本地收藏暂不支持",
"The cover cannot be uncollected here": "封面不能在此取消收藏",
"Uncollected the image": "取消收藏图片",
"Successfully collected": "收藏成功",
"Collect the image": "收藏图片",
"Quick collect image": "快速收藏图片",
"Not enable": "不启用",
"Double Tap": "双击",
"Swipe": "滑动",
"On the image browsing page, you can quickly collect images by sliding horizontally or vertically according to your reading mode": "在图片浏览页面, 你可以根据你的阅读模式横滑或者竖滑快速收藏图片",
"Calculate your favorite from @a comics and @b images": "从 @a 本漫画和 @b 张图片中, 计算你最喜欢的",
"After the parentheses are the number of pictures or the number of pictures compared to the number of comic pages": "括号后是图片数量或图片数比漫画页数",
"The chapter order of the comic may have changed, temporarily not supported for collection": "漫画的章节顺序可能发生了变化, 暂不支持收藏此章节",
"Author: ": "作者: ",
"Tags: ": "标签: ",
"Comics(number): ": "漫画(数量): ",
"Comics(percentage): ": "漫画(比例): ",
"Time Filter": "时间筛选",
"Image Favorites Greater Than": "图片收藏数大于",
"Collection time": "收藏时间",
"favoritesCompareComicPages": "收藏数与漫画页数比较",
"Cover": "封面",
"Page @a": "第 @a 页",
"Time Asc": "时间升序",
"Time Desc": "时间降序",
"Favorite Num": "收藏数",
"Favorite Num Compare Comic Pages": "收藏数比漫画页数",
"All": "全部",
"Last Week": "上周",
"Last Month": "上月",
"Last Half Year": "半年",
"Last Year": "一年",
"Filter": "筛选",
"Image Favorites": "图片收藏",
"Title": "标题",
"@a Cover": "@a 封面",
"Photo View": "图片浏览",
"Delete @a images": "删除 @a 张图片",
"Update the page number by the latest collection": "按最新收藏更新页数",
"Copy the title successfully": "复制标题成功",
"The comic is invalid, please long press to delete, you can double click the title to copy": "该漫画已失效, 请长按删除, 可以双击标题进行复制",
"No search results found": "未找到搜索结果",
"Added @c comics to download queue." : "已添加 @c 本漫画到下载队列",
"Download started": "下载已开始",
Expand All @@ -265,7 +307,10 @@
"Aggregated": "聚合",
"Default Search Target": "默认搜索目标",
"Auto Language Filters": "自动语言筛选",
"Check for updates on startup": "启动时检查更新"
"Check for updates on startup": "启动时检查更新",
"Start Time": "开始时间",
"End Time": "结束时间",
"Custom": "自定义"
},
"zh_TW": {
"Home": "首頁",
Expand All @@ -287,7 +332,7 @@
"help": "幫助",
"Select": "選擇",
"Selected @a comics": "已選擇 @a 部漫畫",
"Imported @a comics": "已匯入 @a 部漫畫",
"Imported @a comics, loaded @b pages, received @c comics": "已匯入 @a 部漫畫, 加載 @b 頁, 接收到 @c 部漫畫",
"Downloading": "下載中",
"Back": "後退",
"Delete": "刪除",
Expand Down Expand Up @@ -431,8 +476,9 @@
"Date": "日期",
"Date Desc": "日期降序",
"Start": "開始",
"Reversed successfully": "反轉成功",
"Export App Data": "匯出應用數據",
"Import App Data": "匯入應用數據",
"Import App Data (Please restart after success)": "匯入應用數據(成功后請手動重啟)",
"Export": "匯出",
"Download Threads": "下載線程數",
"Update Time": "更新時間",
Expand Down Expand Up @@ -520,6 +566,47 @@
"Added @c comics to download queue." : "已添加 @c 本漫畫到下載隊列",
"Download started": "下載已開始",
"Click favorite": "點擊收藏",
"Local comic collection is not supported at present": "本地收藏暫不支持",
"The cover cannot be uncollected here": "封面不能在此取消收藏",
"Uncollected the image": "取消收藏圖片",
"Successfully collected": "收藏成功",
"Collect the image": "收藏圖片",
"Quick collect image": "快速收藏圖片",
"On the image browsing page, you can quickly collect images by sliding horizontally or vertically according to your reading mode": "在圖片瀏覽頁面, 你可以根據你的閱讀模式橫向或者縱向滑動快速收藏圖片",
"Calculate your favorite from @a comics and @b images": "從 @a 本漫畫和 @b 張圖片中, 計算你最喜歡的",
"After the parentheses are the number of pictures or the number of pictures compared to the number of comic pages": "括號後是圖片數量或圖片數比漫畫頁數",
"The chapter order of the comic may have changed, temporarily not supported for collection": "漫畫的章節順序可能發生了變化, 暫不支持收藏此章節",
"Author: ": "作者: ",
"Tags: ": "標籤: ",
"Comics(number): ": "漫畫(數量): ",
"Comics(percentage): ": "漫畫(比例): ",
"Time Filter": "時間篩選",
"Image Favorites Greater Than": "圖片收藏數大於",
"Collection time": "收藏時間",
"Not enable": "不启用",
"Double Tap": "雙擊",
"Swipe": "滑動",
"favoritesCompareComicPages": "收藏數與漫畫頁數比較",
"Cover": "封面",
"Page @a": "第 @a 頁",
"Time Asc": "時間升序",
"Time Desc": "時間降序",
"Favorite Num": "收藏數",
"Favorite Num Compare Comic Pages": "收藏數比漫畫頁數",
"All": "全部",
"Last Week": "上周",
"Last Month": "上月",
"Last Half Year": "半年",
"Last Year": "一年",
"Filter": "篩選",
"Image Favorites": "圖片收藏",
"Title": "標題",
"@a Cover": "@a 封面",
"Photo View": "圖片瀏覽",
"Delete @a images": "刪除 @a 張圖片",
"Update the page number by the latest collection": "按最新收藏更新頁數",
"Copy the title successfully": "複製標題成功",
"The comic is invalid, please long press to delete, you can double click the title to copy": "該漫畫已失效, 請長按刪除, 可以雙擊標題進行複製",
"End": "末尾",
"None": "無",
"View Detail": "查看詳情",
Expand All @@ -533,6 +620,9 @@
"Aggregated": "聚合",
"Default Search Target": "默認搜索目標",
"Auto Language Filters": "自動語言篩選",
"Check for updates on startup": "啟動時檢查更新"
"Check for updates on startup": "啟動時檢查更新",
"Start Time": "開始時間",
"End Time": "結束時間",
"Custom": "自定義"
}
}
45 changes: 45 additions & 0 deletions lib/components/appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,51 @@ class _IndicatorPainter extends CustomPainter {
}
}

class TabViewBody extends StatefulWidget {
/// Create a tab view body, which will show the child at the current tab index.
const TabViewBody({super.key, required this.children, this.controller});

final List<Widget> children;

final TabController? controller;

@override
State<TabViewBody> createState() => _TabViewBodyState();
}

class _TabViewBodyState extends State<TabViewBody> {
late TabController _controller;

int _currentIndex = 0;

void updateIndex() {
if (_controller.index != _currentIndex) {
setState(() {
_currentIndex = _controller.index;
});
}
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
_controller = widget.controller ?? DefaultTabController.of(context);
_controller.addListener(updateIndex);
}

@override
void dispose() {
super.dispose();
_controller.removeListener(updateIndex);
}

@override
Widget build(BuildContext context) {
return widget.children[_currentIndex];
}
}


class SearchBarController {
_SearchBarMixin? _state;

Expand Down
7 changes: 7 additions & 0 deletions lib/components/comic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,16 @@ class _SliverGridComicsState extends State<SliverGridComics> {
comics.add(comic);
}
}
HistoryManager().addListener(update);
super.initState();
}

@override
void dispose() {
HistoryManager().removeListener(update);
super.dispose();
}

void update() {
setState(() {
comics.clear();
Expand Down
7 changes: 6 additions & 1 deletion lib/components/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class AnimatedImage extends StatefulWidget {
this.filterQuality = FilterQuality.medium,
this.isAntiAlias = false,
this.part,
this.onError,
Map<String, String>? headers,
int? cacheWidth,
int? cacheHeight,
Expand Down Expand Up @@ -63,6 +64,8 @@ class AnimatedImage extends StatefulWidget {

final ImagePart? part;

final Function? onError;

static void clear() => _AnimatedImageState.clear();

@override
Expand Down Expand Up @@ -169,6 +172,8 @@ class _AnimatedImageState extends State<AnimatedImage>
_handleImageFrame,
onChunk: _handleImageChunk,
onError: (Object error, StackTrace? stackTrace) {
// 图片加错错误回调
widget.onError?.call(error, stackTrace);
setState(() {
_lastException = error;
});
Expand Down Expand Up @@ -271,7 +276,7 @@ class _AnimatedImageState extends State<AnimatedImage>
Widget result;

if (_imageInfo != null) {
if(widget.part != null) {
if (widget.part != null) {
return CustomPaint(
painter: ImagePainter(
image: _imageInfo!.image,
Expand Down
30 changes: 17 additions & 13 deletions lib/components/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ void showToast({
required BuildContext context,
Widget? icon,
Widget? trailing,
int? seconds,
}) {
var newEntry = OverlayEntry(
builder: (context) => _ToastOverlay(
Expand All @@ -17,7 +18,7 @@ void showToast({

state?.addOverlay(newEntry);

Timer(const Duration(seconds: 2), () => state?.remove(newEntry));
Timer(Duration(seconds: seconds ?? 2), () => state?.remove(newEntry));
}

class _ToastOverlay extends StatelessWidget {
Expand Down Expand Up @@ -48,7 +49,8 @@ class _ToastOverlay extends StatelessWidget {
color: Theme.of(context).colorScheme.onInverseSurface),
child: IntrinsicWidth(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 16),
padding:
const EdgeInsets.symmetric(vertical: 6, horizontal: 16),
constraints: BoxConstraints(
maxWidth: context.width - 32,
),
Expand Down Expand Up @@ -241,13 +243,13 @@ LoadingDialogController showLoadingDialog(BuildContext context,
class ContentDialog extends StatelessWidget {
const ContentDialog({
super.key,
required this.title,
this.title, // 如果不传 title 将不会展示
required this.content,
this.dismissible = true,
this.actions = const [],
});

final String title;
final String? title;

final Widget content;

Expand All @@ -261,14 +263,16 @@ class ContentDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Appbar(
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: dismissible ? context.pop : null,
),
title: Text(title),
backgroundColor: Colors.transparent,
),
title != null
? Appbar(
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: dismissible ? context.pop : null,
),
title: Text(title!),
backgroundColor: Colors.transparent,
)
: const SizedBox.shrink(),
this.content,
const SizedBox(height: 16),
Row(
Expand Down Expand Up @@ -360,7 +364,7 @@ Future<void> showInputDialog({
} else {
result = futureOr;
}
if(result == null) {
if (result == null) {
context.pop();
} else {
setState(() => error = result.toString());
Expand Down
Loading