Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9922a9f82a | ||
|
|
445b9b4673 | ||
|
|
0ef7b358e0 | ||
|
|
2d3fb75576 | ||
|
|
d55ff6d68e | ||
|
|
079654a9c7 | ||
|
|
30263c6260 | ||
|
|
ceaa930623 | ||
|
|
6a8539106b | ||
|
|
7a24c3c08e | ||
|
|
251abeb090 | ||
|
|
a61fe9f98c | ||
|
|
d29c7bf91a | ||
|
|
ed4911c441 | ||
|
|
d40b4f3748 | ||
|
|
f3c4fe1914 | ||
|
|
55ee841bd0 | ||
|
|
657fb488ee | ||
|
|
4eef0b93fb | ||
|
|
f2be56435c | ||
|
|
fa6b3ad7ba | ||
|
|
52c05e6888 | ||
|
|
865bf0ba83 | ||
|
|
3f827d1bad | ||
|
|
0561d5f55c | ||
|
|
1bf2e1dacc | ||
|
|
db5a221b56 | ||
|
|
295285f132 | ||
|
|
5052b6c074 | ||
|
|
f98f45dc54 | ||
|
|
8d16950f46 | ||
|
|
74033b9f4a | ||
|
|
e497d47374 | ||
|
|
a97af59260 | ||
|
|
2197de98ea | ||
|
|
c004c7f71a | ||
|
|
69fc3ad4e8 | ||
|
|
08c4c0bf1f | ||
|
|
2011572270 | ||
|
|
3b682667e1 | ||
|
|
6da8de6463 | ||
|
|
039d415871 | ||
|
|
776f53bde0 | ||
|
|
58e535595e | ||
|
|
96ad5f6a6c | ||
|
|
043f7bedd8 | ||
|
|
69bcd8f7c0 | ||
|
|
8a58564812 | ||
|
|
d346cf431f | ||
|
|
c0bce4f3b1 | ||
|
|
94d258ddbb | ||
|
|
6bdba49284 | ||
|
|
9b99baf4bc | ||
|
|
5ad2a538bc | ||
|
|
28703e9bf2 | ||
|
|
e664efefe9 | ||
|
|
27a8694938 | ||
|
|
e0a6102d4d | ||
|
|
7106cf04ed | ||
|
|
2afdc5591a | ||
|
|
8eed4b67c3 | ||
|
|
edacef0f2b | ||
|
|
d28894f8cd | ||
|
|
ee8e921e1a | ||
|
|
480d4b1e9a | ||
|
|
a79c023220 | ||
|
|
efc50df243 | ||
|
|
905ea766b1 | ||
|
|
bce26f4557 | ||
|
|
474d3ad80a | ||
|
|
a74b2c9b49 | ||
|
|
22bdf61bb3 | ||
|
|
69f9b099b7 | ||
|
|
1d812487a6 | ||
|
|
7c2bf8fb9d | ||
|
|
dfb78bed69 | ||
|
|
fb42b48880 | ||
|
|
bb0988a188 | ||
|
|
c64b6f112b | ||
|
|
9ac7fb490e | ||
|
|
bd88a8a8d3 | ||
|
|
1eb75acb40 | ||
|
|
5ccc96aeb9 | ||
|
|
c51eca5012 | ||
|
|
ef72d10344 | ||
|
|
bff911709d | ||
|
|
573f0b40d1 | ||
|
|
d9c9972a21 | ||
|
|
48f49edb19 | ||
|
|
ea471afa16 | ||
|
|
aa22d9fdd8 | ||
|
|
8410a2fdb3 | ||
|
|
ec98e4e9a4 | ||
|
|
dca6ba457b | ||
|
|
5b10a781a6 | ||
|
|
b103188faf | ||
|
|
29637b234c | ||
|
|
aa8132c9e6 | ||
|
|
34dc238ef1 | ||
|
|
1d21ca2ddf | ||
|
|
3c2675e650 | ||
|
|
7e87bb6838 | ||
|
|
3992a07340 | ||
|
|
bd4b61d7ac | ||
|
|
2046d87031 | ||
|
|
7aab8fa9b9 | ||
|
|
0618d8c6f8 | ||
|
|
b5812f2a3a | ||
|
|
5bfc27835b | ||
|
|
ad6c061b6b | ||
|
|
cdc545ea32 | ||
|
|
a9df00fc2e | ||
|
|
449db97a2b | ||
|
|
a990f5d663 | ||
|
|
e01380090d | ||
|
|
d705cd15b7 | ||
|
|
6d1505241e | ||
|
|
b90814d23e | ||
|
|
f303e49e97 | ||
|
|
7f4b6ed994 | ||
|
|
0e6b50e302 | ||
|
|
45c6f95fcb | ||
|
|
868af1e6a2 | ||
|
|
f48180665f | ||
|
|
34f7b111ee | ||
|
|
c242aa625a | ||
|
|
df27907c57 | ||
|
|
cdb335111e | ||
|
|
75583b9e65 | ||
|
|
81728d94e8 | ||
|
|
79641fec67 | ||
|
|
91157155b8 | ||
|
|
257ad92870 | ||
|
|
3fc71b195a | ||
|
|
a1f5f10813 | ||
|
|
00a1b3e944 | ||
|
|
7ebeb18089 | ||
|
|
0701efcb5f | ||
|
|
31e8c8e453 | ||
|
|
673c4376b5 | ||
|
|
ee6592c544 | ||
|
|
8ab4ce7c78 | ||
|
|
05d11bda0f | ||
|
|
e592b11ee9 | ||
|
|
3acb43ace2 | ||
|
|
4b157aae5d | ||
|
|
5ca73dbc59 | ||
|
|
6f187551ee | ||
|
|
01c1537ae8 | ||
|
|
57e08d2208 | ||
|
|
9014ad6d77 | ||
|
|
6f8697791d | ||
|
|
bcd515b2db | ||
|
|
a0d7417403 | ||
|
|
1faf6cb208 | ||
|
|
530da98ec6 | ||
|
|
f326c69902 | ||
|
|
a83d7cda0a | ||
|
|
fd83f987dd | ||
|
|
8de3eace8a | ||
|
|
e787428e6f | ||
|
|
ba37740c6e | ||
|
|
369fa679a6 | ||
|
|
234f9b069a | ||
|
|
d090a59800 | ||
|
|
bfa25f3d3c | ||
|
|
23bf93e960 | ||
|
|
5e61912f75 | ||
|
|
46702ec3ef | ||
|
|
3e088bd646 | ||
|
|
726cdf0fae | ||
|
|
efefa9e174 | ||
|
|
2acfd3c57c | ||
|
|
a7ecaa8ca7 | ||
|
|
941a023677 | ||
|
|
fe523da6ed | ||
|
|
48c190b449 | ||
|
|
161d1bdcdd | ||
|
|
720149c38a | ||
|
|
2bf0f86510 | ||
|
|
cbb52f3dc9 | ||
|
|
4ba7e269bb | ||
|
|
a71b80b153 | ||
|
|
8e92597dc9 | ||
|
|
abd2f3ae17 | ||
|
|
06c7d77497 | ||
|
|
2a7814798b |
@@ -1,6 +1,19 @@
|
|||||||
_site
|
*.iml
|
||||||
.bundle
|
.gradle
|
||||||
.sass-cache
|
/local.properties
|
||||||
Gemfile.lock
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
|
||||||
|
#Github pages
|
||||||
|
/gh-pages
|
||||||
|
|
||||||
|
#Private files
|
||||||
|
/app/google-services.json
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<AndroidXmlCodeStyleSettings>
|
||||||
|
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
|
||||||
|
</AndroidXmlCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value=" Copyright &#36;today.year tom5079 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||||
|
<option name="myName" value="Apache" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value=" Pupil, Hitomi.la viewer for Android Copyright (C) &#36;today.year tom5079 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>." />
|
||||||
|
<option name="myName" value="GPL" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings>
|
||||||
|
<module2copyright>
|
||||||
|
<element module="Pupil" copyright="GPL" />
|
||||||
|
<element module="libpupil" copyright="Apache" />
|
||||||
|
</module2copyright>
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
<option value="$PROJECT_DIR$/libpupil" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="Pupil" pattern="file[app]:*/" />
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="libpupil" pattern="file[libpupil]:*/" />
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "pwa-chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Launch Chrome against localhost",
|
|
||||||
"url": "http://localhost:8000/hitomi-dev.html",
|
|
||||||
"webRoot": "${workspaceFolder}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
source 'https://rubygems.org'
|
|
||||||
|
|
||||||
gem 'github-pages', group: :jekyll_plugins
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
License is specified in following module separately
|
||||||
|
|
||||||
|
app/
|
||||||
|
libpupil/
|
||||||
@@ -1,69 +1,27 @@
|
|||||||
# Jekyll Cayman theme
|
# Pupil
|
||||||
|
|
||||||
This is a [Jekyll][1] theme for [@jasonlong][2]'s [Cayman theme][4] on [GitHub Pages][3].
|

