diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ec13546..b807c44 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ - + + + + + - + - + icon2 - "app_icon_m" -> icon3 - else -> icon1 + when (iconName) { + "app_icon2" -> { + // 切换到图标2:禁用主Activity的LAUNCHER,启用别名 + pm.setComponentEnabledSetting(mainActivity, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP) + pm.setComponentEnabledSetting(icon2, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP) + } + "app_icon_m" -> { + // 切换到图标3:禁用主Activity的LAUNCHER,启用别名 + pm.setComponentEnabledSetting(mainActivity, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP) + pm.setComponentEnabledSetting(icon3, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP) + } + else -> { + // 切换回默认图标:启用主Activity,禁用所有别名(已在上面禁用) + pm.setComponentEnabledSetting(mainActivity, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP) + } } - pm.setComponentEnabledSetting(target, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP) } private fun getCurrentIcon(): String { diff --git a/android/gradle.properties b/android/gradle.properties index b07cc56..3f0de14 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,5 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +org.gradle.java.home=D:\\Environment\\Java\\java17 android.useAndroidX=true systemProp.http.proxyHost=127.0.0.1 systemProp.http.proxyPort=10808 diff --git a/lib/pages/epub_reader/epub_detail_page.dart b/lib/pages/epub_reader/epub_detail_page.dart index 145ace0..5dcf8bb 100644 --- a/lib/pages/epub_reader/epub_detail_page.dart +++ b/lib/pages/epub_reader/epub_detail_page.dart @@ -195,6 +195,14 @@ class _EpubDetailPageState extends State { padding: const EdgeInsets.fromLTRB(16, 0, 16, 24), child: _buildLinkedBookCard(colors), ), + + // ── 其他作品(同作者)── + if (author.isNotEmpty) ...[ + Divider(height: 0.5, thickness: 0.5, color: colors.outline), + _buildSectionHeader('其他作品', colors), + _buildOtherWorks(author, colors), + const SizedBox(height: 24), + ], ], ), ), @@ -396,6 +404,77 @@ class _EpubDetailPageState extends State { await _refreshBook(); } + Widget _buildOtherWorks(String author, ColorScheme colors) { + final linkedBookId = _book['book_id'] as String? ?? ''; + return FutureBuilder>( + future: _bookDao.getBooksByAuthor(author), + builder: (context, snapshot) { + if (!snapshot.hasData || snapshot.data!.isEmpty) { + return Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 0), + child: Text('暂未收藏该作者其他作品', + style: TextStyle(fontSize: 13, color: colors.onSurface.withValues(alpha: 0.35))), + ); + } + final books = snapshot.data!.where((b) => b.id != linkedBookId).toList(); + if (books.isEmpty) { + return Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 0), + child: Text('暂未收藏该作者其他作品', + style: TextStyle(fontSize: 13, color: colors.onSurface.withValues(alpha: 0.35))), + ); + } + return SizedBox( + height: 160, + child: ListView.builder( + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(horizontal: 16), + itemCount: books.length, + itemBuilder: (context, index) { + final book = books[index]; + return GestureDetector( + onTap: () => Navigator.push(context, + MaterialPageRoute(builder: (_) => BookDetailPage(book: book))), + child: Container( + width: 90, + margin: const EdgeInsets.only(right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 90, height: 126, + child: ClipRRect( + borderRadius: BorderRadius.circular(6), + child: book.coverPath != null && book.coverPath!.isNotEmpty + ? Image.file(File(book.coverPath!), fit: BoxFit.cover, + errorBuilder: (_, __, ___) => _buildBookCoverPlaceholder(colors)) + : _buildBookCoverPlaceholder(colors), + ), + ), + const SizedBox(height: 6), + Text(book.title, maxLines: 1, overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 11, color: colors.onSurface)), + ], + ), + ), + ); + }, + ), + ); + }, + ); + } + + Widget _buildBookCoverPlaceholder(ColorScheme colors) { + return Container( + decoration: BoxDecoration( + color: colors.surfaceContainerHighest, + borderRadius: BorderRadius.circular(6), + ), + child: Icon(Icons.menu_book_outlined, size: 28, color: colors.onSurface.withValues(alpha: 0.2)), + ); + } + Widget _buildCover(String? coverPath, ColorScheme colors) { if (coverPath != null && coverPath.isNotEmpty && File(coverPath).existsSync()) { return ClipRRect( diff --git a/proj-img/Screenshot_1781866410.png b/proj-img/Screenshot_1781866410.png deleted file mode 100644 index 812e9a7..0000000 Binary files a/proj-img/Screenshot_1781866410.png and /dev/null differ diff --git a/proj-img/Screenshot_1781866417.png b/proj-img/Screenshot_1781866417.png deleted file mode 100644 index 4c851e5..0000000 Binary files a/proj-img/Screenshot_1781866417.png and /dev/null differ diff --git a/proj-img/Screenshot_1781866427.png b/proj-img/Screenshot_1781866427.png deleted file mode 100644 index 02bc7f4..0000000 Binary files a/proj-img/Screenshot_1781866427.png and /dev/null differ diff --git a/proj-img/Screenshot_1781866432.png b/proj-img/Screenshot_1781866432.png deleted file mode 100644 index 3446056..0000000 Binary files a/proj-img/Screenshot_1781866432.png and /dev/null differ diff --git a/proj-img/Screenshot_1781866436.png b/proj-img/Screenshot_1781866436.png deleted file mode 100644 index f8616b9..0000000 Binary files a/proj-img/Screenshot_1781866436.png and /dev/null differ diff --git a/proj-img/Screenshot_1781866461.png b/proj-img/Screenshot_1781866461.png deleted file mode 100644 index be8bd99..0000000 Binary files a/proj-img/Screenshot_1781866461.png and /dev/null differ diff --git a/proj-img/bj1.png b/proj-img/bj1.png deleted file mode 100644 index 8d67cee..0000000 Binary files a/proj-img/bj1.png and /dev/null differ diff --git a/proj-img/bj2.png b/proj-img/bj2.png deleted file mode 100644 index 9c4b910..0000000 Binary files a/proj-img/bj2.png and /dev/null differ diff --git a/proj-img/fx1.png b/proj-img/fx1.png deleted file mode 100644 index 53dfbe6..0000000 Binary files a/proj-img/fx1.png and /dev/null differ diff --git a/proj-img/fx2.png b/proj-img/fx2.png deleted file mode 100644 index f073488..0000000 Binary files a/proj-img/fx2.png and /dev/null differ diff --git a/proj-img/xq1.png b/proj-img/xq1.png deleted file mode 100644 index 5fbc872..0000000 Binary files a/proj-img/xq1.png and /dev/null differ diff --git a/proj-img/xq2.png b/proj-img/xq2.png deleted file mode 100644 index 0d0f631..0000000 Binary files a/proj-img/xq2.png and /dev/null differ