├── ProjectPRPR
├── .idea
│ ├── .name
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── vcs.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── compiler.xml
│ ├── gradle.xml
│ └── misc.xml
├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── drawables.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── drawable
│ │ │ │ │ └── side_nav_bar.xml
│ │ │ │ ├── drawable-v21
│ │ │ │ │ ├── ic_menu_send.xml
│ │ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ │ └── ic_menu_share.xml
│ │ │ │ ├── values-v21
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── menu
│ │ │ │ │ ├── main.xml
│ │ │ │ │ └── activity_main_drawer.xml
│ │ │ │ ├── values-w820dp
│ │ │ │ │ └── dimens.xml
│ │ │ │ └── layout
│ │ │ │ │ ├── content_main.xml
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── nav_header_main.xml
│ │ │ │ │ └── app_bar_main.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── mewx
│ │ │ │ └── prpr
│ │ │ │ └── MainActivity.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── mewx
│ │ │ │ └── prpr
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── org
│ │ │ └── mewx
│ │ │ └── prpr
│ │ │ └── ApplicationTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── .gitignore
├── build.gradle
├── gradle.properties
└── gradlew.bat
├── prpr-demo
├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── drawable
│ │ │ │ │ ├── nav_bar_bg.jpg
│ │ │ │ │ ├── splash_bg.jpg
│ │ │ │ │ ├── ic_empty_image.png
│ │ │ │ │ ├── reader_bg_yellow1.jpg
│ │ │ │ │ ├── reader_bg_yellow2.jpg
│ │ │ │ │ ├── reader_bg_yellow3.jpg
│ │ │ │ │ ├── recycler_item_bg1.jpg
│ │ │ │ │ ├── recycler_item_bg2.jpg
│ │ │ │ │ ├── reader_bg_yellow_edge.png
│ │ │ │ │ ├── reader_bg_texture.xml
│ │ │ │ │ ├── ic_reader_download.xml
│ │ │ │ │ ├── ic_reader_jump.xml
│ │ │ │ │ ├── ic_menu_library_local.xml
│ │ │ │ │ ├── ic_menu_data_source_category.xml
│ │ │ │ │ ├── ic_menu_plug_in_center.xml
│ │ │ │ │ ├── ic_menu_cloud.xml
│ │ │ │ │ ├── ic_menu_dictionary.xml
│ │ │ │ │ ├── ic_menu_net_book_add.xml
│ │ │ │ │ ├── ic_reader_image.xml
│ │ │ │ │ ├── ic_menu_settings.xml
│ │ │ │ │ ├── ic_reader_daynight.xml
│ │ │ │ │ ├── ic_reader_rotate.xml
│ │ │ │ │ ├── ic_reader_more.xml
│ │ │ │ │ ├── ic_menu_data_source_account.xml
│ │ │ │ │ ├── ic_menu_data_source_search.xml
│ │ │ │ │ ├── ic_menu_net_book_download.xml
│ │ │ │ │ ├── ic_reader_find.xml
│ │ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ │ └── ic_menu_share.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── reader_bg_texture_mask.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── reader_bg_texture_mask.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── reader_bg_texture_mask.png
│ │ │ │ ├── layout
│ │ │ │ │ ├── layout_reader_swipe_page.xml
│ │ │ │ │ ├── nav_separator.xml
│ │ │ │ │ ├── activity_splash.xml
│ │ │ │ │ ├── content_plugin_center_data_source.xml
│ │ │ │ │ ├── content_data_source_item_initial.xml
│ │ │ │ │ ├── content_data_source_item_chapter.xml
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── content_main.xml
│ │ │ │ │ ├── activity_data_source_item_chapter.xml
│ │ │ │ │ ├── activity_data_source_item_initial.xml
│ │ │ │ │ ├── activity_plugin_center_data_source.xml
│ │ │ │ │ ├── activity_settings.xml
│ │ │ │ │ ├── app_bar_main.xml
│ │ │ │ │ ├── nav_header_main.xml
│ │ │ │ │ ├── recycler_item_plugin_center.xml
│ │ │ │ │ ├── activity_data_source_item_detail.xml
│ │ │ │ │ ├── recycler_item_bookshelf.xml
│ │ │ │ │ ├── content_data_source_item_detail.xml
│ │ │ │ │ ├── recycler_item_data_source.xml
│ │ │ │ │ ├── recycler_item_chapter.xml
│ │ │ │ │ └── layout_view_image_detail.xml
│ │ │ │ ├── anim
│ │ │ │ │ ├── fade_in.xml
│ │ │ │ │ ├── fade_out.xml
│ │ │ │ │ └── hold.xml
│ │ │ │ ├── values-w820dp
│ │ │ │ │ └── dimens.xml
│ │ │ │ ├── menu
│ │ │ │ │ ├── main.xml
│ │ │ │ │ ├── activity_reader_v1.xml
│ │ │ │ │ ├── activity_data_source_initial.xml
│ │ │ │ │ ├── activity_net_book_detail.xml
│ │ │ │ │ ├── activity_data_source_initial_with_account.xml
│ │ │ │ │ └── activity_main_drawer.xml
│ │ │ │ ├── values
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── attrs.xml
│ │ │ │ │ ├── drawables.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── styles.xml
│ │ │ │ │ └── arrays.xml
│ │ │ │ ├── raw
│ │ │ │ │ └── license.txt
│ │ │ │ ├── xml
│ │ │ │ │ └── pref_general.xml
│ │ │ │ ├── values-v19
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── layout-v21
│ │ │ │ │ └── app_bar_main.xml
│ │ │ │ └── values-v21
│ │ │ │ │ └── styles.xml
│ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── mewx
│ │ │ │ └── projectprpr
│ │ │ │ ├── reader
│ │ │ │ ├── format
│ │ │ │ │ ├── FormatSupportTxt.java
│ │ │ │ │ └── generator
│ │ │ │ │ │ └── FormatGeneratorPrpr.java
│ │ │ │ ├── setting
│ │ │ │ │ └── ReaderSaveBasic.java
│ │ │ │ ├── slider
│ │ │ │ │ └── base
│ │ │ │ │ │ ├── BaseSlider.java
│ │ │ │ │ │ └── Slider.java
│ │ │ │ └── loader
│ │ │ │ │ ├── ReaderFormatLoaderTxtUtf8.java
│ │ │ │ │ └── ReaderFormatLoader.java
│ │ │ │ ├── activity
│ │ │ │ ├── DataSourceItemNovelListActivity.java
│ │ │ │ ├── adapter
│ │ │ │ │ ├── PluginCenterItem.java
│ │ │ │ │ ├── DataSourceItem.java
│ │ │ │ │ ├── PluginCenterAdapter.java
│ │ │ │ │ ├── DataSourceAdapter.java
│ │ │ │ │ └── BookshelfAdapter.java
│ │ │ │ ├── SplashActivity.java
│ │ │ │ └── DataSourceItemChapterActivity.java
│ │ │ │ ├── MyApp.java
│ │ │ │ ├── plugin
│ │ │ │ ├── JavaCallJavaClass.java
│ │ │ │ ├── component
│ │ │ │ │ ├── NovelContentLine.java
│ │ │ │ │ ├── PluginInfo.java
│ │ │ │ │ ├── ChapterInfo.java
│ │ │ │ │ ├── PageNumBetween.java
│ │ │ │ │ ├── VolumeInfo.java
│ │ │ │ │ ├── BookshelfSaver.java
│ │ │ │ │ └── NetRequest.java
│ │ │ │ ├── JavaCallLuaJava.java
│ │ │ │ └── builtin
│ │ │ │ │ └── Wenku8.java
│ │ │ │ ├── toolkit
│ │ │ │ ├── thirdparty
│ │ │ │ │ └── SingletonThreadPool.java
│ │ │ │ └── CryptoTool.java
│ │ │ │ ├── template
│ │ │ │ ├── NavigationFitSystemView.java
│ │ │ │ ├── AppCompatTemplateActivity.java
│ │ │ │ └── AppCompatPreferenceActivity.java
│ │ │ │ └── global
│ │ │ │ ├── FormatPluginManager.java
│ │ │ │ └── SettingManager.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── org
│ │ │ │ └── mewx
│ │ │ │ └── prdemo
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── org
│ │ │ └── mewx
│ │ │ └── projectprpr
│ │ │ ├── ApplicationTest.java
│ │ │ └── plugin
│ │ │ └── component
│ │ │ └── NetRequestTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── .idea
│ ├── .name
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── vcs.xml
│ ├── inspectionProfiles
│ │ ├── profiles_settings.xml
│ │ └── Project_Default.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── compiler.xml
│ ├── gradle.xml
│ └── misc.xml
├── andro-lua
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── jniLibs
│ │ │ ├── mips
│ │ │ │ └── libluajava.so
│ │ │ ├── x86
│ │ │ │ └── libluajava.so
│ │ │ ├── armeabi
│ │ │ │ └── libluajava.so
│ │ │ └── armeabi-v7a
│ │ │ │ └── libluajava.so
│ │ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ └── org
│ │ │ └── keplerproject
│ │ │ └── luajava
│ │ │ ├── LuaException.java
│ │ │ ├── CPtr.java
│ │ │ ├── LuaInvocationHandler.java
│ │ │ ├── JavaFunction.java
│ │ │ ├── Console.java
│ │ │ └── LuaStateFactory.java
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── README.md
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── .gitignore
├── build.gradle
├── gradle.properties
└── gradlew.bat
├── res-src
├── launch.fw.png
├── ic_launcher.xxx.png
├── LuaJIT-libs
│ ├── mips
│ │ └── libluajit.so
│ ├── x86
│ │ └── libluajit.so
│ ├── armeabi
│ │ └── libluajit.so
│ └── armeabi-v7a
│ │ └── libluajit.so
├── LuaJava-libs
│ ├── x86
│ │ └── libluajava.so
│ ├── mips
│ │ └── libluajava.so
│ ├── armeabi
│ │ └── libluajava.so
│ └── armeabi-v7a
│ │ └── libluajava.so
├── ic_library_books_black_48px.png
├── ic_library_books_black_48px2.png
└── ic_launcher.svg
├── dbg-suite
├── org.mewx.projectprpr.plugin.builtin.XsDmzj.jar
└── test.bat
├── README.md
└── .gitignore
/ProjectPRPR/.idea/.name:
--------------------------------------------------------------------------------
1 | ProjectPRPR
--------------------------------------------------------------------------------
/ProjectPRPR/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/.name:
--------------------------------------------------------------------------------
1 | PluggableReaderDemo
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ProjectPRPR/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/prpr-demo/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':andro-lua'
2 |
--------------------------------------------------------------------------------
/res-src/launch.fw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/launch.fw.png
--------------------------------------------------------------------------------
/res-src/ic_launcher.xxx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/ic_launcher.xxx.png
--------------------------------------------------------------------------------
/res-src/LuaJIT-libs/mips/libluajit.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJIT-libs/mips/libluajit.so
--------------------------------------------------------------------------------
/res-src/LuaJIT-libs/x86/libluajit.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJIT-libs/x86/libluajit.so
--------------------------------------------------------------------------------
/res-src/LuaJava-libs/x86/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJava-libs/x86/libluajava.so
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/res-src/LuaJIT-libs/armeabi/libluajit.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJIT-libs/armeabi/libluajit.so
--------------------------------------------------------------------------------
/res-src/LuaJava-libs/mips/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJava-libs/mips/libluajava.so
--------------------------------------------------------------------------------
/res-src/ic_library_books_black_48px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/ic_library_books_black_48px.png
--------------------------------------------------------------------------------
/res-src/ic_library_books_black_48px2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/ic_library_books_black_48px2.png
--------------------------------------------------------------------------------
/prpr-demo/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/res-src/LuaJava-libs/armeabi/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJava-libs/armeabi/libluajava.so
--------------------------------------------------------------------------------
/ProjectPRPR/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/res-src/LuaJIT-libs/armeabi-v7a/libluajit.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJIT-libs/armeabi-v7a/libluajit.so
--------------------------------------------------------------------------------
/res-src/LuaJava-libs/armeabi-v7a/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/res-src/LuaJava-libs/armeabi-v7a/libluajava.so
--------------------------------------------------------------------------------
/ProjectPRPR/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/prpr-demo/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/nav_bar_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/nav_bar_bg.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/splash_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/splash_bg.jpg
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/jniLibs/mips/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/andro-lua/src/main/jniLibs/mips/libluajava.so
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/jniLibs/x86/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/andro-lua/src/main/jniLibs/x86/libluajava.so
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_empty_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/ic_empty_image.png
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/dbg-suite/org.mewx.projectprpr.plugin.builtin.XsDmzj.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/dbg-suite/org.mewx.projectprpr.plugin.builtin.XsDmzj.jar
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/jniLibs/armeabi/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/andro-lua/src/main/jniLibs/armeabi/libluajava.so
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/reader_bg_yellow1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/reader_bg_yellow1.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/reader_bg_yellow2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/reader_bg_yellow2.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/reader_bg_yellow3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/reader_bg_yellow3.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/recycler_item_bg1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/recycler_item_bg1.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/recycler_item_bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/recycler_item_bg2.jpg
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/ProjectPRPR/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/jniLibs/armeabi-v7a/libluajava.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/andro-lua/src/main/jniLibs/armeabi-v7a/libluajava.so
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | AndroLua
4 |
5 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/reader_bg_yellow_edge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/drawable/reader_bg_yellow_edge.png
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-hdpi/reader_bg_texture_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-hdpi/reader_bg_texture_mask.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # prpr-reader
2 | 这是一个纯净的安卓阅读器(可在线、可本地),非常纯净没有商城,但是有一个插件市场用于搜索并下载在线书籍;支持云端备份(免费);无广告、统计功能可关;最重要的是Apache 2.0开源协议!嘿嘿,其实这是我的毕业设计课题,所以等毕业之后才能开源~ etc 更多功能以及建议收录的数据源网站,欢迎发issus
3 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-xhdpi/reader_bg_texture_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-xhdpi/reader_bg_texture_mask.png
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/mipmap-xxhdpi/reader_bg_texture_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MewX/prpr-reader/HEAD/prpr-demo/app/src/main/res/mipmap-xxhdpi/reader_bg_texture_mask.png
--------------------------------------------------------------------------------
/prpr-demo/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/reader_bg_texture.xml:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dbg-suite/test.bat:
--------------------------------------------------------------------------------
1 | ; specific a .lua file, and a function, then test its output
2 | ; jar cvf x.jar ./org
3 | ; D:\Android\android-sdk\build-tools\23.0.3\dx.bat --dex --output=org.mewx.projectprpr.plugin.builtin.XsDmzj.dex org.mewx.projectprpr.plugin.builtin.XsDmzj.jar
4 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/format/FormatSupportTxt.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.format;
2 |
3 | /**
4 | * Novel format support for ".txt".
5 | * Created by MewX on 3/31/2016.
6 | */
7 | public class FormatSupportTxt {
8 | }
9 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/prpr-demo/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 21 11:34:03 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
7 |
--------------------------------------------------------------------------------
/ProjectPRPR/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Sep 18 14:07:14 ACST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/layout_reader_swipe_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ProjectPRPR
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 | Settings
8 |
9 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/anim/hold.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/setting/ReaderSaveBasic.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.setting;
2 |
3 | /**
4 | * Created by MewX on 04/30/2016.
5 | */
6 | public class ReaderSaveBasic { // deprecated
7 | public String aid;
8 | public String vid;
9 | public String cid;
10 | public int lineId;
11 | public int wordId;
12 | }
13 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/nav_separator.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_download.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/DataSourceItemNovelListActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity;
2 |
3 | import org.mewx.projectprpr.template.AppCompatTemplateActivity;
4 |
5 | /**
6 | * Created by MewX on 4/14/2016.
7 | * Call by NovelDataSourceBasic to fetch data.
8 | */
9 | public class DataSourceItemNovelListActivity extends AppCompatTemplateActivity {
10 | }
11 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/test/java/org/mewx/prpr/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.prpr;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_jump.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/test/java/org/mewx/prdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/androidTest/java/org/mewx/prpr/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.prpr;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_library_local.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/androidTest/java/org/mewx/projectprpr/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_data_source_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_plug_in_center.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/MyApp.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | public class MyApp extends Application {
7 | private static Context context;
8 |
9 | @Override
10 | public void onCreate() {
11 | super.onCreate();
12 | context = getApplicationContext();
13 | }
14 |
15 | public static Context getContext(){
16 | return context;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_cloud.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_dictionary.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_net_book_add.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_settings.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_daynight.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_rotate.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/JavaCallJavaClass.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin;
2 |
3 | /**
4 | * This class is a loader! Contains the functions that load dex-plugins.
5 | * The class in dex should extend from this class.
6 | * todo: generate class from pluginInfo
7 | * Created by MewX on 1/19/2016.
8 | */
9 | public abstract class JavaCallJavaClass {
10 | private static final String TAG = JavaCallJavaClass.class.getSimpleName();
11 |
12 | JavaCallJavaClass(String path) {
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/activity_reader_v1.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/format/generator/FormatGeneratorPrpr.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.format.generator;
2 |
3 | /**
4 | * This format ".prpr" is self-owned format, so it's the format made for downloaded contents from
5 | * the Internet, by plug-ins. Plug-in should call this function to achieve the save to local function.
6 | * Created by MewX on 3/31/2016.
7 | */
8 | public class FormatGeneratorPrpr {
9 | private static final String TAG = FormatGeneratorPrpr.class.getSimpleName();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/slider/base/BaseSlider.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.slider.base;
2 |
3 | /**
4 | * Created by xuzb on 1/16/15.
5 | */
6 | public abstract class BaseSlider implements Slider {
7 | /** 手指移动的方向 */
8 | public static final int MOVE_TO_LEFT = 0; // Move to next
9 | public static final int MOVE_TO_RIGHT = 1; // Move to previous
10 | public static final int MOVE_NO_RESULT = 4;
11 |
12 | /** 触摸的模式 */
13 | static final int MODE_NONE = 0;
14 | static final int MODE_MOVE = 1;
15 | }
16 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/toolkit/thirdparty/SingletonThreadPool.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.toolkit.thirdparty;
2 |
3 | /**
4 | * Created by ghkjgod/LightNovel2 on 2015/10/29.
5 | */
6 | import java.util.concurrent.ExecutorService;
7 | import java.util.concurrent.Executors;
8 | public class SingletonThreadPool {
9 | private static ExecutorService instance = Executors.newCachedThreadPool();
10 | private SingletonThreadPool (){
11 |
12 | }
13 | public static ExecutorService getInstance() {
14 | return instance;
15 | }
16 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ProjectPRPR/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/raw/license.txt:
--------------------------------------------------------------------------------
1 | # General Copyright
--------
Owner: Xia Yuanzhong
# Open Source Library
--------
- com.github.afollestad.material-dialogs:commons:0.8.5.8
- com.squareup.okhttp3:okhttp:3.2.0 (Apache License 2.0)
- com.squareup.okhttp3:okhttp-urlconnection:3.2.0 (Apache License 2.0)
- com.facebook.fresco:fresco:0.9.0 (Apache License 2.0)
- com.facebook.fresco:imagepipeline-okhttp:0.9.0 (Apache License 2.0)
- com.davemorrissey.labs:subsampling-scale-image-view:3.5.0 (Apache License 2.0)
- org.adw.library:discrete-seekbar:1.0.0 (Apache License 2.0)
- com.nononsenseapps:filepicker:2.5.2 (Apache License 2.0)
--------------------------------------------------------------------------------
/prpr-demo/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_data_source_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_data_source_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_net_book_download.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_reader_find.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/prpr-demo/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | maven { url "https://jitpack.io" }
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:23.3.0'
24 | }
25 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/slider/base/Slider.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.slider.base;
2 |
3 | import android.view.MotionEvent;
4 |
5 | import org.mewx.projectprpr.reader.slider.SlidingAdapter;
6 | import org.mewx.projectprpr.reader.slider.SlidingLayout;
7 |
8 | /**
9 | * Created by xuzb on 1/16/15.
10 | */
11 | public interface Slider {
12 | public void init(SlidingLayout slidingLayout);
13 | public void resetFromAdapter(SlidingAdapter adapter);
14 | public boolean onTouchEvent(MotionEvent event);
15 | public void computeScroll();
16 | public void slideNext();
17 | public void slidePrevious();
18 | }
19 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/prpr-demo/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Program Files\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/activity_data_source_initial.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/activity_net_book_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/NovelContentLine.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | /**
6 | * Created by MewX on 4/12/2016.
7 | * Stores the novel content line element.
8 | */
9 | @SuppressWarnings("unused")
10 | public class NovelContentLine {
11 | public enum TYPE {
12 | TEXT,
13 | IMAGE_URL
14 | }
15 |
16 | @NonNull public TYPE type = TYPE.TEXT;
17 | @NonNull public String content = "";
18 |
19 | public NovelContentLine() {
20 |
21 | }
22 |
23 | public NovelContentLine(@NonNull TYPE type, @NonNull String content) {
24 | this.type = type;
25 | this.content = content;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/content_plugin_center_data_source.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/drawable/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/content_data_source_item_initial.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/prpr-demo/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Mon Jan 11 22:25:38 CST 2016
16 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/xml/pref_general.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
16 |
17 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ProjectPRPR/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Sun Sep 18 14:07:20 ACST 2016
16 | systemProp.http.proxyHost=127.0.0.1
17 | systemProp.http.proxyPort=1080
18 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/content_data_source_item_chapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.2"
6 |
7 | defaultConfig {
8 | applicationId "org.mewx.prpr"
9 | minSdkVersion 15
10 | targetSdkVersion 24
11 |
12 | // version code rules: odd for dev; even for public;
13 | versionCode 1
14 | // version name rules (for public only):
15 | // L.S(SSS) L is the large version number; S is teh small version number.
16 | versionName "0.1"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | testCompile 'junit:junit:4.12'
29 | compile 'com.android.support:appcompat-v7:24.2.0'
30 | compile 'com.android.support:design:24.2.0'
31 | }
32 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/activity_data_source_initial_with_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/adapter/PluginCenterItem.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity.adapter;
2 |
3 | import android.support.annotation.DrawableRes;
4 | import android.support.annotation.NonNull;
5 |
6 | @SuppressWarnings("unused")
7 | public class PluginCenterItem {
8 | @NonNull private String centerName;
9 | @DrawableRes private int backgroundId;
10 |
11 | public PluginCenterItem(@NonNull String name, @DrawableRes int backgroundId) {
12 | this.centerName = name;
13 | this.backgroundId = backgroundId;
14 | }
15 |
16 | @NonNull
17 | public String getCenterName() {
18 | return centerName;
19 | }
20 |
21 | public void setCenterName(@NonNull String centerName) {
22 | this.centerName = centerName;
23 | }
24 |
25 | public int getBackgroundId() {
26 | return backgroundId;
27 | }
28 |
29 | public void setBackgroundId(@DrawableRes int backgroundId) {
30 | this.backgroundId = backgroundId;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/PluginInfo.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by MewX on 04/17/2016.
7 | * This class save the plug-in's information.
8 | * Should be pass between activities.
9 | */
10 | public class PluginInfo implements Serializable {
11 | public enum PluginType {
12 | BUILTIN,
13 | DEX,
14 | LUA
15 | }
16 |
17 | private String className;
18 | private PluginType type;
19 | private String path; // if is "BUILTIN", ignore this; if path contains "http", need download first
20 |
21 | public PluginInfo(String className, PluginType type, String path) {
22 | this.className = className;
23 | this.type = type;
24 | this.path = path;
25 | }
26 |
27 | public String getClassName() {
28 | return className;
29 | }
30 |
31 | public PluginType getType() {
32 | return type;
33 | }
34 |
35 | public String getPath() {
36 | return path;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
21 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #03A9F4
4 | #0288D1
5 | #F44336
6 |
7 | #EEEEEE
8 |
9 | #66000000
10 |
11 | #ffffff
12 | #ffffff
13 | #80000000
14 |
15 | #FFFFFF
16 | #EAEAEA
17 | #F44336
18 | #444444
19 | #DADADA
20 |
21 |
22 | #CC000000
23 | #CFBEB6
24 | #090C13
25 | #32414E
26 | #444444
27 |
28 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/template/NavigationFitSystemView.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.template;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.NavigationView;
5 | import android.util.AttributeSet;
6 |
7 | import org.mewx.projectprpr.toolkit.ScreenTool;
8 |
9 | /**
10 | * This view makes the NavigationDrawer fit system view.
11 | * Created by MewX on 1/19/2016.
12 | */
13 | public class NavigationFitSystemView extends NavigationView {
14 | public NavigationFitSystemView(Context context) {
15 | super(context);
16 | }
17 |
18 | public NavigationFitSystemView(Context context, AttributeSet attrs) {
19 | super(context, attrs);
20 | }
21 |
22 | public NavigationFitSystemView(Context context, AttributeSet attrs, int defStyleAttr) {
23 | super(context, attrs, defStyleAttr);
24 | }
25 |
26 | @Override
27 | protected void onMeasure(int widthSpec, int heightSpec) {
28 |
29 | // TODO: optimize for tablet screen layout
30 | // super.onMeasure(widthSpec, heightSpec- ScreenTool.getCurrentNavigationBarSize(getContext()).y);
31 | super.onMeasure(widthSpec, heightSpec); // todo: this is temporary solution
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/adapter/DataSourceItem.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity.adapter;
2 |
3 | /**
4 | * Created by MewX on 04/17/2016.
5 | * Store the basic info of data source, which are displaying in recycler view.
6 | */
7 | public class DataSourceItem {
8 | private String displayName;
9 | private String websiteDomain;
10 | private int versionCode;
11 | private String logoUrl;
12 | private String pluginAuthor;
13 |
14 | public DataSourceItem(String name, String domain, int versionCode, String logoUrl, String pluginAuthor) {
15 | this.displayName = name;
16 | this.websiteDomain = domain;
17 | this.versionCode = versionCode;
18 | this.logoUrl = logoUrl;
19 | this.pluginAuthor = pluginAuthor;
20 | }
21 |
22 | public String getDisplayName() {
23 | return displayName;
24 | }
25 |
26 | public String getWebsiteDomain() {
27 | return websiteDomain;
28 | }
29 |
30 | public int getVersionCode() {
31 | return versionCode;
32 | }
33 |
34 | public String getLogoUrl() {
35 | return logoUrl;
36 | }
37 |
38 | public String getPluginAuthor() {
39 | return pluginAuthor;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_data_source_item_chapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_data_source_item_initial.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_plugin_center_data_source.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/androidTest/java/org/mewx/projectprpr/plugin/component/NetRequestTest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.content.ContentValues;
4 |
5 | import junit.framework.TestCase;
6 |
7 | /**
8 | * This test case is for testing the NetRequest component.
9 | */
10 | public class NetRequestTest extends TestCase {
11 |
12 | /**
13 | * Test url requests' conjunction method.
14 | * Containing differenct cases.
15 | */
16 | public void testArgumentConjunction() {
17 | ContentValues cv = new ContentValues();
18 | cv.put("test1", "arg1");
19 | cv.put("test2", 2);
20 | NetRequest netRequest = new NetRequest(NetRequest.REQUEST_TYPE.GET, "https://test.com", cv);
21 | assertEquals(netRequest.getArgs(), "test1=arg1&test2=2");
22 |
23 | cv.clear();
24 | netRequest = new NetRequest(NetRequest.REQUEST_TYPE.GET, "https://test.com", cv);
25 | assertEquals(netRequest.getArgs(), "");
26 |
27 | cv.clear();
28 | netRequest = new NetRequest(NetRequest.REQUEST_TYPE.POST, "https://test.com", null);
29 | assertEquals(netRequest.getType(), NetRequest.REQUEST_TYPE.POST);
30 | assertEquals(netRequest.getUrl(), "https://test.com");
31 | assertEquals(netRequest.getArgs(), "");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/ChapterInfo.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by MewX on 4/9/2016.
9 | * Store chapter info only.
10 | */
11 | @SuppressWarnings("unused")
12 | public class ChapterInfo implements Serializable {
13 | @NonNull private String title;
14 | @NonNull private String chapterTag; // TODO: when save, need to translate string, e.g. '/' -> '_'
15 |
16 | /**
17 | * default construct
18 | * @param chapterTag this is a must to be set
19 | */
20 | public ChapterInfo(@NonNull String chapterTag) {
21 | this("", chapterTag);
22 | }
23 |
24 | public ChapterInfo(@NonNull String title, @NonNull String chapterTag) {
25 | this.title = title;
26 | this.chapterTag = chapterTag;
27 | }
28 |
29 | @NonNull
30 | public String getTitle() {
31 | return title;
32 | }
33 |
34 | public void setTitle(@NonNull String title) {
35 | this.title = title;
36 | }
37 |
38 | @NonNull
39 | public String getChapterTag() {
40 | return chapterTag;
41 | }
42 |
43 | public void setChapterTag(@NonNull String chapterTag) {
44 | this.chapterTag = chapterTag;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout-v21/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
37 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
11 |
15 |
19 |
20 |
21 |
23 |
27 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 | /*/build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 |
30 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
31 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
32 |
33 | # User-specific stuff:
34 | .idea/workspace.xml
35 | .idea/tasks.xml
36 | .idea/dictionaries
37 | .idea/vcs.xml
38 | .idea/jsLibraryMappings.xml
39 |
40 | # Sensitive or high-churn files:
41 | .idea/dataSources.ids
42 | .idea/dataSources.xml
43 | .idea/dataSources.local.xml
44 | .idea/sqlDataSources.xml
45 | .idea/dynamic.xml
46 | .idea/uiDesigner.xml
47 |
48 | # Gradle:
49 | .idea/gradle.xml
50 | .idea/libraries
51 |
52 | # Mongo Explorer plugin:
53 | .idea/mongoSettings.xml
54 |
55 | ## File-based project format:
56 | *.iml
57 | *.ipr
58 | *.iws
59 |
60 | ## Plugin-specific files:
61 |
62 | # IntelliJ
63 | /out/
64 |
65 | # mpeltonen/sbt-idea plugin
66 | .idea_modules/
67 |
68 | # JIRA plugin
69 | atlassian-ide-plugin.xml
70 |
71 | # Crashlytics plugin (for Android Studio and IntelliJ)
72 | com_crashlytics_export_strings.xml
73 | crashlytics.properties
74 | crashlytics-build.properties
75 | fabric.properties
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
21 |
28 |
29 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/loader/ReaderFormatLoaderTxtUtf8.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.loader;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import org.mewx.projectprpr.plugin.component.NovelContent;
6 | import org.mewx.projectprpr.plugin.component.NovelContentLine;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.FileInputStream;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | * Created by MewX on 05/16/2016.
14 | * Loader for utf8 txt file.
15 | */
16 | public class ReaderFormatLoaderTxtUtf8 extends ReaderFormatLoaderBasic {
17 | private static final String TAG = ReaderFormatLoaderTxtUtf8.class.getSimpleName();
18 |
19 | public ReaderFormatLoaderTxtUtf8(@NonNull String fullPath) {
20 | // read full book
21 | NovelContent nc = new NovelContent();
22 | try {
23 | FileInputStream fis = new FileInputStream(fullPath);
24 | InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
25 | BufferedReader br = new BufferedReader(isr);
26 |
27 | String line = null;
28 | while ((line = br.readLine()) != null) {
29 | nc.addToNovelContentAndSaveFile(new NovelContentLine(NovelContentLine.TYPE.TEXT, line));
30 | }
31 |
32 | br.close();
33 | isr.close();
34 | fis.close();
35 | } catch (Exception e) {
36 | e.printStackTrace();
37 | }
38 |
39 | // this is a must
40 | setNovelContent(nc);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
28 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/res-src/ic_launcher.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
30 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/recycler_item_plugin_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
18 |
19 |
25 |
26 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/activity_data_source_item_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/PageNumBetween.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.support.annotation.Nullable;
4 |
5 | /**
6 | * Created by MewX on 4/9/2016.
7 | * Page number between a and b, that means [a, b].
8 | */
9 | @SuppressWarnings("unused")
10 | public class PageNumBetween {
11 | private int beg, end; // just set and get directly
12 | @Nullable private Integer current;
13 |
14 | public PageNumBetween(int beg) {
15 | this(beg, beg);
16 | }
17 |
18 | public PageNumBetween(int beg, int end) {
19 | if(beg < end) {
20 | this.beg = beg;
21 | this.end = end;
22 | } else {
23 | this.end = beg;
24 | this.beg = end;
25 | }
26 | }
27 |
28 | public boolean hasNext() {
29 | return current == null || current < end;
30 | }
31 |
32 | public int getNext() {
33 | if (current == null) {
34 | current = beg;
35 | return current;
36 | } else if (current < end) {
37 | current += 1;
38 | return current;
39 | } else {
40 | current = end;
41 | return end;
42 | }
43 | }
44 |
45 | public void setCurrent(int c) {
46 | if (beg <= c && c <= end)
47 | this.current = c;
48 | else
49 | this.current = beg; // if fail
50 | }
51 |
52 | public int getCurrent() {
53 | return current == null ? beg : current;
54 | }
55 |
56 | public int getBeg() {
57 | return beg;
58 | }
59 |
60 | public int getEnd() {
61 | return end;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/template/AppCompatTemplateActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.template;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.content.ContextCompat;
7 | import android.support.v7.app.AppCompatActivity;
8 |
9 | import org.mewx.projectprpr.toolkit.thirdparty.SystemBarTintManager;
10 |
11 | import org.mewx.projectprpr.R;
12 |
13 | /**
14 | * This activity used to init some common components.
15 | * Created by MewX on 1/18/2016.
16 | */
17 | public class AppCompatTemplateActivity extends AppCompatActivity {
18 |
19 | @Override
20 | protected void onCreate(@Nullable Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 |
23 | // set StatusBar Color
24 | // TODO: should change when theme change? like dark mode?
25 | SystemBarTintManager systemBarTintManager = new SystemBarTintManager(this);
26 | if(Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
27 | systemBarTintManager.setStatusBarTintEnabled(true);
28 | systemBarTintManager.setStatusBarTintColor(ContextCompat.getColor(this, R.color.colorPrimary));
29 | }
30 | if(Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT) {
31 | // set navigation bar color (todo temporary solution)
32 | systemBarTintManager.setNavigationBarTintEnabled(true);
33 | systemBarTintManager.setNavigationBarTintColor(ContextCompat.getColor(this, R.color.colorPrimary));
34 | }
35 |
36 | // TODO: Umeng statistic codes can be added here
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/prpr-demo/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "org.mewx.projectprpr"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "under developing"
13 | }
14 | buildTypes {
15 | debug {
16 | minifyEnabled false
17 | }
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | compile fileTree(dir: 'libs', include: ['*.jar'])
27 | testCompile 'junit:junit:4.12'
28 |
29 | // official
30 | compile 'com.android.support:support-v4:23.3.0'
31 | compile 'com.android.support:appcompat-v7:23.3.0'
32 | compile 'com.android.support:design:23.3.0'
33 | compile 'com.android.support:cardview-v7:23.3.0'
34 | compile 'com.android.support:recyclerview-v7:23.3.0'
35 |
36 | // third party
37 | compile project(':andro-lua')
38 | //compile 'com.google.dagger:dagger:2.1'
39 | compile('com.github.afollestad.material-dialogs:commons:0.8.5.8@aar') {
40 | transitive = true
41 | }
42 | compile 'com.squareup.okhttp3:okhttp:3.2.0'
43 | compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
44 | compile 'com.facebook.fresco:fresco:0.9.0'
45 | compile 'com.facebook.fresco:imagepipeline-okhttp:0.9.0'
46 | compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
47 | compile 'org.adw.library:discrete-seekbar:1.0.0'
48 | compile 'com.nononsenseapps:filepicker:2.5.2'
49 | }
50 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/reader/loader/ReaderFormatLoader.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.reader.loader;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import org.mewx.projectprpr.plugin.component.NovelContentLine;
6 |
7 | /**
8 | * Created by MewX on 2016/4/29.
9 | * Parent of all loaders.
10 | */
11 | public abstract class ReaderFormatLoader {
12 | // public abstract void initLoader(String srcPath);
13 |
14 | public abstract void setChapterName(String name); // set chapter name
15 |
16 | public abstract String getChapterName(); // get chapter name
17 |
18 | public abstract boolean hasNext(int wordIndex); // word in current line
19 |
20 | public abstract boolean hasPrevious(int wordIndex); // word in current line
21 |
22 | public abstract NovelContentLine.TYPE getNextType(); // next is {index}, nullable (index keep)
23 |
24 | public abstract String getNextAsString(); // index ++
25 |
26 | public abstract Bitmap getNextAsBitmap(); // index ++
27 |
28 | public abstract NovelContentLine.TYPE getCurrentType(); //
29 |
30 | public abstract String getCurrentAsString(); // index keep
31 |
32 | public abstract Bitmap getCurrentAsBitmap(); // index keep
33 |
34 | public abstract NovelContentLine.TYPE getPreviousType(); // nullable (index keep)
35 |
36 | public abstract String getPreviousAsString(); // index --
37 |
38 | public abstract Bitmap getPreviousAsBitmap(); // index --
39 |
40 | public abstract int getStringLength(int n);
41 |
42 | public abstract int getElementCount();
43 |
44 | public abstract int getCurrentIndex(); // from 0, to {Count - 1}
45 |
46 | public abstract void setCurrentIndex(int i); // set a index, should optimize for the same or relation lines
47 |
48 | public abstract void closeLoader();
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @string/plugin_center_items_data_source
5 | - @string/plugin_center_items_formats
6 |
7 |
8 |
9 | - @string/netnovel_download_option_check_for_update
10 | - @string/netnovel_download_option_update_uncached_volumes
11 | - @string/netnovel_download_option_force_update_all
12 | - @string/netnovel_download_option_select_and_update
13 |
14 |
15 |
16 | - @string/reader_font_system
17 | - @string/reader_font_custom
18 |
19 |
20 |
21 | - @string/reader_background_system
22 | - @string/reader_background_custom
23 |
24 |
25 |
26 | - @string/setting_language_system
27 | - @string/setting_language_english
28 | - @string/setting_language_sc
29 | - @string/setting_language_tc
30 |
31 |
32 | - 0
33 | - 1
34 | - 2
35 | - 3
36 |
37 |
38 |
39 | - @string/setting_clear_cache_simple
40 | - @string/setting_clear_cache_advanced
41 |
42 |
43 |
44 | - @string/bookshelf_remove
45 | - @string/bookshelf_view_detail
46 |
47 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/LuaException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: LuaException.java,v 1.6 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | /**
28 | * LuaJava exception
29 | *
30 | * @author Thiago Ponte
31 | *
32 | */
33 | public class LuaException extends Exception
34 | {
35 | /**
36 | *
37 | */
38 | private static final long serialVersionUID = 1L;
39 |
40 | public LuaException(String str)
41 | {
42 | super(str);
43 | }
44 |
45 | /**
46 | * Will work only on Java 1.4 or later.
47 | * To work with Java 1.3, comment the first line and uncomment the second one.
48 | */
49 | public LuaException(Exception e)
50 | {
51 | super((e.getCause() != null) ? e.getCause() : e);
52 | //super(e.getMessage());
53 | }
54 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/recycler_item_bookshelf.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
19 |
20 |
30 |
31 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/VolumeInfo.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.io.Serializable;
6 | import java.util.ArrayList;
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by MewX on 4/9/2016.
12 | * Contain chapters.
13 | */
14 | @SuppressWarnings("unused")
15 | public class VolumeInfo implements Serializable {
16 | @NonNull private String title;
17 | @NonNull private String volumeTag;
18 | @NonNull private ArrayList chapterList = new ArrayList<>();
19 |
20 | public VolumeInfo(@NonNull String volumeTag) {
21 | this(volumeTag, volumeTag);
22 | }
23 |
24 | public VolumeInfo(@NonNull String title, @NonNull String volumeTag) {
25 | this.title = title;
26 | this.volumeTag = volumeTag;
27 | }
28 |
29 | public int getChapterListSize() {
30 | return chapterList.size();
31 | }
32 |
33 | public ChapterInfo getChapterByListIndex(int i) {
34 | return chapterList.get(i);
35 | }
36 |
37 | public void addToChapterList(ChapterInfo[] chapterInfoArray) {
38 | chapterList.addAll(Arrays.asList(chapterInfoArray));
39 | }
40 |
41 | public void addTochapterList(List chapterInfoList) {
42 | chapterList.addAll(chapterInfoList);
43 | }
44 |
45 | public void addToChapterList(ChapterInfo chapterInfo) {
46 | chapterList.add(chapterInfo);
47 | }
48 |
49 | public void clearChapterList() {
50 | chapterList.clear();
51 | }
52 |
53 | @NonNull
54 | public String getTitle() {
55 | return title;
56 | }
57 |
58 | public void setTitle(@NonNull String title) {
59 | this.title = title;
60 | }
61 |
62 | @NonNull
63 | public String getVolumeTag() {
64 | return volumeTag;
65 | }
66 |
67 | public void setVolumeTag(@NonNull String volumeTag) {
68 | this.volumeTag = volumeTag;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/BookshelfSaver.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.annotation.Nullable;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by MewX on 05/11/2016.
11 | * An item in bookshelf.
12 | */
13 | @SuppressWarnings("unused")
14 | public class BookshelfSaver {
15 |
16 | public enum BOOK_TYPE {
17 | NETNOVEL,
18 | LOCAL_BOOK
19 | }
20 |
21 | @NonNull
22 | private BOOK_TYPE type;
23 | @Nullable
24 | private String dataSourceTag; // if local, null
25 | @NonNull
26 | private NovelInfo novelInfo;
27 | @Nullable
28 | private ArrayList listVolumeInfo; // if local, null
29 |
30 | public BookshelfSaver(@NonNull BOOK_TYPE type, @Nullable String dataSourceTag, @NonNull NovelInfo novelInfo, @Nullable ArrayList listVolumeInfo) {
31 | // path: .. / plug-in's tag / novelInfo's tag
32 | this.type = type;
33 | this.dataSourceTag = dataSourceTag;
34 | this.novelInfo = novelInfo;
35 | this.listVolumeInfo = listVolumeInfo;
36 | }
37 |
38 | @NonNull
39 | public BOOK_TYPE getType() {
40 | return type;
41 | }
42 |
43 | public void setType(@NonNull BOOK_TYPE type) {
44 | this.type = type;
45 | }
46 |
47 | @Nullable
48 | public String getDataSourceTag() {
49 | return dataSourceTag;
50 | }
51 |
52 | public void setDataSourceTag(@Nullable String dataSourceTag) {
53 | this.dataSourceTag = dataSourceTag;
54 | }
55 |
56 | @NonNull
57 | public NovelInfo getNovelInfo() {
58 | return novelInfo;
59 | }
60 |
61 | public void setNovelInfo(@NonNull NovelInfo novelInfo) {
62 | this.novelInfo = novelInfo;
63 | }
64 |
65 | @Nullable
66 | public ArrayList getListVolumeInfo() {
67 | return listVolumeInfo;
68 | }
69 |
70 | public void setListVolumeInfo(@NonNull ArrayList listVolumeInfo) {
71 | this.listVolumeInfo = listVolumeInfo;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/global/FormatPluginManager.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.global;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.annotation.Nullable;
5 | import android.util.Log;
6 |
7 | import org.mewx.projectprpr.reader.loader.ReaderFormatLoader;
8 | import org.mewx.projectprpr.reader.loader.ReaderFormatLoaderTxtUtf8;
9 |
10 | /**
11 | * Created by MewX on 05/16/2016.
12 | * Holds all the reading formats plugins.
13 | */
14 | public class FormatPluginManager {
15 | private static final String TAG = FormatPluginManager.class.getSimpleName();
16 | private static final String FORMAT_TXT = "txt";
17 |
18 | public enum SUPPORTED_FORMAT {
19 | UNKNOWN,
20 | TXT_UTF8
21 | }
22 |
23 | @Nullable
24 | static public ReaderFormatLoader detectFileAndLoadFormatLoader(@NonNull String fullPath) {
25 | SUPPORTED_FORMAT format = detectFileFormat(fullPath);
26 | switch (format) {
27 | case TXT_UTF8:
28 | return new ReaderFormatLoaderTxtUtf8(fullPath);
29 |
30 | case UNKNOWN:
31 | default:
32 | return null;
33 | }
34 | }
35 |
36 | static public SUPPORTED_FORMAT detectFileFormat(@NonNull String fullPath) {
37 | int separatorIndex = fullPath.lastIndexOf('/') < 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/');
38 | if(separatorIndex < 0) return SUPPORTED_FORMAT.UNKNOWN;
39 |
40 | // use suffix to detect
41 | String fileName = fullPath.substring(separatorIndex + 1);
42 | int dotIndex = fileName.lastIndexOf('.');
43 | if (dotIndex >= 0) {
44 | String suffix = fileName.substring(dotIndex + 1).trim().toLowerCase();
45 | if (suffix.equals(FORMAT_TXT))
46 | return SUPPORTED_FORMAT.TXT_UTF8;
47 | // add more elseif
48 | else
49 | return SUPPORTED_FORMAT.UNKNOWN;
50 |
51 | } else {
52 | // todo: need to read binary to detect
53 | Log.e(TAG, "need to read binary to detect");
54 | return SUPPORTED_FORMAT.UNKNOWN;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/global/SettingManager.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.global;
2 |
3 | import android.content.ContentValues;
4 | import android.support.annotation.Nullable;
5 | import android.text.TextUtils;
6 |
7 | import org.mewx.projectprpr.toolkit.FileTool;
8 |
9 | /**
10 | * Created by MewX on 05/08/2016.
11 | * This for all the settings.
12 | */
13 | @SuppressWarnings("unused")
14 | public class SettingManager {
15 | private static final String TAG = SettingManager.class.getSimpleName();
16 |
17 | private static ContentValues allSetting;
18 |
19 | public static void loadAllSetting() {
20 | allSetting = new ContentValues();
21 | String h = FileTool.loadFullFileContent(G.getStoragePath(G.PROJECT_FILE_READER_SETTINGS));
22 | String[] sets = h.split("\\|\\|\\|\\|");
23 | for(String set : sets) {
24 | String[] temp = set.split("::::");
25 | if(temp.length != 2 || temp[0] == null || temp[0].length() == 0 || temp[1] == null || temp[1].length() == 0) continue;
26 |
27 | allSetting.put(temp[0], temp[1]);
28 | }
29 |
30 | if(TextUtils.isEmpty(getFromAllSetting(G.SettingItemsBasic.version)))
31 | setToAllSetting(G.SettingItemsBasic.version, "1");
32 | }
33 |
34 | public static void saveAllSetting() {
35 | if(allSetting == null) loadAllSetting();
36 | String result = "";
37 | for( String key : allSetting.keySet() ) {
38 | if(!result.equals("")) result = result + "||||";
39 | result = result + key + "::::" + allSetting.getAsString(key);
40 | }
41 |
42 | FileTool.writeFullFileContent(G.getStoragePath(G.PROJECT_FILE_READER_SETTINGS), result);
43 | }
44 |
45 | @Nullable
46 | public static String getFromAllSetting(G.SettingItemsBasic name) {
47 | if(allSetting == null) loadAllSetting();
48 | return allSetting.getAsString(name.toString());
49 | }
50 |
51 | public static void setToAllSetting(G.SettingItemsBasic name, String value) {
52 | if(allSetting == null) loadAllSetting();
53 | if(name != null && value != null) {
54 | allSetting.remove(name.toString());
55 | allSetting.put(name.toString(), value);
56 | saveAllSetting();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/prpr-demo/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/content_data_source_item_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
36 |
37 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/toolkit/CryptoTool.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.toolkit;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.util.Base64;
5 |
6 | import java.io.File;
7 | import java.io.UnsupportedEncodingException;
8 | import java.security.MessageDigest;
9 | import java.security.NoSuchAlgorithmException;
10 |
11 | /**
12 | * Created by MewX on 05/14/2016.
13 | * Contains the basic encryption methods, and hash methods.
14 | */
15 | @SuppressWarnings("unused")
16 | public class CryptoTool {
17 | private static final String DEFAULT_DIGEST_ALGORITHM = "SHA-1";
18 |
19 | static public String base64Encode(byte[] b) {
20 | return Base64.encodeToString(b, Base64.DEFAULT);
21 | }
22 |
23 | static public String base64Encode(String s) {
24 | try {
25 | return base64Encode(s.getBytes("UTF-8")).trim();
26 | } catch (UnsupportedEncodingException e) {
27 | e.printStackTrace();
28 | return null;
29 | }
30 | }
31 |
32 | @Nullable
33 | static public byte[] base64Decode(String s) {
34 | try {
35 | byte[] b;
36 | b = Base64.decode(s, Base64.DEFAULT);
37 | return b;
38 | } catch (Exception e) {
39 | e.printStackTrace();
40 | return null;
41 | }
42 | }
43 |
44 | @Nullable
45 | static public String base64DecodeString(String s, String charset) {
46 | try {
47 | return new String(base64Decode(s), charset); // UTF-8
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | return null;
51 | }
52 | }
53 |
54 | static public String hashMessageDigest(String msg) throws NoSuchAlgorithmException{
55 | final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
56 | MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_DIGEST_ALGORITHM);
57 | messageDigest.update(msg.getBytes());
58 |
59 | // convert to
60 | byte[] hash = messageDigest.digest();
61 | StringBuilder buf = new StringBuilder(hash.length * 2);
62 | for (int j = 0; j < hash.length; j++) {
63 | buf.append(HEX_DIGITS[(hash[j] << 4) & 0x0f]);
64 | buf.append(HEX_DIGITS[hash[j] & 0x0f]);
65 | }
66 | for (byte c : hash) {
67 | buf.append(HEX_DIGITS[(c << 4) & 0x0f]);
68 | buf.append(HEX_DIGITS[c & 0x0f]);
69 | }
70 | return buf.toString();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/recycler_item_data_source.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
18 |
19 |
28 |
29 |
42 |
43 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/CPtr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: CPtr.java,v 1.4 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | /**
28 | * An abstraction for a C pointer data type. A CPtr instance represents, on
29 | * the Java side, a C pointer. The C pointer could be any type of C
30 | * pointer.
31 | */
32 | public class CPtr
33 | {
34 |
35 | /**
36 | * Compares this CPtr to the specified object.
37 | *
38 | * @param other a CPtr
39 | * @return true if the class of this CPtr object and the
40 | * class of other are exactly equal, and the C
41 | * pointers being pointed to by these objects are also
42 | * equal. Returns false otherwise.
43 | */
44 | public boolean equals(Object other)
45 | {
46 | if (other == null)
47 | return false;
48 | if (other == this)
49 | return true;
50 | if (CPtr.class != other.getClass())
51 | return false;
52 | return peer == ((CPtr)other).peer;
53 | }
54 |
55 |
56 | /* Pointer value of the real C pointer. Use long to be 64-bit safe. */
57 | private long peer;
58 |
59 | /**
60 | * Gets the value of the C pointer abstraction
61 | * @return long
62 | */
63 | protected long getPeer()
64 | {
65 | return peer;
66 | }
67 |
68 | /* No-args constructor. */
69 | CPtr() {}
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/ProjectPRPR/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/prpr-demo/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/README.md:
--------------------------------------------------------------------------------
1 | AndroLua
2 | ========
3 |
4 | AndroLua is the [Lua](http://www.lua.org/) interpreter ported to the [Android](http://www.android.com/) platform. Others have ported Lua to Android, but this project is special:
5 |
6 | * it includes [LuaJava](http://www.keplerproject.org/luajava/), so you can access (almost) everything the [Android API](http://developer.android.com/reference/classes.html) provides
7 | * because writing code on the soft keyboard can be hard, you can connect to it using TCP an upload code from your computer
8 |
9 | I created it because I wanted to learn how to use the [Android NDK](http://developer.android.com/sdk/ndk/index.html) and explore the Android API without having to go through the fuss of creating a project, writing boilerplate code, compiling and uploading the APK just to test a few lines of code.
10 |
11 | Depending on the interest, it may become something more...
12 |
13 | Requirements
14 | ------------
15 |
16 | * [Android SDK](http://developer.android.com/sdk/index.html)
17 | * [Android NDK](http://developer.android.com/sdk/ndk/index.html)
18 | * (optionally) Eclipse with the [ADT](http://developer.android.com/sdk/eclipse-adt.html) plugin
19 |
20 | Lua and LuaJava sources are included.
21 |
22 | Building
23 | --------
24 |
25 | Assuming that `$SDK` points to your SDK and `$NDK` points to your NDK installation, run the following:
26 |
27 | git clone git://github.com/mkottman/AndroLua.git
28 | cd AndroLua
29 | $NDK/ndk-build
30 |
31 | This will build the native library, consisting of Lua and LuaJava. Then import the project into Eclipse, or run the following
32 |
33 | $SDK/tools/android update project -p .
34 | ant debug
35 | ant install
36 |
37 | Usage
38 | -----
39 |
40 | The UI consist of the following:
41 |
42 | * a large "Execute" button (that's what you want to do, after all)
43 | * a text editor, where you can write Lua code, conveniently preloaded with the classic "Hello World!" example. A long click on the whole editor will clear it.
44 | * a status/output window, that shows the output of 'print' function, and is scrollable should there be many lines of output
45 |
46 | You can also work interactively by connecting to the TCP port 3333 of the device. You can do that either directly by using WiFi, or through the USB cable. For that you need to run the following:
47 |
48 | $SDK/platform-tools/adb forward tcp:3333 tcp:3333
49 |
50 | In this version, there is a simple client `interp.lua` that uses LuaSocket. By default it will initially read stuff from `init.lua`.
51 |
52 | For example:
53 |
54 | $ lua interp.lua
55 | loading init.lua
56 |
57 | > = activity
58 | sk.kottman.androlua.Main@405166c0
59 | > for i = 1,4 do print(i) end
60 | 1
61 | 2
62 | 3
63 | 4
64 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/LuaInvocationHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: LuaInvocationHandler.java,v 1.4 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | import java.lang.reflect.InvocationHandler;
28 | import java.lang.reflect.Method;
29 |
30 | /**
31 | * Class that implements the InvocationHandler interface.
32 | * This class is used in the LuaJava's proxy system.
33 | * When a proxy object is accessed, the method invoked is
34 | * called from Lua
35 | * @author Rizzato
36 | * @author Thiago Ponte
37 | */
38 | public class LuaInvocationHandler implements InvocationHandler
39 | {
40 | private LuaObject obj;
41 |
42 |
43 | public LuaInvocationHandler(LuaObject obj)
44 | {
45 | this.obj = obj;
46 | }
47 |
48 | /**
49 | * Function called when a proxy object function is invoked.
50 | */
51 | public Object invoke(Object proxy, Method method, Object[] args) throws LuaException
52 | {
53 | synchronized(obj.L)
54 | {
55 | String methodName = method.getName();
56 | LuaObject func = obj.getField(methodName);
57 |
58 | if ( func.isNil() )
59 | {
60 | return null;
61 | }
62 |
63 | Class retType = method.getReturnType();
64 | Object ret;
65 |
66 | // Checks if returned type is void. if it is returns null.
67 | if ( retType.equals( Void.class ) || retType.equals( void.class ) )
68 | {
69 | func.call( args , 0 );
70 | ret = null;
71 | }
72 | else
73 | {
74 | ret = func.call(args, 1)[0];
75 | if( ret != null && ret instanceof Double )
76 | {
77 | ret = LuaState.convertLuaNumber((Double) ret, retType);
78 | }
79 | }
80 |
81 | return ret;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/recycler_item_chapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
27 |
28 |
43 |
44 |
45 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.CountDownTimer;
7 | import android.view.View;
8 |
9 | import org.mewx.projectprpr.R;
10 | import org.mewx.projectprpr.global.G;
11 |
12 | /**
13 | * An example full-screen activity that shows and hides the system UI (i.e.
14 | * status bar and navigation/system bar) with user interaction.
15 | */
16 | public class SplashActivity extends Activity {
17 | private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
18 |
19 | private static CountDownTimer activityDeadCounter;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | setContentView(R.layout.activity_splash);
26 |
27 | findViewById(R.id.splash_image).setOnClickListener(new OnClickSkipSplashScreen());
28 |
29 | if(G.VERSION_TYPE == G.VERSION_TYPE_ENUM.TEST || G.getSkipSplashScreen()) {
30 | endActivityInstantly();
31 | } else {
32 | activityDeadCounter = new CountDownTimer(AUTO_HIDE_DELAY_MILLIS, 100) {
33 | @Override
34 | public void onTick ( long millisUntilFinished){
35 | // Animation can be here.
36 | }
37 |
38 | @Override
39 | public void onFinish () {
40 | // time-up, and jump
41 | endActivity();
42 | }
43 | }.start();
44 | }
45 | }
46 |
47 | private void endActivity() {
48 | activityDeadCounter.cancel();
49 | Intent intent = new Intent();
50 | intent.setClass(SplashActivity.this, MainActivity.class);
51 | startActivity(intent);
52 | overridePendingTransition(R.anim.fade_in, R.anim.hold); // fade in animation
53 | finish(); // destroy itself
54 | }
55 |
56 | private void endActivityInstantly() {
57 | Intent intent = new Intent();
58 | intent.setClass(SplashActivity.this, MainActivity.class);
59 | startActivity(intent);
60 | overridePendingTransition(0, 0); // no animation
61 | finish(); // destroy itself
62 | }
63 |
64 | @Override
65 | public void onBackPressed() {
66 | // hijack this event, and do nothing
67 | }
68 |
69 |
70 | /**
71 | * The OnClickListener to finish this activity itself, and jump to main activity.
72 | * Design for saving time, but time consuming tasi must have been done before finish:
73 | * Guide viewpages;
74 | * Upgrading database;
75 | * etc.
76 | */
77 | class OnClickSkipSplashScreen implements View.OnClickListener {
78 |
79 | @Override
80 | public void onClick(View v) {
81 | // TODO: time consuming task judgement
82 |
83 | // just end this activity
84 | endActivity();
85 | }
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/adapter/PluginCenterAdapter.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity.adapter;
2 |
3 | import android.support.v7.widget.CardView;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import org.mewx.projectprpr.R;
12 |
13 | import java.util.List;
14 |
15 | @SuppressWarnings("unused")
16 | public class PluginCenterAdapter extends RecyclerView.Adapter {
17 |
18 | public static interface OnRecyclerViewListener {
19 | void onItemClick(int position);
20 | boolean onItemLongClick(int position);
21 | }
22 |
23 | private OnRecyclerViewListener onRecyclerViewListener;
24 |
25 | public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
26 | this.onRecyclerViewListener = onRecyclerViewListener;
27 | }
28 |
29 | private List list;
30 |
31 | public PluginCenterAdapter(List list) {
32 | this.list = list;
33 | }
34 |
35 | @Override
36 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
37 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_item_plugin_center, null);
38 | CardView.LayoutParams lp = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
39 | view.setLayoutParams(lp);
40 | return new PluginCenterViewHolder(view);
41 | }
42 |
43 | @Override
44 | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
45 | PluginCenterViewHolder holder = (PluginCenterViewHolder) viewHolder;
46 | holder.position = i;
47 | PluginCenterItem item = list.get(i);
48 | holder.text.setText(item.getCenterName());
49 | holder.image.setImageResource(item.getBackgroundId());
50 | }
51 |
52 | @Override
53 | public int getItemCount() {
54 | return list.size();
55 | }
56 |
57 | class PluginCenterViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
58 | public View rootView;
59 | public TextView text;
60 | public ImageView image;
61 | public int position;
62 |
63 | public PluginCenterViewHolder(View itemView) {
64 | super(itemView);
65 | text = (TextView) itemView.findViewById(R.id.cardtext);
66 | image = (ImageView) itemView.findViewById(R.id.cardimage);
67 | rootView = itemView.findViewById(R.id.cardview);
68 | rootView.setOnClickListener(this);
69 | rootView.setOnLongClickListener(this);
70 | }
71 |
72 | @Override
73 | public void onClick(View v) {
74 | if (null != onRecyclerViewListener) {
75 | onRecyclerViewListener.onItemClick(position);
76 | }
77 | }
78 |
79 | @Override
80 | public boolean onLongClick(View v) {
81 | return null != onRecyclerViewListener &&onRecyclerViewListener.onItemLongClick(position);
82 | }
83 | }
84 |
85 | }
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/JavaFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: JavaFunction.java,v 1.6 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | /**
28 | * JavaFunction is a class that can be used to implement a Lua function in Java.
29 | * JavaFunction is an abstract class, so in order to use it you must extend this
30 | * class and implement the execute method. This execute
31 | * method is the method that will be called when you call the function from Lua.
32 | * To register the JavaFunction in Lua use the method register(String name).
33 | */
34 | public abstract class JavaFunction
35 | {
36 |
37 | /**
38 | * This is the state in which this function will exist.
39 | */
40 | protected LuaState L;
41 |
42 | /**
43 | * This method is called from Lua. Any parameters can be taken with
44 | * getParam. A reference to the JavaFunctionWrapper itself is
45 | * always the first parameter received. Values passed back as results
46 | * of the function must be pushed onto the stack.
47 | * @return The number of values pushed onto the stack.
48 | */
49 | public abstract int execute() throws LuaException;
50 |
51 | /**
52 | * Constructor that receives a LuaState.
53 | * @param L LuaState object associated with this JavaFunction object
54 | */
55 | public JavaFunction(LuaState L)
56 | {
57 | this.L = L;
58 | }
59 |
60 | /**
61 | * Returns a parameter received from Lua. Parameters are numbered from 1.
62 | * A reference to the JavaFunction itself is always the first parameter
63 | * received (the same as this).
64 | * @param idx Index of the parameter.
65 | * @return Reference to parameter.
66 | * @see LuaObject
67 | */
68 | public LuaObject getParam(int idx)
69 | {
70 | return L.getLuaObject(idx);
71 | }
72 |
73 | /**
74 | * Register a JavaFunction with a given name. This method registers in a
75 | * global variable the JavaFunction specified.
76 | * @param name name of the function.
77 | */
78 | public void register(String name) throws LuaException
79 | {
80 | synchronized (L)
81 | {
82 | L.pushJavaFunction(this);
83 | L.setGlobal(name);
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/JavaCallLuaJava.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin;
2 |
3 | import org.keplerproject.luajava.JavaFunction;
4 | import org.keplerproject.luajava.LuaException;
5 | import org.keplerproject.luajava.LuaState;
6 | import org.keplerproject.luajava.LuaStateFactory;
7 |
8 | /**
9 | * This class contains the functions that 'LuaJava' provides.
10 | *
11 | * LuaJava provides these functions:
12 | * - Java run lua codes;
13 | * - Java call lua functions, with args and returns;
14 | * - Lua call java functions, with args, 'result' return;
15 | * Created by MewX on 1/19/2016.
16 | */
17 | @SuppressWarnings("unused")
18 | public class JavaCallLuaJava {
19 | private static final String TAG = JavaCallJavaClass.class.getSimpleName();
20 |
21 | static {
22 | final String libLuaJavaName = "luajava";
23 | System.loadLibrary(libLuaJavaName);
24 | }
25 |
26 | LuaState luaState;
27 | String returnValue;
28 |
29 | /**
30 | * Construct does the initial job.
31 | */
32 | public JavaCallLuaJava() {
33 | luaState = LuaStateFactory.newLuaState();
34 | luaState.openLibs();
35 |
36 | if(!bindAllOpenFunctions())
37 | close(); // fail to bind data
38 | }
39 |
40 | public void close() {
41 | luaState.close();
42 | }
43 |
44 | public LuaState getLuaState() {
45 | return luaState;
46 | }
47 |
48 | private boolean bindAllOpenFunctions() {
49 | JavaFunction javaFunctionTest = new JavaFunction(luaState) {
50 | @Override
51 | public int execute() throws LuaException {
52 | int stackHeight = 1;
53 | for (int i = stackHeight; i <= luaState.getTop(); i++) {
54 | // if in dev mode, this part should check type
55 | int type = luaState.type(i);
56 | String stype = luaState.typeName(type);
57 |
58 | String val = null;
59 | Object obj = luaState.toJavaObject(i);
60 | if (obj != null)
61 | val = obj.toString();
62 |
63 | // For helloLuaJavaCallFromLua()
64 | if(val != null)
65 | returnValue = val.toUpperCase(); // get return value
66 |
67 | // For helloLuaJavaCallFromLuaWithReturn()
68 | luaState.pushString(returnValue);
69 | luaState.setGlobal("result");
70 | }
71 | return 0;
72 | }
73 | };
74 |
75 |
76 | try {
77 | javaFunctionTest.register("test");
78 | return true;
79 | } catch (LuaException e) {
80 | e.printStackTrace();
81 | return false;
82 | }
83 | }
84 |
85 | public String helloLuaJavaCallFromLua() {
86 | luaState.LdoString("test(\"test lua\")");
87 | return returnValue;
88 | }
89 |
90 | public String helloLuaJavaCallFromLuaWithReturn() {
91 | luaState.LdoString("test(\"test lua\");a=result;");
92 | return luaState.getLuaObject("a").toString();
93 | }
94 |
95 | public String helloLuaJava() {
96 | luaState.LdoString("a=\"test lua\"");
97 | return luaState.getLuaObject("a").toString();
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/Console.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: Console.java,v 1.7 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | import java.io.BufferedReader;
28 | import java.io.InputStreamReader;
29 |
30 | /**
31 | * Simple LuaJava console.
32 | * This is also an example on how to use the Java side of LuaJava and how to startup
33 | * a LuaJava application.
34 | *
35 | * @author Thiago Ponte
36 | */
37 | public class Console
38 | {
39 |
40 | /**
41 | * Creates a console for user interaction.
42 | *
43 | * @param args names of the lua files to be executed
44 | */
45 | public static void main(String[] args)
46 | {
47 | try
48 | {
49 | LuaState L = LuaStateFactory.newLuaState();
50 | L.openLibs();
51 |
52 | if (args.length > 0)
53 | {
54 | for (int i = 0; i < args.length; i++)
55 | {
56 | int res = L.LloadFile(args[i]);
57 | if (res == 0)
58 | {
59 | res = L.pcall(0, 0, 0);
60 | }
61 | if (res != 0)
62 | {
63 | throw new LuaException("Error on file: " + args[i] + ". " + L.toString(-1));
64 | }
65 | }
66 |
67 | return;
68 | }
69 |
70 | System.out.println("API Lua Java - console mode.");
71 |
72 | BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
73 |
74 | String line;
75 |
76 | System.out.print("> ");
77 | while ((line = inp.readLine()) != null && !line.equals("exit"))
78 | {
79 | int ret = L.LloadBuffer(line.getBytes(), "from console");
80 | if (ret == 0)
81 | {
82 | ret = L.pcall(0, 0, 0);
83 | }
84 | if (ret != 0)
85 | {
86 | System.err.println("Error on line: " + line);
87 | System.err.println(L.toString(-1));
88 | }
89 | System.out.print("> ");
90 | }
91 |
92 | L.close();
93 | }
94 | catch (Exception e)
95 | {
96 | e.printStackTrace();
97 | }
98 |
99 | }
100 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/builtin/Wenku8.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.builtin;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import org.mewx.projectprpr.plugin.NovelDataSourceBasic;
6 | import org.mewx.projectprpr.plugin.component.ChapterInfo;
7 | import org.mewx.projectprpr.plugin.component.NetRequest;
8 | import org.mewx.projectprpr.plugin.component.NovelContent;
9 | import org.mewx.projectprpr.plugin.component.NovelInfo;
10 | import org.mewx.projectprpr.plugin.component.PageNumBetween;
11 | import org.mewx.projectprpr.plugin.component.VolumeInfo;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * This is built-in plug-in support for wenku8.com, and it's need to be logged in to access novel.
17 | * Created by MewX on 3/31/2016.
18 | */
19 | public class Wenku8 extends NovelDataSourceBasic {
20 |
21 | @Override
22 | public NetRequest[] getUltraRequests(String tag, @NonNull String preRequestContent) {
23 | return new NetRequest[0];
24 | }
25 |
26 | @Override
27 | public void ultraReturn(String tag, byte[][] requestResult) {
28 |
29 | }
30 |
31 | @NonNull
32 | @Override
33 | public String[] getCategories() {
34 | return new String[0];
35 | }
36 |
37 | @Override
38 | public boolean judgeIs404(String pageContent) {
39 | return false;
40 | }
41 |
42 | @Override
43 | public NetRequest getMainListRequest(int pageNum) {
44 | return null;
45 | }
46 |
47 | @Override
48 | public List parseMainListRequestResult(String pageContent) {
49 | return null;
50 | }
51 |
52 | @Override
53 | public PageNumBetween getMainListPageNum() {
54 | return null;
55 | }
56 |
57 | @Override
58 | public NetRequest getSpecificListRequest(String categoryName, int pageNum) {
59 | return null;
60 | }
61 |
62 | @Override
63 | public List parseSpecificListRequestResult(String categoryName, String pageContent) {
64 | return null;
65 | }
66 |
67 | @Override
68 | public PageNumBetween getSpecificListPageNum(String categoryName) {
69 | return null;
70 | }
71 |
72 | @Override
73 | public NetRequest getNovelInfoRequest(String tag) {
74 | return null;
75 | }
76 |
77 | @Override
78 | public NovelInfo parseNovelInfo(String content) {
79 | return null;
80 | }
81 |
82 | @Override
83 | public NetRequest getNovelVolumeRequest(String tag) {
84 | return null;
85 | }
86 |
87 | @Override
88 | public List parseNovelVolume(String content) {
89 | return null;
90 | }
91 |
92 | @Override
93 | public NetRequest getNovelChapterRequest(String tag) {
94 | return null;
95 | }
96 |
97 | @Override
98 | public List parseNovelChapter(String content) {
99 | return null;
100 | }
101 |
102 | @Override
103 | public NetRequest getNovelContentRequest(String tag) {
104 | return null;
105 | }
106 |
107 | @Override
108 | public NovelContent parseNovelContent(String content) {
109 | return null;
110 | }
111 |
112 | @Override
113 | public NetRequest[] getSearchRequest(String query) {
114 | return new NetRequest[0];
115 | }
116 |
117 | @Override
118 | public List parseSearchResults(String[] contents) {
119 | return null;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/ProjectPRPR/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Class structureJava
39 |
40 |
41 | Code maturity issuesJava
42 |
43 |
44 | Java
45 |
46 |
47 | Java language level migration aidsJava
48 |
49 |
50 | Javadoc issuesJava
51 |
52 |
53 | Performance issuesJava
54 |
55 |
56 | TestNGJava
57 |
58 |
59 | Threading issuesJava
60 |
61 |
62 |
63 |
64 | Android
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/template/AppCompatPreferenceActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.template;
2 |
3 | import android.content.res.Configuration;
4 | import android.os.Bundle;
5 | import android.preference.PreferenceActivity;
6 | import android.support.annotation.LayoutRes;
7 | import android.support.annotation.Nullable;
8 | import android.support.v7.app.ActionBar;
9 | import android.support.v7.app.AppCompatDelegate;
10 | import android.support.v7.widget.Toolbar;
11 | import android.view.MenuInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 |
15 | /**
16 | * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
17 | * to be used with AppCompat.
18 | */
19 | public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
20 |
21 | private AppCompatDelegate mDelegate;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | getDelegate().installViewFactory();
26 | getDelegate().onCreate(savedInstanceState);
27 | super.onCreate(savedInstanceState);
28 | }
29 |
30 | @Override
31 | protected void onPostCreate(Bundle savedInstanceState) {
32 | super.onPostCreate(savedInstanceState);
33 | getDelegate().onPostCreate(savedInstanceState);
34 | }
35 |
36 | public ActionBar getSupportActionBar() {
37 | return getDelegate().getSupportActionBar();
38 | }
39 |
40 | public void setSupportActionBar(@Nullable Toolbar toolbar) {
41 | getDelegate().setSupportActionBar(toolbar);
42 | }
43 |
44 | @Override
45 | public MenuInflater getMenuInflater() {
46 | return getDelegate().getMenuInflater();
47 | }
48 |
49 | @Override
50 | public void setContentView(@LayoutRes int layoutResID) {
51 | getDelegate().setContentView(layoutResID);
52 | }
53 |
54 | @Override
55 | public void setContentView(View view) {
56 | getDelegate().setContentView(view);
57 | }
58 |
59 | @Override
60 | public void setContentView(View view, ViewGroup.LayoutParams params) {
61 | getDelegate().setContentView(view, params);
62 | }
63 |
64 | @Override
65 | public void addContentView(View view, ViewGroup.LayoutParams params) {
66 | getDelegate().addContentView(view, params);
67 | }
68 |
69 | @Override
70 | protected void onPostResume() {
71 | super.onPostResume();
72 | getDelegate().onPostResume();
73 | }
74 |
75 | @Override
76 | protected void onTitleChanged(CharSequence title, int color) {
77 | super.onTitleChanged(title, color);
78 | getDelegate().setTitle(title);
79 | }
80 |
81 | @Override
82 | public void onConfigurationChanged(Configuration newConfig) {
83 | super.onConfigurationChanged(newConfig);
84 | getDelegate().onConfigurationChanged(newConfig);
85 | }
86 |
87 | @Override
88 | protected void onStop() {
89 | super.onStop();
90 | getDelegate().onStop();
91 | }
92 |
93 | @Override
94 | protected void onDestroy() {
95 | super.onDestroy();
96 | getDelegate().onDestroy();
97 | }
98 |
99 | public void invalidateOptionsMenu() {
100 | getDelegate().invalidateOptionsMenu();
101 | }
102 |
103 | private AppCompatDelegate getDelegate() {
104 | if (mDelegate == null) {
105 | mDelegate = AppCompatDelegate.create(this, null);
106 | }
107 | return mDelegate;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/res/layout/layout_view_image_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
27 |
28 |
41 |
42 |
50 |
51 |
59 |
60 |
61 |
69 |
70 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/adapter/DataSourceAdapter.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity.adapter;
2 |
3 | import android.net.Uri;
4 | import android.support.v7.widget.CardView;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import com.facebook.drawee.view.SimpleDraweeView;
12 |
13 | import org.mewx.projectprpr.R;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * Created by MewX on 04/17/2016.
19 | * This class adapt the data source list in plug-in list.
20 | */
21 | @SuppressWarnings("unused")
22 | public class DataSourceAdapter extends RecyclerView.Adapter {
23 | private static final String TAG = DataSourceAdapter.class.getSimpleName();
24 |
25 | public static interface OnRecyclerViewListener {
26 | void onItemClick(int position);
27 | boolean onItemLongClick(int position);
28 | }
29 |
30 | private OnRecyclerViewListener onRecyclerViewListener;
31 |
32 | public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
33 | this.onRecyclerViewListener = onRecyclerViewListener;
34 | }
35 |
36 | private List list;
37 |
38 | public DataSourceAdapter(List list) {
39 | this.list = list;
40 | }
41 |
42 | @Override
43 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
44 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_item_data_source, null);
45 | CardView.LayoutParams lp = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
46 | view.setLayoutParams(lp);
47 | return new DataSourceViewHolder(view);
48 | }
49 |
50 | @Override
51 | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
52 | final DataSourceViewHolder holder = (DataSourceViewHolder) viewHolder;
53 | holder.position = i;
54 | DataSourceItem item = list.get(i);
55 | holder.textMain.setText(item.getDisplayName() + " [ v" + item.getVersionCode() + " ], by: " + item.getPluginAuthor());
56 | holder.textSub.setText(item.getWebsiteDomain());
57 | holder.image.setImageURI(Uri.parse(item.getLogoUrl()));
58 | }
59 |
60 | @Override
61 | public int getItemCount() {
62 | return list.size();
63 | }
64 |
65 | class DataSourceViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
66 | public View rootView;
67 | public TextView textMain;
68 | public TextView textSub;
69 | public SimpleDraweeView image;
70 | public int position;
71 |
72 | public DataSourceViewHolder(View itemView) {
73 | super(itemView);
74 | textMain = (TextView) itemView.findViewById(R.id.site_info);
75 | textSub = (TextView) itemView.findViewById(R.id.site_meta);
76 | image = (SimpleDraweeView) itemView.findViewById(R.id.domain_logo);
77 | rootView = itemView.findViewById(R.id.cardview);
78 | rootView.setOnClickListener(this);
79 | rootView.setOnLongClickListener(this);
80 | }
81 |
82 | @Override
83 | public void onClick(View v) {
84 | if (null != onRecyclerViewListener) {
85 | onRecyclerViewListener.onItemClick(position);
86 | }
87 | }
88 |
89 | @Override
90 | public boolean onLongClick(View v) {
91 | return null != onRecyclerViewListener && onRecyclerViewListener.onItemLongClick(position);
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/prpr-demo/andro-lua/src/main/java/org/keplerproject/luajava/LuaStateFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id: LuaStateFactory.java,v 1.4 2006/12/22 14:06:40 thiago Exp $
3 | * Copyright (C) 2003-2007 Kepler Project.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files (the
7 | * "Software"), to deal in the Software without restriction, including
8 | * without limitation the rights to use, copy, modify, merge, publish,
9 | * distribute, sublicense, and/or sell copies of the Software, and to
10 | * permit persons to whom the Software is furnished to do so, subject to
11 | * the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | package org.keplerproject.luajava;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | /**
31 | * This class is responsible for instantiating new LuaStates.
32 | * When a new LuaState is instantiated it is put into a List
33 | * and an index is returned. This index is registred in Lua
34 | * and it is used to find the right LuaState when lua calls
35 | * a Java Function.
36 | *
37 | * @author Thiago Ponte
38 | */
39 | public final class LuaStateFactory
40 | {
41 | /**
42 | * Array with all luaState's instances
43 | */
44 | private static final List states = new ArrayList();
45 |
46 | /**
47 | * Non-public constructor.
48 | */
49 | private LuaStateFactory()
50 | {}
51 |
52 | /**
53 | * Method that creates a new instance of LuaState
54 | * @return LuaState
55 | */
56 | public synchronized static LuaState newLuaState()
57 | {
58 | int i = getNextStateIndex();
59 | LuaState L = new LuaState(i);
60 |
61 | states.add(i, L);
62 |
63 | return L;
64 | }
65 |
66 | /**
67 | * Returns a existing instance of LuaState
68 | * @param index
69 | * @return LuaState
70 | */
71 | public synchronized static LuaState getExistingState(int index)
72 | {
73 | return (LuaState) states.get(index);
74 | }
75 |
76 | /**
77 | * Receives a existing LuaState and checks if it exists in the states list.
78 | * If it doesn't exist adds it to the list.
79 | * @param L
80 | * @return int
81 | */
82 | public synchronized static int insertLuaState(LuaState L)
83 | {
84 | int i;
85 | for (i = 0 ; i < states.size() ; i++)
86 | {
87 | LuaState state = (LuaState) states.get(i);
88 |
89 | if (state != null)
90 | {
91 | if (state.getCPtrPeer() == L.getCPtrPeer())
92 | return i;
93 | }
94 | }
95 |
96 | i = getNextStateIndex();
97 |
98 | states.set(i, L);
99 |
100 | return i;
101 | }
102 |
103 | /**
104 | * removes the luaState from the states list
105 | * @param idx
106 | */
107 | public synchronized static void removeLuaState(int idx)
108 | {
109 | states.add(idx, null);
110 | }
111 |
112 | /**
113 | * Get next available index
114 | * @return int
115 | */
116 | private synchronized static int getNextStateIndex()
117 | {
118 | int i;
119 | for ( i=0 ; i < states.size() && states.get(i) != null ; i++ );
120 |
121 | return i;
122 | }
123 | }
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/adapter/BookshelfAdapter.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity.adapter;
2 |
3 | import android.net.Uri;
4 | import android.support.v7.widget.CardView;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.text.TextUtils;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import com.facebook.drawee.view.SimpleDraweeView;
13 |
14 | import org.mewx.projectprpr.MyApp;
15 | import org.mewx.projectprpr.R;
16 | import org.mewx.projectprpr.plugin.component.BookshelfSaver;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * Created by MewX on 05/15/2016.
22 | * Grid view for local bookshelf.
23 | */
24 | public class BookshelfAdapter extends RecyclerView.Adapter {
25 | private static final String TAG = DataSourceAdapter.class.getSimpleName();
26 |
27 | public static interface OnRecyclerViewListener {
28 | void onItemClick(int position);
29 | boolean onItemLongClick(int position);
30 | }
31 |
32 | private OnRecyclerViewListener onRecyclerViewListener;
33 |
34 | public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
35 | this.onRecyclerViewListener = onRecyclerViewListener;
36 | }
37 |
38 | private List list;
39 |
40 | public BookshelfAdapter(List list) {
41 | this.list = list;
42 | }
43 |
44 | @Override
45 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
46 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_item_bookshelf, null);
47 | CardView.LayoutParams lp = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
48 | view.setLayoutParams(lp);
49 | return new DataSourceViewHolder(view);
50 | }
51 |
52 | @Override
53 | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
54 | final DataSourceViewHolder holder = (DataSourceViewHolder) viewHolder;
55 | holder.position = i;
56 | BookshelfSaver item = list.get(i);
57 | holder.textTitle.setText(item.getNovelInfo().getTitle());
58 | if (!TextUtils.isEmpty(item.getNovelInfo().getCoverUrl())) {
59 | holder.image.setImageURI(Uri.parse(item.getNovelInfo().getCoverUrl()));
60 | } else {
61 | holder.image.setImageURI(Uri.parse("android.resource://" + MyApp.getContext().getPackageName() + "/" + R.drawable.ic_empty_image));
62 | }
63 | }
64 |
65 | @Override
66 | public int getItemCount() {
67 | return list.size();
68 | }
69 |
70 | class DataSourceViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
71 | public View rootView;
72 | public TextView textTitle;
73 | public SimpleDraweeView image;
74 | public int position;
75 |
76 | public DataSourceViewHolder(View itemView) {
77 | super(itemView);
78 | textTitle = (TextView) itemView.findViewById(R.id.cardtext);
79 | image = (SimpleDraweeView) itemView.findViewById(R.id.cardimage);
80 | rootView = itemView.findViewById(R.id.cardview);
81 | rootView.setOnClickListener(this);
82 | rootView.setOnLongClickListener(this);
83 | }
84 |
85 | @Override
86 | public void onClick(View v) {
87 | if (null != onRecyclerViewListener) {
88 | onRecyclerViewListener.onItemClick(position);
89 | }
90 | }
91 |
92 | @Override
93 | public boolean onLongClick(View v) {
94 | return null != onRecyclerViewListener && onRecyclerViewListener.onItemLongClick(position);
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/ProjectPRPR/app/src/main/java/org/mewx/prpr/MainActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.prpr;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.view.View;
7 | import android.support.design.widget.NavigationView;
8 | import android.support.v4.view.GravityCompat;
9 | import android.support.v4.widget.DrawerLayout;
10 | import android.support.v7.app.ActionBarDrawerToggle;
11 | import android.support.v7.app.AppCompatActivity;
12 | import android.support.v7.widget.Toolbar;
13 | import android.view.Menu;
14 | import android.view.MenuItem;
15 |
16 | public class MainActivity extends AppCompatActivity
17 | implements NavigationView.OnNavigationItemSelectedListener {
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_main);
23 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
24 | setSupportActionBar(toolbar);
25 |
26 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
27 | fab.setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View view) {
30 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
31 | .setAction("Action", null).show();
32 | }
33 | });
34 |
35 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
36 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
37 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
38 | drawer.setDrawerListener(toggle);
39 | toggle.syncState();
40 |
41 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
42 | navigationView.setNavigationItemSelectedListener(this);
43 | }
44 |
45 | @Override
46 | public void onBackPressed() {
47 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
48 | if (drawer.isDrawerOpen(GravityCompat.START)) {
49 | drawer.closeDrawer(GravityCompat.START);
50 | } else {
51 | super.onBackPressed();
52 | }
53 | }
54 |
55 | @Override
56 | public boolean onCreateOptionsMenu(Menu menu) {
57 | // Inflate the menu; this adds items to the action bar if it is present.
58 | getMenuInflater().inflate(R.menu.main, menu);
59 | return true;
60 | }
61 |
62 | @Override
63 | public boolean onOptionsItemSelected(MenuItem item) {
64 | // Handle action bar item clicks here. The action bar will
65 | // automatically handle clicks on the Home/Up button, so long
66 | // as you specify a parent activity in AndroidManifest.xml.
67 | int id = item.getItemId();
68 |
69 | //noinspection SimplifiableIfStatement
70 | if (id == R.id.action_settings) {
71 | return true;
72 | }
73 |
74 | return super.onOptionsItemSelected(item);
75 | }
76 |
77 | @SuppressWarnings("StatementWithEmptyBody")
78 | @Override
79 | public boolean onNavigationItemSelected(MenuItem item) {
80 | // Handle navigation view item clicks here.
81 | int id = item.getItemId();
82 |
83 | if (id == R.id.nav_camera) {
84 | // Handle the camera action
85 | } else if (id == R.id.nav_gallery) {
86 |
87 | } else if (id == R.id.nav_slideshow) {
88 |
89 | } else if (id == R.id.nav_manage) {
90 |
91 | } else if (id == R.id.nav_share) {
92 |
93 | } else if (id == R.id.nav_send) {
94 |
95 | }
96 |
97 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
98 | drawer.closeDrawer(GravityCompat.START);
99 | return true;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/activity/DataSourceItemChapterActivity.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.LayoutInflater;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.widget.LinearLayout;
11 | import android.widget.RelativeLayout;
12 | import android.widget.TextView;
13 |
14 | import org.mewx.projectprpr.R;
15 | import org.mewx.projectprpr.plugin.component.ChapterInfo;
16 | import org.mewx.projectprpr.plugin.component.VolumeInfo;
17 | import org.mewx.projectprpr.reader.activity.ReaderActivityV1;
18 | import org.mewx.projectprpr.template.AppCompatTemplateActivity;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | public class DataSourceItemChapterActivity extends AppCompatTemplateActivity {
24 | private static final String TAG = DataSourceItemChapterActivity.class.getSimpleName();
25 | public static final String NOVEL_TAG = "novel";
26 | public static final String VOLUME_TAG = "volume";
27 |
28 | private LinearLayout linearLayout;
29 |
30 | private String novelTag;
31 | private VolumeInfo volumeInfo;
32 | private List chapterInfoList;
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_data_source_item_chapter);
38 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
39 | setSupportActionBar(toolbar);
40 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
41 |
42 | // fetch data
43 | novelTag = getIntent().getStringExtra(NOVEL_TAG);
44 | volumeInfo = (VolumeInfo) getIntent().getSerializableExtra(VOLUME_TAG);
45 | getSupportActionBar().setTitle(volumeInfo.getTitle());
46 |
47 | chapterInfoList = new ArrayList<>();
48 | for (int i = 0; i < volumeInfo.getChapterListSize(); i ++) {
49 | chapterInfoList.add(volumeInfo.getChapterByListIndex(i));
50 | }
51 |
52 | // find views
53 | linearLayout = (LinearLayout) findViewById(R.id.novel_chapter_scroll);
54 |
55 | // update layout
56 | listAllChapters();
57 | }
58 |
59 | private void listAllChapters() {
60 | for(final ChapterInfo ci : chapterInfoList) {
61 | // get view
62 | RelativeLayout rl = (RelativeLayout) LayoutInflater.from(DataSourceItemChapterActivity.this).inflate(R.layout.recycler_item_chapter, null);
63 |
64 | TextView tv = (TextView) rl.findViewById(R.id.chapter_title);
65 | tv.setText(ci.getTitle());
66 | rl.findViewById(R.id.chapter_btn).setOnClickListener(new View.OnClickListener() {
67 | @Override
68 | public void onClick(View v) {
69 | // todo: test does file exist, load from cloud or local
70 | // if not downloaded yet, download first
71 |
72 | // jump to reader activity
73 | Intent intent = new Intent(DataSourceItemChapterActivity.this, ReaderActivityV1.class); //VerticalReaderActivity.class);
74 | intent.putExtra(ReaderActivityV1.TAG_NOVEL, novelTag);
75 | intent.putExtra(ReaderActivityV1.TAG_VOLUME, volumeInfo);
76 | intent.putExtra(ReaderActivityV1.TAG_CHAPTER, ci.getChapterTag());
77 | startActivity(intent);
78 | overridePendingTransition(R.anim.fade_in, R.anim.hold); // fade in animation
79 | }
80 | });
81 |
82 | linearLayout.addView(rl); // add to scroll view
83 | }
84 | }
85 |
86 | @Override
87 | public boolean onOptionsItemSelected(MenuItem menuItem) {
88 | if (menuItem.getItemId() == android.R.id.home) {
89 | onBackPressed();
90 | }
91 | return super.onOptionsItemSelected(menuItem);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/prpr-demo/app/src/main/java/org/mewx/projectprpr/plugin/component/NetRequest.java:
--------------------------------------------------------------------------------
1 | package org.mewx.projectprpr.plugin.component;
2 |
3 | import android.content.ContentValues;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.text.TextUtils;
7 | import android.util.Log;
8 |
9 | import org.mewx.projectprpr.global.G;
10 |
11 | import java.io.IOException;
12 | import java.io.UnsupportedEncodingException;
13 | import java.net.URLEncoder;
14 |
15 | import okhttp3.CacheControl;
16 | import okhttp3.MediaType;
17 | import okhttp3.Request;
18 | import okhttp3.RequestBody;
19 |
20 | /**
21 | * This class packs the request infomation.
22 | * From "POST", "GET", etc.
23 | * Format: arg=encodedArgument&arg=encodedArgument...
24 | */
25 | public class NetRequest {
26 | private static final String TAG = NetRequest.class.getSimpleName();
27 |
28 | public enum REQUEST_TYPE {
29 | GET,
30 | POST,
31 | SOCKET,
32 | ULTRA_REQUEST // this should call the ultra functions in NovelDataSourceBasic, URL is TAG
33 | }
34 |
35 | private REQUEST_TYPE type;
36 | @NonNull private String url;
37 | @NonNull private String args;
38 |
39 | public NetRequest(REQUEST_TYPE requestType, @Nullable String url, @Nullable ContentValues args) {
40 | // save values
41 | this.type = requestType;
42 | this.url = url == null ? "" : url;
43 | if(!this.url.contains("http"))
44 | this.url = "http://" + this.url; // must start with "http://" or "https://"
45 |
46 | // make request args
47 | if(args != null) {
48 | StringBuilder params = new StringBuilder("");
49 | for (String key : args.keySet()) {
50 | if (key.length() == 0) continue; // for safe
51 | params.append("&").append(key).append("="); // now, like "&a=?&b=?&c=?"
52 | try {
53 | params.append(URLEncoder.encode(args.get(key).toString(), "UTF-8")); // NEED URL ENCODING
54 | } catch (UnsupportedEncodingException e) {
55 | // append empty string, nothing to do (user input error, so just ignore)
56 | e.printStackTrace();
57 | }
58 | }
59 | if (params.length() > 1) params.deleteCharAt(0); // remove the leading "&"
60 | this.args = params.toString(); // save value
61 | } else {
62 | this.args = ""; // make default value
63 | }
64 | }
65 |
66 | public boolean isEmptyArg() {
67 | return TextUtils.isEmpty(args);
68 | }
69 |
70 | public String getFullGetUrl() {
71 | return isEmptyArg() ? url : url + "?" + args;
72 | }
73 |
74 | @Nullable
75 | public Request getOkHttpRequest(String charset) throws IOException {
76 | Request request;
77 |
78 | switch (type) {
79 | case GET:
80 | request = new Request.Builder()
81 | .url(getFullGetUrl())
82 | .cacheControl(CacheControl.FORCE_NETWORK)
83 | .addHeader("User-Agent", G.USER_AGENT)
84 | .build();
85 | return request;
86 |
87 | case POST:
88 | request = new Request.Builder()
89 | .url(getFullGetUrl())
90 | .cacheControl(CacheControl.FORCE_NETWORK)
91 | .post(RequestBody.create(MediaType.parse("text/plain; charset=" + charset), args))
92 | .addHeader("User-Agent", G.USER_AGENT)
93 | .build();
94 | return request; //G.globalOkHttpClient3.newCall(request).execute();
95 |
96 | default:
97 | Log.e(TAG, "Unsupported request type: " + type.toString() + "; " + url + "; " + args);
98 | return null;
99 | }
100 | }
101 |
102 | public REQUEST_TYPE getType() {
103 | return type;
104 | }
105 |
106 | @NonNull
107 | public String getUrl() {
108 | return url;
109 | }
110 |
111 | @NonNull
112 | public String getArgs() {
113 | return args;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------