|
||||||
|
*Pupil, Hitomi.la viewer for Android*
|
||||||
|
|
||||||
Cayman is a clean, responsive theme for [GitHub Pages](https://pages.github.com). This theme is available as an option if you use the [Automatic Page Generator](https://help.github.com/articles/creating-pages-with-the-automatic-generator/) or you can copy the template and styles to use on your own.
|
# Screenshot
|
||||||
|

|
||||||
|
*Main Screen*
|
||||||
|
|
||||||
You can preview the theme at https://jasonlong.github.io/cayman-theme or with real content at https://jasonlong.github.io/geo_pattern.
|

|
||||||
|
*Reader Screen*
|
||||||
|
|
||||||

|
Images are censored to be SFW
|
||||||
|
|
||||||
# How to use it?
|
# Installation
|
||||||
|
|
||||||
Download the theme @ https://github.com/pietromenna/jekyll-cayman-theme/archive/master.zip
|
Go [Releases page](https://github.com/tom5079/Pupil/releases) and get latest version or
|
||||||
|
Visit [github page](https://tom5079.github.io/Pupil/) (only available in Korean)
|
||||||
|
or Build app yourself
|
||||||
|
|
||||||
Unzip it and use it as a regular jekyll folder.
|
# Manual
|
||||||
|
|
||||||
```
|
[Manual](https://tom5079.github.io/Pupil/2019/06/06/manual-kr.html) is only available in Korean. Consider using translator.
|
||||||
$ unzip jekyll-cayman-theme-master.zip
|
|
||||||
```
|
|
||||||
|
|
||||||
Get inside the newly extracted folder
|
# Contribution
|
||||||
```
|
|
||||||
$ cd jekyll-cayman-theme-master
|
|
||||||
```
|
|
||||||
|
|
||||||
Get the required gems
|
Any kind of contribution is appriciated. Feel free to leave PR!
|
||||||
```
|
|
||||||
$ bundle install
|
|
||||||
```
|
|
||||||
|
|
||||||
Use it!
|
|
||||||
|
|
||||||
```
|
|
||||||
$ jekyll serve
|
|
||||||
```
|
|
||||||
|
|
||||||
For more details read about [Jekyll][1] on its web page.
|
|
||||||
|
|
||||||
# Setup
|
|
||||||
|
|
||||||
Some important configuration can be done in the file `_config.yml`. Please, check the Setup section in that file.
|
|
||||||
|
|
||||||
|
|
||||||
## baseurl
|
|
||||||
|
|
||||||
`baseurl` parameter is required in the case the site doesn't sit on the root of the domain. For example: https://pietromenna.github.io/jekyll-cayman-theme
|
|
||||||
|
|
||||||
In the case above the baseurl should be set to "/jekyll-cayman-theme".
|
|
||||||
|
|
||||||
In the case the site sits in the root, you can leave `baseurl` as empty "".
|
|
||||||
|
|
||||||
# Contributing
|
|
||||||
|
|
||||||
Bug reports and pull requests are welcome on GitHub at https://github.com/pietromenna/jekyll-cayman-theme.
|
|
||||||
|
|
||||||
# Development
|
|
||||||
|
|
||||||
To set up your environment to develop this theme, run `bundle install`.
|
|
||||||
|
|
||||||
Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
This work is licensed under a [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) license.
|
|
||||||
|
|
||||||
[1]: https://jekyllrb.com/
|
|
||||||
[2]: https://github.com/jasonlong
|
|
||||||
[3]: https://pages.github.com/
|
|
||||||
[4]: https://github.com/jasonlong/cayman-theme
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
theme: jekyll-theme-cayman
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- jekyll-sitemap
|
|
||||||
|
|
||||||
title: Pupil
|
|
||||||
description: Hitomi.la viewer for Android
|
|
||||||
baseurl: "/Pupil"
|
|
||||||
|
|
||||||
google_analytics: UA-119938781-2
|
|
||||||
|
|
||||||
disqus_url: "https://pupil.disqus.com"
|
|
||||||
discord_url: "https://discord.gg/Stj4b5v"
|
|
||||||
|
|
||||||
github_url: "https://github.com/tom5079/Pupil"
|
|
||||||
|
|
||||||
t:
|
|
||||||
en:
|
|
||||||
header:
|
|
||||||
description: "Hitomi.la viewer for Android"
|
|
||||||
download: "Download app"
|
|
||||||
issue: "Having a problem?"
|
|
||||||
or: "or…"
|
|
||||||
email: "Send an E-mail"
|
|
||||||
discord: "Join Discord server"
|
|
||||||
ko:
|
|
||||||
header:
|
|
||||||
description: "안드로이드 Hitomi.la 뷰어"
|
|
||||||
download: "앱 다운로드"
|
|
||||||
issue: "문제가 있으세요?"
|
|
||||||
or: "또는…"
|
|
||||||
email: "이메일 보내기"
|
|
||||||
discord: "디스코드"
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
layout: default
|
|
||||||
lang: ko
|
|
||||||
title: 히토미를 여행하는 신사들을 위한 안내서
|
|
||||||
---
|
|
||||||
|
|
||||||

|
|
||||||
*히옷!*
|
|
||||||
|
|
||||||
안녕하십니까, 전국 방방곡곡의 신사 여러분들~!
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="{{ site.lang | default: " en-US " }}">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
||||||
<script src="https://kit.fontawesome.com/695c47bd28.js" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
{% if site.google_analytics %}
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
|
|
||||||
function gtag() {
|
|
||||||
dataLayer.push(arguments);
|
|
||||||
}
|
|
||||||
gtag('js', new Date());
|
|
||||||
gtag('config', '{{ site.google_analytics }}');
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
|
|
||||||
{% seo %}
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<meta name="theme-color" content="#157878">
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
|
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/styles.css' | absolute_url }}">
|
|
||||||
<link rel="shortcut icon" href="/Pupil/favicon.ico" type="image/x-icon" />
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/**
|
|
||||||
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
|
|
||||||
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
|
|
||||||
|
|
||||||
var disqus_config = function() {
|
|
||||||
this.page.url = '{{ site.url }}{{ page.url }}'; // Replace PAGE_URL with your page's canonical URL variable
|
|
||||||
this.page.identifier = '{{ page.id }}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
|
||||||
this.page.language = '{{ page.lang }}';
|
|
||||||
};
|
|
||||||
|
|
||||||
(function() { // DON'T EDIT BELOW THIS LINE
|
|
||||||
var d = document,
|
|
||||||
s = d.createElement('script');
|
|
||||||
s.src = 'https://pupil.disqus.com/embed.js';
|
|
||||||
s.setAttribute('data-timestamp', +new Date());
|
|
||||||
(d.head || d.body).appendChild(s);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type='text/javascript' src='/Pupil/assets/js/pupil.js'></script>
|
|
||||||
<script>
|
|
||||||
Promise.resolve()
|
|
||||||
.then(getLatestRelease)
|
|
||||||
.then(result => {
|
|
||||||
let url = result["assets"][0]["browser_download_url"];
|
|
||||||
|
|
||||||
$("#download-btn").attr("href", url)
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<header class="page-header" role="banner">
|
|
||||||
<a href="https://tom5079.github.io/Pupil" style="text-decoration:none; color:inherit;"><h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1></a>
|
|
||||||
<h2 class="project-tagline">{{ site.t[page.lang].header.description }}</h2>
|
|
||||||
<a id="download-btn" class="btn">{{ site.t[page.lang].header.download }}</a>
|
|
||||||
<p/>
|
|
||||||
<div class="wrap">
|
|
||||||
<a href="{{ site.github_url }}"><i class="fab fa-github"></i></a>
|
|
||||||
<a href="mailto:pupil.hentai@gmail.com"><i class="fas fa-envelope"></i></a>
|
|
||||||
<a href="{{ site.discord_url }}"><i class="fab fa-discord"></i></a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main id="content" class="main-content" role="main">
|
|
||||||
{{ content }}
|
|
||||||
|
|
||||||
<footer class="site-footer">
|
|
||||||
|
|
||||||
<div id="disqus_thread"></div>
|
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
|
||||||
|
|
||||||
{% if site.github.is_project_page %}
|
|
||||||
<span class="site-footer-owner">{{ site.github.repository_name }} is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span> {% endif %}
|
|
||||||
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
|
|
||||||
</footer>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
---
|
|
||||||
layout: default
|
|
||||||
lang: ko
|
|
||||||
title: 접속 불가 현상 해결법
|
|
||||||
description: 히토미 뷰어 Pupil 접속 불가 현상 해결법
|
|
||||||
date: 2020-10-01
|
|
||||||
---
|
|
||||||
|
|
||||||
**현재 Intra/유니콘/Aspear 등으로 접속이 불가능합니다.**
|
|
||||||
|
|
||||||
**1줄요약: [PowerTunnel](https://github.com/krlvm/PowerTunnel-Android) / [1.1.1.1](https://play.google.com/store/apps/details?id=com.cloudflare.onedotonedotonedotone)쓰세요**
|
|
||||||
|
|
||||||

|
|
||||||
*익숙한 `그` 화면*
|
|
||||||
|
|
||||||
현재 일부 통신사에서 https 차단이 시행되고 있는 관계로 우회접속을 해야합니다.
|
|
||||||
|
|
||||||
# 해결 방법
|
|
||||||
|
|
||||||
## 1. PowerTunnel(속도저하 없음, 무료)
|
|
||||||
테스트해본 앱 중 유일하게 작동하는 앱입니다.
|
|
||||||
SNI 파편화로 작동하며, 외부 서버를 경유하지 않아 속도가 가장 빠릅니다.
|
|
||||||
|
|
||||||
[Github](https://github.com/krlvm/PowerTunnel-Android)
|
|
||||||
|
|
||||||
## 2. 1.1.1.1(속도저하 거의 없음, 무료)
|
|
||||||
Cloudflare에서 제공하는 검열 우회 앱입니다.
|
|
||||||
가까운 Cloudflare 서버를 경유하여 일반 VPN보다는 빠른 속도가 특징입니다.
|
|
||||||
|
|
||||||
[플레이스토어 링크](https://play.google.com/store/apps/details?id=com.cloudflare.onedotonedotonedotone)
|
|
||||||
|
|
||||||
## 3. VPN
|
|
||||||
확실한 해결 방법입니다.
|
|
||||||
추천 VPN으로는
|
|
||||||
* Tunnelbear(한 달 1.5GB 무료, 이후 유료)
|
|
||||||
* Betternet(무료)
|
|
||||||
* NordVPN(유료)
|
|
||||||
|
|
||||||
가 있습니다. 속도는 NordVPN>Tunnelbear>Betternet순입니다.
|
|
||||||
개인적으로 Tunnelbear을 추천드립니다.
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
---
|
|
||||||
layout: default
|
|
||||||
lang: ko
|
|
||||||
title: Pupil v4.0 사용 설명서
|
|
||||||
description: 히토미 뷰어 Pupil 사용 설명서
|
|
||||||
---
|
|
||||||
|
|
||||||
일단 읽어 보셔봐
|
|
||||||
|
|
||||||
**취소 버튼이 없는 알림창은 알림창 밖을 누르면 취소됩니다**
|
|
||||||
**만화 내보내기 기본 위치는 `내장메모리/Pupil`폴더 입니다.**
|
|
||||||
**결과 없음/연결 오류/썸네일 안 나오시는 분들은 [접속 불가 해결법](https://tom5079.github.io/Pupil/2019/05/30/https-block-kr.html)을 참조해 주세요!**
|
|
||||||
|
|
||||||
# 1. 메인 화면
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
1. <span style="color:rgb(34,177,76)">사이드 메뉴 열기</span>
|
|
||||||
2. <span style="color:rgb(255,127,39)">검색창</span>
|
|
||||||
3. <span style="color:rgb(0,162,232)">설정</span>
|
|
||||||
4. <span style="color:rgb(255,174,201)">기타</span>
|
|
||||||
- 정렬 설정 (시간순, 인기순)
|
|
||||||
5. <span style="color:rgb(185,122,87)">다운로드 상태</span>
|
|
||||||
- 녹색: 다운로드 완료
|
|
||||||
- 적색: 다운로드 중
|
|
||||||
- 없음: 다운로드 안 됨
|
|
||||||
6. <span style="color:rgb(237,28,36)">태그</span>
|
|
||||||
- 태그를 누르면 해당 태그로 검색됩니다
|
|
||||||
7. <span style="color:rgb(163,73,164)">갤러리 번호</span>
|
|
||||||
- 태그를 누르면 검색됩니다
|
|
||||||
8. <span style="color:rgb(255,242,0)">즐겨찾기</span>
|
|
||||||
9. <span style="color:rgb(181,230,29)">추가 기능</span>
|
|
||||||
- 페이지 이동: 원하는 페이지로 바로 이동
|
|
||||||
- 갤러리 번호로 열기: 갤러리 번호로 뷰어를 엽니다
|
|
||||||
|
|
||||||
## 1-1. 검색
|
|
||||||
|
|
||||||
검색창에 태그/검색어를 입력하면 검색이 됩니다
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
검색어를 덜 입력하면 추천 태그가 나옵니다.
|
|
||||||
물론 즐겨찾기 된 태그가 제일 앞에 표시됩니다.
|
|
||||||
|
|
||||||
우측 별 아이콘을 누르면 즐겨찾기 태그로 등록할 수 있습니다.
|
|
||||||
|
|
||||||

|
|
||||||
즐겨찾기 태그는 검색어를 입력하지 않은 상태에서 나타납니다.
|
|
||||||
|
|
||||||
## 1-2. 페이지 이동
|
|
||||||
페이지 이동은 볼륨 버튼으로도 가능합니다
|
|
||||||
```
|
|
||||||
볼륨 상 -> 이전 페이지
|
|
||||||
볼륨 하 -> 다음 페이지
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1-2.1. 다음 페이지
|
|
||||||

|
|
||||||
페이지 맨 아래에서 한 번 더 끌어주시면 됩니다
|
|
||||||
|
|
||||||
### 1-2.2. 이전 페이지
|
|
||||||

|
|
||||||
페이지 맨 위에서 한 번 더 끌어주시면 됩니다
|
|
||||||
|
|
||||||
## 1-3. 갤러리 상세 보기
|
|
||||||
갤러리의 상세 정보를 볼 수 있습니다
|
|
||||||
|
|
||||||
해당하는 갤러리를 길게 눌러 주세요
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
* 갤러리 종류/작가/그룹/언어/태그를 볼 수 있습니다
|
|
||||||
- 클릭 시 해당 태그로 검색됩니다
|
|
||||||
* 썸네일 표시
|
|
||||||
* 연관 갤러리 표시
|
|
||||||
|
|
||||||
# 2. 뷰어
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
1. <span style="color:rgb(0,0,0)">제목</span>
|
|
||||||
2. <span style="color:rgb(34,177,76)">즐겨찾기</span>
|
|
||||||
3. <span style="color:rgb(238,28,36)">hiyobi.me 사용 표시</span>
|
|
||||||
- hiyobi에서 이미지를 불러올 때 표시됩니다
|
|
||||||
4. <span style="color:rgb(163,73,164)">페이지 표시</span>
|
|
||||||
- 클릭 시 페이지 이동
|
|
||||||
5. <span style="color:rgb(255,127,39)">로딩 상태바</span>
|
|
||||||
- 다운로드 완료 시 사라짐
|
|
||||||
6. <span style="color:rgb(255,201,14)">백그라운드 다운로드 버튼</span>
|
|
||||||
7. <span style="color:rgb(0,162,232)">전체 화면 버튼</span>
|
|
||||||
|
|
||||||
## 2-1. 스크롤 모드
|
|
||||||
|
|
||||||
세로 스크롤 방식과 가로 스크롤 방식을 모두 지원합니다
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
* 세로 스크롤
|
|
||||||
* 기본 방식
|
|
||||||
* 세로 전체화면 스크롤
|
|
||||||
* 전체화면 버튼을 이용
|
|
||||||
* 가로 전체화면 스크롤
|
|
||||||
* 이미지를 한 번 클릭
|
|
||||||
* 뒤로가기 버튼으로 나갈 수 있음
|
|
||||||
|
|
||||||
# 3. 설정
|
|
||||||
|
|
||||||
## 3-1. 검색 설정
|
|
||||||
### 3-1.1. 한 번에 로드할 갤러리 수
|
|
||||||
한 페이지당 갤러리 수를 설정합니다.
|
|
||||||
기본 값은 `25`입니다.
|
|
||||||
|
|
||||||
### 3-1.2. 기본 검색어
|
|
||||||

|
|
||||||
|
|
||||||
메인 화면에서 검색어를 지정하지 않아도 추가되는 검색어입니다.
|
|
||||||
한국어만 보고 싶을 때나 *특정 태그*에 관심이 있을 때 아주 유용합니다.
|
|
||||||
|
|
||||||
## 3-2. 캐시
|
|
||||||
|
|
||||||
### 3-1.1 캐시 삭제
|
|
||||||
캐시 된 갤러리를 삭제합니다.
|
|
||||||
|
|
||||||
### 3-1.2 다운로드 삭제
|
|
||||||
다운로드 된 갤러리를 삭제합니다.
|
|
||||||
다운로드 목록에서도 지워집니다.
|
|
||||||
|
|
||||||
### 3-1.3 기록 삭제
|
|
||||||
히스토리를 삭제합니다. 캐시된 이미지는 지워지지 않습니다.
|
|
||||||
|
|
||||||
## 3-3. 앱 잠금
|
|
||||||
시작 시 잠금을 지원합니다.
|
|
||||||
|
|
||||||
현재 패턴 잠금만 지원합니다.
|
|
||||||
|
|
||||||
패턴을 잊어버렸을 때는 앱을 재설치 해주시기 바랍니다.
|
|
||||||
|
|
||||||
## 3-4. 기타
|
|
||||||
### 3-4.1. hiyobi.me 사용
|
|
||||||
이미지 로딩 속도 향상을 위해 ***가급적이면*** 히요비에서 불러옵니다.
|
|
||||||
요즘 히요비가 계속 죽어서 효과가 없는 것 같기도 하고...
|
|
||||||
|
|
||||||
### 3-4.2. 보안 모드
|
|
||||||
최근 앱 목록 창에서 끄지 못한 히토미를 남이 보는 불상사를 아주 조금 방지합니다.
|
|
||||||
|
|
||||||

|
|
||||||
*보안 모드 ON*
|
|
||||||
|
|
||||||

|
|
||||||
*보안 모드 OFF*
|
|
||||||
|
|
||||||
혹시 모르니까 켜 놓는게 좋습니다. **진짜루요**
|
|
||||||
|
|
||||||
### 3-4.3. 다크 모드
|
|
||||||
앱의 테마를 어두운 색깔로 바꿉니다.
|
|
||||||
밤에 볼때 좋겠지요^^*
|
|
||||||
|
|
||||||

|
|
||||||
*다크 모드 OFF*
|
|
||||||
|
|
||||||

|
|
||||||
*다크 모드 ON*
|
|
||||||
|
|
||||||
## 3-4.4. 이미지 숨기기
|
|
||||||
갤러리에서 다운로드한 이미지를 보이지 않게 합니다.
|
|
||||||
|
|
||||||
이런 곤란한 상황을 막아줍니다
|
|
||||||
|
|
||||||

|
|
||||||
*곤란...*
|
|
||||||
|
|
||||||
# 4. 갤러리 다운로드
|
|
||||||
갤러리를 다운로드 하시면 `내장메모리/Pupil/<갤러리ID>` 폴더에 저장됩니다.
|
|
||||||
이미지는 `images` 폴더에 이미지 번호 순서대로 저장되어 있습니다.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
일단 여기까지입니다.
|
|
||||||
더 궁금하신 게 있으시면 이메일 주세요!
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
apply plugin: 'io.fabric'
|
||||||
|
apply plugin: 'com.google.firebase.firebase-perf'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 29
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "xyz.quaver.pupil"
|
||||||
|
minSdkVersion 16
|
||||||
|
targetSdkVersion 29
|
||||||
|
versionCode 31
|
||||||
|
versionName "4.2-beta2-hotfix1"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
multiDexEnabled true
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
buildTypes.each {
|
||||||
|
it.buildConfigField('boolean', 'PRERELEASE', 'true')
|
||||||
|
it.buildConfigField('boolean', 'CENSOR', 'false')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
freeCompilerArgs += '-Xuse-experimental=kotlin.Experimental'
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
def markwonVersion = "3.0.1"
|
||||||
|
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1'
|
||||||
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.1'
|
||||||
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
implementation 'androidx.preference:preference:1.1.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation "androidx.biometric:biometric:1.0.0"
|
||||||
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
|
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
||||||
|
implementation 'com.google.android.material:material:1.2.0-alpha02'
|
||||||
|
implementation 'com.google.firebase:firebase-core:17.2.1'
|
||||||
|
implementation 'com.google.firebase:firebase-perf:19.0.3'
|
||||||
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
||||||
|
implementation 'com.github.arimorty:floatingsearchview:2.1.1'
|
||||||
|
implementation 'com.github.clans:fab:1.6.4'
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.9.0'
|
||||||
|
implementation ("com.github.bumptech.glide:recyclerview-integration:4.9.0") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
|
||||||
|
implementation "ru.noties.markwon:core:${markwonVersion}"
|
||||||
|
kapt 'com.github.bumptech.glide:compiler:4.9.0'
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test:rules:1.2.0'
|
||||||
|
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
implementation project(path: ':libpupil')
|
||||||
|
}
|
||||||
|
|
||||||
|
androidExtensions {
|
||||||
|
experimental = true
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":31,"versionName":"4.2-beta2-hotfix1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("UNUSED_VARIABLE")
|
||||||
|
|
||||||
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.rule.ActivityTestRule
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonConfiguration
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import xyz.quaver.hiyobi.cookie
|
||||||
|
import xyz.quaver.hiyobi.createImgList
|
||||||
|
import xyz.quaver.hiyobi.getReader
|
||||||
|
import xyz.quaver.hiyobi.user_agent
|
||||||
|
import xyz.quaver.pupil.ui.LockActivity
|
||||||
|
import xyz.quaver.pupil.util.getDownloadDirectory
|
||||||
|
import xyz.quaver.pupil.util.updateOldReaderGalleries
|
||||||
|
import java.io.File
|
||||||
|
import java.net.URL
|
||||||
|
import javax.net.ssl.HttpsURLConnection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
Log.i("PUPILD", getDownloadDirectory(appContext).absolutePath ?: "")
|
||||||
|
assertEquals("xyz.quaver.pupil", appContext.packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun checkCacheDir() {
|
||||||
|
val activityTestRule = ActivityTestRule(LockActivity::class.java)
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
|
||||||
|
activityTestRule.launchActivity(Intent())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun test_doSearch() {
|
||||||
|
val reader = getReader( 1426382)
|
||||||
|
|
||||||
|
val data: ByteArray
|
||||||
|
|
||||||
|
with(URL(createImgList(1426382, reader)[0].path).openConnection() as HttpsURLConnection) {
|
||||||
|
setRequestProperty("User-Agent", user_agent)
|
||||||
|
setRequestProperty("Cookie", cookie)
|
||||||
|
|
||||||
|
data = inputStream.readBytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("Pupil", data.size.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
@Test
|
||||||
|
fun test_deleteCodeFromReader() {
|
||||||
|
val context = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
|
||||||
|
val json = Json(JsonConfiguration.Stable)
|
||||||
|
|
||||||
|
listOf(
|
||||||
|
getDownloadDirectory(context),
|
||||||
|
File(context.cacheDir, "imageCache")
|
||||||
|
).forEach { root ->
|
||||||
|
root.listFiles()?.forEach gallery@{ gallery ->
|
||||||
|
val reader = json.parseJson(File(gallery, "reader.json").apply {
|
||||||
|
if (!exists())
|
||||||
|
return@gallery
|
||||||
|
}.readText())
|
||||||
|
.jsonObject.toMutableMap()
|
||||||
|
|
||||||
|
Log.d("PUPILD", gallery.name)
|
||||||
|
|
||||||
|
reader.remove("code")
|
||||||
|
|
||||||
|
File(gallery, "reader.json").writeText(JsonObject(reader).toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun test_updateOldReader() {
|
||||||
|
val context = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
|
||||||
|
updateOldReaderGalleries(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="xyz.quaver.pupil">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="28"/>
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
|
||||||
|
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".Pupil"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:fullBackupContent="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
tools:replace="android:theme">
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"/>
|
||||||
|
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<activity android:name=".ui.LockActivity"/>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.ReaderActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:parentActivityName=".ui.MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="hitomi.la"
|
||||||
|
android:pathPrefix="/galleries"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="히요비.asia"
|
||||||
|
android:pathPrefix="/reader"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="xn--9w3b15m8vo.asia"
|
||||||
|
android:pathPrefix="/reader"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="e-hentai.org"
|
||||||
|
android:pathPrefix="/g"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="hitomi.la"
|
||||||
|
android:pathPrefix="/galleries"
|
||||||
|
android:scheme="http" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="히요비.asia"
|
||||||
|
android:pathPrefix="/reader"
|
||||||
|
android:scheme="http" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="xn--9w3b15m8vo.asia"
|
||||||
|
android:pathPrefix="/reader"
|
||||||
|
android:scheme="http" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="e-hentai.org"
|
||||||
|
android:pathPrefix="/g"
|
||||||
|
android:scheme="http" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.SettingsActivity"
|
||||||
|
android:label="@string/settings_title" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.MainActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:theme="@style/NoActionBarAppTheme">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
|
import android.app.Notification
|
||||||
|
import android.app.NotificationChannel
|
||||||
|
import android.app.NotificationManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.multidex.MultiDexApplication
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesNotAvailableException
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesRepairableException
|
||||||
|
import com.google.android.gms.security.ProviderInstaller
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import xyz.quaver.pupil.util.Histories
|
||||||
|
import xyz.quaver.pupil.util.updateOldReaderGalleries
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class Pupil : MultiDexApplication() {
|
||||||
|
|
||||||
|
lateinit var histories: Histories
|
||||||
|
lateinit var downloads: Histories
|
||||||
|
lateinit var favorites: Histories
|
||||||
|
|
||||||
|
init {
|
||||||
|
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
val preference = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
|
||||||
|
histories = Histories(File(ContextCompat.getDataDir(this), "histories.json"))
|
||||||
|
downloads = Histories(File(ContextCompat.getDataDir(this), "downloads.json"))
|
||||||
|
favorites = Histories(File(ContextCompat.getDataDir(this), "favorites.json"))
|
||||||
|
|
||||||
|
try {
|
||||||
|
ProviderInstaller.installIfNeeded(this)
|
||||||
|
} catch (e: GooglePlayServicesRepairableException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: GooglePlayServicesNotAvailableException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preference.getBoolean("channel_created", false)) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
val channel = NotificationChannel("download", getString(R.string.channel_download), NotificationManager.IMPORTANCE_LOW).apply {
|
||||||
|
description = getString(R.string.channel_download_description)
|
||||||
|
enableLights(false)
|
||||||
|
enableVibration(false)
|
||||||
|
lockscreenVisibility = Notification.VISIBILITY_SECRET
|
||||||
|
}
|
||||||
|
manager.createNotificationChannel(channel)
|
||||||
|
}
|
||||||
|
|
||||||
|
preference.edit().putBoolean("channel_created", true).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
AppCompatDelegate.setDefaultNightMode(when (preference.getBoolean("dark_mode", false)) {
|
||||||
|
true -> AppCompatDelegate.MODE_NIGHT_YES
|
||||||
|
false -> AppCompatDelegate.MODE_NIGHT_NO
|
||||||
|
})
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
updateOldReaderGalleries(this@Pupil)
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onCreate()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,378 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.adapters
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.util.SparseBooleanArray
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.cardview.widget.CardView
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.vectordrawable.graphics.drawable.Animatable2Compat
|
||||||
|
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
|
||||||
|
import com.bumptech.glide.RequestManager
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.daimajia.swipe.SwipeLayout
|
||||||
|
import com.daimajia.swipe.adapters.RecyclerSwipeAdapter
|
||||||
|
import com.daimajia.swipe.interfaces.SwipeAdapterInterface
|
||||||
|
import com.google.android.material.chip.Chip
|
||||||
|
import kotlinx.android.synthetic.main.item_galleryblock.view.*
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Deferred
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonConfiguration
|
||||||
|
import xyz.quaver.hitomi.GalleryBlock
|
||||||
|
import xyz.quaver.hitomi.Reader
|
||||||
|
import xyz.quaver.pupil.BuildConfig
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.types.Tag
|
||||||
|
import xyz.quaver.pupil.util.GalleryDownloader
|
||||||
|
import xyz.quaver.pupil.util.Histories
|
||||||
|
import xyz.quaver.pupil.util.getCachedGallery
|
||||||
|
import xyz.quaver.pupil.util.wordCapitalize
|
||||||
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.collections.HashMap
|
||||||
|
import kotlin.concurrent.schedule
|
||||||
|
|
||||||
|
class GalleryBlockAdapter(private val glide: RequestManager, private val galleries: List<Pair<GalleryBlock, Deferred<String>>>) : RecyclerSwipeAdapter<RecyclerView.ViewHolder>(), SwipeAdapterInterface {
|
||||||
|
|
||||||
|
enum class ViewType {
|
||||||
|
NEXT,
|
||||||
|
GALLERY,
|
||||||
|
PREV
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var favorites: Histories
|
||||||
|
|
||||||
|
inner class GalleryViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
|
fun bind(item: Pair<GalleryBlock, Deferred<String>>) {
|
||||||
|
with(view) {
|
||||||
|
val resources = context.resources
|
||||||
|
val languages = resources.getStringArray(R.array.languages).map {
|
||||||
|
it.split("|").let { split ->
|
||||||
|
Pair(split[0], split[1])
|
||||||
|
}
|
||||||
|
}.toMap()
|
||||||
|
|
||||||
|
val (galleryBlock: GalleryBlock, thumbnail: Deferred<String>) = item
|
||||||
|
|
||||||
|
val artists = galleryBlock.artists
|
||||||
|
val series = galleryBlock.series
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
val cache = thumbnail.await()
|
||||||
|
|
||||||
|
glide
|
||||||
|
.load(cache)
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.error(R.drawable.image_broken_variant)
|
||||||
|
.apply {
|
||||||
|
if (BuildConfig.CENSOR)
|
||||||
|
override(5, 8)
|
||||||
|
}
|
||||||
|
.into(galleryblock_thumbnail)
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check cache
|
||||||
|
val readerCache = { File(getCachedGallery(context, galleryBlock.id), "reader.json") }
|
||||||
|
val imageCache = { File(getCachedGallery(context, galleryBlock.id), "images") }
|
||||||
|
|
||||||
|
try {
|
||||||
|
Json(JsonConfiguration.Stable)
|
||||||
|
.parse(Reader.serializer(), readerCache.invoke().readText())
|
||||||
|
} catch(e: Exception) {
|
||||||
|
readerCache.invoke().delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (readerCache.invoke().exists()) {
|
||||||
|
val reader = Json(JsonConfiguration.Stable)
|
||||||
|
.parse(Reader.serializer(), readerCache.invoke().readText())
|
||||||
|
|
||||||
|
with(galleryblock_progressbar) {
|
||||||
|
max = reader.galleryInfo.size
|
||||||
|
progress = imageCache.invoke().list()?.size ?: 0
|
||||||
|
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
galleryblock_progressbar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (refreshTasks[this@GalleryViewHolder] == null) {
|
||||||
|
val refresh = Timer(false).schedule(0, 1000) {
|
||||||
|
post {
|
||||||
|
with(view.galleryblock_progressbar) {
|
||||||
|
progress = imageCache.invoke().list()?.size ?: 0
|
||||||
|
|
||||||
|
if (!readerCache.invoke().exists()) {
|
||||||
|
visibility = View.GONE
|
||||||
|
max = 0
|
||||||
|
progress = 0
|
||||||
|
|
||||||
|
view.galleryblock_progress_complete.visibility = View.INVISIBLE
|
||||||
|
} else {
|
||||||
|
if (visibility == View.GONE) {
|
||||||
|
val reader = Json(JsonConfiguration.Stable)
|
||||||
|
.parse(Reader.serializer(), readerCache.invoke().readText())
|
||||||
|
max = reader.galleryInfo.size
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress == max) {
|
||||||
|
if (completeFlag.get(galleryBlock.id, false)) {
|
||||||
|
with(view.galleryblock_progress_complete) {
|
||||||
|
setImageResource(R.drawable.ic_progressbar)
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
with(view.galleryblock_progress_complete) {
|
||||||
|
setImageDrawable(AnimatedVectorDrawableCompat.create(context, R.drawable.ic_progressbar_complete).apply {
|
||||||
|
this?.start()
|
||||||
|
})
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
completeFlag.put(galleryBlock.id, true)
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
view.galleryblock_progress_complete.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshTasks[this@GalleryViewHolder] = refresh
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryblock_title.text = galleryBlock.title
|
||||||
|
with(galleryblock_artist) {
|
||||||
|
text = artists.joinToString(", ") { it.wordCapitalize() }
|
||||||
|
visibility = when {
|
||||||
|
artists.isNotEmpty() -> View.VISIBLE
|
||||||
|
else -> View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with(galleryblock_series) {
|
||||||
|
text =
|
||||||
|
resources.getString(
|
||||||
|
R.string.galleryblock_series,
|
||||||
|
series.joinToString(", ") { it.wordCapitalize() })
|
||||||
|
visibility = when {
|
||||||
|
series.isNotEmpty() -> View.VISIBLE
|
||||||
|
else -> View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
galleryblock_type.text = resources.getString(R.string.galleryblock_type, galleryBlock.type).wordCapitalize()
|
||||||
|
with(galleryblock_language) {
|
||||||
|
text =
|
||||||
|
resources.getString(R.string.galleryblock_language, languages[galleryBlock.language])
|
||||||
|
visibility = when {
|
||||||
|
galleryBlock.language.isNotEmpty() -> View.VISIBLE
|
||||||
|
else -> View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryblock_tag_group.removeAllViews()
|
||||||
|
galleryBlock.relatedTags.forEach {
|
||||||
|
galleryblock_tag_group.addView(Chip(context).apply {
|
||||||
|
val tag = Tag.parse(it).let { tag ->
|
||||||
|
when {
|
||||||
|
tag.area != null -> tag
|
||||||
|
else -> Tag("tag", it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chipIcon = when(tag.area) {
|
||||||
|
"male" -> {
|
||||||
|
setChipBackgroundColorResource(R.color.material_blue_700)
|
||||||
|
setTextColor(ContextCompat.getColor(context, android.R.color.white))
|
||||||
|
ContextCompat.getDrawable(context, R.drawable.ic_gender_male_white)
|
||||||
|
}
|
||||||
|
"female" -> {
|
||||||
|
setChipBackgroundColorResource(R.color.material_pink_600)
|
||||||
|
setTextColor(ContextCompat.getColor(context, android.R.color.white))
|
||||||
|
ContextCompat.getDrawable(context, R.drawable.ic_gender_female_white)
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
text = tag.tag.wordCapitalize()
|
||||||
|
setOnClickListener {
|
||||||
|
for (callback in onChipClickedHandler)
|
||||||
|
callback.invoke(tag)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryblock_id.text = galleryBlock.id.toString()
|
||||||
|
|
||||||
|
if (!::favorites.isInitialized)
|
||||||
|
favorites = (context.applicationContext as Pupil).favorites
|
||||||
|
|
||||||
|
with(galleryblock_favorite) {
|
||||||
|
setImageResource(if (favorites.contains(galleryBlock.id)) R.drawable.ic_star_filled else R.drawable.ic_star_empty)
|
||||||
|
setOnClickListener {
|
||||||
|
when {
|
||||||
|
favorites.contains(galleryBlock.id) -> {
|
||||||
|
favorites.remove(galleryBlock.id)
|
||||||
|
|
||||||
|
setImageResource(R.drawable.ic_star_empty)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
favorites.add(galleryBlock.id)
|
||||||
|
|
||||||
|
setImageDrawable(AnimatedVectorDrawableCompat.create(context, R.drawable.avd_star).apply {
|
||||||
|
this ?: return@apply
|
||||||
|
|
||||||
|
registerAnimationCallback(object: Animatable2Compat.AnimationCallback() {
|
||||||
|
override fun onAnimationEnd(drawable: Drawable?) {
|
||||||
|
setImageResource(R.drawable.ic_star_filled)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
start()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class NextViewHolder(view: LinearLayout) : RecyclerView.ViewHolder(view)
|
||||||
|
class PrevViewHolder(view: LinearLayout) : RecyclerView.ViewHolder(view)
|
||||||
|
|
||||||
|
class ViewHolderFactory {
|
||||||
|
companion object {
|
||||||
|
fun getLayoutID(type: Int): Int {
|
||||||
|
return when(ViewType.values()[type]) {
|
||||||
|
ViewType.NEXT -> R.layout.item_next
|
||||||
|
ViewType.PREV -> R.layout.item_prev
|
||||||
|
ViewType.GALLERY -> R.layout.item_galleryblock
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val refreshTasks = HashMap<GalleryViewHolder, TimerTask>()
|
||||||
|
val completeFlag = SparseBooleanArray()
|
||||||
|
|
||||||
|
val onChipClickedHandler = ArrayList<((Tag) -> Unit)>()
|
||||||
|
var onDownloadClickedHandler: ((Int) -> Unit)? = null
|
||||||
|
var onDeleteClickedHandler: ((Int) -> Unit)? = null
|
||||||
|
|
||||||
|
var showNext = false
|
||||||
|
var showPrev = false
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
fun getViewHolder(type: Int, view: View): RecyclerView.ViewHolder {
|
||||||
|
return when(ViewType.values()[type]) {
|
||||||
|
ViewType.NEXT -> NextViewHolder(view as LinearLayout)
|
||||||
|
ViewType.PREV -> PrevViewHolder(view as LinearLayout)
|
||||||
|
ViewType.GALLERY -> GalleryViewHolder(view as CardView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getViewHolder(
|
||||||
|
viewType,
|
||||||
|
LayoutInflater.from(parent.context).inflate(
|
||||||
|
ViewHolderFactory.getLayoutID(viewType),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
|
if (holder is GalleryViewHolder) {
|
||||||
|
val gallery = galleries[position-(if (showPrev) 1 else 0)]
|
||||||
|
|
||||||
|
holder.bind(gallery)
|
||||||
|
|
||||||
|
with(holder.view.galleryblock_primary) {
|
||||||
|
setOnClickListener {
|
||||||
|
holder.view.performClick()
|
||||||
|
}
|
||||||
|
setOnLongClickListener {
|
||||||
|
holder.view.performLongClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.view.galleryblock_download.setOnClickListener {
|
||||||
|
onDownloadClickedHandler?.invoke(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.view.galleryblock_delete.setOnClickListener {
|
||||||
|
onDeleteClickedHandler?.invoke(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
mItemManger.bindView(holder.view, position)
|
||||||
|
|
||||||
|
holder.view.galleryblock_swipe_layout.addSwipeListener(object: SwipeLayout.SwipeListener {
|
||||||
|
override fun onStartOpen(layout: SwipeLayout?) {
|
||||||
|
mItemManger.closeAllExcept(layout)
|
||||||
|
|
||||||
|
holder.view.galleryblock_download.text = when(GalleryDownloader.get(gallery.first.id)) {
|
||||||
|
null -> holder.view.context.getString(R.string.main_download)
|
||||||
|
else -> holder.view.context.getString(android.R.string.cancel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClose(layout: SwipeLayout?) {}
|
||||||
|
override fun onHandRelease(layout: SwipeLayout?, xvel: Float, yvel: Float) {}
|
||||||
|
override fun onOpen(layout: SwipeLayout?) {}
|
||||||
|
override fun onStartClose(layout: SwipeLayout?) {}
|
||||||
|
override fun onUpdate(layout: SwipeLayout?, leftOffset: Int, topOffset: Int) {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder) {
|
||||||
|
super.onViewDetachedFromWindow(holder)
|
||||||
|
|
||||||
|
if (holder is GalleryViewHolder) {
|
||||||
|
val task = refreshTasks[holder] ?: return
|
||||||
|
|
||||||
|
task.cancel()
|
||||||
|
refreshTasks.remove(holder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() =
|
||||||
|
(if (galleries.isEmpty()) 0 else galleries.size)+
|
||||||
|
(if (showNext) 1 else 0)+
|
||||||
|
(if (showPrev) 1 else 0)
|
||||||
|
|
||||||
|
override fun getItemViewType(position: Int): Int {
|
||||||
|
return when {
|
||||||
|
showPrev && position == 0 -> ViewType.PREV
|
||||||
|
showNext && position == galleries.size+(if (showPrev) 1 else 0) -> ViewType.NEXT
|
||||||
|
else -> ViewType.GALLERY
|
||||||
|
}.ordinal
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getSwipeLayoutResourceId(position: Int) = R.id.galleryblock_swipe_layout
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.adapters
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.bumptech.glide.RequestManager
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import xyz.quaver.pupil.BuildConfig
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.util.getCachedGallery
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class ReaderAdapter(private val glide: RequestManager,
|
||||||
|
private val galleryID: Int,
|
||||||
|
private val images: List<String>) : RecyclerView.Adapter<ReaderAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
var isFullScreen = false
|
||||||
|
|
||||||
|
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
return LayoutInflater.from(parent.context).inflate(
|
||||||
|
R.layout.item_reader, parent, false
|
||||||
|
).let {
|
||||||
|
ViewHolder(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
holder.view as ImageView
|
||||||
|
|
||||||
|
if (isFullScreen)
|
||||||
|
holder.view.layoutParams.height = RecyclerView.LayoutParams.MATCH_PARENT
|
||||||
|
else
|
||||||
|
holder.view.layoutParams.height = RecyclerView.LayoutParams.WRAP_CONTENT
|
||||||
|
|
||||||
|
glide
|
||||||
|
.load(File(getCachedGallery(holder.view.context, galleryID), images[position]))
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.error(R.drawable.image_broken_variant)
|
||||||
|
.dontTransform()
|
||||||
|
.apply {
|
||||||
|
if (BuildConfig.CENSOR)
|
||||||
|
override(5, 8)
|
||||||
|
}
|
||||||
|
.into(holder.view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = images.size
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.adapters
|
||||||
|
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.bumptech.glide.RequestManager
|
||||||
|
import xyz.quaver.pupil.BuildConfig
|
||||||
|
|
||||||
|
class ThumbnailAdapter(private val glide: RequestManager, private val thumbnails: List<String>) : RecyclerView.Adapter<ThumbnailAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
class ViewHolder(val view: ImageView) : RecyclerView.ViewHolder(view)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
return ViewHolder(ImageView(parent.context))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
glide
|
||||||
|
.load(thumbnails[position])
|
||||||
|
.apply {
|
||||||
|
if (BuildConfig.CENSOR)
|
||||||
|
override(5, 8)
|
||||||
|
}
|
||||||
|
.into(holder.view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = thumbnails.size
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.types
|
||||||
|
|
||||||
|
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion
|
||||||
|
import kotlinx.android.parcel.Parcelize
|
||||||
|
import xyz.quaver.hitomi.Suggestion
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
data class TagSuggestion(val s: String, val t: Int, val u: String, val n: String) : SearchSuggestion {
|
||||||
|
constructor(s: Suggestion) : this(s.s, s.t, s.u, s.n)
|
||||||
|
|
||||||
|
override fun getBody(): String {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.types
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Tag(val area: String?, val tag: String, val isNegative: Boolean = false) {
|
||||||
|
companion object {
|
||||||
|
fun parse(tag: String) : Tag {
|
||||||
|
if (tag.first() == '-') {
|
||||||
|
tag.substring(1).split(Regex(":"), 2).let {
|
||||||
|
return when(it.size) {
|
||||||
|
2 -> Tag(it[0], it[1], true)
|
||||||
|
else -> Tag(null, tag, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tag.split(Regex(":"), 2).let {
|
||||||
|
return when(it.size) {
|
||||||
|
2 -> Tag(it[0], it[1])
|
||||||
|
else -> Tag(null, tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return (if (isNegative) "-" else "") + when(area) {
|
||||||
|
null -> tag
|
||||||
|
else -> "$area:$tag"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toQuery(): String {
|
||||||
|
return toString().replace(' ', '_')
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (other !is Tag)
|
||||||
|
return false
|
||||||
|
|
||||||
|
if (other.area == area && other.tag == tag)
|
||||||
|
return true
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return super.hashCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Tags(tag: List<Tag?>?) : ArrayList<Tag>() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun parse(tags: String) : Tags {
|
||||||
|
return Tags(
|
||||||
|
tags.split(' ').map {
|
||||||
|
if (it.isNotEmpty())
|
||||||
|
Tag.parse(it)
|
||||||
|
else
|
||||||
|
null
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
tag?.forEach {
|
||||||
|
if (it != null)
|
||||||
|
add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun contains(element: String): Boolean {
|
||||||
|
forEach {
|
||||||
|
if (it.toString() == element)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun add(element: String): Boolean {
|
||||||
|
return super.add(Tag.parse(element))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun remove(element: String) {
|
||||||
|
filter { it.toString() == element }.forEach {
|
||||||
|
remove(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeByArea(area: String, isNegative: Boolean? = null) {
|
||||||
|
filter { it.area == area && (if(isNegative == null) true else (it.isNegative == isNegative)) }.forEach {
|
||||||
|
remove(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return joinToString(" ") { it.toString() }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.LinearLayout.LayoutParams
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.google.android.material.chip.Chip
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.android.synthetic.main.dialog_galleryblock.*
|
||||||
|
import kotlinx.android.synthetic.main.gallery_details.view.*
|
||||||
|
import kotlinx.android.synthetic.main.item_gallery_details.view.*
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import xyz.quaver.hitomi.Gallery
|
||||||
|
import xyz.quaver.hitomi.GalleryBlock
|
||||||
|
import xyz.quaver.hitomi.getGallery
|
||||||
|
import xyz.quaver.hitomi.getGalleryBlock
|
||||||
|
import xyz.quaver.pupil.BuildConfig
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.adapters.GalleryBlockAdapter
|
||||||
|
import xyz.quaver.pupil.adapters.ThumbnailAdapter
|
||||||
|
import xyz.quaver.pupil.types.Tag
|
||||||
|
import xyz.quaver.pupil.util.ItemClickSupport
|
||||||
|
import xyz.quaver.pupil.util.wordCapitalize
|
||||||
|
|
||||||
|
class GalleryDialog(context: Context, private val galleryID: Int) : Dialog(context) {
|
||||||
|
|
||||||
|
private val languages = context.resources.getStringArray(R.array.languages).map {
|
||||||
|
it.split("|").let { split ->
|
||||||
|
Pair(split[0], split[1])
|
||||||
|
}
|
||||||
|
}.toMap()
|
||||||
|
|
||||||
|
private val glide = Glide.with(context)
|
||||||
|
|
||||||
|
val onChipClickedHandler = ArrayList<((Tag) -> (Unit))>()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.dialog_galleryblock)
|
||||||
|
|
||||||
|
window?.attributes.apply {
|
||||||
|
this ?: return@apply
|
||||||
|
|
||||||
|
width = LayoutParams.MATCH_PARENT
|
||||||
|
height = LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
|
||||||
|
with(gallery_fab) {
|
||||||
|
setImageDrawable(ContextCompat.getDrawable(context, R.drawable.arrow_right))
|
||||||
|
setOnClickListener {
|
||||||
|
context.startActivity(Intent(context, ReaderActivity::class.java).apply {
|
||||||
|
putExtra("galleryID", galleryID)
|
||||||
|
})
|
||||||
|
(context.applicationContext as Pupil).histories.add(galleryID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
try {
|
||||||
|
val gallery = getGallery(galleryID)
|
||||||
|
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
gallery_progressbar.visibility = View.GONE
|
||||||
|
gallery_title.text = gallery.title
|
||||||
|
gallery_artist.text = gallery.artists.joinToString(", ") { it.wordCapitalize() }
|
||||||
|
|
||||||
|
with(gallery_type) {
|
||||||
|
text = gallery.type.wordCapitalize()
|
||||||
|
setOnClickListener {
|
||||||
|
gallery.type.let {
|
||||||
|
when (it) {
|
||||||
|
"artist CG" -> "artistcg"
|
||||||
|
"game CG" -> "gamecg"
|
||||||
|
else -> it
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
onChipClickedHandler.forEach { handler ->
|
||||||
|
handler.invoke(Tag("type", it))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glide.with(context)
|
||||||
|
.load(gallery.cover)
|
||||||
|
.apply {
|
||||||
|
if (BuildConfig.CENSOR)
|
||||||
|
override(5, 8)
|
||||||
|
}.into(gallery_cover)
|
||||||
|
|
||||||
|
addDetails(gallery)
|
||||||
|
addThumbnails(gallery)
|
||||||
|
addRelated(gallery)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Snackbar.make(gallery_layout, R.string.unable_to_connect, Snackbar.LENGTH_INDEFINITE).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addDetails(gallery: Gallery) {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
|
||||||
|
inflater.inflate(R.layout.gallery_details, gallery_contents, false).apply {
|
||||||
|
gallery_details.setText(R.string.gallery_details)
|
||||||
|
|
||||||
|
listOf(
|
||||||
|
R.string.gallery_artists,
|
||||||
|
R.string.gallery_groups,
|
||||||
|
R.string.gallery_language,
|
||||||
|
R.string.gallery_series,
|
||||||
|
R.string.gallery_characters,
|
||||||
|
R.string.gallery_tags
|
||||||
|
).zip(
|
||||||
|
listOf(
|
||||||
|
gallery.artists.map { Tag("artist", it) },
|
||||||
|
gallery.groups.map { Tag("group", it) },
|
||||||
|
listOf(gallery.language).map { Tag("language", it) },
|
||||||
|
gallery.series.map { Tag("series", it) },
|
||||||
|
gallery.characters.map { Tag("character", it) },
|
||||||
|
gallery.tags.map {
|
||||||
|
Tag.parse(it).let { tag ->
|
||||||
|
when {
|
||||||
|
tag.area != null -> tag
|
||||||
|
else -> Tag("tag", it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
).filter {
|
||||||
|
(_, content) -> content.isNotEmpty()
|
||||||
|
}.forEach { (title, content) ->
|
||||||
|
inflater.inflate(R.layout.item_gallery_details, gallery_details_contents, false).apply {
|
||||||
|
gallery_details_type.setText(title)
|
||||||
|
|
||||||
|
content.forEach { tag ->
|
||||||
|
gallery_details_tags.addView(
|
||||||
|
Chip(context).apply {
|
||||||
|
chipIcon = when(tag.area) {
|
||||||
|
"male" -> {
|
||||||
|
setChipBackgroundColorResource(R.color.material_blue_700)
|
||||||
|
setTextColor(ContextCompat.getColor(context, android.R.color.white))
|
||||||
|
ContextCompat.getDrawable(context, R.drawable.ic_gender_male_white)
|
||||||
|
}
|
||||||
|
"female" -> {
|
||||||
|
setChipBackgroundColorResource(R.color.material_pink_600)
|
||||||
|
setTextColor(ContextCompat.getColor(context, android.R.color.white))
|
||||||
|
ContextCompat.getDrawable(context, R.drawable.ic_gender_female_white)
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
text = when (tag.area) {
|
||||||
|
"language" -> languages[tag.tag]
|
||||||
|
else -> tag.tag.wordCapitalize()
|
||||||
|
}
|
||||||
|
|
||||||
|
setOnClickListener {
|
||||||
|
onChipClickedHandler.forEach { handler ->
|
||||||
|
handler.invoke(tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
gallery_details_contents.addView(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
gallery_contents.addView(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addThumbnails(gallery: Gallery) {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
|
||||||
|
inflater.inflate(R.layout.gallery_details, gallery_contents, false).apply {
|
||||||
|
gallery_details.setText(R.string.gallery_thumbnails)
|
||||||
|
|
||||||
|
RecyclerView(context).apply {
|
||||||
|
layoutManager = GridLayoutManager(context, 3)
|
||||||
|
adapter = ThumbnailAdapter(glide, gallery.thumbnails)
|
||||||
|
}.let {
|
||||||
|
gallery_details_contents.addView(it, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT))
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
gallery_contents.addView(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addRelated(gallery: Gallery) {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val galleries = ArrayList<Pair<GalleryBlock, Deferred<String>>>()
|
||||||
|
|
||||||
|
val adapter = GalleryBlockAdapter(glide, galleries).apply {
|
||||||
|
onChipClickedHandler.add { tag ->
|
||||||
|
this@GalleryDialog.onChipClickedHandler.forEach { handler ->
|
||||||
|
handler.invoke(tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
gallery.related.forEachIndexed { i, galleryID ->
|
||||||
|
async(Dispatchers.IO) {
|
||||||
|
getGalleryBlock(galleryID)
|
||||||
|
}.let {
|
||||||
|
val galleryBlock = it.await() ?: return@let
|
||||||
|
|
||||||
|
galleries.add(Pair(galleryBlock, GlobalScope.async { galleryBlock.thumbnails.first() }))
|
||||||
|
adapter.notifyItemInserted(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inflater.inflate(R.layout.gallery_details, gallery_contents, false).apply {
|
||||||
|
gallery_details.setText(R.string.gallery_related)
|
||||||
|
|
||||||
|
RecyclerView(context).apply {
|
||||||
|
layoutManager = LinearLayoutManager(context)
|
||||||
|
this.adapter = adapter
|
||||||
|
|
||||||
|
ItemClickSupport.addTo(this)
|
||||||
|
.setOnItemClickListener { _, position, _ ->
|
||||||
|
context.startActivity(Intent(context, ReaderActivity::class.java).apply {
|
||||||
|
putExtra("galleryID", galleries[position].first.id)
|
||||||
|
})
|
||||||
|
(context.applicationContext as Pupil).histories.add(galleries[position].first.id)
|
||||||
|
}
|
||||||
|
.setOnItemLongClickListener { _, position, _ ->
|
||||||
|
GalleryDialog(context, galleries[position].first.id).apply {
|
||||||
|
onChipClickedHandler.add { tag ->
|
||||||
|
this@GalleryDialog.onChipClickedHandler.forEach { it.invoke(tag) }
|
||||||
|
}
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
gallery_details_contents.addView(it, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT))
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
gallery_contents.addView(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.andrognito.patternlockview.PatternLockView
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.android.synthetic.main.activity_lock.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_pattern_lock.*
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.util.Lock
|
||||||
|
import xyz.quaver.pupil.util.LockManager
|
||||||
|
|
||||||
|
class LockActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_lock)
|
||||||
|
|
||||||
|
val lockManager = try {
|
||||||
|
LockManager(this)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
AlertDialog.Builder(this).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.lock_corrupted)
|
||||||
|
setPositiveButton(android.R.string.ok) { _, _ ->
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}.show()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val mode = intent.getStringExtra("mode")
|
||||||
|
|
||||||
|
lock_pattern.isEnabled = false
|
||||||
|
lock_pin.isEnabled = false
|
||||||
|
lock_fingerprint.isEnabled = false
|
||||||
|
lock_password.isEnabled = false
|
||||||
|
|
||||||
|
when(mode) {
|
||||||
|
null -> {
|
||||||
|
if (lockManager.isEmpty()) {
|
||||||
|
setResult(RESULT_OK)
|
||||||
|
finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"add_lock" -> {
|
||||||
|
when(intent.getStringExtra("type")!!) {
|
||||||
|
"pattern" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
supportFragmentManager.beginTransaction().add(
|
||||||
|
R.id.lock_content,
|
||||||
|
PatternLockFragment().apply {
|
||||||
|
var lastPass = ""
|
||||||
|
onPatternDrawn = {
|
||||||
|
when(mode) {
|
||||||
|
null -> {
|
||||||
|
val result = lockManager.check(it)
|
||||||
|
|
||||||
|
if (result == true) {
|
||||||
|
setResult(Activity.RESULT_OK)
|
||||||
|
finish()
|
||||||
|
} else
|
||||||
|
lock_pattern_view.setViewMode(PatternLockView.PatternViewMode.WRONG)
|
||||||
|
}
|
||||||
|
"add_lock" -> {
|
||||||
|
if (lastPass.isEmpty()) {
|
||||||
|
lastPass = it
|
||||||
|
|
||||||
|
Snackbar.make(view!!, R.string.settings_lock_confirm, Snackbar.LENGTH_LONG).show()
|
||||||
|
} else {
|
||||||
|
if (lastPass == it) {
|
||||||
|
LockManager(context!!).add(Lock.generate(Lock.Type.PATTERN, it))
|
||||||
|
finish()
|
||||||
|
} else {
|
||||||
|
lock_pattern_view.setViewMode(PatternLockView.PatternViewMode.WRONG)
|
||||||
|
lastPass = ""
|
||||||
|
|
||||||
|
Snackbar.make(view!!, R.string.settings_lock_wrong_confirm, Snackbar.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.andrognito.patternlockview.PatternLockView
|
||||||
|
import com.andrognito.patternlockview.listener.PatternLockViewListener
|
||||||
|
import com.andrognito.patternlockview.utils.PatternLockUtils
|
||||||
|
import kotlinx.android.synthetic.main.fragment_pattern_lock.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_pattern_lock.view.*
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
|
||||||
|
class PatternLockFragment : Fragment(), PatternLockViewListener {
|
||||||
|
|
||||||
|
var onPatternDrawn: ((String) -> Unit)? = null
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
return inflater.inflate(R.layout.fragment_pattern_lock, container, false).apply {
|
||||||
|
lock_pattern_view.addPatternLockListener(this@PatternLockFragment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCleared() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete(pattern: MutableList<PatternLockView.Dot>?) {
|
||||||
|
val password = PatternLockUtils.patternToMD5(lock_pattern_view, pattern)
|
||||||
|
onPatternDrawn?.invoke(password)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProgress(progressPattern: MutableList<PatternLockView.Dot>?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStarted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,430 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.drawable.Animatable
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.*
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.PagerSnapHelper
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.vectordrawable.graphics.drawable.Animatable2Compat
|
||||||
|
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.crashlytics.android.Crashlytics
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.android.synthetic.main.activity_reader.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_reader.view.*
|
||||||
|
import kotlinx.android.synthetic.main.dialog_numberpicker.view.*
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.adapters.ReaderAdapter
|
||||||
|
import xyz.quaver.pupil.util.GalleryDownloader
|
||||||
|
import xyz.quaver.pupil.util.Histories
|
||||||
|
import xyz.quaver.pupil.util.ItemClickSupport
|
||||||
|
import xyz.quaver.pupil.util.hasPermission
|
||||||
|
|
||||||
|
class ReaderActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private var galleryID = 0
|
||||||
|
private val images = ArrayList<String>()
|
||||||
|
private var gallerySize = 0
|
||||||
|
private var currentPage = 0
|
||||||
|
|
||||||
|
private var isScroll = true
|
||||||
|
private var isFullscreen = false
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
|
||||||
|
(reader_recyclerview.adapter as ReaderAdapter).isFullScreen = value
|
||||||
|
|
||||||
|
reader_progressbar.visibility = when {
|
||||||
|
value -> View.VISIBLE
|
||||||
|
else -> View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var downloader: GalleryDownloader
|
||||||
|
|
||||||
|
private val snapHelper = PagerSnapHelper()
|
||||||
|
|
||||||
|
private var menu: Menu? = null
|
||||||
|
|
||||||
|
private lateinit var favorites: Histories
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
title = getString(R.string.reader_loading)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(false)
|
||||||
|
|
||||||
|
favorites = (application as Pupil).favorites
|
||||||
|
|
||||||
|
window.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE,
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_reader)
|
||||||
|
|
||||||
|
handleIntent(intent)
|
||||||
|
|
||||||
|
Crashlytics.setInt("GalleryID", galleryID)
|
||||||
|
|
||||||
|
if (galleryID == 0) {
|
||||||
|
onBackPressed()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
initDownloader()
|
||||||
|
|
||||||
|
initView()
|
||||||
|
|
||||||
|
if (!downloader.download)
|
||||||
|
downloader.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNewIntent(intent: Intent) {
|
||||||
|
super.onNewIntent(intent)
|
||||||
|
handleIntent(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleIntent(intent: Intent) {
|
||||||
|
if (intent.action == Intent.ACTION_VIEW) {
|
||||||
|
val uri = intent.data
|
||||||
|
val lastPathSegment = uri?.lastPathSegment
|
||||||
|
if (uri != null && lastPathSegment != null) {
|
||||||
|
val nonNumber = Regex("[^-?0-9]+")
|
||||||
|
|
||||||
|
galleryID = when (uri.host) {
|
||||||
|
"hitomi.la" -> lastPathSegment.replace(nonNumber, "").toInt()
|
||||||
|
"히요비.asia" -> lastPathSegment.toInt()
|
||||||
|
"xn--9w3b15m8vo.asia" -> lastPathSegment.toInt()
|
||||||
|
"e-hentai.org" -> uri.pathSegments[1].toInt()
|
||||||
|
else -> return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
galleryID = intent.getIntExtra("galleryID", 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
|
||||||
|
if (preferences.getBoolean("security_mode", false))
|
||||||
|
window.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE,
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
else
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
|
||||||
|
super.onResume()
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
|
menuInflater.inflate(R.menu.reader, menu)
|
||||||
|
|
||||||
|
with(menu?.findItem(R.id.reader_menu_favorite)) {
|
||||||
|
this ?: return@with
|
||||||
|
|
||||||
|
if (favorites.contains(galleryID))
|
||||||
|
(icon as Animatable).start()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.menu = menu
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||||
|
when(item?.itemId) {
|
||||||
|
R.id.reader_menu_page_indicator -> {
|
||||||
|
val view = LayoutInflater.from(this).inflate(R.layout.dialog_numberpicker, findViewById(android.R.id.content), false)
|
||||||
|
with(view.dialog_number_picker) {
|
||||||
|
minValue=1
|
||||||
|
maxValue=gallerySize
|
||||||
|
value=currentPage
|
||||||
|
}
|
||||||
|
val dialog = AlertDialog.Builder(this).apply {
|
||||||
|
setView(view)
|
||||||
|
}.create()
|
||||||
|
view.dialog_ok.setOnClickListener {
|
||||||
|
(reader_recyclerview.layoutManager as LinearLayoutManager?)?.scrollToPositionWithOffset(view.dialog_number_picker.value-1, 0)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
R.id.reader_menu_favorite -> {
|
||||||
|
val id = galleryID
|
||||||
|
val favorite = menu?.findItem(R.id.reader_menu_favorite) ?: return true
|
||||||
|
|
||||||
|
if (favorites.contains(id)) {
|
||||||
|
favorites.remove(id)
|
||||||
|
favorite.icon = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_star)
|
||||||
|
} else {
|
||||||
|
favorites.add(id)
|
||||||
|
(favorite.icon as Animatable).start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
|
||||||
|
if (::downloader.isInitialized && !downloader.download)
|
||||||
|
downloader.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
if (isScroll and !isFullscreen)
|
||||||
|
super.onBackPressed()
|
||||||
|
|
||||||
|
if (isFullscreen) {
|
||||||
|
isFullscreen = false
|
||||||
|
fullscreen(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isScroll) {
|
||||||
|
isScroll = true
|
||||||
|
scrollMode(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||||
|
//currentPage is 1-based
|
||||||
|
return when(keyCode) {
|
||||||
|
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||||
|
(reader_recyclerview.layoutManager as LinearLayoutManager?)?.scrollToPositionWithOffset(currentPage-2, 0)
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
KeyEvent.KEYCODE_VOLUME_DOWN -> {
|
||||||
|
(reader_recyclerview.layoutManager as LinearLayoutManager?)?.scrollToPositionWithOffset(currentPage, 0)
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
else -> super.onKeyDown(keyCode, event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDownloader() {
|
||||||
|
var d: GalleryDownloader? = GalleryDownloader.get(galleryID)
|
||||||
|
|
||||||
|
if (d == null)
|
||||||
|
d = GalleryDownloader(this, galleryID)
|
||||||
|
|
||||||
|
downloader = d.apply {
|
||||||
|
onReaderLoadedHandler = {
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
title = it.title
|
||||||
|
with(reader_download_progressbar) {
|
||||||
|
max = it.galleryInfo.size
|
||||||
|
progress = 0
|
||||||
|
}
|
||||||
|
with(reader_progressbar) {
|
||||||
|
max = it.galleryInfo.size
|
||||||
|
progress = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
gallerySize = it.galleryInfo.size
|
||||||
|
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${it.galleryInfo.size}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onProgressHandler = {
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
reader_download_progressbar.progress = it
|
||||||
|
menu?.findItem(R.id.reader_menu_use_hiyobi)?.isVisible = downloader.useHiyobi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onDownloadedHandler = {
|
||||||
|
val item = it.toList()
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
if (images.isEmpty()) {
|
||||||
|
images.addAll(item)
|
||||||
|
reader_recyclerview.adapter?.notifyDataSetChanged()
|
||||||
|
} else {
|
||||||
|
images.add(item.last())
|
||||||
|
reader_recyclerview.adapter?.notifyItemInserted(images.size-1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onErrorHandler = {
|
||||||
|
Snackbar
|
||||||
|
.make(reader_layout, it.message ?: it.javaClass.name, Snackbar.LENGTH_INDEFINITE)
|
||||||
|
.setAction(R.string.reader_help) {
|
||||||
|
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.error_help))))
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
downloader.download = false
|
||||||
|
}
|
||||||
|
onCompleteHandler = {
|
||||||
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
|
reader_download_progressbar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onNotifyChangedHandler = { notify ->
|
||||||
|
val fab = reader_fab_download
|
||||||
|
|
||||||
|
runOnUiThread {
|
||||||
|
if (notify) {
|
||||||
|
val icon = AnimatedVectorDrawableCompat.create(this, R.drawable.ic_downloading)
|
||||||
|
icon?.registerAnimationCallback(object: Animatable2Compat.AnimationCallback() {
|
||||||
|
override fun onAnimationEnd(drawable: Drawable?) {
|
||||||
|
if (downloader.download)
|
||||||
|
fab.post {
|
||||||
|
icon.start()
|
||||||
|
fab.labelText = getString(R.string.reader_fab_download_cancel)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fab.post {
|
||||||
|
fab.setImageResource(R.drawable.ic_download)
|
||||||
|
fab.labelText = getString(R.string.reader_fab_download)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
fab.setImageDrawable(icon)
|
||||||
|
icon?.start()
|
||||||
|
} else {
|
||||||
|
runOnUiThread {
|
||||||
|
fab.setImageResource(R.drawable.ic_download)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (downloader.download) {
|
||||||
|
downloader.invokeOnReaderLoaded()
|
||||||
|
downloader.invokeOnNotifyChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
with(reader_recyclerview) {
|
||||||
|
adapter = ReaderAdapter(Glide.with(this@ReaderActivity), galleryID, images)
|
||||||
|
|
||||||
|
addOnScrollListener(object: RecyclerView.OnScrollListener() {
|
||||||
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
|
|
||||||
|
if (dy < 0)
|
||||||
|
this@ReaderActivity.reader_fab.showMenuButton(true)
|
||||||
|
else if (dy > 0)
|
||||||
|
this@ReaderActivity.reader_fab.hideMenuButton(true)
|
||||||
|
|
||||||
|
val layoutManager = recyclerView.layoutManager as LinearLayoutManager
|
||||||
|
|
||||||
|
if (layoutManager.findFirstVisibleItemPosition() == -1)
|
||||||
|
return
|
||||||
|
currentPage = layoutManager.findFirstVisibleItemPosition()+1
|
||||||
|
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/$gallerySize"
|
||||||
|
this@ReaderActivity.reader_progressbar.progress = currentPage
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ItemClickSupport.addTo(this)
|
||||||
|
.setOnItemClickListener { _, _, _ ->
|
||||||
|
if (isScroll) {
|
||||||
|
isScroll = false
|
||||||
|
isFullscreen = true
|
||||||
|
|
||||||
|
scrollMode(false)
|
||||||
|
fullscreen(true)
|
||||||
|
} else {
|
||||||
|
(reader_recyclerview.layoutManager as LinearLayoutManager?)?.scrollToPosition(currentPage) //Moves to next page because currentPage is 1-based indexing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(reader_fab_download) {
|
||||||
|
setImageResource(R.drawable.ic_download)
|
||||||
|
setOnClickListener {
|
||||||
|
|
||||||
|
if (!this@ReaderActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||||
|
AlertDialog.Builder(this@ReaderActivity).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.update_no_permission)
|
||||||
|
setPositiveButton(android.R.string.ok) { _, _ -> }
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
downloader.download = !downloader.download
|
||||||
|
|
||||||
|
if (!downloader.download)
|
||||||
|
downloader.clearNotification()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(reader_fab_fullscreen) {
|
||||||
|
setImageResource(R.drawable.ic_fullscreen)
|
||||||
|
setOnClickListener {
|
||||||
|
isFullscreen = true
|
||||||
|
fullscreen(isFullscreen)
|
||||||
|
|
||||||
|
this@ReaderActivity.reader_fab.close(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fullscreen(isFullscreen: Boolean) {
|
||||||
|
with(window.attributes) {
|
||||||
|
if (isFullscreen) {
|
||||||
|
flags = flags or WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||||
|
supportActionBar?.hide()
|
||||||
|
this@ReaderActivity.reader_fab.visibility = View.INVISIBLE
|
||||||
|
} else {
|
||||||
|
flags = flags and WindowManager.LayoutParams.FLAG_FULLSCREEN.inv()
|
||||||
|
supportActionBar?.show()
|
||||||
|
this@ReaderActivity.reader_fab.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
window.attributes = this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun scrollMode(isScroll: Boolean) {
|
||||||
|
if (isScroll) {
|
||||||
|
snapHelper.attachToRecyclerView(null)
|
||||||
|
reader_recyclerview.layoutManager = LinearLayoutManager(this)
|
||||||
|
} else {
|
||||||
|
snapHelper.attachToRecyclerView(reader_recyclerview)
|
||||||
|
reader_recyclerview.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
(reader_recyclerview.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(currentPage-1, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,499 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.ui
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.Editable
|
||||||
|
import android.text.TextWatcher
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.MenuItem
|
||||||
|
import android.view.WindowManager
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.preference.Preference
|
||||||
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.android.synthetic.main.dialog_default_query.view.*
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.parseList
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.types.Tags
|
||||||
|
import xyz.quaver.pupil.util.Lock
|
||||||
|
import xyz.quaver.pupil.util.LockManager
|
||||||
|
import xyz.quaver.pupil.util.getDownloadDirectory
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.charset.Charset
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class SettingsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
val REQUEST_LOCK = 38238
|
||||||
|
val REQUEST_RESTORE = 16546
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
window.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE,
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
|
||||||
|
setContentView(R.layout.settings_activity)
|
||||||
|
supportFragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.settings, SettingsFragment())
|
||||||
|
.commit()
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
|
||||||
|
if (preferences.getBoolean("security_mode", false))
|
||||||
|
window.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE,
|
||||||
|
WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
else
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
super.onResume()
|
||||||
|
}
|
||||||
|
|
||||||
|
class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
|
private val suffix = listOf(
|
||||||
|
"B",
|
||||||
|
"kB",
|
||||||
|
"MB",
|
||||||
|
"GB",
|
||||||
|
"TB" //really?
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
val lockManager = LockManager(context!!)
|
||||||
|
|
||||||
|
findPreference<Preference>("app_lock")?.summary = if (lockManager.locks.isNullOrEmpty()) {
|
||||||
|
getString(R.string.settings_lock_none)
|
||||||
|
} else {
|
||||||
|
lockManager.locks?.joinToString(", ") {
|
||||||
|
when(it.type) {
|
||||||
|
Lock.Type.PATTERN -> getString(R.string.settings_lock_pattern)
|
||||||
|
Lock.Type.PIN -> getString(R.string.settings_lock_pin)
|
||||||
|
Lock.Type.PASSWORD -> getString(R.string.settings_lock_password)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDirSize(dir: File) : String {
|
||||||
|
var size = dir.walk().map { it.length() }.sum()
|
||||||
|
var suffixIndex = 0
|
||||||
|
|
||||||
|
while (size >= 1024) {
|
||||||
|
size /= 1024
|
||||||
|
suffixIndex++
|
||||||
|
}
|
||||||
|
|
||||||
|
return getString(R.string.settings_clear_summary, size, suffix[suffixIndex])
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
|
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||||
|
|
||||||
|
with(findPreference<Preference>("app_version")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val manager = context.packageManager
|
||||||
|
val info = manager.getPackageInfo(context.packageName, 0)
|
||||||
|
|
||||||
|
summary = info.versionName
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("delete_cache")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val dir = File(context.cacheDir, "imageCache")
|
||||||
|
|
||||||
|
summary = getDirSize(dir)
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
AlertDialog.Builder(context).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.settings_clear_cache_alert_message)
|
||||||
|
setPositiveButton(android.R.string.yes) { _, _ ->
|
||||||
|
if (dir.exists())
|
||||||
|
dir.deleteRecursively()
|
||||||
|
|
||||||
|
summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("delete_downloads")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val dir = getDownloadDirectory(context)
|
||||||
|
|
||||||
|
summary = getDirSize(dir)
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
AlertDialog.Builder(context).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.settings_clear_downloads_alert_message)
|
||||||
|
setPositiveButton(android.R.string.yes) { _, _ ->
|
||||||
|
if (dir.exists())
|
||||||
|
dir.deleteRecursively()
|
||||||
|
|
||||||
|
val downloads = (activity!!.application as Pupil).downloads
|
||||||
|
|
||||||
|
downloads.clear()
|
||||||
|
|
||||||
|
summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with(findPreference<Preference>("clear_history")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val histories = (activity!!.application as Pupil).histories
|
||||||
|
|
||||||
|
summary = getString(R.string.settings_clear_history_summary, histories.size)
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
AlertDialog.Builder(context).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.settings_clear_history_alert_message)
|
||||||
|
setPositiveButton(android.R.string.yes) { _, _ ->
|
||||||
|
histories.clear()
|
||||||
|
summary = getString(R.string.settings_clear_history_summary, histories.size)
|
||||||
|
}
|
||||||
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("default_query")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
||||||
|
summary = preferences.getString("default_query", "") ?: ""
|
||||||
|
|
||||||
|
val languages = resources.getStringArray(R.array.languages).map {
|
||||||
|
it.split("|").let { split ->
|
||||||
|
Pair(split[0], split[1])
|
||||||
|
}
|
||||||
|
}.toMap()
|
||||||
|
val reverseLanguages = languages.entries.associate { (k, v) -> v to k }
|
||||||
|
|
||||||
|
val excludeBL = "-male:yaoi"
|
||||||
|
val excludeGuro = listOf("-female:guro", "-male:guro")
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
val dialogView = LayoutInflater.from(context).inflate(
|
||||||
|
R.layout.dialog_default_query,
|
||||||
|
LinearLayout(context),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
val tags = Tags.parse(
|
||||||
|
preferences.getString("default_query", "") ?: ""
|
||||||
|
)
|
||||||
|
|
||||||
|
summary = tags.toString()
|
||||||
|
|
||||||
|
with(dialogView.default_query_dialog_language_selector) {
|
||||||
|
adapter =
|
||||||
|
ArrayAdapter(
|
||||||
|
context,
|
||||||
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
|
arrayListOf(
|
||||||
|
getString(R.string.default_query_dialog_language_selector_none)
|
||||||
|
).apply {
|
||||||
|
addAll(languages.values)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (tags.any { it.area == "language" && !it.isNegative }) {
|
||||||
|
val tag = languages[tags.first { it.area == "language" }.tag]
|
||||||
|
if (tag != null) {
|
||||||
|
setSelection(
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
(adapter as ArrayAdapter<String>).getPosition(tag)
|
||||||
|
)
|
||||||
|
tags.removeByArea("language", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(dialogView.default_query_dialog_BL_checkbox) {
|
||||||
|
isChecked = tags.contains(excludeBL)
|
||||||
|
if (tags.contains(excludeBL))
|
||||||
|
tags.remove(excludeBL)
|
||||||
|
}
|
||||||
|
|
||||||
|
with(dialogView.default_query_dialog_guro_checkbox) {
|
||||||
|
isChecked = excludeGuro.all { tags.contains(it) }
|
||||||
|
if (excludeGuro.all { tags.contains(it) })
|
||||||
|
excludeGuro.forEach {
|
||||||
|
tags.remove(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(dialogView.default_query_dialog_edittext) {
|
||||||
|
setText(tags.toString(), TextView.BufferType.EDITABLE)
|
||||||
|
addTextChangedListener(object : TextWatcher {
|
||||||
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||||
|
|
||||||
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||||
|
|
||||||
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
s ?: return
|
||||||
|
|
||||||
|
if (s.any { it.isUpperCase() })
|
||||||
|
s.replace(0, s.length, s.toString().toLowerCase(Locale.getDefault()))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
val dialog = AlertDialog.Builder(context!!).apply {
|
||||||
|
setView(dialogView)
|
||||||
|
}.create()
|
||||||
|
|
||||||
|
dialogView.default_query_dialog_ok.setOnClickListener {
|
||||||
|
val newTags = Tags.parse(dialogView.default_query_dialog_edittext.text.toString())
|
||||||
|
|
||||||
|
with(dialogView.default_query_dialog_language_selector) {
|
||||||
|
if (selectedItemPosition != 0)
|
||||||
|
newTags.add("language:${reverseLanguages[selectedItem]}")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialogView.default_query_dialog_BL_checkbox.isChecked)
|
||||||
|
newTags.add(excludeBL)
|
||||||
|
|
||||||
|
if (dialogView.default_query_dialog_guro_checkbox.isChecked)
|
||||||
|
excludeGuro.forEach { tag ->
|
||||||
|
newTags.add(tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
preferenceManager.sharedPreferences.edit().putString("default_query", newTags.toString()).apply()
|
||||||
|
summary = preferences.getString("default_query", "") ?: ""
|
||||||
|
tags.clear()
|
||||||
|
tags.addAll(newTags)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with(findPreference<Preference>("app_lock")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
val lockManager = LockManager(context)
|
||||||
|
|
||||||
|
summary = if (lockManager.locks.isNullOrEmpty()) {
|
||||||
|
getString(R.string.settings_lock_none)
|
||||||
|
} else {
|
||||||
|
lockManager.locks?.joinToString(", ") {
|
||||||
|
when(it.type) {
|
||||||
|
Lock.Type.PATTERN -> getString(R.string.settings_lock_pattern)
|
||||||
|
Lock.Type.PIN -> getString(R.string.settings_lock_pin)
|
||||||
|
Lock.Type.PASSWORD -> getString(R.string.settings_lock_password)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
val intent = Intent(context, LockActivity::class.java)
|
||||||
|
activity?.startActivityForResult(intent, (activity as SettingsActivity).REQUEST_LOCK)
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("dark_mode")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
|
AppCompatDelegate.setDefaultNightMode(when (newValue as Boolean) {
|
||||||
|
true -> AppCompatDelegate.MODE_NIGHT_YES
|
||||||
|
false -> AppCompatDelegate.MODE_NIGHT_NO
|
||||||
|
})
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("backup")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
File(ContextCompat.getDataDir(context), "favorites.json").copyTo(
|
||||||
|
File(getDownloadDirectory(context), "favorites.json"),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
|
Snackbar.make(this@SettingsFragment.listView, R.string.settings_backup_snackbar, Snackbar.LENGTH_LONG)
|
||||||
|
.show()
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(findPreference<Preference>("restore")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||||
|
addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
|
type = "*/*"
|
||||||
|
}
|
||||||
|
|
||||||
|
activity?.startActivityForResult(intent, (activity as SettingsActivity).REQUEST_RESTORE)
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
val lockManager = LockManager(context!!)
|
||||||
|
|
||||||
|
findPreference<Preference>("lock_pattern")?.summary =
|
||||||
|
if (lockManager.contains(Lock.Type.PATTERN))
|
||||||
|
getString(R.string.settings_lock_enabled)
|
||||||
|
else
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
|
setPreferencesFromResource(R.xml.lock_preferences, rootKey)
|
||||||
|
|
||||||
|
with(findPreference<Preference>("lock_pattern")) {
|
||||||
|
this!!
|
||||||
|
|
||||||
|
if (LockManager(context!!).contains(Lock.Type.PATTERN))
|
||||||
|
summary = getString(R.string.settings_lock_enabled)
|
||||||
|
|
||||||
|
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
val lockManager = LockManager(context!!)
|
||||||
|
|
||||||
|
if (lockManager.contains(Lock.Type.PATTERN)) {
|
||||||
|
AlertDialog.Builder(context).apply {
|
||||||
|
setTitle(R.string.warning)
|
||||||
|
setMessage(R.string.settings_lock_remove_message)
|
||||||
|
|
||||||
|
setPositiveButton(android.R.string.yes) { _, _ ->
|
||||||
|
lockManager.remove(Lock.Type.PATTERN)
|
||||||
|
onResume()
|
||||||
|
}
|
||||||
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
|
}.show()
|
||||||
|
} else {
|
||||||
|
val intent = Intent(context, LockActivity::class.java).apply {
|
||||||
|
putExtra("mode", "add_lock")
|
||||||
|
putExtra("type", "pattern")
|
||||||
|
}
|
||||||
|
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||||
|
when (item?.itemId) {
|
||||||
|
android.R.id.home -> onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
when(requestCode) {
|
||||||
|
REQUEST_LOCK -> {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
supportFragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.settings, LockFragment())
|
||||||
|
.addToBackStack("Lock")
|
||||||
|
.commitAllowingStateLoss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
REQUEST_RESTORE -> {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
val uri = data?.data ?: return
|
||||||
|
|
||||||
|
try {
|
||||||
|
val json = contentResolver.openInputStream(uri).use { inputStream ->
|
||||||
|
inputStream!!
|
||||||
|
|
||||||
|
inputStream.readBytes().toString(Charset.defaultCharset())
|
||||||
|
}
|
||||||
|
|
||||||
|
(application as Pupil).favorites.addAll(Json.parseList<Int>(json).also {
|
||||||
|
Snackbar.make(
|
||||||
|
window.decorView,
|
||||||
|
getString(R.string.settings_restore_successful, it.size),
|
||||||
|
Snackbar.LENGTH_LONG
|
||||||
|
).show()
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Snackbar.make(
|
||||||
|
window.decorView,
|
||||||
|
R.string.settings_restore_failed,
|
||||||
|
Snackbar.LENGTH_LONG
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,327 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.app.PendingIntent
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.ContextWrapper
|
||||||
|
import android.content.Intent
|
||||||
|
import android.util.SparseArray
|
||||||
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.app.NotificationManagerCompat
|
||||||
|
import androidx.core.app.TaskStackBuilder
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import com.crashlytics.android.Crashlytics
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonConfiguration
|
||||||
|
import xyz.quaver.hitomi.Reader
|
||||||
|
import xyz.quaver.hitomi.getReader
|
||||||
|
import xyz.quaver.hitomi.getReferer
|
||||||
|
import xyz.quaver.hitomi.urlFromUrlFromHash
|
||||||
|
import xyz.quaver.hiyobi.cookie
|
||||||
|
import xyz.quaver.hiyobi.createImgList
|
||||||
|
import xyz.quaver.hiyobi.user_agent
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.R
|
||||||
|
import xyz.quaver.pupil.ui.ReaderActivity
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.net.URL
|
||||||
|
import java.util.*
|
||||||
|
import javax.net.ssl.HttpsURLConnection
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.concurrent.schedule
|
||||||
|
|
||||||
|
class GalleryDownloader(
|
||||||
|
base: Context,
|
||||||
|
private val galleryID: Int,
|
||||||
|
_notify: Boolean = false
|
||||||
|
) : ContextWrapper(base) {
|
||||||
|
|
||||||
|
private val downloads = (applicationContext as Pupil).downloads
|
||||||
|
var useHiyobi = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("use_hiyobi", false)
|
||||||
|
|
||||||
|
var download: Boolean = false
|
||||||
|
set(value) {
|
||||||
|
if (value) {
|
||||||
|
field = true
|
||||||
|
notificationManager.notify(galleryID, notificationBuilder.build())
|
||||||
|
|
||||||
|
if (reader?.isActive == false && downloadJob?.isActive != true) {
|
||||||
|
val data = File(getDownloadDirectory(this), galleryID.toString())
|
||||||
|
val cache = File(cacheDir, "imageCache/$galleryID")
|
||||||
|
|
||||||
|
if (File(cache, "images").exists() && !data.exists()) {
|
||||||
|
cache.copyRecursively(data, true)
|
||||||
|
cache.deleteRecursively()
|
||||||
|
}
|
||||||
|
|
||||||
|
field = false
|
||||||
|
}
|
||||||
|
|
||||||
|
downloads.add(galleryID)
|
||||||
|
} else {
|
||||||
|
field = false
|
||||||
|
}
|
||||||
|
|
||||||
|
onNotifyChangedHandler?.invoke(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val reader: Deferred<Reader?>?
|
||||||
|
private var downloadJob: Job? = null
|
||||||
|
|
||||||
|
private lateinit var notificationBuilder: NotificationCompat.Builder
|
||||||
|
private lateinit var notificationManager: NotificationManagerCompat
|
||||||
|
|
||||||
|
var onReaderLoadedHandler: ((Reader) -> Unit)? = null
|
||||||
|
var onProgressHandler: ((Int) -> Unit)? = null
|
||||||
|
var onDownloadedHandler: ((List<String>) -> Unit)? = null
|
||||||
|
var onErrorHandler: ((Exception) -> Unit)? = null
|
||||||
|
var onCompleteHandler: (() -> Unit)? = null
|
||||||
|
var onNotifyChangedHandler: ((Boolean) -> Unit)? = null
|
||||||
|
|
||||||
|
companion object : SparseArray<GalleryDownloader>()
|
||||||
|
|
||||||
|
init {
|
||||||
|
put(galleryID, this)
|
||||||
|
|
||||||
|
initNotification()
|
||||||
|
|
||||||
|
reader = CoroutineScope(Dispatchers.IO).async {
|
||||||
|
try {
|
||||||
|
download = _notify
|
||||||
|
val json = Json(JsonConfiguration.Stable)
|
||||||
|
val serializer = Reader.serializer()
|
||||||
|
|
||||||
|
//Check cache
|
||||||
|
val cache = File(getCachedGallery(this@GalleryDownloader, galleryID), "reader.json")
|
||||||
|
|
||||||
|
try {
|
||||||
|
json.parse(serializer, cache.readText())
|
||||||
|
} catch(e: Exception) {
|
||||||
|
cache.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache.exists()) {
|
||||||
|
val cached = json.parse(serializer, cache.readText())
|
||||||
|
|
||||||
|
if (cached.galleryInfo.isNotEmpty()) {
|
||||||
|
useHiyobi = cached.code == Reader.Code.HIYOBI
|
||||||
|
|
||||||
|
onReaderLoadedHandler?.invoke(cached)
|
||||||
|
|
||||||
|
return@async cached
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cache doesn't exist. Load from internet
|
||||||
|
val reader = when {
|
||||||
|
useHiyobi -> {
|
||||||
|
try {
|
||||||
|
xyz.quaver.hiyobi.getReader(galleryID)
|
||||||
|
} catch(e: Exception) {
|
||||||
|
useHiyobi = false
|
||||||
|
getReader(galleryID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
getReader(galleryID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader.galleryInfo.isNotEmpty()) {
|
||||||
|
//Save cache
|
||||||
|
if (cache.parentFile?.exists() == false)
|
||||||
|
cache.parentFile!!.mkdirs()
|
||||||
|
|
||||||
|
cache.writeText(json.stringify(serializer, reader))
|
||||||
|
}
|
||||||
|
|
||||||
|
reader
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Crashlytics.logException(e)
|
||||||
|
onErrorHandler?.invoke(e)
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun webpUrlFromUrl(url: String) = url.replace("/galleries/", "/webp/") + ".webp"
|
||||||
|
|
||||||
|
fun start() {
|
||||||
|
downloadJob = CoroutineScope(Dispatchers.Default).launch {
|
||||||
|
val reader = reader!!.await() ?: return@launch
|
||||||
|
|
||||||
|
notificationBuilder.setContentTitle(reader.title)
|
||||||
|
|
||||||
|
val list = ArrayList<String>()
|
||||||
|
|
||||||
|
onReaderLoadedHandler?.invoke(reader)
|
||||||
|
|
||||||
|
notificationBuilder
|
||||||
|
.setProgress(reader.galleryInfo.size, 0, false)
|
||||||
|
.setContentText("0/${reader.galleryInfo.size}")
|
||||||
|
|
||||||
|
reader.galleryInfo.chunked(4).forEachIndexed { chunkIndex, chunked ->
|
||||||
|
chunked.mapIndexed { i, galleryInfo ->
|
||||||
|
val index = chunkIndex*4+i
|
||||||
|
|
||||||
|
async(Dispatchers.IO) {
|
||||||
|
val url = when(useHiyobi) {
|
||||||
|
true -> createImgList(galleryID, reader)[index].path
|
||||||
|
false -> when {
|
||||||
|
(!galleryInfo.hash.isNullOrBlank()) and (galleryInfo.haswebp == 1) ->
|
||||||
|
urlFromUrlFromHash(galleryID, galleryInfo, "webp")
|
||||||
|
else ->
|
||||||
|
urlFromUrlFromHash(galleryID, galleryInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val name = "$index".padStart(4, '0')
|
||||||
|
val ext = url.split('.').last()
|
||||||
|
|
||||||
|
val cache = File(getCachedGallery(this@GalleryDownloader, galleryID), "images/$name.$ext")
|
||||||
|
|
||||||
|
if (!cache.exists())
|
||||||
|
try {
|
||||||
|
with(URL(url).openConnection() as HttpsURLConnection) {
|
||||||
|
if (useHiyobi) {
|
||||||
|
setRequestProperty("User-Agent", user_agent)
|
||||||
|
setRequestProperty("Cookie", cookie)
|
||||||
|
} else
|
||||||
|
setRequestProperty("Referer", getReferer(galleryID))
|
||||||
|
|
||||||
|
if (cache.parentFile?.exists() == false)
|
||||||
|
cache.parentFile!!.mkdirs()
|
||||||
|
|
||||||
|
inputStream.copyTo(FileOutputStream(cache))
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
cache.delete()
|
||||||
|
|
||||||
|
onErrorHandler?.invoke(e)
|
||||||
|
|
||||||
|
notificationBuilder
|
||||||
|
.setContentTitle(reader.title)
|
||||||
|
.setContentText(getString(R.string.reader_notification_error))
|
||||||
|
.setProgress(0, 0, false)
|
||||||
|
|
||||||
|
notificationManager.notify(galleryID, notificationBuilder.build())
|
||||||
|
}
|
||||||
|
|
||||||
|
"images/$name.$ext"
|
||||||
|
}
|
||||||
|
}.forEach {
|
||||||
|
list.add(it.await())
|
||||||
|
|
||||||
|
val index = list.size
|
||||||
|
|
||||||
|
onProgressHandler?.invoke(index)
|
||||||
|
|
||||||
|
notificationBuilder
|
||||||
|
.setProgress(reader.galleryInfo.size, index, false)
|
||||||
|
.setContentText("$index/${reader.galleryInfo.size}")
|
||||||
|
|
||||||
|
if (download)
|
||||||
|
notificationManager.notify(galleryID, notificationBuilder.build())
|
||||||
|
|
||||||
|
onDownloadedHandler?.invoke(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer(false).schedule(1000) {
|
||||||
|
notificationBuilder
|
||||||
|
.setContentTitle(reader.title)
|
||||||
|
.setContentText(getString(R.string.reader_notification_complete))
|
||||||
|
.setProgress(0, 0, false)
|
||||||
|
|
||||||
|
if (download) {
|
||||||
|
File(cacheDir, "imageCache/${galleryID}").let {
|
||||||
|
if (it.exists()) {
|
||||||
|
val target = File(getDownloadDirectory(this@GalleryDownloader), galleryID.toString())
|
||||||
|
|
||||||
|
if (!target.exists())
|
||||||
|
target.mkdirs()
|
||||||
|
|
||||||
|
it.copyRecursively(target, true)
|
||||||
|
it.deleteRecursively()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationManager.notify(galleryID, notificationBuilder.build())
|
||||||
|
|
||||||
|
download = false
|
||||||
|
}
|
||||||
|
|
||||||
|
onCompleteHandler?.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(galleryID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun cancel() {
|
||||||
|
downloadJob?.cancel()
|
||||||
|
|
||||||
|
remove(galleryID)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun cancelAndJoin() {
|
||||||
|
downloadJob?.cancelAndJoin()
|
||||||
|
|
||||||
|
remove(galleryID)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun invokeOnReaderLoaded() {
|
||||||
|
CoroutineScope(Dispatchers.Default).launch {
|
||||||
|
onReaderLoadedHandler?.invoke(reader?.await() ?: return@launch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clearNotification() {
|
||||||
|
notificationManager.cancel(galleryID)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun invokeOnNotifyChanged() {
|
||||||
|
onNotifyChangedHandler?.invoke(download)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initNotification() {
|
||||||
|
val intent = Intent(this, ReaderActivity::class.java).apply {
|
||||||
|
putExtra("galleryID", galleryID)
|
||||||
|
}
|
||||||
|
val pendingIntent = TaskStackBuilder.create(this).run {
|
||||||
|
addNextIntentWithParentStack(intent)
|
||||||
|
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationManager = NotificationManagerCompat.from(this)
|
||||||
|
|
||||||
|
notificationBuilder = NotificationCompat.Builder(this, "download").apply {
|
||||||
|
setContentTitle(getString(R.string.reader_loading))
|
||||||
|
setContentText(getString(R.string.reader_notification_text))
|
||||||
|
setSmallIcon(android.R.drawable.stat_sys_download)
|
||||||
|
setContentIntent(pendingIntent)
|
||||||
|
setProgress(0, 0, true)
|
||||||
|
priority = NotificationCompat.PRIORITY_LOW
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package xyz.quaver.pupil.util;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import xyz.quaver.pupil.R;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
|
||||||
|
// do it
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
public class ItemClickSupport {
|
||||||
|
private final RecyclerView mRecyclerView;
|
||||||
|
private OnItemClickListener mOnItemClickListener;
|
||||||
|
private OnItemLongClickListener mOnItemLongClickListener;
|
||||||
|
private View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mOnItemClickListener != null) {
|
||||||
|
RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
|
||||||
|
mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
if (mOnItemLongClickListener != null) {
|
||||||
|
RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
|
||||||
|
return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private RecyclerView.OnChildAttachStateChangeListener mAttachListener
|
||||||
|
= new RecyclerView.OnChildAttachStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onChildViewAttachedToWindow(@NonNull View view) {
|
||||||
|
if (mOnItemClickListener != null) {
|
||||||
|
view.setOnClickListener(mOnClickListener);
|
||||||
|
}
|
||||||
|
if (mOnItemLongClickListener != null) {
|
||||||
|
view.setOnLongClickListener(mOnLongClickListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChildViewDetachedFromWindow(@NonNull View view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private ItemClickSupport(RecyclerView recyclerView) {
|
||||||
|
mRecyclerView = recyclerView;
|
||||||
|
mRecyclerView.setTag(R.id.item_click_support, this);
|
||||||
|
mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemClickSupport addTo(RecyclerView view) {
|
||||||
|
ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
|
||||||
|
if (support == null) {
|
||||||
|
support = new ItemClickSupport(view);
|
||||||
|
}
|
||||||
|
return support;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemClickSupport removeFrom(RecyclerView view) {
|
||||||
|
ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
|
||||||
|
if (support != null) {
|
||||||
|
support.detach(view);
|
||||||
|
}
|
||||||
|
return support;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) {
|
||||||
|
mOnItemClickListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) {
|
||||||
|
mOnItemLongClickListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void detach(RecyclerView view) {
|
||||||
|
view.removeOnChildAttachStateChangeListener(mAttachListener);
|
||||||
|
view.setTag(R.id.item_click_support, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
|
||||||
|
void onItemClicked(RecyclerView recyclerView, int position, View v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemLongClickListener {
|
||||||
|
|
||||||
|
boolean onItemLongClicked(RecyclerView recyclerView, int position, View v);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.graphics.Paint
|
||||||
|
import android.text.style.LineHeightSpan
|
||||||
|
|
||||||
|
class SetLineOverlap(private val overlap: Boolean) : LineHeightSpan {
|
||||||
|
companion object {
|
||||||
|
private var originalBottom = 15
|
||||||
|
private var originalDescent = 13
|
||||||
|
private var overlapSaved = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chooseHeight(
|
||||||
|
text: CharSequence?,
|
||||||
|
start: Int,
|
||||||
|
end: Int,
|
||||||
|
spanstartv: Int,
|
||||||
|
lineHeight: Int,
|
||||||
|
fm: Paint.FontMetricsInt?
|
||||||
|
) {
|
||||||
|
fm ?: return
|
||||||
|
|
||||||
|
if (overlap) {
|
||||||
|
if (overlapSaved) {
|
||||||
|
originalBottom = fm.bottom
|
||||||
|
originalDescent = fm.descent
|
||||||
|
overlapSaved = true
|
||||||
|
}
|
||||||
|
fm.bottom += fm.top
|
||||||
|
fm.descent += fm.top
|
||||||
|
} else {
|
||||||
|
fm.bottom = originalBottom
|
||||||
|
fm.descent = originalDescent
|
||||||
|
overlapSaved = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Environment
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
fun getCachedGallery(context: Context, galleryID: Int): File {
|
||||||
|
return File(getDownloadDirectory(context), galleryID.toString()).let {
|
||||||
|
when {
|
||||||
|
it.exists() -> it
|
||||||
|
else -> File(context.cacheDir, "imageCache/$galleryID")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
fun getDownloadDirectory(context: Context): File {
|
||||||
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
|
context.getExternalFilesDir("Pupil")!!
|
||||||
|
else
|
||||||
|
File(Environment.getExternalStorageDirectory(), "Pupil")
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonConfiguration
|
||||||
|
import kotlinx.serialization.parseList
|
||||||
|
import kotlinx.serialization.stringify
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class Histories(private val file: File) : ArrayList<Int>() {
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (!file.exists())
|
||||||
|
file.parentFile?.mkdirs()
|
||||||
|
|
||||||
|
try {
|
||||||
|
load()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
fun load() : Histories {
|
||||||
|
return apply {
|
||||||
|
super.clear()
|
||||||
|
addAll(
|
||||||
|
Json(JsonConfiguration.Stable).parseList(
|
||||||
|
file.bufferedReader().use { it.readText() }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
fun save() {
|
||||||
|
file.writeText(Json(JsonConfiguration.Stable).stringify(this))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun add(element: Int): Boolean {
|
||||||
|
load()
|
||||||
|
|
||||||
|
if (contains(element))
|
||||||
|
super.remove(element)
|
||||||
|
|
||||||
|
super.add(0, element)
|
||||||
|
|
||||||
|
save()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun remove(element: Int): Boolean {
|
||||||
|
load()
|
||||||
|
val retval = super.remove(element)
|
||||||
|
save()
|
||||||
|
|
||||||
|
return retval
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun clear() {
|
||||||
|
super.clear()
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.ContextWrapper
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonConfiguration
|
||||||
|
import java.io.File
|
||||||
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
fun hash(password: String): String {
|
||||||
|
val bytes = password.toByteArray()
|
||||||
|
val md = MessageDigest.getInstance("SHA-256")
|
||||||
|
|
||||||
|
return md.digest(bytes).fold("") { str, it -> str + "%02x".format(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ret1: SHA-256 Hash
|
||||||
|
// Ret2: Hash salt
|
||||||
|
fun hashWithSalt(password: String): Pair<String, String> {
|
||||||
|
val salt = (0 until 12).map { source.random() }.joinToString()
|
||||||
|
|
||||||
|
return Pair(hash(password+salt), salt)
|
||||||
|
}
|
||||||
|
|
||||||
|
val source = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Lock(val type: Type, val hash: String, val salt: String) {
|
||||||
|
|
||||||
|
enum class Type {
|
||||||
|
PATTERN,
|
||||||
|
PIN,
|
||||||
|
PASSWORD
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun generate(type: Type, password: String): Lock {
|
||||||
|
val (hash, salt) = hashWithSalt(password)
|
||||||
|
return Lock(type, hash, salt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun match(password: String): Boolean {
|
||||||
|
return hash(password+salt) == hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockManager(base: Context): ContextWrapper(base) {
|
||||||
|
|
||||||
|
var locks: ArrayList<Lock>? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
private fun load() {
|
||||||
|
val lock = File(ContextCompat.getDataDir(this), "lock.json")
|
||||||
|
|
||||||
|
if (!lock.exists()) {
|
||||||
|
lock.createNewFile()
|
||||||
|
lock.writeText("[]")
|
||||||
|
}
|
||||||
|
|
||||||
|
locks = ArrayList(Json(JsonConfiguration.Stable).parseList(lock.readText()))
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(ImplicitReflectionSerializer::class)
|
||||||
|
private fun save() {
|
||||||
|
val lock = File(ContextCompat.getDataDir(this), "lock.json")
|
||||||
|
|
||||||
|
if (!lock.exists())
|
||||||
|
lock.createNewFile()
|
||||||
|
|
||||||
|
lock.writeText(Json(JsonConfiguration.Stable).stringify(locks?.toList() ?: listOf()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun add(lock: Lock) {
|
||||||
|
remove(lock.type)
|
||||||
|
locks?.add(lock)
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun remove(type: Lock.Type) {
|
||||||
|
locks?.removeAll { it.type == type }
|
||||||
|
save()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun check(password: String): Boolean? {
|
||||||
|
return locks?.any {
|
||||||
|
it.match(password)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isEmpty(): Boolean {
|
||||||
|
return locks.isNullOrEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isNotEmpty(): Boolean = !isEmpty()
|
||||||
|
|
||||||
|
fun contains(type: Lock.Type): Boolean {
|
||||||
|
return locks?.any { it.type == type } ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
|
||||||
|
fun Context.hasPermission(permission: String) =
|
||||||
|
ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
|
||||||
|
|
||||||
|
fun String.wordCapitalize() : String {
|
||||||
|
val result = ArrayList<String>()
|
||||||
|
|
||||||
|
for (word in this.split(" "))
|
||||||
|
result.add(word.capitalize())
|
||||||
|
|
||||||
|
return result.joinToString(" ")
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Pupil, Hitomi.la viewer for Android
|
||||||
|
* Copyright (C) 2019 tom5079
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package xyz.quaver.pupil.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import kotlinx.serialization.InternalSerializationApi
|
||||||
|
import kotlinx.serialization.internal.EnumSerializer
|
||||||
|
import kotlinx.serialization.json.*
|
||||||
|
import xyz.quaver.availableInHiyobi
|
||||||
|
import xyz.quaver.hitomi.Reader
|
||||||
|
import xyz.quaver.pupil.BuildConfig
|
||||||
|
import java.io.File
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
|
fun getReleases(url: String) : JsonArray {
|
||||||
|
return try {
|
||||||
|
URL(url).readText().let {
|
||||||
|
Json(JsonConfiguration.Stable).parse(JsonArray.serializer(), it)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
JsonArray(emptyList())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkUpdate(url: String) : JsonObject? {
|
||||||
|
val releases = getReleases(url)
|
||||||
|
|
||||||
|
if (releases.isEmpty())
|
||||||
|
return null
|
||||||
|
|
||||||
|
return releases.firstOrNull {
|
||||||
|
if (BuildConfig.PRERELEASE) {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
it.jsonObject["prerelease"]?.boolean == false
|
||||||
|
}
|
||||||
|
}?.let {
|
||||||
|
if (it.jsonObject["tag_name"]?.content == BuildConfig.VERSION_NAME)
|
||||||
|
null
|
||||||
|
else
|
||||||
|
it.jsonObject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getApkUrl(releases: JsonObject) : Pair<String?, String?>? {
|
||||||
|
return releases["assets"]?.jsonArray?.firstOrNull {
|
||||||
|
Regex("Pupil-v.+\\.apk").matches(it.jsonObject["name"]?.content ?: "")
|
||||||
|
}.let {
|
||||||
|
if (it == null)
|
||||||
|
null
|
||||||
|
else
|
||||||
|
Pair(it.jsonObject["browser_download_url"]?.content, it.jsonObject["name"]?.content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getOldReaderGalleries(context: Context) : List<File> {
|
||||||
|
val oldGallery = mutableListOf<File>()
|
||||||
|
|
||||||
|
listOf(
|
||||||
|
getDownloadDirectory(context),
|
||||||
|
File(context.cacheDir, "imageCache")
|
||||||
|
).forEach { root ->
|
||||||
|
root.listFiles()?.forEach { gallery ->
|
||||||
|
File(gallery, "reader.json").let { readerFile ->
|
||||||
|
if (!readerFile.exists())
|
||||||
|
return@let
|
||||||
|
|
||||||
|
try {
|
||||||
|
Json(JsonConfiguration.Stable).parseJson(readerFile.readText())
|
||||||
|
.jsonObject.let { reader ->
|
||||||
|
if (!reader.contains("code"))
|
||||||
|
oldGallery.add(gallery)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return oldGallery
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseExperimental(InternalSerializationApi::class)
|
||||||
|
fun updateOldReaderGalleries(context: Context) {
|
||||||
|
|
||||||
|
val json = Json(JsonConfiguration.Stable)
|
||||||
|
|
||||||
|
getOldReaderGalleries(context).forEach { gallery ->
|
||||||
|
val reader = json.parseJson(File(gallery, "reader.json").apply {
|
||||||
|
if (!exists())
|
||||||
|
return@forEach
|
||||||
|
}.readText())
|
||||||
|
.jsonObject.toMutableMap()
|
||||||
|
|
||||||
|
val codeSerializer = EnumSerializer(Reader.Code::class)
|
||||||
|
|
||||||
|
reader["code"] = when {
|
||||||
|
(File(gallery, "images").list()?.
|
||||||
|
all { !it.endsWith("webp") } ?: return@forEach) &&
|
||||||
|
availableInHiyobi(gallery.name.toIntOrNull() ?: return@forEach)
|
||||||
|
-> json.toJson(codeSerializer, Reader.Code.HIYOBI)
|
||||||
|
else -> json.toJson(codeSerializer, Reader.Code.HITOMI)
|
||||||
|
}
|
||||||
|
|
||||||
|
File(gallery, "reader.json").writeText(JsonObject(reader).toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 620 B |
|
After Width: | Height: | Size: 975 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 585 B |
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 361 B |
|
After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 469 B |
|
After Width: | Height: | Size: 965 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 793 B |
|
After Width: | Height: | Size: 802 B |
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 817 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 934 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 979 B |
|
After Width: | Height: | Size: 636 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 947 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 345 B |
|
After Width: | Height: | Size: 366 B |
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 848 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 892 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 383 B |
|
After Width: | Height: | Size: 226 B |