Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95ed0eb7ea | ||
|
|
9ec74934bc | ||
|
|
4f868a4556 | ||
|
|
21bff4dff7 | ||
|
|
30819fc7c6 | ||
|
|
ce70859fb2 | ||
|
|
197a34721b | ||
|
|
3a21724342 | ||
|
|
ffceda72b1 | ||
|
|
bb655783b8 | ||
|
|
d5cd23c130 | ||
|
|
70bb0d06b2 | ||
|
|
18f1ec7403 | ||
|
|
20c0030cdc | ||
|
|
7509bf9776 | ||
|
|
fb7b9b28a7 | ||
|
|
185ab00431 | ||
|
|
b48b38e8c4 | ||
|
|
34632342fc | ||
|
|
c7bf9509e3 | ||
|
|
877c354f84 | ||
|
|
6c7b33e86f | ||
|
|
2c3fa31e91 | ||
|
|
550d3735c7 | ||
|
|
71f654635c | ||
|
|
e9c7695367 | ||
|
|
b2e34e622c | ||
|
|
78db7ecbc5 | ||
|
|
4896a1edbc | ||
|
|
61b2075302 | ||
|
|
b21fe89ea1 | ||
|
|
4af054a9cd | ||
|
|
3f579060b5 | ||
|
|
1e87279310 | ||
|
|
5fae1df78c | ||
|
|
84949442ee | ||
|
|
3b395380c7 | ||
|
|
3e3de0ff2a | ||
|
|
da802c5371 | ||
|
|
24405f7c44 | ||
|
|
9ed826a87e | ||
|
|
9c5c9dfa95 | ||
|
|
6eb29c783a | ||
|
|
cb11ecc9f0 | ||
|
|
bf5feaacd1 | ||
|
|
0ef4088b88 | ||
|
|
1e87d34806 | ||
|
|
0b35fb01ee | ||
|
|
7f1d590fbd | ||
|
|
97ce2bbe54 | ||
|
|
d8a6424ecc | ||
|
|
fdc199cc49 | ||
|
|
a02fe88765 | ||
|
|
6488de75f1 | ||
|
|
439f199a10 | ||
|
|
e535b2fa09 | ||
|
|
81ae752975 | ||
|
|
5dd584776a | ||
|
|
f617e62b85 | ||
|
|
4d95a7163f | ||
|
|
b5cae76de5 | ||
|
|
9065e7457a | ||
|
|
08ab9159a5 | ||
|
|
6b5b961986 | ||
|
|
6a96035149 | ||
|
|
1ce035591a | ||
|
|
6cc78802ee | ||
|
|
636c011c23 | ||
|
|
92490ca1a6 | ||
|
|
b6a5d237ac | ||
|
|
8be0b5c588 | ||
|
|
fcbe129b6e | ||
|
|
befbcd6720 | ||
|
|
ee5062d4c7 | ||
|
|
a4392523d6 | ||
|
|
b3371304bf | ||
|
|
38911c2d34 | ||
|
|
6c5ad068d2 | ||
|
|
868521f19f | ||
|
|
c4cd965306 | ||
|
|
639adaf7fa | ||
|
|
e174ee0b2c | ||
|
|
04da83f950 | ||
|
|
84a35e9283 | ||
|
|
a907db43be | ||
|
|
890be41aa5 | ||
|
|
f3db305cee | ||
|
|
4626ab1ec4 | ||
|
|
a44b070120 | ||
|
|
1760fb65e2 |
No files matched your search
@@ -0,0 +1,28 @@
|
||||
感谢您提交 Issue,请在提交前仔细阅读以下信息。
|
||||
|
||||
请在阅读完毕后,删除这些文字,并写下对该 Issue 的描述。
|
||||
|
||||
Issue 的内容仅可为
|
||||
* Bug 反馈
|
||||
* 功能申请
|
||||
|
||||
若您希望得到使用指导(譬如如何删除快速搜索),请至 [G+ 社区](https://plus.google.com/u/1/communities/103823982034655188459) 发贴。若有其他问题,可在应用内找到开发者的邮箱地址,使用电子邮件与开发者交流。
|
||||
|
||||
若内容为 Bug 反馈,请先查看 [release 页面](https://github.com/seven332/EhViewer/releases),以帮助确认该 bug 是否存在于最新版中;同时应详细描述 bug 内容与重现方法,必要时可附加截图,但请确定截图符合风序良俗。
|
||||
|
||||
功能申请包括添加新功能与改进现有功能。
|
||||
|
||||
一个 Issue 只包含一个 Bug 反馈或者功能申请。若有多个需求,请提交多个 Issue。
|
||||
|
||||
尽量不提交重复的 Issue,可先进行搜索。对于重复的 Issue,开发者可能会直接关闭并添加 Duplicate 标签。
|
||||
|
||||
|
||||
Thank you for taking the time to submit an issue. Before you proceed, please consider the following.
|
||||
|
||||
An issue can only be about:
|
||||
* Bug Report
|
||||
* Feature Request
|
||||
|
||||
If you need application instructions, please post your question in [G+ community](https://plus.google.com/u/1/communities/103823982034655188459). If you have other questions, please get the developer's email address in the application, and send him/her an email.
|
||||
|
||||
One issue one bug report or feature request.
|
||||
@@ -1,3 +1,5 @@
|
||||
[](https://t.me/ehviewer) [](https://plus.google.com/communities/103823982034655188459)
|
||||
|
||||
# EhViewer
|
||||
|
||||

|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
import com.android.build.gradle.internal.tasks.DefaultAndroidTask
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'android-chinese-string'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
buildToolsVersion "24.0.1"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 24
|
||||
versionCode 66
|
||||
versionName "1.0.13"
|
||||
targetSdkVersion 25
|
||||
versionCode 79
|
||||
versionName "1.0.26"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW"
|
||||
|
||||
jackOptions {
|
||||
enabled true
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
incremental true
|
||||
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
|
||||
"es"
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError true
|
||||
abortOnError false
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -48,8 +43,8 @@ task copyNotice(type: Copy) {
|
||||
finalizedBy ":daogenerator:executeDaoGenerator"
|
||||
}
|
||||
|
||||
tasks.withType(AbstractCompile) {
|
||||
compileTask -> compileTask.dependsOn copyNotice
|
||||
tasks.withType(DefaultAndroidTask) {
|
||||
task -> task.dependsOn copyNotice
|
||||
}
|
||||
|
||||
clean {
|
||||
@@ -58,25 +53,26 @@ clean {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:appcompat-v7:24.1.1'
|
||||
compile 'com.android.support:design:24.1.1'
|
||||
compile "com.android.support:appcompat-v7:$supportLibrary"
|
||||
compile "com.android.support:design:$supportLibrary"
|
||||
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
|
||||
compile 'com.github.seven332:android-recaptcha:2bbb3459a8'
|
||||
compile 'com.github.seven332:animator:0.1.0'
|
||||
compile 'com.github.seven332:beerbelly:0.1.4'
|
||||
compile 'com.github.seven332:conaco:0.1.5-eh'
|
||||
compile 'com.github.seven332:drawerlayout:0.1.0'
|
||||
compile 'com.github.seven332:drawerlayout:0.2.1'
|
||||
compile 'com.github.seven332:easyrecyclerview:0.1.1'
|
||||
compile 'com.github.seven332:glgallery:0.1.2'
|
||||
compile 'com.github.seven332:glview:0.1.0'
|
||||
compile 'com.github.seven332:glview-image:0.1.0'
|
||||
compile 'com.github.seven332:hotspot:0.1.0'
|
||||
compile 'com.github.seven332:image:0.1.12'
|
||||
compile 'com.github.seven332:okhttp:3.4.1-eh'
|
||||
compile 'com.github.seven332:okhttp:3.5.0'
|
||||
compile 'com.github.seven332:refreshlayout:0.1.0'
|
||||
compile 'com.github.seven332:ripple:0.1.1'
|
||||
compile 'com.github.seven332:ripple:0.1.2'
|
||||
compile 'com.github.seven332:streampipe:0.1.0'
|
||||
compile 'com.github.seven332:tuxiang:0.1.2'
|
||||
compile 'com.github.seven332:unifile:0.1.4'
|
||||
compile 'com.github.seven332:unifile:0.2.0'
|
||||
compile 'com.github.seven332:yorozuya:0.1.2'
|
||||
compile 'com.github.seven332:yorozuya-thread:0.1.1'
|
||||
compile 'com.github.seven332:yorozuya-collect:0.1.4'
|
||||
@@ -85,4 +81,14 @@ dependencies {
|
||||
compile 'org.greenrobot:greendao:2.2.0'
|
||||
compile 'org.jsoup:jsoup:1.9.2'
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.robolectric:robolectric:3.4'
|
||||
testCompile 'org.jooq:joor:0.9.6'
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force 'com.github.seven332:glgallery:0f276c0'
|
||||
force 'com.github.seven332:glview-image:4c744db'
|
||||
force 'com.github.seven332:image:bab9b11'
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,14 @@
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||
|
||||
<application
|
||||
android:name="com.hippo.ehviewer.EhApplication"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:allowBackup="true"
|
||||
@@ -51,7 +53,9 @@
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="http"/>
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="exhentai.org"/>
|
||||
<data android:host="e-hentai.org"/>
|
||||
<data android:host="g.e-hentai.org"/>
|
||||
<data android:host="lofi.e-hentai.org"/>
|
||||
</intent-filter>
|
||||
@@ -128,12 +132,18 @@
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/set_pattern_protection"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.UConfigActivity"
|
||||
android:configChanges="screenSize|uiMode"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/u_config"/>
|
||||
|
||||
<service
|
||||
android:name="com.hippo.ehviewer.download.DownloadService"
|
||||
android:label="@string/download_service_label"/>
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:name="com.hippo.content.FileProvider"
|
||||
android:authorities="com.hippo.ehviewer.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
|
||||
@@ -0,0 +1,816 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.content;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ProviderInfo;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
|
||||
import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
||||
|
||||
/**
|
||||
* FileProvider is a special subclass of {@link ContentProvider} that facilitates secure sharing
|
||||
* of files associated with an app by creating a <code>content://</code> {@link Uri} for a file
|
||||
* instead of a <code>file:///</code> {@link Uri}.
|
||||
* <p>
|
||||
* A content URI allows you to grant read and write access using
|
||||
* temporary access permissions. When you create an {@link Intent} containing
|
||||
* a content URI, in order to send the content URI
|
||||
* to a client app, you can also call {@link Intent#setFlags(int) Intent.setFlags()} to add
|
||||
* permissions. These permissions are available to the client app for as long as the stack for
|
||||
* a receiving {@link android.app.Activity} is active. For an {@link Intent} going to a
|
||||
* {@link android.app.Service}, the permissions are available as long as the
|
||||
* {@link android.app.Service} is running.
|
||||
* <p>
|
||||
* In comparison, to control access to a <code>file:///</code> {@link Uri} you have to modify the
|
||||
* file system permissions of the underlying file. The permissions you provide become available to
|
||||
* <em>any</em> app, and remain in effect until you change them. This level of access is
|
||||
* fundamentally insecure.
|
||||
* <p>
|
||||
* The increased level of file access security offered by a content URI
|
||||
* makes FileProvider a key part of Android's security infrastructure.
|
||||
* <p>
|
||||
* This overview of FileProvider includes the following topics:
|
||||
* </p>
|
||||
* <ol>
|
||||
* <li><a href="#ProviderDefinition">Defining a FileProvider</a></li>
|
||||
* <li><a href="#SpecifyFiles">Specifying Available Files</a></li>
|
||||
* <li><a href="#GetUri">Retrieving the Content URI for a File</li>
|
||||
* <li><a href="#Permissions">Granting Temporary Permissions to a URI</a></li>
|
||||
* <li><a href="#ServeUri">Serving a Content URI to Another App</a></li>
|
||||
* </ol>
|
||||
* <h3 id="ProviderDefinition">Defining a FileProvider</h3>
|
||||
* <p>
|
||||
* Since the default functionality of FileProvider includes content URI generation for files, you
|
||||
* don't need to define a subclass in code. Instead, you can include a FileProvider in your app
|
||||
* by specifying it entirely in XML. To specify the FileProvider component itself, add a
|
||||
* <code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code>
|
||||
* element to your app manifest. Set the <code>android:name</code> attribute to
|
||||
* <code>android.support.v4.content.FileProvider</code>. Set the <code>android:authorities</code>
|
||||
* attribute to a URI authority based on a domain you control; for example, if you control the
|
||||
* domain <code>mydomain.com</code> you should use the authority
|
||||
* <code>com.mydomain.fileprovider</code>. Set the <code>android:exported</code> attribute to
|
||||
* <code>false</code>; the FileProvider does not need to be public. Set the
|
||||
* <a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn"
|
||||
* >android:grantUriPermissions</a> attribute to <code>true</code>, to allow you
|
||||
* to grant temporary access to files. For example:
|
||||
* <pre class="prettyprint">
|
||||
*<manifest>
|
||||
* ...
|
||||
* <application>
|
||||
* ...
|
||||
* <provider
|
||||
* android:name="android.support.v4.content.FileProvider"
|
||||
* android:authorities="com.mydomain.fileprovider"
|
||||
* android:exported="false"
|
||||
* android:grantUriPermissions="true">
|
||||
* ...
|
||||
* </provider>
|
||||
* ...
|
||||
* </application>
|
||||
*</manifest></pre>
|
||||
* <p>
|
||||
* If you want to override any of the default behavior of FileProvider methods, extend
|
||||
* the FileProvider class and use the fully-qualified class name in the <code>android:name</code>
|
||||
* attribute of the <code><provider></code> element.
|
||||
* <h3 id="SpecifyFiles">Specifying Available Files</h3>
|
||||
* A FileProvider can only generate a content URI for files in directories that you specify
|
||||
* beforehand. To specify a directory, specify the its storage area and path in XML, using child
|
||||
* elements of the <code><paths></code> element.
|
||||
* For example, the following <code>paths</code> element tells FileProvider that you intend to
|
||||
* request content URIs for the <code>images/</code> subdirectory of your private file area.
|
||||
* <pre class="prettyprint">
|
||||
*<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
* <files-path name="my_images" path="images/"/>
|
||||
* ...
|
||||
*</paths>
|
||||
*</pre>
|
||||
* <p>
|
||||
* The <code><paths></code> element must contain one or more of the following child elements:
|
||||
* </p>
|
||||
* <dl>
|
||||
* <dt>
|
||||
* <pre class="prettyprint">
|
||||
*<files-path name="<i>name</i>" path="<i>path</i>" />
|
||||
*</pre>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* Represents files in the <code>files/</code> subdirectory of your app's internal storage
|
||||
* area. This subdirectory is the same as the value returned by {@link Context#getFilesDir()
|
||||
* Context.getFilesDir()}.
|
||||
* </dd>
|
||||
* <dt>
|
||||
* <pre>
|
||||
*<cache-path name="<i>name</i>" path="<i>path</i>" />
|
||||
*</pre>
|
||||
* <dt>
|
||||
* <dd>
|
||||
* Represents files in the cache subdirectory of your app's internal storage area. The root path
|
||||
* of this subdirectory is the same as the value returned by {@link Context#getCacheDir()
|
||||
* getCacheDir()}.
|
||||
* </dd>
|
||||
* <dt>
|
||||
* <pre class="prettyprint">
|
||||
*<external-path name="<i>name</i>" path="<i>path</i>" />
|
||||
*</pre>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* Represents files in the root of the external storage area. The root path of this subdirectory
|
||||
* is the same as the value returned by
|
||||
* {@link Environment#getExternalStorageDirectory() Environment.getExternalStorageDirectory()}.
|
||||
* </dd>
|
||||
* <dt>
|
||||
* <pre class="prettyprint">
|
||||
*<external-files-path name="<i>name</i>" path="<i>path</i>" />
|
||||
*</pre>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* Represents files in the root of your app's external storage area. The root path of this
|
||||
* subdirectory is the same as the value returned by
|
||||
* {@code Context#getExternalFilesDir(String) Context.getExternalFilesDir(null)}.
|
||||
* </dd>
|
||||
* <dt>
|
||||
* <pre class="prettyprint">
|
||||
*<external-cache-path name="<i>name</i>" path="<i>path</i>" />
|
||||
*</pre>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* Represents files in the root of your app's external cache area. The root path of this
|
||||
* subdirectory is the same as the value returned by
|
||||
* {@link Context#getExternalCacheDir() Context.getExternalCacheDir()}.
|
||||
* </dd>
|
||||
* </dl>
|
||||
* <p>
|
||||
* These child elements all use the same attributes:
|
||||
* </p>
|
||||
* <dl>
|
||||
* <dt>
|
||||
* <code>name="<i>name</i>"</code>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* A URI path segment. To enforce security, this value hides the name of the subdirectory
|
||||
* you're sharing. The subdirectory name for this value is contained in the
|
||||
* <code>path</code> attribute.
|
||||
* </dd>
|
||||
* <dt>
|
||||
* <code>path="<i>path</i>"</code>
|
||||
* </dt>
|
||||
* <dd>
|
||||
* The subdirectory you're sharing. While the <code>name</code> attribute is a URI path
|
||||
* segment, the <code>path</code> value is an actual subdirectory name. Notice that the
|
||||
* value refers to a <b>subdirectory</b>, not an individual file or files. You can't
|
||||
* share a single file by its file name, nor can you specify a subset of files using
|
||||
* wildcards.
|
||||
* </dd>
|
||||
* </dl>
|
||||
* <p>
|
||||
* You must specify a child element of <code><paths></code> for each directory that contains
|
||||
* files for which you want content URIs. For example, these XML elements specify two directories:
|
||||
* <pre class="prettyprint">
|
||||
*<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
* <files-path name="my_images" path="images/"/>
|
||||
* <files-path name="my_docs" path="docs/"/>
|
||||
*</paths>
|
||||
*</pre>
|
||||
* <p>
|
||||
* Put the <code><paths></code> element and its children in an XML file in your project.
|
||||
* For example, you can add them to a new file called <code>res/xml/file_paths.xml</code>.
|
||||
* To link this file to the FileProvider, add a
|
||||
* <a href="{@docRoot}guide/topics/manifest/meta-data-element.html"><meta-data></a> element
|
||||
* as a child of the <code><provider></code> element that defines the FileProvider. Set the
|
||||
* <code><meta-data></code> element's "android:name" attribute to
|
||||
* <code>android.support.FILE_PROVIDER_PATHS</code>. Set the element's "android:resource" attribute
|
||||
* to <code>@xml/file_paths</code> (notice that you don't specify the <code>.xml</code>
|
||||
* extension). For example:
|
||||
* <pre class="prettyprint">
|
||||
*<provider
|
||||
* android:name="android.support.v4.content.FileProvider"
|
||||
* android:authorities="com.mydomain.fileprovider"
|
||||
* android:exported="false"
|
||||
* android:grantUriPermissions="true">
|
||||
* <meta-data
|
||||
* android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
* android:resource="@xml/file_paths" />
|
||||
*</provider>
|
||||
*</pre>
|
||||
* <h3 id="GetUri">Generating the Content URI for a File</h3>
|
||||
* <p>
|
||||
* To share a file with another app using a content URI, your app has to generate the content URI.
|
||||
* To generate the content URI, create a new {@link File} for the file, then pass the {@link File}
|
||||
* to {@link #getUriForFile(Context, String, File) getUriForFile()}. You can send the content URI
|
||||
* returned by {@link #getUriForFile(Context, String, File) getUriForFile()} to another app in an
|
||||
* {@link android.content.Intent}. The client app that receives the content URI can open the file
|
||||
* and access its contents by calling
|
||||
* {@link android.content.ContentResolver#openFileDescriptor(Uri, String)
|
||||
* ContentResolver.openFileDescriptor} to get a {@link ParcelFileDescriptor}.
|
||||
* <p>
|
||||
* For example, suppose your app is offering files to other apps with a FileProvider that has the
|
||||
* authority <code>com.mydomain.fileprovider</code>. To get a content URI for the file
|
||||
* <code>default_image.jpg</code> in the <code>images/</code> subdirectory of your internal storage
|
||||
* add the following code:
|
||||
* <pre class="prettyprint">
|
||||
*File imagePath = new File(Context.getFilesDir(), "images");
|
||||
*File newFile = new File(imagePath, "default_image.jpg");
|
||||
*Uri contentUri = getUriForFile(getContext(), "com.mydomain.fileprovider", newFile);
|
||||
*</pre>
|
||||
* As a result of the previous snippet,
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()} returns the content URI
|
||||
* <code>content://com.mydomain.fileprovider/my_images/default_image.jpg</code>.
|
||||
* <h3 id="Permissions">Granting Temporary Permissions to a URI</h3>
|
||||
* To grant an access permission to a content URI returned from
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()}, do one of the following:
|
||||
* <ul>
|
||||
* <li>
|
||||
* Call the method
|
||||
* {@link Context#grantUriPermission(String, Uri, int)
|
||||
* Context.grantUriPermission(package, Uri, mode_flags)} for the <code>content://</code>
|
||||
* {@link Uri}, using the desired mode flags. This grants temporary access permission for the
|
||||
* content URI to the specified package, according to the value of the
|
||||
* the <code>mode_flags</code> parameter, which you can set to
|
||||
* {@link Intent#FLAG_GRANT_READ_URI_PERMISSION}, {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION}
|
||||
* or both. The permission remains in effect until you revoke it by calling
|
||||
* {@link Context#revokeUriPermission(Uri, int) revokeUriPermission()} or until the device
|
||||
* reboots.
|
||||
* </li>
|
||||
* <li>
|
||||
* Put the content URI in an {@link Intent} by calling {@link Intent#setData(Uri) setData()}.
|
||||
* </li>
|
||||
* <li>
|
||||
* Next, call the method {@link Intent#setFlags(int) Intent.setFlags()} with either
|
||||
* {@link Intent#FLAG_GRANT_READ_URI_PERMISSION} or
|
||||
* {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION} or both.
|
||||
* </li>
|
||||
* <li>
|
||||
* Finally, send the {@link Intent} to
|
||||
* another app. Most often, you do this by calling
|
||||
* {@link android.app.Activity#setResult(int, android.content.Intent) setResult()}.
|
||||
* <p>
|
||||
* Permissions granted in an {@link Intent} remain in effect while the stack of the receiving
|
||||
* {@link android.app.Activity} is active. When the stack finishes, the permissions are
|
||||
* automatically removed. Permissions granted to one {@link android.app.Activity} in a client
|
||||
* app are automatically extended to other components of that app.
|
||||
* </p>
|
||||
* </li>
|
||||
* </ul>
|
||||
* <h3 id="ServeUri">Serving a Content URI to Another App</h3>
|
||||
* <p>
|
||||
* There are a variety of ways to serve the content URI for a file to a client app. One common way
|
||||
* is for the client app to start your app by calling
|
||||
* {@link android.app.Activity#startActivityForResult(Intent, int, Bundle) startActivityResult()},
|
||||
* which sends an {@link Intent} to your app to start an {@link android.app.Activity} in your app.
|
||||
* In response, your app can immediately return a content URI to the client app or present a user
|
||||
* interface that allows the user to pick a file. In the latter case, once the user picks the file
|
||||
* your app can return its content URI. In both cases, your app returns the content URI in an
|
||||
* {@link Intent} sent via {@link android.app.Activity#setResult(int, Intent) setResult()}.
|
||||
* </p>
|
||||
* <p>
|
||||
* You can also put the content URI in a {@link android.content.ClipData} object and then add the
|
||||
* object to an {@link Intent} you send to a client app. To do this, call
|
||||
* {@link Intent#setClipData(ClipData) Intent.setClipData()}. When you use this approach, you can
|
||||
* add multiple {@link android.content.ClipData} objects to the {@link Intent}, each with its own
|
||||
* content URI. When you call {@link Intent#setFlags(int) Intent.setFlags()} on the {@link Intent}
|
||||
* to set temporary access permissions, the same permissions are applied to all of the content
|
||||
* URIs.
|
||||
* </p>
|
||||
* <p class="note">
|
||||
* <strong>Note:</strong> The {@link Intent#setClipData(ClipData) Intent.setClipData()} method is
|
||||
* only available in platform version 16 (Android 4.1) and later. If you want to maintain
|
||||
* compatibility with previous versions, you should send one content URI at a time in the
|
||||
* {@link Intent}. Set the action to {@link Intent#ACTION_SEND} and put the URI in data by calling
|
||||
* {@link Intent#setData setData()}.
|
||||
* </p>
|
||||
* <h3 id="">More Information</h3>
|
||||
* <p>
|
||||
* To learn more about FileProvider, see the Android training class
|
||||
* <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files Securely with URIs</a>.
|
||||
* </p>
|
||||
*/
|
||||
public class FileProvider extends ContentProvider {
|
||||
private static final String[] COLUMNS = {
|
||||
MediaStore.MediaColumns.DISPLAY_NAME,
|
||||
MediaStore.MediaColumns.SIZE,
|
||||
MediaStore.MediaColumns.DATA
|
||||
};
|
||||
|
||||
private static final String
|
||||
META_DATA_FILE_PROVIDER_PATHS = "android.support.FILE_PROVIDER_PATHS";
|
||||
|
||||
private static final String TAG_ROOT_PATH = "root-path";
|
||||
private static final String TAG_FILES_PATH = "files-path";
|
||||
private static final String TAG_CACHE_PATH = "cache-path";
|
||||
private static final String TAG_EXTERNAL = "external-path";
|
||||
private static final String TAG_EXTERNAL_FILES = "external-files-path";
|
||||
private static final String TAG_EXTERNAL_CACHE = "external-cache-path";
|
||||
|
||||
private static final String ATTR_NAME = "name";
|
||||
private static final String ATTR_PATH = "path";
|
||||
|
||||
private static final File DEVICE_ROOT = new File("/");
|
||||
|
||||
// @GuardedBy("sCache")
|
||||
private static HashMap<String, PathStrategy> sCache = new HashMap<String, PathStrategy>();
|
||||
|
||||
private PathStrategy mStrategy;
|
||||
|
||||
/**
|
||||
* The default FileProvider implementation does not need to be initialized. If you want to
|
||||
* override this method, you must provide your own subclass of FileProvider.
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* After the FileProvider is instantiated, this method is called to provide the system with
|
||||
* information about the provider.
|
||||
*
|
||||
* @param context A {@link Context} for the current component.
|
||||
* @param info A {@link ProviderInfo} for the new provider.
|
||||
*/
|
||||
@Override
|
||||
public void attachInfo(Context context, ProviderInfo info) {
|
||||
super.attachInfo(context, info);
|
||||
|
||||
// Sanity check our security
|
||||
if (info.exported) {
|
||||
throw new SecurityException("Provider must not be exported");
|
||||
}
|
||||
if (!info.grantUriPermissions) {
|
||||
throw new SecurityException("Provider must grant uri permissions");
|
||||
}
|
||||
|
||||
mStrategy = getPathStrategy(context, info.authority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a content URI for a given {@link File}. Specific temporary
|
||||
* permissions for the content URI can be set with
|
||||
* {@link Context#grantUriPermission(String, Uri, int)}, or added
|
||||
* to an {@link Intent} by calling {@link Intent#setData(Uri) setData()} and then
|
||||
* {@link Intent#setFlags(int) setFlags()}; in both cases, the applicable flags are
|
||||
* {@link Intent#FLAG_GRANT_READ_URI_PERMISSION} and
|
||||
* {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION}. A FileProvider can only return a
|
||||
* <code>content</code> {@link Uri} for file paths defined in their <code><paths></code>
|
||||
* meta-data element. See the Class Overview for more information.
|
||||
*
|
||||
* @param context A {@link Context} for the current component.
|
||||
* @param authority The authority of a {@link FileProvider} defined in a
|
||||
* {@code <provider>} element in your app's manifest.
|
||||
* @param file A {@link File} pointing to the filename for which you want a
|
||||
* <code>content</code> {@link Uri}.
|
||||
* @return A content URI for the file.
|
||||
* @throws IllegalArgumentException When the given {@link File} is outside
|
||||
* the paths supported by the provider.
|
||||
*/
|
||||
public static Uri getUriForFile(Context context, String authority, File file) {
|
||||
final PathStrategy strategy = getPathStrategy(context, authority);
|
||||
return strategy.getUriForFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a content URI returned by
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()} to get information about a file
|
||||
* managed by the FileProvider.
|
||||
* FileProvider reports the column names defined in {@link android.provider.MediaStore.MediaColumns}:
|
||||
* <ul>
|
||||
* <li>{@link android.provider.MediaStore.MediaColumns#DISPLAY_NAME}</li>
|
||||
* <li>{@link android.provider.MediaStore.MediaColumns#SIZE}</li>
|
||||
* <li>{@link android.provider.MediaStore.MediaColumns#DATA}</li>
|
||||
* </ul>
|
||||
* For more information, see
|
||||
* {@link ContentProvider#query(Uri, String[], String, String[], String)
|
||||
* ContentProvider.query()}.
|
||||
*
|
||||
* @param uri A content URI returned by {@link #getUriForFile}.
|
||||
* @param projection The list of columns to put into the {@link Cursor}. If null all columns are
|
||||
* included.
|
||||
* @param selection Selection criteria to apply. If null then all data that matches the content
|
||||
* URI is returned.
|
||||
* @param selectionArgs An array of {@link java.lang.String}, containing arguments to bind to
|
||||
* the <i>selection</i> parameter. The <i>query</i> method scans <i>selection</i> from left to
|
||||
* right and iterates through <i>selectionArgs</i>, replacing the current "?" character in
|
||||
* <i>selection</i> with the value at the current position in <i>selectionArgs</i>. The
|
||||
* values are bound to <i>selection</i> as {@link java.lang.String} values.
|
||||
* @param sortOrder A {@link java.lang.String} containing the column name(s) on which to sort
|
||||
* the resulting {@link Cursor}.
|
||||
* @return A {@link Cursor} containing the results of the query.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
|
||||
String sortOrder) {
|
||||
// ContentProvider has already checked granted permissions
|
||||
final File file = mStrategy.getFileForUri(uri);
|
||||
|
||||
if (projection == null) {
|
||||
projection = COLUMNS;
|
||||
}
|
||||
|
||||
String[] cols = new String[projection.length];
|
||||
Object[] values = new Object[projection.length];
|
||||
int i = 0;
|
||||
for (String col : projection) {
|
||||
if (MediaStore.MediaColumns.DISPLAY_NAME.equals(col)) {
|
||||
cols[i] = MediaStore.MediaColumns.DISPLAY_NAME;
|
||||
values[i++] = file.getName();
|
||||
} else if (MediaStore.MediaColumns.SIZE.equals(col)) {
|
||||
cols[i] = MediaStore.MediaColumns.SIZE;
|
||||
values[i++] = file.length();
|
||||
} else if (MediaStore.MediaColumns.DATA.equals(col)) {
|
||||
cols[i] = MediaStore.MediaColumns.DATA;
|
||||
values[i++] = file.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
cols = copyOf(cols, i);
|
||||
values = copyOf(values, i);
|
||||
|
||||
final MatrixCursor cursor = new MatrixCursor(cols, 1);
|
||||
cursor.addRow(values);
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the MIME type of a content URI returned by
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()}.
|
||||
*
|
||||
* @param uri A content URI returned by
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()}.
|
||||
* @return If the associated file has an extension, the MIME type associated with that
|
||||
* extension; otherwise <code>application/octet-stream</code>.
|
||||
*/
|
||||
@Override
|
||||
public String getType(Uri uri) {
|
||||
// ContentProvider has already checked granted permissions
|
||||
final File file = mStrategy.getFileForUri(uri);
|
||||
|
||||
final int lastDot = file.getName().lastIndexOf('.');
|
||||
if (lastDot >= 0) {
|
||||
final String extension = file.getName().substring(lastDot + 1);
|
||||
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
|
||||
if (mime != null) {
|
||||
return mime;
|
||||
}
|
||||
}
|
||||
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, this method throws an {@link java.lang.UnsupportedOperationException}. You must
|
||||
* subclass FileProvider if you want to provide different functionality.
|
||||
*/
|
||||
@Override
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
throw new UnsupportedOperationException("No external inserts");
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, this method throws an {@link java.lang.UnsupportedOperationException}. You must
|
||||
* subclass FileProvider if you want to provide different functionality.
|
||||
*/
|
||||
@Override
|
||||
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||
throw new UnsupportedOperationException("No external updates");
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the file associated with the specified content URI, as
|
||||
* returned by {@link #getUriForFile(Context, String, File) getUriForFile()}. Notice that this
|
||||
* method does <b>not</b> throw an {@link java.io.IOException}; you must check its return value.
|
||||
*
|
||||
* @param uri A content URI for a file, as returned by
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()}.
|
||||
* @param selection Ignored. Set to {@code null}.
|
||||
* @param selectionArgs Ignored. Set to {@code null}.
|
||||
* @return 1 if the delete succeeds; otherwise, 0.
|
||||
*/
|
||||
@Override
|
||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||
// ContentProvider has already checked granted permissions
|
||||
final File file = mStrategy.getFileForUri(uri);
|
||||
return file.delete() ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, FileProvider automatically returns the
|
||||
* {@link ParcelFileDescriptor} for a file associated with a <code>content://</code>
|
||||
* {@link Uri}. To get the {@link ParcelFileDescriptor}, call
|
||||
* {@link android.content.ContentResolver#openFileDescriptor(Uri, String)
|
||||
* ContentResolver.openFileDescriptor}.
|
||||
*
|
||||
* To override this method, you must provide your own subclass of FileProvider.
|
||||
*
|
||||
* @param uri A content URI associated with a file, as returned by
|
||||
* {@link #getUriForFile(Context, String, File) getUriForFile()}.
|
||||
* @param mode Access mode for the file. May be "r" for read-only access, "rw" for read and
|
||||
* write access, or "rwt" for read and write access that truncates any existing file.
|
||||
* @return A new {@link ParcelFileDescriptor} with which you can access the file.
|
||||
*/
|
||||
@Override
|
||||
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
|
||||
// ContentProvider has already checked granted permissions
|
||||
final File file = mStrategy.getFileForUri(uri);
|
||||
final int fileMode = modeToMode(mode);
|
||||
return ParcelFileDescriptor.open(file, fileMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@link PathStrategy} for given authority, either by parsing or
|
||||
* returning from cache.
|
||||
*/
|
||||
private static PathStrategy getPathStrategy(Context context, String authority) {
|
||||
PathStrategy strat;
|
||||
synchronized (sCache) {
|
||||
strat = sCache.get(authority);
|
||||
if (strat == null) {
|
||||
try {
|
||||
strat = parsePathStrategy(context, authority);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Failed to parse " + META_DATA_FILE_PROVIDER_PATHS + " meta-data", e);
|
||||
} catch (XmlPullParserException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Failed to parse " + META_DATA_FILE_PROVIDER_PATHS + " meta-data", e);
|
||||
}
|
||||
sCache.put(authority, strat);
|
||||
}
|
||||
}
|
||||
return strat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse and return {@link PathStrategy} for given authority as defined in
|
||||
* {@link #META_DATA_FILE_PROVIDER_PATHS} {@code <meta-data>}.
|
||||
*
|
||||
* @see #getPathStrategy(Context, String)
|
||||
*/
|
||||
private static PathStrategy parsePathStrategy(Context context, String authority)
|
||||
throws IOException, XmlPullParserException {
|
||||
final SimplePathStrategy strat = new SimplePathStrategy(authority);
|
||||
|
||||
final ProviderInfo info = context.getPackageManager()
|
||||
.resolveContentProvider(authority, PackageManager.GET_META_DATA);
|
||||
final XmlResourceParser in = info.loadXmlMetaData(
|
||||
context.getPackageManager(), META_DATA_FILE_PROVIDER_PATHS);
|
||||
if (in == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Missing " + META_DATA_FILE_PROVIDER_PATHS + " meta-data");
|
||||
}
|
||||
|
||||
int type;
|
||||
while ((type = in.next()) != END_DOCUMENT) {
|
||||
if (type == START_TAG) {
|
||||
final String tag = in.getName();
|
||||
|
||||
final String name = in.getAttributeValue(null, ATTR_NAME);
|
||||
String path = in.getAttributeValue(null, ATTR_PATH);
|
||||
|
||||
File target = null;
|
||||
if (TAG_ROOT_PATH.equals(tag)) {
|
||||
target = DEVICE_ROOT;
|
||||
} else if (TAG_FILES_PATH.equals(tag)) {
|
||||
target = context.getFilesDir();
|
||||
} else if (TAG_CACHE_PATH.equals(tag)) {
|
||||
target = context.getCacheDir();
|
||||
} else if (TAG_EXTERNAL.equals(tag)) {
|
||||
target = Environment.getExternalStorageDirectory();
|
||||
} else if (TAG_EXTERNAL_FILES.equals(tag)) {
|
||||
File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(context, null);
|
||||
if (externalFilesDirs.length > 0) {
|
||||
target = externalFilesDirs[0];
|
||||
}
|
||||
} else if (TAG_EXTERNAL_CACHE.equals(tag)) {
|
||||
File[] externalCacheDirs = ContextCompat.getExternalCacheDirs(context);
|
||||
if (externalCacheDirs.length > 0) {
|
||||
target = externalCacheDirs[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (target != null) {
|
||||
strat.addRoot(name, buildPath(target, path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strategy for mapping between {@link File} and {@link Uri}.
|
||||
* <p>
|
||||
* Strategies must be symmetric so that mapping a {@link File} to a
|
||||
* {@link Uri} and then back to a {@link File} points at the original
|
||||
* target.
|
||||
* <p>
|
||||
* Strategies must remain consistent across app launches, and not rely on
|
||||
* dynamic state. This ensures that any generated {@link Uri} can still be
|
||||
* resolved if your process is killed and later restarted.
|
||||
*
|
||||
* @see SimplePathStrategy
|
||||
*/
|
||||
interface PathStrategy {
|
||||
/**
|
||||
* Return a {@link Uri} that represents the given {@link File}.
|
||||
*/
|
||||
public Uri getUriForFile(File file);
|
||||
|
||||
/**
|
||||
* Return a {@link File} that represents the given {@link Uri}.
|
||||
*/
|
||||
public File getFileForUri(Uri uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strategy that provides access to files living under a narrow whitelist of
|
||||
* filesystem roots. It will throw {@link SecurityException} if callers try
|
||||
* accessing files outside the configured roots.
|
||||
* <p>
|
||||
* For example, if configured with
|
||||
* {@code addRoot("myfiles", context.getFilesDir())}, then
|
||||
* {@code context.getFileStreamPath("foo.txt")} would map to
|
||||
* {@code content://myauthority/myfiles/foo.txt}.
|
||||
*/
|
||||
static class SimplePathStrategy implements PathStrategy {
|
||||
private final String mAuthority;
|
||||
private final HashMap<String, File> mRoots = new HashMap<String, File>();
|
||||
|
||||
public SimplePathStrategy(String authority) {
|
||||
mAuthority = authority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mapping from a name to a filesystem root. The provider only offers
|
||||
* access to files that live under configured roots.
|
||||
*/
|
||||
public void addRoot(String name, File root) {
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
throw new IllegalArgumentException("Name must not be empty");
|
||||
}
|
||||
|
||||
try {
|
||||
// Resolve to canonical path to keep path checking fast
|
||||
root = root.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Failed to resolve canonical path for " + root, e);
|
||||
}
|
||||
|
||||
mRoots.put(name, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getUriForFile(File file) {
|
||||
String path;
|
||||
try {
|
||||
path = file.getCanonicalPath();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
|
||||
}
|
||||
|
||||
// Find the most-specific root path
|
||||
Map.Entry<String, File> mostSpecific = null;
|
||||
for (Map.Entry<String, File> root : mRoots.entrySet()) {
|
||||
final String rootPath = root.getValue().getPath();
|
||||
if (path.startsWith(rootPath) && (mostSpecific == null
|
||||
|| rootPath.length() > mostSpecific.getValue().getPath().length())) {
|
||||
mostSpecific = root;
|
||||
}
|
||||
}
|
||||
|
||||
if (mostSpecific == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Failed to find configured root that contains " + path);
|
||||
}
|
||||
|
||||
// Start at first char of path under root
|
||||
final String rootPath = mostSpecific.getValue().getPath();
|
||||
if (rootPath.endsWith("/")) {
|
||||
path = path.substring(rootPath.length());
|
||||
} else {
|
||||
path = path.substring(rootPath.length() + 1);
|
||||
}
|
||||
|
||||
// Encode the tag and path separately
|
||||
path = Uri.encode(mostSpecific.getKey()) + '/' + Uri.encode(path, "/");
|
||||
return new Uri.Builder().scheme("content")
|
||||
.authority(mAuthority).encodedPath(path).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFileForUri(Uri uri) {
|
||||
String path = uri.getEncodedPath();
|
||||
|
||||
final int splitIndex = path.indexOf('/', 1);
|
||||
final String tag = Uri.decode(path.substring(1, splitIndex));
|
||||
path = Uri.decode(path.substring(splitIndex + 1));
|
||||
|
||||
final File root = mRoots.get(tag);
|
||||
if (root == null) {
|
||||
throw new IllegalArgumentException("Unable to find configured root for " + uri);
|
||||
}
|
||||
|
||||
File file = new File(root, path);
|
||||
try {
|
||||
file = file.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
|
||||
}
|
||||
|
||||
if (!file.getPath().startsWith(root.getPath())) {
|
||||
throw new SecurityException("Resolved path jumped beyond configured root");
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from ContentResolver.java
|
||||
*/
|
||||
private static int modeToMode(String mode) {
|
||||
int modeBits;
|
||||
if ("r".equals(mode)) {
|
||||
modeBits = ParcelFileDescriptor.MODE_READ_ONLY;
|
||||
} else if ("w".equals(mode) || "wt".equals(mode)) {
|
||||
modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
|
||||
| ParcelFileDescriptor.MODE_CREATE
|
||||
| ParcelFileDescriptor.MODE_TRUNCATE;
|
||||
} else if ("wa".equals(mode)) {
|
||||
modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
|
||||
| ParcelFileDescriptor.MODE_CREATE
|
||||
| ParcelFileDescriptor.MODE_APPEND;
|
||||
} else if ("rw".equals(mode)) {
|
||||
modeBits = ParcelFileDescriptor.MODE_READ_WRITE
|
||||
| ParcelFileDescriptor.MODE_CREATE;
|
||||
} else if ("rwt".equals(mode)) {
|
||||
modeBits = ParcelFileDescriptor.MODE_READ_WRITE
|
||||
| ParcelFileDescriptor.MODE_CREATE
|
||||
| ParcelFileDescriptor.MODE_TRUNCATE;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid mode: " + mode);
|
||||
}
|
||||
return modeBits;
|
||||
}
|
||||
|
||||
private static File buildPath(File base, String... segments) {
|
||||
File cur = base;
|
||||
for (String segment : segments) {
|
||||
if (segment != null) {
|
||||
cur = new File(cur, segment);
|
||||
}
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
||||
private static String[] copyOf(String[] original, int newLength) {
|
||||
final String[] result = new String[newLength];
|
||||
System.arraycopy(original, 0, result, 0, newLength);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Object[] copyOf(Object[] original, int newLength) {
|
||||
final Object[] result = new Object[newLength];
|
||||
System.arraycopy(original, 0, result, 0, newLength);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.database;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/3.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.SparseArray;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MSQLiteBuilder {
|
||||
|
||||
public static final String COLUMN_ID = "_id";
|
||||
|
||||
private static final Map<Class, String> JAVA_TYPE_TO_SQLITE_TYPE = new HashMap<>();
|
||||
|
||||
static {
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(boolean.class, "INTEGER NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(byte.class, "INTEGER NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(short.class, "INTEGER NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(int.class, "INTEGER NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(long.class, "INTEGER NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(float.class, "REAL NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(double.class, "REAL NOT NULL DEFAULT 0");
|
||||
JAVA_TYPE_TO_SQLITE_TYPE.put(String.class, "TEXT");
|
||||
}
|
||||
|
||||
private static String javaTypeToSQLiteType(Class clazz) {
|
||||
String type = JAVA_TYPE_TO_SQLITE_TYPE.get(clazz);
|
||||
if (type == null) {
|
||||
throw new IllegalStateException("Unknown type: " + clazz);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
private int version = 0;
|
||||
private List<String> statements;
|
||||
private SparseArray<List<String>> statementsMap = new SparseArray<>();
|
||||
|
||||
/**
|
||||
* Bump database version.
|
||||
*/
|
||||
public MSQLiteBuilder version(int version) {
|
||||
if (version <= this.version) {
|
||||
throw new IllegalStateException("New version must be bigger than current version. "
|
||||
+ "current version: " + this.version + ", new version: " + version + ".");
|
||||
}
|
||||
this.version = version;
|
||||
this.statements = new ArrayList<>();
|
||||
this.statementsMap.put(version, this.statements);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a table with int {@link #COLUMN_ID} primary key.
|
||||
*/
|
||||
public MSQLiteBuilder createTable(String table) {
|
||||
return createTable(table, COLUMN_ID, int.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a table.
|
||||
*/
|
||||
public MSQLiteBuilder createTable(String table, String column, Class clazz) {
|
||||
return statement("CREATE TABLE " + table + " (" + column + " " + javaTypeToSQLiteType(clazz) + " PRIMARY KEY);");
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a table.
|
||||
*/
|
||||
public MSQLiteBuilder dropTable(String table) {
|
||||
return statement("DROP TABLE " + table + ";");
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a column to the table.
|
||||
*/
|
||||
public MSQLiteBuilder insertColumn(String table, String column, Class clazz) {
|
||||
return statement("ALTER TABLE " + table + " ADD COLUMN " + column + " " + javaTypeToSQLiteType(clazz) + ";");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a statement.
|
||||
*/
|
||||
public MSQLiteBuilder statement(String statement) {
|
||||
if (version == 0 || statements == null) {
|
||||
throw new IllegalStateException("Call version() first!");
|
||||
}
|
||||
statements.add(statement);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a SQLiteOpenHelper from it.
|
||||
*/
|
||||
public SQLiteOpenHelper build(Context context, String name, int version) {
|
||||
return new MSQLiteOpenHelper(context, name, version, this);
|
||||
}
|
||||
|
||||
List<String> getStatements(int oldVersion, int newVersion) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for (int i = oldVersion + 1; i <= newVersion; ++i) {
|
||||
List<String> list = statementsMap.get(i);
|
||||
if (list != null) {
|
||||
result.addAll(list);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.database;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import com.hippo.util.SqlUtils;
|
||||
|
||||
class MSQLiteOpenHelper extends SQLiteOpenHelper {
|
||||
|
||||
private final int version;
|
||||
private final MSQLiteBuilder builder;
|
||||
|
||||
public MSQLiteOpenHelper(Context context, String name, int version, MSQLiteBuilder builder) {
|
||||
super(context, name, null, version);
|
||||
this.version = version;
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
onUpgrade(db, 0, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
for (String command : builder.getStatements(oldVersion, newVersion)) {
|
||||
db.execSQL(command);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
SqlUtils.dropAllTable(db);
|
||||
onCreate(db);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.drawable;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/6.
|
||||
*/
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class TextDrawable extends Drawable {
|
||||
|
||||
private static final float STANDARD_TEXT_SIZE = 1000.0f;
|
||||
private static final Paint STANDARD_PAINT = new Paint();
|
||||
|
||||
static {
|
||||
STANDARD_PAINT.setTextSize(STANDARD_TEXT_SIZE);
|
||||
}
|
||||
|
||||
private String text;
|
||||
private float contentPercent;
|
||||
|
||||
private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
private int textColor = Color.BLACK;
|
||||
private int backgroundColor = Color.BLACK;
|
||||
|
||||
private float x = 0.0f;
|
||||
private float y = 0.0f;
|
||||
private boolean textSizeDirty = false;
|
||||
private Rect textBounds = new Rect();
|
||||
|
||||
public TextDrawable(String text, float contentPercent) {
|
||||
this.text = text;
|
||||
this.contentPercent = contentPercent;
|
||||
STANDARD_PAINT.getTextBounds(text, 0, text.length(), textBounds);
|
||||
}
|
||||
|
||||
public int getTextColor() {
|
||||
return textColor;
|
||||
}
|
||||
|
||||
public void setTextColor(int textColor) {
|
||||
if (this.textColor != textColor) {
|
||||
this.textColor = textColor;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int backgroundColor) {
|
||||
if (this.backgroundColor != backgroundColor) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
super.onBoundsChange(bounds);
|
||||
textSizeDirty = true;
|
||||
}
|
||||
|
||||
private void updateTextSizeIfDirty(Rect bounds) {
|
||||
if (!textSizeDirty) {
|
||||
return;
|
||||
}
|
||||
textSizeDirty = false;
|
||||
|
||||
int contentWidth = (int) (bounds.width() * contentPercent);
|
||||
int contentHeight = (int) (bounds.height() * contentPercent);
|
||||
float widthRatio = (float) contentWidth / (float) textBounds.width();
|
||||
float heightRatio = (float) contentHeight / (float) textBounds.height();
|
||||
float ratio = Math.min(widthRatio, heightRatio);
|
||||
float textSize = STANDARD_TEXT_SIZE * ratio;
|
||||
textPaint.setTextSize(textSize);
|
||||
x = (bounds.width() - textBounds.width() * ratio) / 2 - textBounds.left * ratio;
|
||||
y = (bounds.height() - textBounds.height() * ratio) / 2 - textBounds.top * ratio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
Rect bounds = getBounds();
|
||||
if (!bounds.isEmpty()) {
|
||||
// Draw background
|
||||
backgroundPaint.setColor(backgroundColor);
|
||||
canvas.drawRect(bounds, backgroundPaint);
|
||||
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
// Draw text
|
||||
updateTextSizeIfDirty(bounds);
|
||||
textPaint.setColor(textColor);
|
||||
canvas.drawText(text, x, y, textPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(@IntRange(from = 0, to = 255) int alpha) {}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(@Nullable ColorFilter colorFilter) {
|
||||
backgroundPaint.setColorFilter(colorFilter);
|
||||
textPaint.setColorFilter(colorFilter);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return PixelFormat.TRANSLUCENT;
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ import com.hippo.conaco.Conaco;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhEngine;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.ehviewer.spider.SpiderDen;
|
||||
@@ -40,7 +39,6 @@ import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.image.Image;
|
||||
import com.hippo.image.ImageBitmap;
|
||||
import com.hippo.network.StatusCodeException;
|
||||
import com.hippo.okhttp.CookieDB;
|
||||
import com.hippo.scene.SceneApplication;
|
||||
import com.hippo.text.Html;
|
||||
import com.hippo.unifile.UniFile;
|
||||
@@ -54,12 +52,10 @@ import com.hippo.yorozuya.SimpleHandler;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class EhApplication extends SceneApplication implements Thread.UncaughtExceptionHandler {
|
||||
@@ -76,7 +72,7 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
private Thread.UncaughtExceptionHandler mDefaultHandler;
|
||||
|
||||
private final IntIdGenerator mIdGenerator = new IntIdGenerator();
|
||||
private final WeakHashMap<Integer, Object> mGlobalStuffMap = new WeakHashMap<>();
|
||||
private final HashMap<Integer, Object> mGlobalStuffMap = new HashMap<>();
|
||||
private EhCookieStore mEhCookieStore;
|
||||
private EhClient mEhClient;
|
||||
private OkHttpClient mOkHttpClient;
|
||||
@@ -97,7 +93,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
super.onCreate();
|
||||
|
||||
GetText.initialize(this);
|
||||
CookieDB.initialize(this);
|
||||
StatusCodeException.initialize(this);
|
||||
Settings.initialize(this);
|
||||
ReadableTime.initialize(this);
|
||||
@@ -159,29 +154,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
if (version < 52) {
|
||||
Settings.putGuideGallery(true);
|
||||
}
|
||||
if (version < 56) { // Make cookie long live
|
||||
HttpUrl eUrl = HttpUrl.parse(EhUrl.HOST_E);
|
||||
HttpUrl exUrl = HttpUrl.parse(EhUrl.HOST_EX);
|
||||
EhCookieStore cookieStore = getEhCookieStore(this);
|
||||
|
||||
Cookie c;
|
||||
c = cookieStore.get(eUrl, EhCookieStore.KEY_IPD_MEMBER_ID);
|
||||
if (null != c) {
|
||||
cookieStore.add(EhCookieStore.newCookie(c, c.domain(), true, true, true));
|
||||
}
|
||||
c = cookieStore.get(eUrl, EhCookieStore.KEY_IPD_PASS_HASH);
|
||||
if (null != c) {
|
||||
cookieStore.add(EhCookieStore.newCookie(c, c.domain(), true, true, true));
|
||||
}
|
||||
c = cookieStore.get(exUrl, EhCookieStore.KEY_IPD_MEMBER_ID);
|
||||
if (null != c) {
|
||||
cookieStore.add(EhCookieStore.newCookie(c, c.domain(), true, true, true));
|
||||
}
|
||||
c = cookieStore.get(exUrl, EhCookieStore.KEY_IPD_PASS_HASH);
|
||||
if (null != c) {
|
||||
cookieStore.add(EhCookieStore.newCookie(c, c.domain(), true, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearMemoryCache() {
|
||||
@@ -243,7 +215,7 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
public static EhCookieStore getEhCookieStore(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
if (application.mEhCookieStore == null) {
|
||||
application.mEhCookieStore = new EhCookieStore();
|
||||
application.mEhCookieStore = new EhCookieStore(context);
|
||||
}
|
||||
return application.mEhCookieStore;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,19 @@ public class EhDB {
|
||||
switch (oldVersion) {
|
||||
case 1: // 1 to 2
|
||||
FilterDao.createTable(db, true);
|
||||
break;
|
||||
case 2: // add ENABLE column to table FILTER
|
||||
db.execSQL("CREATE TABLE " + "\"FILTER2\" (" +
|
||||
"\"_id\" INTEGER PRIMARY KEY ," +
|
||||
"\"MODE\" INTEGER NOT NULL ," +
|
||||
"\"TEXT\" TEXT," +
|
||||
"\"ENABLE\" INTEGER);");
|
||||
db.execSQL("INSERT INTO \"FILTER2\" (" +
|
||||
"_id, MODE, TEXT, ENABLE)" +
|
||||
"SELECT _id, MODE, TEXT, 1 FROM FILTER;");
|
||||
db.execSQL("DROP TABLE FILTER");
|
||||
db.execSQL("ALTER TABLE FILTER2 RENAME TO FILTER");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +462,7 @@ public class EhDB {
|
||||
|
||||
public static synchronized List<GalleryInfo> getAllLocalFavorites() {
|
||||
LocalFavoritesDao dao = sDaoSession.getLocalFavoritesDao();
|
||||
List<LocalFavoriteInfo> list = dao.queryBuilder().orderAsc(LocalFavoritesDao.Properties.Time).list();
|
||||
List<LocalFavoriteInfo> list = dao.queryBuilder().orderDesc(LocalFavoritesDao.Properties.Time).list();
|
||||
List<GalleryInfo> result = new ArrayList<>();
|
||||
result.addAll(list);
|
||||
return result;
|
||||
@@ -458,7 +471,7 @@ public class EhDB {
|
||||
public static synchronized List<GalleryInfo> searchLocalFavorites(String query) {
|
||||
query = SqlUtils.sqlEscapeString("%" + query+ "%");
|
||||
LocalFavoritesDao dao = sDaoSession.getLocalFavoritesDao();
|
||||
List<LocalFavoriteInfo> list = dao.queryBuilder().orderAsc(LocalFavoritesDao.Properties.Time)
|
||||
List<LocalFavoriteInfo> list = dao.queryBuilder().orderDesc(LocalFavoritesDao.Properties.Time)
|
||||
.where(LocalFavoritesDao.Properties.Title.like(query)).list();
|
||||
List<GalleryInfo> result = new ArrayList<>();
|
||||
result.addAll(list);
|
||||
@@ -606,6 +619,11 @@ public class EhDB {
|
||||
sDaoSession.getFilterDao().delete(filter);
|
||||
}
|
||||
|
||||
public static synchronized void triggerFilter(Filter filter) {
|
||||
filter.setEnable(!filter.enable);
|
||||
sDaoSession.getFilterDao().update(filter);
|
||||
}
|
||||
|
||||
public static synchronized boolean exportDB(Context context, File file) {
|
||||
File dbFile = context.getDatabasePath("eh.db");
|
||||
if (null == dbFile || !dbFile.isFile()) {
|
||||
|
||||
@@ -300,6 +300,13 @@ public class Settings {
|
||||
return getIntFromStr(KEY_THUMB_RESOLUTION, DEFAULT_THUMB_RESOLUTION);
|
||||
}
|
||||
|
||||
private static final String KEY_FIX_THUMB_URL = "fix_thumb_url";
|
||||
private static final boolean DEFAULT_FIX_THUMB_URL = false;
|
||||
|
||||
public static boolean getFixThumbUrl() {
|
||||
return getBoolean(KEY_FIX_THUMB_URL, DEFAULT_FIX_THUMB_URL);
|
||||
}
|
||||
|
||||
private static final String KEY_SHOW_JPN_TITLE = "show_jpn_title";
|
||||
private static final boolean DEFAULT_SHOW_JPN_TITLE = false;
|
||||
|
||||
@@ -513,6 +520,17 @@ public class Settings {
|
||||
putBoolean(KEY_SHOW_BATTERY, value);
|
||||
}
|
||||
|
||||
private static final String KEY_SHOW_PAGE_INTERVAL = "gallery_show_page_interval";
|
||||
private static final boolean DEFAULT_SHOW_PAGE_INTERVAL = true;
|
||||
|
||||
public static boolean getShowPageInterval() {
|
||||
return getBoolean(KEY_SHOW_PAGE_INTERVAL, DEFAULT_SHOW_PAGE_INTERVAL);
|
||||
}
|
||||
|
||||
public static void putShowPageInterval(boolean value) {
|
||||
putBoolean(KEY_SHOW_PAGE_INTERVAL, value);
|
||||
}
|
||||
|
||||
private static final String KEY_VOLUME_PAGE = "volume_page";
|
||||
private static final boolean DEFAULT_VOLUME_PAGE = false;
|
||||
|
||||
@@ -904,6 +922,16 @@ public class Settings {
|
||||
putString(KEY_SECURITY, value);
|
||||
}
|
||||
|
||||
public static final String KEY_ENABLE_FINGERPRINT = "enable_fingerprint";
|
||||
|
||||
public static boolean getEnableFingerprint() {
|
||||
return getBoolean(KEY_ENABLE_FINGERPRINT, false);
|
||||
}
|
||||
|
||||
public static void putEnableFingerprint(boolean value) {
|
||||
putBoolean(KEY_ENABLE_FINGERPRINT, value);
|
||||
}
|
||||
|
||||
public static final String KEY_READ_CACHE_SIZE = "read_cache_size";
|
||||
public static final int DEFAULT_READ_CACHE_SIZE = 160;
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ public class EhClient {
|
||||
public static final int METHOD_GET_PROFILE = 14;
|
||||
public static final int METHOD_VOTE_COMMENT = 15;
|
||||
public static final int METHOD_IMAGE_SEARCH = 16;
|
||||
public static final int METHOD_ARCHIVE_LIST = 17;
|
||||
public static final int METHOD_DOWNLOAD_ARCHIVE = 18;
|
||||
|
||||
private final ThreadPoolExecutor mRequestThreadPool;
|
||||
private final OkHttpClient mOkHttpClient;
|
||||
@@ -151,7 +153,7 @@ public class EhClient {
|
||||
try {
|
||||
switch (mMethod) {
|
||||
case METHOD_SIGN_IN:
|
||||
return EhEngine.signIn(this, mOkHttpClient, (String) params[0], (String) params[1]);
|
||||
return EhEngine.signIn(this, mOkHttpClient, (String) params[0], (String) params[1], (String) params[2], (String) params[3]);
|
||||
case METHOD_GET_GALLERY_LIST:
|
||||
return EhEngine.getGalleryList(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_FILL_GALLERY_LIST_BY_API:
|
||||
@@ -184,6 +186,10 @@ public class EhClient {
|
||||
return EhEngine.voteComment(this, mOkHttpClient, (Long) params[0], (String) params[1], (Long) params[2], (String) params[3], (Long) params[4], (Integer) params[5]);
|
||||
case METHOD_IMAGE_SEARCH:
|
||||
return EhEngine.imageSearch(this, mOkHttpClient, (File) params[0], (Boolean) params[1], (Boolean) params[2], (Boolean) params[3]);
|
||||
case METHOD_ARCHIVE_LIST:
|
||||
return EhEngine.getArchiveList(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_DOWNLOAD_ARCHIVE:
|
||||
return EhEngine.downloadArchive(this, mOkHttpClient, (Long) params[0], (String) params[1], (String) params[2], (String) params[3]);
|
||||
default:
|
||||
return new IllegalStateException("Can't detect method " + mMethod);
|
||||
}
|
||||
|
||||
@@ -299,6 +299,7 @@ public class EhConfig implements Cloneable {
|
||||
public static final int NAMESPACES_MALE = 0x40;
|
||||
public static final int NAMESPACES_FEMALE = 0x80;
|
||||
|
||||
public static final String JAPANESE_ORIGINAL = "0";
|
||||
public static final String JAPANESE_TRANSLATED = "1024";
|
||||
public static final String JAPANESE_REWRITE = "2048";
|
||||
public static final String ENGLISH_ORIGINAL = "1";
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
package com.hippo.ehviewer.client;
|
||||
|
||||
import com.hippo.okhttp.CookieDBStore;
|
||||
import android.content.Context;
|
||||
|
||||
import com.hippo.network.CookieRepository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -26,27 +28,33 @@ import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class EhCookieStore extends CookieDBStore {
|
||||
public class EhCookieStore extends CookieRepository {
|
||||
|
||||
public static final String KEY_IPD_MEMBER_ID = "ipb_member_id";
|
||||
public static final String KEY_IPD_PASS_HASH = "ipb_pass_hash";
|
||||
public static final String KEY_IGNEOUS = "igneous";
|
||||
|
||||
public static final Cookie sTipsCookie =
|
||||
new Cookie.Builder()
|
||||
.name(EhConfig.KEY_CONTENT_WARNING)
|
||||
.value(EhConfig.CONTENT_WARNING_NOT_SHOW)
|
||||
.domain(EhUrl.DOMAIN_G)
|
||||
.domain(EhUrl.DOMAIN_E)
|
||||
.path("/")
|
||||
.expiresAt(Long.MAX_VALUE)
|
||||
.build();
|
||||
|
||||
public EhCookieStore(Context context) {
|
||||
super(context, "okhttp3-cookie.db");
|
||||
}
|
||||
|
||||
public void signOut() {
|
||||
removeAll();
|
||||
clear();
|
||||
}
|
||||
|
||||
public boolean hasSignedIn() {
|
||||
return contain(EhUrl.DOMAIN_EX, KEY_IPD_MEMBER_ID) &&
|
||||
contain(EhUrl.DOMAIN_EX, KEY_IPD_PASS_HASH);
|
||||
HttpUrl url = HttpUrl.parse(EhUrl.HOST_E);
|
||||
return contains(url, KEY_IPD_MEMBER_ID) &&
|
||||
contains(url, KEY_IPD_PASS_HASH);
|
||||
}
|
||||
|
||||
public static Cookie newCookie(Cookie cookie, String newDomain, boolean forcePersistent,
|
||||
@@ -81,10 +89,9 @@ public class EhCookieStore extends CookieDBStore {
|
||||
public List<Cookie> loadForRequest(HttpUrl url, Request request) {
|
||||
List<Cookie> cookies = super.loadForRequest(url, request);
|
||||
Object tag = request.tag();
|
||||
String host = url.host();
|
||||
|
||||
boolean checkTips = domainMatch(host, EhUrl.DOMAIN_G);
|
||||
boolean checkUconfig = (domainMatch(host, EhUrl.DOMAIN_E) || domainMatch(host, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;
|
||||
boolean checkTips = domainMatch(url, EhUrl.DOMAIN_E);
|
||||
boolean checkUconfig = (domainMatch(url, EhUrl.DOMAIN_E) || domainMatch(url, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;
|
||||
|
||||
if (checkTips || checkUconfig) {
|
||||
List<Cookie> result = new ArrayList<>(cookies.size() + 1);
|
||||
@@ -108,7 +115,7 @@ public class EhCookieStore extends CookieDBStore {
|
||||
Cookie uconfigCookie = new Cookie.Builder()
|
||||
.name(EhConfig.KEY_UCONFIG)
|
||||
.value(ehConfig.uconfig())
|
||||
.domain(host)
|
||||
.domain(url.host())
|
||||
.path("/")
|
||||
.expiresAt(Long.MAX_VALUE)
|
||||
.build();
|
||||
@@ -119,25 +126,4 @@ public class EhCookieStore extends CookieDBStore {
|
||||
return cookies;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
|
||||
List<Cookie> result = new ArrayList<>(cookies.size() + 2);
|
||||
|
||||
for (Cookie cookie: cookies) {
|
||||
if (EhUrl.DOMAIN_E.equals(cookie.domain())) {
|
||||
// Save id and hash for exhentai
|
||||
if (KEY_IPD_MEMBER_ID.equals(cookie.name()) ||
|
||||
KEY_IPD_PASS_HASH.equals(cookie.name())) {
|
||||
result.add(newCookie(cookie, EhUrl.DOMAIN_E, true, true, true));
|
||||
result.add(newCookie(cookie, EhUrl.DOMAIN_EX, true, true, true));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
result.add(cookie);
|
||||
}
|
||||
|
||||
super.saveFromResponse(url, Collections.unmodifiableList(result));
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.hippo.ehviewer.client;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
@@ -30,7 +31,9 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.CancelledException;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.ehviewer.client.parser.ArchiveParser;
|
||||
import com.hippo.ehviewer.client.parser.FavoritesParser;
|
||||
import com.hippo.ehviewer.client.parser.ForumsParser;
|
||||
import com.hippo.ehviewer.client.parser.GalleryApiParser;
|
||||
@@ -56,6 +59,8 @@ import org.jsoup.nodes.Document;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.FormBody;
|
||||
@@ -78,6 +83,8 @@ public class EhEngine {
|
||||
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
private static final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
|
||||
|
||||
private static final Pattern PATTERN_NEED_HATH_CLIENT = Pattern.compile("(You must have a H@H client assigned to your account to use this feature\\.)");
|
||||
|
||||
public static EhFilter sEhFilter;
|
||||
|
||||
public static void initialize() {
|
||||
@@ -114,13 +121,17 @@ public class EhEngine {
|
||||
}
|
||||
|
||||
public static String signIn(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
|
||||
String username, String password) throws Exception {
|
||||
String username, String password, String recaptchaChallenge, String recaptchaResponse) throws Exception {
|
||||
FormBody.Builder builder = new FormBody.Builder()
|
||||
.add("UserName", username)
|
||||
.add("PassWord", password)
|
||||
.add("submit", "Log me in")
|
||||
.add("CookieDate", "1")
|
||||
.add("temporary_https", "off");
|
||||
if (!TextUtils.isEmpty(recaptchaChallenge) && !TextUtils.isEmpty(recaptchaResponse)) {
|
||||
builder.add("recaptcha_challenge_field", recaptchaChallenge);
|
||||
builder.add("recaptcha_response_field", recaptchaResponse);
|
||||
}
|
||||
String url = EhUrl.API_SIGN_IN;
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig())
|
||||
@@ -200,6 +211,10 @@ public class EhEngine {
|
||||
}
|
||||
}
|
||||
|
||||
for (GalleryInfo info : list) {
|
||||
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -448,6 +463,10 @@ public class EhEngine {
|
||||
fillGalleryListByApi(task, okHttpClient, result.galleryInfoList);
|
||||
}
|
||||
|
||||
for (GalleryInfo info : result.galleryInfoList) {
|
||||
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -555,6 +574,10 @@ public class EhEngine {
|
||||
fillGalleryListByApi(task, okHttpClient, result.galleryInfoList);
|
||||
}
|
||||
|
||||
for (GalleryInfo info : result.galleryInfoList) {
|
||||
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -587,9 +610,82 @@ public class EhEngine {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Pair<String, Pair<String, String>[]> getArchiveList(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
|
||||
String url) throws Exception {
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig()).build();
|
||||
Call call = okHttpClient.newCall(request);
|
||||
|
||||
// Put call
|
||||
if (null != task) {
|
||||
task.setCall(call);
|
||||
}
|
||||
|
||||
String body = null;
|
||||
Headers headers = null;
|
||||
Pair<String, Pair<String, String>[]> result;
|
||||
int code = -1;
|
||||
try {
|
||||
Response response = call.execute();
|
||||
code = response.code();
|
||||
headers = response.headers();
|
||||
body = response.body().string();
|
||||
result = ArchiveParser.parse(body);
|
||||
} catch (Exception e) {
|
||||
throwException(call, code, headers, body, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Void downloadArchive(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
|
||||
long gid, String token, String or, String res) throws Exception {
|
||||
if (or == null || or.length() == 0) {
|
||||
throw new EhException("Invalid form param or: " + or);
|
||||
}
|
||||
if (res == null || res.length() == 0) {
|
||||
throw new EhException("Invalid res: " + res);
|
||||
}
|
||||
FormBody.Builder builder = new FormBody.Builder();
|
||||
builder.add("hathdl_xres", res);
|
||||
String url = EhUrl.getDownloadArchive(gid, token, or);
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig())
|
||||
.post(builder.build())
|
||||
.build();
|
||||
Call call = okHttpClient.newCall(request);
|
||||
|
||||
// Put call
|
||||
if (null != task) {
|
||||
task.setCall(call);
|
||||
}
|
||||
|
||||
String body = null;
|
||||
Headers headers = null;
|
||||
int code = -1;
|
||||
try {
|
||||
Response response = call.execute();
|
||||
code = response.code();
|
||||
headers = response.headers();
|
||||
body = response.body().string();
|
||||
throwException(call, code, headers, body, null);
|
||||
} catch (Exception e) {
|
||||
throwException(call, code, headers, body, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
Matcher m = PATTERN_NEED_HATH_CLIENT.matcher(body);
|
||||
if (m.find()) {
|
||||
throw new NoHAtHClientException("No H@H client");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<GalleryInfo> getWhatsHot(@Nullable EhClient.Task task,
|
||||
OkHttpClient okHttpClient) throws Exception {
|
||||
String url = EhUrl.HOST_G;
|
||||
String url = EhUrl.HOST_E;
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig()).build();
|
||||
Call call = okHttpClient.newCall(request);
|
||||
@@ -619,6 +715,10 @@ public class EhEngine {
|
||||
fillGalleryListByApi(task, okHttpClient, list);
|
||||
}
|
||||
|
||||
for (GalleryInfo info : list) {
|
||||
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -802,6 +902,10 @@ public class EhEngine {
|
||||
}
|
||||
}
|
||||
|
||||
for (GalleryInfo info : list) {
|
||||
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ public final class EhFilter {
|
||||
}
|
||||
|
||||
public synchronized void addFilter(Filter filter) {
|
||||
// enable filter by default before it is added to database
|
||||
filter.enable = true;
|
||||
EhDB.addFilter(filter);
|
||||
|
||||
switch (filter.mode) {
|
||||
@@ -116,6 +118,10 @@ public final class EhFilter {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void triggerFilter(Filter filter) {
|
||||
EhDB.triggerFilter(filter);
|
||||
}
|
||||
|
||||
public synchronized void deleteFilter(Filter filter) {
|
||||
EhDB.deleteFilter(filter);
|
||||
|
||||
@@ -153,7 +159,7 @@ public final class EhFilter {
|
||||
if (null != title && filters.size() > 0) {
|
||||
title = title.toLowerCase();
|
||||
for (int i = 0, n = filters.size(); i < n; i++) {
|
||||
if (title.contains(filters.get(i).text)) {
|
||||
if (filters.get(i).enable && title.contains(filters.get(i).text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +178,7 @@ public final class EhFilter {
|
||||
List<Filter> filters = mUploaderFilterList;
|
||||
if (null != uploader && filters.size() > 0) {
|
||||
for (int i = 0, n = filters.size(); i < n; i++) {
|
||||
if (uploader.equals(filters.get(i).text)) {
|
||||
if (filters.get(i).enable && uploader.equals(filters.get(i).text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -229,7 +235,7 @@ public final class EhFilter {
|
||||
if (null != tags && filters.size() > 0) {
|
||||
for (String tag: tags) {
|
||||
for (int i = 0, n = filters.size(); i < n; i++) {
|
||||
if (matchTag(tag, filters.get(i).text)) {
|
||||
if (filters.get(i).enable && matchTag(tag, filters.get(i).text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -264,7 +270,7 @@ public final class EhFilter {
|
||||
if (null != tags && filters.size() > 0) {
|
||||
for (String tag: tags) {
|
||||
for (int i = 0, n = filters.size(); i < n; i++) {
|
||||
if (matchTagNamespace(tag, filters.get(i).text)) {
|
||||
if (filters.get(i).enable && matchTagNamespace(tag, filters.get(i).text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,31 +21,43 @@ import android.support.annotation.NonNull;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.network.UrlBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
public class EhUrl {
|
||||
|
||||
public static final int SITE_G = 0;
|
||||
public static final int SITE_E = 0;
|
||||
public static final int SITE_EX = 1;
|
||||
|
||||
public static final String DOMAIN_EX = "exhentai.org";
|
||||
public static final String DOMAIN_E = "e-hentai.org";
|
||||
public static final String DOMAIN_G = "g.e-hentai.org";
|
||||
public static final String DOMAIN_LOFI = "lofi.e-hentai.org";
|
||||
|
||||
public static final String HOST_E = "http://" + DOMAIN_E + "/";
|
||||
public static final String HOST_EX = "https://" + DOMAIN_EX + "/";
|
||||
public static final String HOST_G = "http://" + DOMAIN_G + "/";
|
||||
public static final String HOST_E = "https://" + DOMAIN_E + "/";
|
||||
|
||||
public static final String API_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login&CODE=01";
|
||||
|
||||
public static final String API_G = HOST_G + "api.php";
|
||||
public static final String API_E = HOST_E + "api.php";
|
||||
public static final String API_EX = HOST_EX + "api.php";
|
||||
|
||||
public static final String URL_IMAGE_SEARCH_E = "https://upload.e-hentai.org/image_lookup.php";
|
||||
public static final String URL_IMAGE_SEARCH_EX = "https://exhentai.org/upload/image_lookup.php";
|
||||
|
||||
public static final String URL_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login";
|
||||
public static final String URL_REGISTER = "https://forums.e-hentai.org/index.php?act=Reg&CODE=00";
|
||||
public static final String URL_FAVORITES_G = HOST_G + "favorites.php";
|
||||
public static final String URL_FAVORITES_E = HOST_E + "favorites.php";
|
||||
public static final String URL_FAVORITES_EX = HOST_EX + "favorites.php";
|
||||
public static final String URL_FORUMS = "https://forums.e-hentai.org/";
|
||||
|
||||
public static final String UCONFIG_E = HOST_E + "uconfig.php";
|
||||
public static final String UCONFIG_EX = HOST_EX + "uconfig.php";
|
||||
|
||||
private static final String URL_PREFIX_THUMB_E = "https://ehgt.org/t/";
|
||||
private static final String URL_PREFIX_THUMB_EX = "https://exhentai.org/t/";
|
||||
|
||||
public static String getGalleryDetailUrl(long gid, String token) {
|
||||
return getGalleryDetailUrl(gid, token, 0, false);
|
||||
}
|
||||
@@ -53,8 +65,8 @@ public class EhUrl {
|
||||
public static String getHost() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_G:
|
||||
return HOST_G;
|
||||
case SITE_E:
|
||||
return HOST_E;
|
||||
case SITE_EX:
|
||||
return HOST_EX;
|
||||
}
|
||||
@@ -63,8 +75,8 @@ public class EhUrl {
|
||||
public static String getFavoritesUrl() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_G:
|
||||
return URL_FAVORITES_G;
|
||||
case SITE_E:
|
||||
return URL_FAVORITES_E;
|
||||
case SITE_EX:
|
||||
return URL_FAVORITES_EX;
|
||||
}
|
||||
@@ -73,13 +85,23 @@ public class EhUrl {
|
||||
public static String getApiUrl() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_G:
|
||||
return API_G;
|
||||
case SITE_E:
|
||||
return API_E;
|
||||
case SITE_EX:
|
||||
return API_EX;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUConfigUrl() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_E:
|
||||
return UCONFIG_E;
|
||||
case SITE_EX:
|
||||
return UCONFIG_EX;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getGalleryDetailUrl(long gid, String token, int index, boolean allComment) {
|
||||
UrlBuilder builder = new UrlBuilder(getHost() + "g/" + gid + '/' + token + '/');
|
||||
if (index != 0) {
|
||||
@@ -99,6 +121,10 @@ public class EhUrl {
|
||||
return getHost() + "gallerypopups.php?gid=" + gid + "&t=" + token + "&act=addfav";
|
||||
}
|
||||
|
||||
public static String getDownloadArchive(long gid, String token, String or) {
|
||||
return getHost() + "archiver.php?gid=" + gid + "&token=" + token + "&or=" + or;
|
||||
}
|
||||
|
||||
public static String getTagDefinitionUrl(String tag) {
|
||||
return "https://ehwiki.org/wiki/" + tag.replace(' ', '_');
|
||||
}
|
||||
@@ -107,10 +133,50 @@ public class EhUrl {
|
||||
public static String getImageSearchUrl() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_G:
|
||||
return "http://ul.e-hentai.org/image_lookup.php";
|
||||
case SITE_E:
|
||||
return URL_IMAGE_SEARCH_E;
|
||||
case SITE_EX:
|
||||
return "http://ul.exhentai.org/image_lookup.php";
|
||||
return URL_IMAGE_SEARCH_EX;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getThumbUrlPrefix() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
//case SITE_E:
|
||||
return URL_PREFIX_THUMB_E;
|
||||
//case SITE_EX:
|
||||
// return URL_PREFIX_THUMB_EX;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFixedPreviewThumbUrl(String originUrl) {
|
||||
HttpUrl url = HttpUrl.parse(originUrl);
|
||||
if (url == null) return originUrl;
|
||||
List<String> pathSegments = url.pathSegments();
|
||||
if (pathSegments == null || pathSegments.size() < 3) return originUrl;
|
||||
|
||||
ListIterator<String> iterator = pathSegments.listIterator(pathSegments.size());
|
||||
// The last segments, like
|
||||
// 317a1a254cd9c3269e71b2aa2671fe8d28c91097-260198-640-480-png_250.jpg
|
||||
if (!iterator.hasPrevious()) return originUrl;
|
||||
String lastSegment = iterator.previous();
|
||||
// The second last segments, like
|
||||
// 7a
|
||||
if (!iterator.hasPrevious()) return originUrl;
|
||||
String secondLastSegment = iterator.previous();
|
||||
// The third last segments, like
|
||||
// 31
|
||||
if (!iterator.hasPrevious()) return originUrl;
|
||||
String thirdLastSegment = iterator.previous();
|
||||
// Check path segments
|
||||
if (lastSegment != null && secondLastSegment != null
|
||||
&& thirdLastSegment != null
|
||||
&& lastSegment.startsWith(thirdLastSegment)
|
||||
&& lastSegment.startsWith(secondLastSegment, thirdLastSegment.length())) {
|
||||
return getThumbUrlPrefix() + thirdLastSegment + "/" + secondLastSegment + "/" + lastSegment;
|
||||
} else {
|
||||
return originUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
public String apiKey;
|
||||
public int torrentCount;
|
||||
public String torrentUrl;
|
||||
public String archiveUrl;
|
||||
public String parent;
|
||||
public String visible;
|
||||
public String language;
|
||||
@@ -50,6 +51,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(this.torrentCount);
|
||||
dest.writeString(this.torrentUrl);
|
||||
dest.writeString(this.archiveUrl);
|
||||
dest.writeString(this.parent);
|
||||
dest.writeString(this.visible);
|
||||
dest.writeString(this.language);
|
||||
@@ -71,6 +73,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
super(in);
|
||||
this.torrentCount = in.readInt();
|
||||
this.torrentUrl = in.readString();
|
||||
this.archiveUrl = in.readString();
|
||||
this.parent = in.readString();
|
||||
this.visible = in.readString();
|
||||
this.language = in.readString();
|
||||
|
||||
@@ -14,17 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.okhttp;
|
||||
package com.hippo.ehviewer.client.exception;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
public class NoHAtHClientException extends EhException {
|
||||
|
||||
public class CookieWithID {
|
||||
|
||||
public long id;
|
||||
public Cookie cookie;
|
||||
|
||||
public CookieWithID(long id, Cookie cookie) {
|
||||
this.id = id;
|
||||
this.cookie = cookie;
|
||||
public NoHAtHClientException(String detailMessage) {
|
||||
super(detailMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.client.parser;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ArchiveParser {
|
||||
|
||||
private static final Pattern PATTERN_FORM = Pattern.compile("<form id=\"hathdl_form\" action=\"[^\"]*?or=([^=\"]*?)\" method=\"post\">");
|
||||
private static final Pattern PATTERN_ARCHIVE = Pattern.compile("<a href=\"[^\"]*\" onclick=\"return do_hathdl\\('([0-9]+|org)'\\)\">([^<]+)</a>");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Pair<String, Pair<String, String>[]> parse(String body) {
|
||||
Matcher m = PATTERN_FORM.matcher(body);
|
||||
if (!m.find()) {
|
||||
return new Pair<String, Pair<String, String>[]>("", new Pair[0]);
|
||||
}
|
||||
String paramOr = m.group(1);
|
||||
List<Pair<String, String>> archiveList = new ArrayList<>();
|
||||
m = PATTERN_ARCHIVE.matcher(body);
|
||||
while (m.find()) {
|
||||
String res = ParserUtils.trim(m.group(1));
|
||||
String name = ParserUtils.trim(m.group(2));
|
||||
Pair<String, String> item = new Pair<>(res, name);
|
||||
archiveList.add(item);
|
||||
}
|
||||
return new Pair<String, Pair<String, String>[]>(paramOr, archiveList.toArray(new Pair[archiveList.size()]));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryComment;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
@@ -56,6 +58,8 @@ public class GalleryDetailParser {
|
||||
private static final Pattern PATTERN_ERROR = Pattern.compile("<div class=\"d\">\n<p>([^<]+)</p>");
|
||||
private static final Pattern PATTERN_DETAIL = Pattern.compile("var gid = (\\d+);.+?var token = \"([a-f0-9]+)\";.+?var apiuid = ([\\-\\d]+);.+?var apikey = \"([a-f0-9]+)\";", Pattern.DOTALL);
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)</a>");
|
||||
private static final Pattern PATTERN_ARCHIVE = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Archive Download</a>");
|
||||
private static final Pattern PATTERN_COVER = Pattern.compile("width:(\\d+)px; height:(\\d+)px.+?url\\((.+?)\\)");
|
||||
private static final Pattern PATTERN_TAG_GROUP = Pattern.compile("<tr><td[^<>]+>([\\w\\s]+):</td><td>(?:<div[^<>]+><a[^<>]+>[\\w\\s]+</a></div>)+</td></tr>");
|
||||
private static final Pattern PATTERN_TAG = Pattern.compile("<div[^<>]+><a[^<>]+>([\\w\\s]+)</a></div>");
|
||||
private static final Pattern PATTERN_COMMENT = Pattern.compile("<div class=\"c3\">Posted on ([^<>]+) by: <a[^<>]+>([^<>]+)</a>.+?<div class=\"c6\"[^>]*>(.+?)</div><div class=\"c[78]\"");
|
||||
@@ -124,13 +128,20 @@ public class GalleryDetailParser {
|
||||
gd.torrentUrl = "";
|
||||
}
|
||||
|
||||
matcher = PATTERN_ARCHIVE.matcher(body);
|
||||
if (matcher.find()) {
|
||||
gd.archiveUrl = StringUtils.unescapeXml(StringUtils.trim(matcher.group(1)));
|
||||
} else {
|
||||
gd.archiveUrl = "";
|
||||
}
|
||||
|
||||
try {
|
||||
Element gm = JsoupUtils.getElementByClass(d, "gm");
|
||||
|
||||
// Thumb url
|
||||
Element gd1 = gm.getElementById("gd1");
|
||||
try {
|
||||
gd.thumb = EhUtils.handleThumbUrlResolution(StringUtils.trim(gd1.child(0).attr("src")));
|
||||
gd.thumb = parseCoverStyle(StringUtils.trim(gd1.child(0).attr("style")));
|
||||
} catch (Exception e) {
|
||||
gd.thumb = "";
|
||||
}
|
||||
@@ -154,7 +165,9 @@ public class GalleryDetailParser {
|
||||
// Category
|
||||
Element gdc = gm.getElementById("gdc");
|
||||
try {
|
||||
gd.category = EhUtils.getCategory(gdc.child(0).child(0).attr("alt"));
|
||||
String href = gdc.child(0).attr("href");
|
||||
String category = href.substring(href.lastIndexOf('/') + 1);
|
||||
gd.category = EhUtils.getCategory(category);
|
||||
} catch (Exception e) {
|
||||
gd.category = EhUtils.UNKNOWN;
|
||||
}
|
||||
@@ -219,6 +232,16 @@ public class GalleryDetailParser {
|
||||
}
|
||||
}
|
||||
|
||||
// width:250px; height:356px; background:transparent url(https://exhentai.org/t/fe/1f/fe1fcfa9bf8fba2f03982eda0aa347cc9d6a6372-145921-1050-1492-jpg_250.jpg) 0 0 no-repeat
|
||||
private static String parseCoverStyle(String str) {
|
||||
Matcher matcher = PATTERN_COVER.matcher(str);
|
||||
if (matcher.find()) {
|
||||
return EhUtils.handleThumbUrlResolution(matcher.group(3));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseDetailInfo(GalleryDetail gd, Element e, String body) {
|
||||
Elements es = e.children();
|
||||
if (es.size() < 2) {
|
||||
@@ -280,7 +303,7 @@ public class GalleryDetailParser {
|
||||
// Sometimes parody tag is followed with '|' and english translate, just remove them
|
||||
int index = tag.indexOf('|');
|
||||
if (index >= 0) {
|
||||
tag = tag.substring(0, index);
|
||||
tag = tag.substring(0, index).trim();
|
||||
}
|
||||
group.addTag(tag);
|
||||
}
|
||||
@@ -511,6 +534,9 @@ public class GalleryDetailParser {
|
||||
String pageUrl = element.attr("href");
|
||||
element = element.child(0);
|
||||
String imageUrl = element.attr("src");
|
||||
if (Settings.getFixThumbUrl()) {
|
||||
imageUrl = EhUrl.getFixedPreviewThumbUrl(imageUrl);
|
||||
}
|
||||
int index = Integer.parseInt(element.attr("alt")) - 1;
|
||||
largePreviewSet.addItem(index, imageUrl, pageUrl);
|
||||
}
|
||||
@@ -529,8 +555,13 @@ public class GalleryDetailParser {
|
||||
LargePreviewSet largePreviewSet = new LargePreviewSet();
|
||||
|
||||
while (m.find()) {
|
||||
largePreviewSet.addItem(ParserUtils.parseInt(m.group(2)) - 1,
|
||||
ParserUtils.trim(m.group(3)), ParserUtils.trim(m.group(1)));
|
||||
int index = ParserUtils.parseInt(m.group(2)) - 1;
|
||||
String imageUrl = ParserUtils.trim(m.group(3));
|
||||
String pageUrl = ParserUtils.trim(m.group(1));
|
||||
if (Settings.getFixThumbUrl()) {
|
||||
imageUrl = EhUrl.getFixedPreviewThumbUrl(imageUrl);
|
||||
}
|
||||
largePreviewSet.addItem(index, imageUrl, pageUrl);
|
||||
}
|
||||
|
||||
if (largePreviewSet.size() == 0) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
|
||||
public final class GalleryDetailUrlParser {
|
||||
|
||||
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
|
||||
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
|
||||
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
|
||||
|
||||
@Nullable
|
||||
public static Result parse(String url) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.net.URLDecoder;
|
||||
|
||||
public final class GalleryListUrlParser {
|
||||
|
||||
private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_G, EhUrl.DOMAIN_LOFI};
|
||||
private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_E, EhUrl.DOMAIN_LOFI};
|
||||
|
||||
private static final String PATH_NORMAL = "/";
|
||||
private static final String PATH_UPLOADER = "/uploader/";
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class GalleryPageParser {
|
||||
|
||||
private static final Pattern PATTERN_IMAGE_URL = Pattern.compile("<(?:/iframe|div id=\"i3\")[^>]*><a[^>]+><img[^>]*src=\"(.+?)\"");
|
||||
private static final Pattern PATTERN_IMAGE_URL = Pattern.compile("<img[^>]*src=\"([^\"]+)\" style");
|
||||
private static final Pattern PATTERN_SKIP_HATH_KEY = Pattern.compile("onclick=\"return nl\\('([^\\)]+)'\\)");
|
||||
private static final Pattern PATTERN_ORIGIN_IMAGE_URL = Pattern.compile("<a href=\"([^\"]+)fullimg.php([^\"]+)\">");
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
|
||||
public final class GalleryPageUrlParser {
|
||||
|
||||
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
|
||||
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
|
||||
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
|
||||
|
||||
public static Result parse(String url) {
|
||||
if (url == null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class TorrentParser {
|
||||
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<td colspan=\"5\"> <a href=\"([^\"]+)\">([^<]+)</a></td>");
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<td colspan=\"5\"> <a href=\"([^\"]+)\"[^<]+>([^<]+)</a></td>");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Pair<String, String>[] parse(String body) {
|
||||
|
||||
@@ -1007,14 +1007,27 @@ public final class SpiderQueen implements Runnable {
|
||||
mGid = mGalleryInfo.gid;
|
||||
}
|
||||
|
||||
private GalleryPageParser.Result getImageUrl(long gid, int index, String pToken,
|
||||
String skipHathKey) throws Exception {
|
||||
String url = EhUrl.getPageUrl(gid, index, pToken);
|
||||
if (skipHathKey != null) {
|
||||
url = url + "?nl=" + skipHathKey;
|
||||
private String getPageUrl(long gid, int index, String pToken,
|
||||
String oldPageUrl, String skipHathKey) {
|
||||
String pageUrl;
|
||||
if (oldPageUrl != null) {
|
||||
pageUrl = oldPageUrl;
|
||||
} else {
|
||||
pageUrl = EhUrl.getPageUrl(gid, index, pToken);
|
||||
}
|
||||
// Add skipHathKey
|
||||
if (skipHathKey != null) {
|
||||
if (pageUrl.contains("?")) {
|
||||
pageUrl += "&nl=" + skipHathKey;
|
||||
} else {
|
||||
pageUrl += "?nl=" + skipHathKey;
|
||||
}
|
||||
}
|
||||
return pageUrl;
|
||||
}
|
||||
|
||||
GalleryPageParser.Result result = EhEngine.getGalleryPage(null, mHttpClient, url);
|
||||
private GalleryPageParser.Result getImageUrl(int index, String pageUrl) throws Exception {
|
||||
GalleryPageParser.Result result = EhEngine.getGalleryPage(null, mHttpClient, pageUrl);
|
||||
if (StringUtils.endsWith(result.imageUrl, URL_509_SUFFIX_ARRAY)) {
|
||||
// Get 509
|
||||
// Notify listeners
|
||||
@@ -1027,21 +1040,25 @@ public final class SpiderQueen implements Runnable {
|
||||
|
||||
// false for stop
|
||||
private boolean downloadImage(long gid, int index, String pToken, boolean force) {
|
||||
List<String> skipHathKeys = new ArrayList<>(5);
|
||||
String skipHathKey = null;
|
||||
String imageUrl;
|
||||
String error = null;
|
||||
String pageUrl = null;
|
||||
boolean interrupt = false;
|
||||
boolean leakSkipHathKey = false;
|
||||
|
||||
// Try twice
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i > 0 && TextUtils.isEmpty(skipHathKey)) {
|
||||
// No need to get image url twice without skip hath key
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (leakSkipHathKey) {
|
||||
break;
|
||||
}
|
||||
|
||||
pageUrl = getPageUrl(gid, index, pToken, pageUrl, skipHathKey);
|
||||
|
||||
GalleryPageParser.Result result = null;
|
||||
try {
|
||||
result = getImageUrl(gid, index, pToken, skipHathKey);
|
||||
result = getImageUrl(index, pageUrl);
|
||||
} catch (Image509Exception e) {
|
||||
error = GetText.getString(R.string.error_509);
|
||||
} catch (Exception e) {
|
||||
@@ -1053,6 +1070,7 @@ public final class SpiderQueen implements Runnable {
|
||||
}
|
||||
// Check interrupted
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
error = "Interrupted";
|
||||
interrupt = true;
|
||||
break;
|
||||
}
|
||||
@@ -1063,11 +1081,22 @@ public final class SpiderQueen implements Runnable {
|
||||
imageUrl = result.imageUrl;
|
||||
}
|
||||
skipHathKey = result.skipHathKey;
|
||||
if (!TextUtils.isEmpty(skipHathKey)) {
|
||||
if (skipHathKeys.contains(skipHathKey)) {
|
||||
// Duplicate skip hath key, don't run next turn
|
||||
leakSkipHathKey = true;
|
||||
} else {
|
||||
skipHathKeys.add(skipHathKey);
|
||||
}
|
||||
} else {
|
||||
// No skip hath key, don't run next turn
|
||||
leakSkipHathKey = true;
|
||||
}
|
||||
|
||||
// If it is force request, skip first image
|
||||
if (force && i == 0) {
|
||||
continue;
|
||||
}
|
||||
//if (force && i == 0) {
|
||||
// continue;
|
||||
//}
|
||||
|
||||
if (DEBUG_LOG) {
|
||||
Log.d(TAG, imageUrl);
|
||||
@@ -1086,6 +1115,7 @@ public final class SpiderQueen implements Runnable {
|
||||
if (response.code() >= 400) {
|
||||
// Maybe 404
|
||||
response.body().close();
|
||||
error = "Bad code: " + response.code();
|
||||
continue;
|
||||
}
|
||||
ResponseBody responseBody = response.body();
|
||||
@@ -1136,6 +1166,7 @@ public final class SpiderQueen implements Runnable {
|
||||
if (contentLength >= 0) {
|
||||
if (receivedSize < contentLength) {
|
||||
Log.e(TAG, "Can't download all of image data");
|
||||
error = "Incomplete";
|
||||
continue;
|
||||
} else if (receivedSize > contentLength) {
|
||||
Log.w(TAG, "Received data is more than contentLength");
|
||||
@@ -1145,6 +1176,7 @@ public final class SpiderQueen implements Runnable {
|
||||
// Check interrupted
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
interrupt = true;
|
||||
error = "Interrupted";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1275,7 +1307,7 @@ public final class SpiderQueen implements Runnable {
|
||||
if (pToken == null) {
|
||||
// Interrupted
|
||||
// Get token failed
|
||||
updatePageState(index, STATE_FAILED, null);
|
||||
updatePageState(index, STATE_FAILED, "Interrupted");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class ExcludedLanguagesActivity extends ToolbarActivity
|
||||
};
|
||||
|
||||
private static final String[] LANGUAGES = {
|
||||
EhConfig.JAPANESE_ORIGINAL,
|
||||
EhConfig.JAPANESE_TRANSLATED,
|
||||
EhConfig.JAPANESE_REWRITE,
|
||||
EhConfig.ENGLISH_ORIGINAL,
|
||||
@@ -207,8 +208,8 @@ public class ExcludedLanguagesActivity extends ToolbarActivity
|
||||
String pattern = LANGUAGES[j];
|
||||
if (pattern.equals(language)) {
|
||||
// Get it
|
||||
int row = (j + 1) / 3;
|
||||
int column = (j + 1) % 3;
|
||||
int row = j / 3;
|
||||
int column = j % 3;
|
||||
mSelections[row][column] = true;
|
||||
break;
|
||||
}
|
||||
@@ -282,22 +283,19 @@ public class ExcludedLanguagesActivity extends ToolbarActivity
|
||||
finish();
|
||||
} else if (v == mOk) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int i = -1;
|
||||
int i = 0;
|
||||
boolean first = true;
|
||||
for (boolean[] selections : mSelections) {
|
||||
for (boolean b : selections) {
|
||||
i++;
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
if (b) {
|
||||
if (!first) {
|
||||
sb.append("x");
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
sb.append(LANGUAGES[i - 1]);
|
||||
sb.append(LANGUAGES[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,11 +381,6 @@ public class ExcludedLanguagesActivity extends ToolbarActivity
|
||||
@Override
|
||||
public void onBindViewHolder(LanguageHolder holder, int position) {
|
||||
holder.language.setText(LANGUAGE_STR_IDS[position]);
|
||||
if (position == 0) {
|
||||
holder.original.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
holder.original.setVisibility(View.VISIBLE);
|
||||
}
|
||||
boolean[] selections = mSelections[position];
|
||||
holder.original.setChecked(selections[0]);
|
||||
holder.translated.setChecked(selections[1]);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
@@ -77,6 +78,7 @@ public class FilterActivity extends ToolbarActivity {
|
||||
mRecyclerView.setClipChildren(false);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mRecyclerView.hasFixedSize();
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
|
||||
updateView(false);
|
||||
}
|
||||
@@ -247,6 +249,8 @@ public class FilterActivity extends ToolbarActivity {
|
||||
if (null != icon) {
|
||||
icon.setOnClickListener(this);
|
||||
}
|
||||
// click on the filter text to enable/disable it
|
||||
text.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -257,7 +261,15 @@ public class FilterActivity extends ToolbarActivity {
|
||||
}
|
||||
Filter filter = mFilterList.get(position);
|
||||
if (FilterList.MODE_HEADER != filter.mode) {
|
||||
showDeleteFilterDialog(filter);
|
||||
if (v instanceof ImageView) {
|
||||
showDeleteFilterDialog(filter);
|
||||
} else if (v instanceof TextView) {
|
||||
mFilterList.trigger(filter);
|
||||
|
||||
//for updating delete line on filter text
|
||||
mAdapter.notifyItemChanged(getAdapterPosition());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,12 +326,18 @@ public class FilterActivity extends ToolbarActivity {
|
||||
holder.text.setText(filter.text);
|
||||
} else {
|
||||
holder.text.setText(filter.text);
|
||||
// add a delete line if the filter is disabled
|
||||
if (!filter.enable) {
|
||||
holder.text.setPaintFlags(holder.text.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
} else {
|
||||
holder.text.setPaintFlags(holder.text.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return null != mFilterList ? mFilterList.size(): 0;
|
||||
return null != mFilterList ? mFilterList.size() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,5 +468,9 @@ public class FilterActivity extends ToolbarActivity {
|
||||
public void delete(Filter filter) {
|
||||
mEhFilter.deleteFilter(filter);
|
||||
}
|
||||
|
||||
public void trigger(Filter filter) {
|
||||
mEhFilter.triggerFilter(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,8 +280,8 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
.setStartPage(startPage)
|
||||
.setBackgroundColor(resources.getColor(R.color.gallery_background))
|
||||
.setEdgeColor(primaryColor & 0xffffff | 0x33000000)
|
||||
.setPagerInterval(resources.getDimensionPixelOffset(R.dimen.gallery_pager_interval))
|
||||
.setScrollInterval(resources.getDimensionPixelOffset(R.dimen.gallery_scroll_interval))
|
||||
.setPagerInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_pager_interval) : 0)
|
||||
.setScrollInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_scroll_interval) : 0)
|
||||
.setPageMinHeight(resources.getDimensionPixelOffset(R.dimen.gallery_page_min_height))
|
||||
.setPageInfoInterval(resources.getDimensionPixelOffset(R.dimen.gallery_page_info_interval))
|
||||
.setProgressColor(primaryColor)
|
||||
@@ -702,6 +702,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
private final SwitchCompat mShowClock;
|
||||
private final SwitchCompat mShowProgress;
|
||||
private final SwitchCompat mShowBattery;
|
||||
private final SwitchCompat mShowPageInterval;
|
||||
private final SwitchCompat mVolumePage;
|
||||
private final SwitchCompat mReadingFullscreen;
|
||||
private final SwitchCompat mCustomScreenLightness;
|
||||
@@ -718,6 +719,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
mShowClock = (SwitchCompat) mView.findViewById(R.id.show_clock);
|
||||
mShowProgress = (SwitchCompat) mView.findViewById(R.id.show_progress);
|
||||
mShowBattery = (SwitchCompat) mView.findViewById(R.id.show_battery);
|
||||
mShowPageInterval = (SwitchCompat) mView.findViewById(R.id.show_page_interval);
|
||||
mVolumePage = (SwitchCompat) mView.findViewById(R.id.volume_page);
|
||||
mReadingFullscreen = (SwitchCompat) mView.findViewById(R.id.reading_fullscreen);
|
||||
mCustomScreenLightness = (SwitchCompat) mView.findViewById(R.id.custom_screen_lightness);
|
||||
@@ -731,6 +733,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
mShowClock.setChecked(Settings.getShowClock());
|
||||
mShowProgress.setChecked(Settings.getShowProgress());
|
||||
mShowBattery.setChecked(Settings.getShowBattery());
|
||||
mShowPageInterval.setChecked(Settings.getShowPageInterval());
|
||||
mVolumePage.setChecked(Settings.getVolumePage());
|
||||
mReadingFullscreen.setChecked(Settings.getReadingFullscreen());
|
||||
mCustomScreenLightness.setChecked(Settings.getCustomScreenLightness());
|
||||
@@ -759,6 +762,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
boolean showClock = mShowClock.isChecked();
|
||||
boolean showProgress = mShowProgress.isChecked();
|
||||
boolean showBattery = mShowBattery.isChecked();
|
||||
boolean showPageInterval = mShowPageInterval.isChecked();
|
||||
boolean volumePage = mVolumePage.isChecked();
|
||||
boolean readingFullscreen = mReadingFullscreen.isChecked();
|
||||
boolean customScreenLightness = mCustomScreenLightness.isChecked();
|
||||
@@ -774,6 +778,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
Settings.putShowClock(showClock);
|
||||
Settings.putShowProgress(showProgress);
|
||||
Settings.putShowBattery(showBattery);
|
||||
Settings.putShowPageInterval(showPageInterval);
|
||||
Settings.putVolumePage(volumePage);
|
||||
Settings.putReadingFullscreen(readingFullscreen);
|
||||
Settings.putCustomScreenLightness(customScreenLightness);
|
||||
@@ -812,6 +817,8 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
if (mBattery != null) {
|
||||
mBattery.setVisibility(showBattery ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
mGalleryView.setPagerInterval(showPageInterval ? getResources().getDimensionPixelOffset(R.dimen.gallery_pager_interval) : 0);
|
||||
mGalleryView.setScrollInterval(showPageInterval ? getResources().getDimensionPixelOffset(R.dimen.gallery_scroll_interval) : 0);
|
||||
setScreenLightness(customScreenLightness, screenLightness);
|
||||
|
||||
// Update slider
|
||||
@@ -829,19 +836,20 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
return;
|
||||
}
|
||||
|
||||
File dir = AppConfig.getTempDir();
|
||||
File dir = AppConfig.getExternalImageDir();
|
||||
if (null == dir) {
|
||||
Toast.makeText(this, R.string.error_cant_create_temp_file, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
UniFile file;
|
||||
if (null == (file = mGalleryProvider.save(page, UniFile.fromFile(dir), Long.toString(System.currentTimeMillis())))) {
|
||||
if (null == (file = mGalleryProvider.save(page, UniFile.fromFile(dir), mGalleryProvider.getImageFilename(page)))) {
|
||||
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String filename = file.getName();
|
||||
if (filename == null) {
|
||||
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
|
||||
@@ -853,7 +861,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
Uri uri = new Uri.Builder()
|
||||
.scheme(ContentResolver.SCHEME_CONTENT)
|
||||
.authority("com.hippo.ehviewer.fileprovider")
|
||||
.appendPath("temp")
|
||||
.appendPath("image")
|
||||
.appendPath(filename)
|
||||
.build();
|
||||
Intent intent = new Intent();
|
||||
@@ -861,6 +869,9 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
intent.setType(mimeType);
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share_image)));
|
||||
|
||||
// Sync media store
|
||||
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, file.getUri()));
|
||||
}
|
||||
|
||||
private void saveImage(int page) {
|
||||
@@ -880,6 +891,9 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
}
|
||||
|
||||
Toast.makeText(this, getString(R.string.image_saved, file.getUri()), Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Sync media store
|
||||
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, file.getUri()));
|
||||
}
|
||||
|
||||
private void showPageDialog(final int page) {
|
||||
|
||||
@@ -16,11 +16,13 @@
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
@@ -36,6 +38,8 @@ public class SetSecurityActivity extends ToolbarActivity implements View.OnClick
|
||||
private View mCancel;
|
||||
@Nullable
|
||||
private View mSet;
|
||||
@Nullable
|
||||
private CheckBox mFingerprint;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -46,6 +50,7 @@ public class SetSecurityActivity extends ToolbarActivity implements View.OnClick
|
||||
mPatternView = (LockPatternView) ViewUtils.$$(this, R.id.pattern_view);
|
||||
mCancel = ViewUtils.$$(this, R.id.cancel);
|
||||
mSet = ViewUtils.$$(this, R.id.set);
|
||||
mFingerprint = (CheckBox) ViewUtils.$$(this, R.id.fingerprint_checkbox);
|
||||
|
||||
String pattern = Settings.getSecurity();
|
||||
if (!TextUtils.isEmpty(pattern)) {
|
||||
@@ -53,6 +58,16 @@ public class SetSecurityActivity extends ToolbarActivity implements View.OnClick
|
||||
LockPatternUtils.stringToPattern(pattern));
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
|
||||
// The line below prevents the false positive inspection from Android Studio
|
||||
// noinspection ResourceType
|
||||
if (fingerprintManager.hasEnrolledFingerprints()) {
|
||||
mFingerprint.setVisibility(View.VISIBLE);
|
||||
mFingerprint.setChecked(Settings.getEnableFingerprint());
|
||||
}
|
||||
}
|
||||
|
||||
mCancel.setOnClickListener(this);
|
||||
mSet.setOnClickListener(this);
|
||||
}
|
||||
@@ -79,7 +94,7 @@ public class SetSecurityActivity extends ToolbarActivity implements View.OnClick
|
||||
if (v == mCancel) {
|
||||
finish();
|
||||
} else if (v == mSet) {
|
||||
if (null != mPatternView) {
|
||||
if (null != mPatternView && null != mFingerprint) {
|
||||
String security;
|
||||
if (mPatternView.getCellSize() <= 1) {
|
||||
security = "";
|
||||
@@ -87,6 +102,8 @@ public class SetSecurityActivity extends ToolbarActivity implements View.OnClick
|
||||
security = mPatternView.getPatternString();
|
||||
}
|
||||
Settings.putSecurity(security);
|
||||
Settings.putEnableFingerprint(mFingerprint.getVisibility() == View.VISIBLE &&
|
||||
mFingerprint.isChecked() && !security.isEmpty());
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Copyright 2018 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2018/2/9.
|
||||
*/
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.JsPromptResult;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.widget.ProgressView;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
public class UConfigActivity extends ToolbarActivity {
|
||||
|
||||
private WebView webView;
|
||||
private ProgressView progress;
|
||||
private String url;
|
||||
private boolean loaded;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// http://stackoverflow.com/questions/32284642/how-to-handle-an-uncatched-exception
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cookieManager.flush();
|
||||
cookieManager.removeAllCookies(null);
|
||||
cookieManager.removeSessionCookies(null);
|
||||
} else {
|
||||
CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(this);
|
||||
cookieSyncManager.startSync();
|
||||
cookieManager.removeAllCookie();
|
||||
cookieManager.removeSessionCookie();
|
||||
cookieSyncManager.stopSync();
|
||||
}
|
||||
|
||||
// Copy cookies from okhttp cookie store to CookieManager
|
||||
url = EhUrl.getUConfigUrl();
|
||||
EhCookieStore store = EhApplication.getEhCookieStore(this);
|
||||
for (Cookie cookie : store.getCookies(HttpUrl.parse(url))) {
|
||||
cookieManager.setCookie(url, cookie.toString());
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_u_config);
|
||||
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
|
||||
webView = (WebView) findViewById(R.id.webview);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.setWebViewClient(new UConfigWebViewClient());
|
||||
webView.setWebChromeClient(new UConfigWebChromeClient());
|
||||
webView.loadUrl(url);
|
||||
progress = (ProgressView) findViewById(R.id.progress);
|
||||
|
||||
Snackbar.make(webView, R.string.apply_tip, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
private void apply() {
|
||||
webView.loadUrl("javascript:"
|
||||
+ "(function() {\n"
|
||||
+ " var apply = document.getElementById(\"apply\").children[0];\n"
|
||||
+ " apply.click();\n"
|
||||
+ "})();");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.activity_u_config, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_apply:
|
||||
if (loaded) {
|
||||
apply();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private Cookie longLive(Cookie cookie) {
|
||||
return new Cookie.Builder()
|
||||
.name(cookie.name())
|
||||
.value(cookie.value())
|
||||
.domain(cookie.domain())
|
||||
.path(cookie.path())
|
||||
.expiresAt(Long.MAX_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
webView.destroy();
|
||||
|
||||
// Put cookies back to okhttp cookie store
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
String cookiesString = cookieManager.getCookie(url);
|
||||
|
||||
if (cookiesString != null && !cookiesString.isEmpty()) {
|
||||
EhCookieStore store = EhApplication.getEhCookieStore(this);
|
||||
HttpUrl eUrl = HttpUrl.parse(EhUrl.HOST_E);
|
||||
HttpUrl exUrl = HttpUrl.parse(EhUrl.HOST_EX);
|
||||
|
||||
// The cookies saved in the uconfig page should be shared between e and ex
|
||||
for (String header : cookiesString.split(";")) {
|
||||
Cookie eCookie = Cookie.parse(eUrl, header);
|
||||
if (eCookie != null) {
|
||||
store.addCookie(longLive(eCookie));
|
||||
}
|
||||
|
||||
Cookie exCookie = Cookie.parse(exUrl, header);
|
||||
if (exCookie != null) {
|
||||
store.addCookie(longLive(exCookie));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UConfigWebViewClient extends WebViewClient {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
// Never load other urls
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
loaded = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
progress.setVisibility(View.GONE);
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
private class UConfigWebChromeClient extends WebChromeClient {
|
||||
|
||||
private Context context = UConfigActivity.this;
|
||||
|
||||
@Override
|
||||
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
|
||||
final JsPromptResult result) {
|
||||
|
||||
View promptView = UConfigActivity.this.getLayoutInflater()
|
||||
.inflate(R.layout.dialog_js_prompt, null, false);
|
||||
TextView messageView = (TextView) promptView.findViewById(R.id.message);
|
||||
messageView.setText(message);
|
||||
final EditText valueView = (EditText) promptView.findViewById(R.id.value);
|
||||
valueView.setText(defaultValue);
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setView(promptView)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
result.confirm(valueView.getText().toString());
|
||||
}
|
||||
})
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
result.cancel();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showMessageDialog(String message, final JsResult result) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
result.confirm();
|
||||
}
|
||||
})
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
result.cancel();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
|
||||
showMessageDialog(message, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
|
||||
showMessageDialog(message, result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,16 +30,13 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
|
||||
public class CookieSignInScene extends SolidScene implements EditText.OnEditorActionListener,
|
||||
@@ -53,10 +50,14 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
@Nullable
|
||||
private TextInputLayout mIpbPassHashLayout;
|
||||
@Nullable
|
||||
private TextInputLayout mIgneousLayout;
|
||||
@Nullable
|
||||
private EditText mIpbMemberId;
|
||||
@Nullable
|
||||
private EditText mIpbPassHash;
|
||||
@Nullable
|
||||
private EditText mIgneous;
|
||||
@Nullable
|
||||
private View mOk;
|
||||
|
||||
@Override
|
||||
@@ -75,6 +76,9 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
mIpbPassHashLayout = (TextInputLayout) ViewUtils.$$(view, R.id.ipb_pass_hash_layout);
|
||||
mIpbPassHash = mIpbPassHashLayout.getEditText();
|
||||
Assert.assertNotNull(mIpbPassHash);
|
||||
mIgneousLayout = (TextInputLayout) ViewUtils.$$(view, R.id.igneous_layout);
|
||||
mIgneous = mIgneousLayout.getEditText();
|
||||
Assert.assertNotNull(mIgneous);
|
||||
mOk = ViewUtils.$$(view, R.id.ok);
|
||||
|
||||
mIpbPassHash.setOnEditorActionListener(this);
|
||||
@@ -87,6 +91,7 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("eh_info", 0);
|
||||
String ipbMemberId = sharedPreferences.getString("ipb_member_id", null);
|
||||
String ipbPassHash = sharedPreferences.getString("ipb_pass_hash", null);
|
||||
String igneous = sharedPreferences.getString("igneous", null);
|
||||
boolean getIt = false;
|
||||
if (!TextUtils.isEmpty(ipbMemberId)) {
|
||||
mIpbMemberId.setText(ipbMemberId);
|
||||
@@ -96,6 +101,10 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
mIpbPassHash.setText(ipbPassHash);
|
||||
getIt = true;
|
||||
}
|
||||
if (!TextUtils.isEmpty(igneous)) {
|
||||
mIgneous.setText(igneous);
|
||||
getIt = true;
|
||||
}
|
||||
if (getIt) {
|
||||
showTip(R.string.found_cookies, LENGTH_SHORT);
|
||||
}
|
||||
@@ -117,8 +126,10 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
|
||||
mIpbMemberIdLayout = null;
|
||||
mIpbPassHashLayout = null;
|
||||
mIgneousLayout = null;
|
||||
mIpbMemberId = null;
|
||||
mIpbPassHash = null;
|
||||
mIgneous = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,12 +175,14 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
public void enter() {
|
||||
Context context = getContext2();
|
||||
if (null == context || null == mIpbMemberIdLayout || null == mIpbPassHashLayout ||
|
||||
null == mIpbMemberId || null == mIpbPassHash) {
|
||||
null == mIgneousLayout || null == mIpbMemberId || null == mIpbPassHash ||
|
||||
null == mIgneous) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String ipbMemberId = mIpbMemberId.getText().toString().trim();
|
||||
final String ipbPassHash = mIpbPassHash.getText().toString().trim();
|
||||
final String igneous = mIgneous.getText().toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(ipbMemberId)) {
|
||||
mIpbMemberIdLayout.setError(getString(R.string.text_is_empty));
|
||||
@@ -183,6 +196,12 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
} else {
|
||||
mIpbPassHashLayout.setError(null);
|
||||
}
|
||||
if (TextUtils.isEmpty(igneous)) {
|
||||
mIgneousLayout.setError(getString(R.string.text_is_empty));
|
||||
return;
|
||||
} else {
|
||||
mIgneousLayout.setError(null);
|
||||
}
|
||||
|
||||
hideSoftInput();
|
||||
|
||||
@@ -193,13 +212,13 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
.setPositiveButton(R.string.i_will_check_it, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
storeCookie(ipbMemberId, ipbPassHash);
|
||||
storeCookie(ipbMemberId, ipbPassHash, igneous);
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
} else {
|
||||
storeCookie(ipbMemberId, ipbPassHash);
|
||||
storeCookie(ipbMemberId, ipbPassHash, igneous);
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
}
|
||||
@@ -210,7 +229,7 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
.domain(domain).expiresAt(Long.MAX_VALUE).build();
|
||||
}
|
||||
|
||||
private void storeCookie(String id, String hash) {
|
||||
private void storeCookie(String id, String hash, String igneous) {
|
||||
Context context = getContext2();
|
||||
if (null == context) {
|
||||
return;
|
||||
@@ -219,9 +238,11 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
EhUtils.signOut(context);
|
||||
|
||||
EhCookieStore store = EhApplication.getEhCookieStore(context);
|
||||
store.add(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_E));
|
||||
store.add(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_EX));
|
||||
store.add(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_E));
|
||||
store.add(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_EX));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_E));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_EX));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_E));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_EX));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IGNEOUS, igneous, EhUrl.DOMAIN_E));
|
||||
store.addCookie(newCookie(EhCookieStore.KEY_IGNEOUS, igneous, EhUrl.DOMAIN_EX));
|
||||
}
|
||||
}
|
||||
@@ -389,7 +389,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
if (1 == mHelper.getShownViewIndex()) {
|
||||
mHasFirstRefresh = false;
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
|
||||
@@ -74,6 +74,7 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
|
||||
import com.hippo.ehviewer.client.parser.RateGalleryParser;
|
||||
import com.hippo.ehviewer.dao.DownloadInfo;
|
||||
import com.hippo.ehviewer.dao.Filter;
|
||||
@@ -100,7 +101,9 @@ import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.widget.ObservedTextView;
|
||||
import com.hippo.widget.ProgressView;
|
||||
import com.hippo.widget.SimpleGridAutoSpanLayout;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
import com.hippo.yorozuya.IntIdGenerator;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
@@ -202,6 +205,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
@Nullable
|
||||
private TextView mTorrent;
|
||||
@Nullable
|
||||
private TextView mArchive;
|
||||
@Nullable
|
||||
private TextView mShare;
|
||||
@Nullable
|
||||
private TextView mRate;
|
||||
@@ -246,10 +251,13 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Nullable
|
||||
private GalleryDetail mGalleryDetail;
|
||||
private int mRequestId;
|
||||
private int mRequestId = IntIdGenerator.INVALID_ID;
|
||||
|
||||
private Pair<String, String>[] mTorrentList;
|
||||
|
||||
private String mArchiveFormParamOr;
|
||||
private Pair<String, String>[] mArchiveList;
|
||||
|
||||
@State
|
||||
private int mState = STATE_INIT;
|
||||
|
||||
@@ -464,18 +472,21 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mHeart = (TextView) ViewUtils.$$(mHeartGroup, R.id.heart);
|
||||
mHeartOutline = (TextView) ViewUtils.$$(mHeartGroup, R.id.heart_outline);
|
||||
mTorrent = (TextView) ViewUtils.$$(mActions, R.id.torrent);
|
||||
mArchive = (TextView) ViewUtils.$$(mActions, R.id.archive);
|
||||
mShare = (TextView) ViewUtils.$$(mActions, R.id.share);
|
||||
mRate = (TextView) ViewUtils.$$(mActions, R.id.rate);
|
||||
mSimilar = (TextView) ViewUtils.$$(mActions, R.id.similar);
|
||||
mSearchCover = (TextView) ViewUtils.$$(mActions, R.id.search_cover);
|
||||
Ripple.addRipple(mHeartGroup, false);
|
||||
Ripple.addRipple(mTorrent, false);
|
||||
Ripple.addRipple(mArchive, false);
|
||||
Ripple.addRipple(mShare, false);
|
||||
Ripple.addRipple(mRate, false);
|
||||
Ripple.addRipple(mSimilar, false);
|
||||
Ripple.addRipple(mSearchCover, false);
|
||||
mHeartGroup.setOnClickListener(this);
|
||||
mTorrent.setOnClickListener(this);
|
||||
mArchive.setOnClickListener(this);
|
||||
mShare.setOnClickListener(this);
|
||||
mRate.setOnClickListener(this);
|
||||
mSimilar.setOnClickListener(this);
|
||||
@@ -564,6 +575,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mHeart = null;
|
||||
mHeartOutline = null;
|
||||
mTorrent = null;
|
||||
mArchive = null;
|
||||
mShare = null;
|
||||
mRate = null;
|
||||
mSimilar = null;
|
||||
@@ -647,6 +659,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
setActionDrawable(mHeartOutline, heartOutline);
|
||||
Drawable torrent = DrawableManager.getDrawable(context, R.drawable.v_utorrent_primary_x48);
|
||||
setActionDrawable(mTorrent, torrent);
|
||||
Drawable archive = DrawableManager.getDrawable(context, R.drawable.v_archive_primary_x48);
|
||||
setActionDrawable(mArchive, archive);
|
||||
Drawable share = DrawableManager.getDrawable(context, R.drawable.v_share_primary_x48);
|
||||
setActionDrawable(mShare, share);
|
||||
Drawable rate = DrawableManager.getDrawable(context, R.drawable.v_thumb_up_primary_x48);
|
||||
@@ -1166,6 +1180,21 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
.show();
|
||||
helper.setDialog(dialog, mGalleryDetail.torrentUrl);
|
||||
}
|
||||
} else if (mArchive == v) {
|
||||
if (mGalleryDetail == null) {
|
||||
return;
|
||||
}
|
||||
if (mGalleryDetail.apiUid < 0) {
|
||||
showTip(R.string.sign_in_first, LENGTH_SHORT);
|
||||
return;
|
||||
}
|
||||
ArchiveListDialogHelper helper = new ArchiveListDialogHelper();
|
||||
Dialog dialog = new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.dialog_archive_title)
|
||||
.setView(R.layout.dialog_archive_list)
|
||||
.setOnDismissListener(helper)
|
||||
.show();
|
||||
helper.setDialog(dialog, mGalleryDetail.archiveUrl);
|
||||
} else if (mRate == v) {
|
||||
if (mGalleryDetail == null) {
|
||||
return;
|
||||
@@ -1546,6 +1575,150 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private class DownloadArchiveListener extends EhCallback<GalleryDetailScene, Void> {
|
||||
|
||||
public DownloadArchiveListener(Context context, int stageId, String sceneTag) {
|
||||
super(context, stageId, sceneTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
showTip(R.string.download_archive_started, LENGTH_SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
if (e instanceof NoHAtHClientException) {
|
||||
showTip(R.string.download_archive_failure_no_hath, LENGTH_SHORT);
|
||||
} else {
|
||||
showTip(R.string.download_archive_failure, LENGTH_SHORT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryDetailScene;
|
||||
}
|
||||
}
|
||||
|
||||
private class ArchiveListDialogHelper implements AdapterView.OnItemClickListener,
|
||||
DialogInterface.OnDismissListener, EhClient.Callback<Pair<String, Pair<String, String>[]>> {
|
||||
|
||||
@Nullable
|
||||
private ProgressView mProgressView;
|
||||
@Nullable
|
||||
private TextView mErrorText;
|
||||
@Nullable
|
||||
private ListView mListView;
|
||||
@Nullable
|
||||
private EhRequest mRequest;
|
||||
@Nullable
|
||||
private Dialog mDialog;
|
||||
|
||||
public void setDialog(@Nullable Dialog dialog, String url) {
|
||||
mDialog = dialog;
|
||||
mProgressView = (ProgressView) ViewUtils.$$(dialog, R.id.progress);
|
||||
mErrorText = (TextView) ViewUtils.$$(dialog, R.id.text);
|
||||
mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
|
||||
mListView.setOnItemClickListener(this);
|
||||
|
||||
Context context = getContext2();
|
||||
if (context != null) {
|
||||
if (mArchiveList == null) {
|
||||
mErrorText.setVisibility(View.GONE);
|
||||
mListView.setVisibility(View.GONE);
|
||||
mRequest = new EhRequest().setMethod(EhClient.METHOD_ARCHIVE_LIST)
|
||||
.setArgs(url)
|
||||
.setCallback(this);
|
||||
EhApplication.getEhClient(context).execute(mRequest);
|
||||
} else {
|
||||
bind(mArchiveList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bind(Pair<String, String>[] data) {
|
||||
if (null == mDialog || null == mProgressView || null == mErrorText || null == mListView) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == data.length) {
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.VISIBLE);
|
||||
mListView.setVisibility(View.GONE);
|
||||
mErrorText.setText(R.string.no_archives);
|
||||
} else {
|
||||
String[] nameArray = new String[data.length];
|
||||
for (int i = 0, n = data.length; i < n; i++) {
|
||||
nameArray[i] = data[i].second;
|
||||
}
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.GONE);
|
||||
mListView.setVisibility(View.VISIBLE);
|
||||
mListView.setAdapter(new ArrayAdapter<>(mDialog.getContext(), R.layout.item_select_dialog, nameArray));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
if (null != context && null != activity && null != mArchiveList && position < mArchiveList.length) {
|
||||
String res = mArchiveList[position].first;
|
||||
EhRequest request = new EhRequest();
|
||||
request.setMethod(EhClient.METHOD_DOWNLOAD_ARCHIVE);
|
||||
request.setArgs(mGalleryDetail.gid, mGalleryDetail.token, mArchiveFormParamOr, res);
|
||||
request.setCallback(new DownloadArchiveListener(context, activity.getStageId(), getTag()));
|
||||
EhApplication.getEhClient(context).execute(request);
|
||||
}
|
||||
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
mDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
if (mRequest != null) {
|
||||
mRequest.cancel();
|
||||
mRequest = null;
|
||||
}
|
||||
mDialog = null;
|
||||
mProgressView = null;
|
||||
mErrorText = null;
|
||||
mListView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pair<String, Pair<String, String>[]> result) {
|
||||
if (mRequest != null) {
|
||||
mRequest = null;
|
||||
mArchiveFormParamOr = result.first;
|
||||
mArchiveList = result.second;
|
||||
bind(result.second);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
mRequest = null;
|
||||
Context context = getContext2();
|
||||
if (null != context && null != mProgressView && null != mErrorText && null != mListView) {
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.VISIBLE);
|
||||
mListView.setVisibility(View.GONE);
|
||||
mErrorText.setText(ExceptionUtils.getReadableString(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() { mRequest = null; }
|
||||
}
|
||||
|
||||
private class TorrentListDialogHelper implements AdapterView.OnItemClickListener,
|
||||
DialogInterface.OnDismissListener, EhClient.Callback<Pair<String, String>[]> {
|
||||
|
||||
@@ -1612,7 +1785,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
String name = mTorrentList[position].second;
|
||||
// Use system download service
|
||||
DownloadManager.Request r = new DownloadManager.Request(Uri.parse(url));
|
||||
r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, name + ".torrent");
|
||||
r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
|
||||
FileUtils.sanitizeFilename(name + ".torrent"));
|
||||
r.allowScanningByMediaScanner();
|
||||
r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
|
||||
@@ -518,7 +518,6 @@ public final class GalleryListScene extends BaseScene
|
||||
if (1 == mHelper.getShownViewIndex()) {
|
||||
mHasFirstRefresh = false;
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
|
||||
@@ -174,7 +174,6 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
if (1 == mHelper.getShownViewIndex()) {
|
||||
mHasFirstRefresh = false;
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
|
||||
@@ -19,11 +19,15 @@ package com.hippo.ehviewer.ui.scene;
|
||||
import android.content.Context;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
@@ -42,15 +46,21 @@ public class SecurityScene extends SolidScene implements
|
||||
LockPatternView.OnPatternListener, ShakeDetector.OnShakeListener {
|
||||
|
||||
private static final int MAX_RETRY_TIMES = 5;
|
||||
private static final long ERROR_TIMEOUT_MILLIS = 1200;
|
||||
private static final long SUCCESS_DELAY_MILLIS = 100;
|
||||
|
||||
private static final String KEY_RETRY_TIMES = "retry_times";
|
||||
|
||||
@Nullable
|
||||
private LockPatternView mPatternView;
|
||||
private ImageView mFingerprintIcon;
|
||||
|
||||
private SensorManager mSensorManager;
|
||||
private Sensor mAccelerometer;
|
||||
private ShakeDetector mShakeDetector;
|
||||
private FingerprintManager mFingerprintManager;
|
||||
|
||||
private CancellationSignal mFingerprintCancellationSignal;
|
||||
|
||||
private int mRetryTimes;
|
||||
|
||||
@@ -73,6 +83,9 @@ public class SecurityScene extends SolidScene implements
|
||||
mShakeDetector.setOnShakeListener(this);
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mFingerprintManager = context.getSystemService(FingerprintManager.class);
|
||||
}
|
||||
|
||||
if (null == savedInstanceState) {
|
||||
mRetryTimes = MAX_RETRY_TIMES;
|
||||
@@ -97,6 +110,38 @@ public class SecurityScene extends SolidScene implements
|
||||
if (null != mShakeDetector) {
|
||||
mSensorManager.registerListener(mShakeDetector, mAccelerometer, SensorManager.SENSOR_DELAY_UI);
|
||||
}
|
||||
|
||||
if (isFingerprintAuthAvailable()) {
|
||||
mFingerprintCancellationSignal = new CancellationSignal();
|
||||
// The line below prevents the false positive inspection from Android Studio
|
||||
// noinspection ResourceType
|
||||
mFingerprintManager.authenticate(null, mFingerprintCancellationSignal, 0,
|
||||
new FingerprintManager.AuthenticationCallback() {
|
||||
@Override
|
||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||
fingerprintError(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailed() {
|
||||
fingerprintError(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(
|
||||
FingerprintManager.AuthenticationResult result) {
|
||||
mFingerprintIcon.setImageResource(R.drawable.ic_fingerprint_success);
|
||||
mFingerprintIcon.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startSceneForCheckStep(CHECK_STEP_SECURITY, getArguments());
|
||||
finish();
|
||||
}
|
||||
}, SUCCESS_DELAY_MILLIS);
|
||||
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,6 +151,10 @@ public class SecurityScene extends SolidScene implements
|
||||
if (null != mShakeDetector) {
|
||||
mSensorManager.unregisterListener(mShakeDetector);
|
||||
}
|
||||
if (isFingerprintAuthAvailable() && mFingerprintCancellationSignal != null) {
|
||||
mFingerprintCancellationSignal.cancel();
|
||||
mFingerprintCancellationSignal = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,6 +172,11 @@ public class SecurityScene extends SolidScene implements
|
||||
mPatternView = (LockPatternView) ViewUtils.$$(view, R.id.pattern_view);
|
||||
mPatternView.setOnPatternListener(this);
|
||||
|
||||
mFingerprintIcon = (ImageView) ViewUtils.$$(view, R.id.fingerprint_icon);
|
||||
if (Settings.getEnableFingerprint() && isFingerprintAuthAvailable()) {
|
||||
mFingerprintIcon.setVisibility(View.VISIBLE);
|
||||
mFingerprintIcon.setImageResource(R.drawable.ic_fp_40px);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -176,4 +230,38 @@ public class SecurityScene extends SolidScene implements
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFingerprintAuthAvailable() {
|
||||
// The line below prevents the false positive inspection from Android Studio
|
||||
// noinspection ResourceType
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& Settings.getEnableFingerprint()
|
||||
&& mFingerprintManager != null
|
||||
&& mFingerprintManager.isHardwareDetected()
|
||||
&& mFingerprintManager.hasEnrolledFingerprints();
|
||||
}
|
||||
|
||||
private Runnable mResetFingerprintRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mFingerprintIcon != null)
|
||||
mFingerprintIcon.setImageResource(R.drawable.ic_fp_40px);
|
||||
}
|
||||
};
|
||||
|
||||
private void fingerprintError(boolean unrecoverable) {
|
||||
// Do not decrease mRetryTimes here since Android system will handle it :)
|
||||
mFingerprintIcon.setImageResource(R.drawable.ic_fingerprint_error);
|
||||
mFingerprintIcon.removeCallbacks(mResetFingerprintRunnable);
|
||||
if (unrecoverable) {
|
||||
mFingerprintIcon.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mFingerprintIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}, ERROR_TIMEOUT_MILLIS);
|
||||
} else {
|
||||
mFingerprintIcon.postDelayed(mResetFingerprintRunnable, ERROR_TIMEOUT_MILLIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class SelectSiteScene extends SolidScene implements View.OnClickListener
|
||||
switch (id) {
|
||||
case R.id.site_e:
|
||||
Settings.putSelectSite(false);
|
||||
Settings.putGallerySite(EhUrl.SITE_G);
|
||||
Settings.putGallerySite(EhUrl.SITE_E);
|
||||
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
|
||||
finish();
|
||||
break;
|
||||
|
||||
@@ -40,8 +40,10 @@ import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.parser.ProfileParser;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.widget.RecaptchaView;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.yorozuya.IntIdGenerator;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
@@ -67,6 +69,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
private EditText mUsername;
|
||||
@Nullable
|
||||
private EditText mPassword;
|
||||
private EditText mRecaptcha;
|
||||
private RecaptchaView mRecaptchaView;
|
||||
@Nullable
|
||||
private View mRegister;
|
||||
@Nullable
|
||||
@@ -79,7 +83,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
private TextView mSkipSigningIn;
|
||||
|
||||
private boolean mSigningIn;
|
||||
private int mRequestId;
|
||||
private int mRequestId = IntIdGenerator.INVALID_ID;
|
||||
|
||||
@Override
|
||||
public boolean needShowLeftDrawer() {
|
||||
@@ -124,6 +128,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
mPasswordLayout = (TextInputLayout) ViewUtils.$$(loginForm, R.id.password_layout);
|
||||
mPassword = mPasswordLayout.getEditText();
|
||||
Assert.assertNotNull(mPassword);
|
||||
mRecaptcha = (EditText) ViewUtils.$$(loginForm, R.id.recaptcha);
|
||||
mRecaptchaView = (RecaptchaView) ViewUtils.$$(loginForm, R.id.recaptcha_image);
|
||||
mRegister = ViewUtils.$$(loginForm, R.id.register);
|
||||
mSignIn = ViewUtils.$$(loginForm, R.id.sign_in);
|
||||
mSignInViaWebView = (TextView) ViewUtils.$$(loginForm, R.id.sign_in_via_webview);
|
||||
@@ -226,8 +232,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
} else if (mSignInViaCookies == v) {
|
||||
startScene(new Announcer(CookieSignInScene.class).setRequestCode(this, REQUEST_CODE_COOKIE));
|
||||
} else if (mSkipSigningIn == v) {
|
||||
// Set gallery size SITE_G if skip sign in
|
||||
Settings.putGallerySite(EhUrl.SITE_G);
|
||||
// Set gallery size SITE_E if skip sign in
|
||||
Settings.putGallerySite(EhUrl.SITE_E);
|
||||
redirectTo();
|
||||
}
|
||||
}
|
||||
@@ -279,12 +285,15 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
// Clean up for sign in
|
||||
EhUtils.signOut(context);
|
||||
|
||||
String challenge = mRecaptchaView.getChallenge();
|
||||
String response = mRecaptcha.getText().toString();
|
||||
|
||||
EhCallback callback = new SignInListener(context,
|
||||
activity.getStageId(), getTag());
|
||||
mRequestId = ((EhApplication) context.getApplicationContext()).putGlobalStuff(callback);
|
||||
EhRequest request = new EhRequest()
|
||||
.setMethod(EhClient.METHOD_SIGN_IN)
|
||||
.setArgs(username, password)
|
||||
.setArgs(username, password, challenge, response)
|
||||
.setCallback(callback);
|
||||
EhApplication.getEhClient(context).execute(request);
|
||||
|
||||
|
||||
@@ -28,18 +28,14 @@ import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
@@ -122,7 +118,7 @@ public class WebViewSignInScene extends SolidScene {
|
||||
}
|
||||
|
||||
private void addCookie(Context context, String domain, Cookie cookie) {
|
||||
EhApplication.getEhCookieStore(context).add(EhCookieStore.newCookie(cookie, domain, true, true, true));
|
||||
EhApplication.getEhCookieStore(context).addCookie(EhCookieStore.newCookie(cookie, domain, true, true, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,6 +145,9 @@ public class WebViewSignInScene extends SolidScene {
|
||||
getHash = true;
|
||||
addCookie(context, EhUrl.DOMAIN_EX, cookie);
|
||||
addCookie(context, EhUrl.DOMAIN_E, cookie);
|
||||
} else if (EhCookieStore.KEY_IGNEOUS.equals(cookie.name())) {
|
||||
addCookie(context, EhUrl.DOMAIN_EX, cookie);
|
||||
addCookie(context, EhUrl.DOMAIN_E, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/8/20.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import com.hippo.android.recaptcha.RecaptchaV1;
|
||||
import com.hippo.drawable.TextDrawable;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
|
||||
public class RecaptchaView extends LoadImageView implements RecaptchaV1.RecaptchaCallback, View.OnClickListener {
|
||||
|
||||
private static final String CHALLENGE = "6LdtfgYAAAAAALjIPPiCgPJJah8MhAUpnHcKF8u_";
|
||||
|
||||
private boolean loading = false;
|
||||
private String challenge;
|
||||
private String image;
|
||||
|
||||
private TextDrawable waitingDrawable;
|
||||
private TextDrawable loadingDrawable;
|
||||
private TextDrawable failureDrawable;
|
||||
|
||||
public RecaptchaView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public RecaptchaView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setOnClickListener(this);
|
||||
if (waitingDrawable == null) {
|
||||
waitingDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_none), 0.6f);
|
||||
waitingDrawable.setBackgroundColor(Color.GRAY);
|
||||
waitingDrawable.setTextColor(Color.WHITE);
|
||||
}
|
||||
load(waitingDrawable);
|
||||
}
|
||||
|
||||
public String getChallenge() {
|
||||
return challenge;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
loading = false;
|
||||
challenge = null;
|
||||
image = null;
|
||||
|
||||
if (loadingDrawable == null) {
|
||||
loadingDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_loading), 0.6f);
|
||||
loadingDrawable.setBackgroundColor(Color.GRAY);
|
||||
loadingDrawable.setTextColor(Color.WHITE);
|
||||
}
|
||||
load(loadingDrawable);
|
||||
|
||||
RecaptchaV1.recaptcha(getContext(), CHALLENGE, SimpleHandler.getInstance(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View v) {
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(@NonNull String challenge, @NonNull String image) {
|
||||
this.loading = false;
|
||||
this.challenge = challenge;
|
||||
this.image = image;
|
||||
|
||||
load(image, image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
this.loading = false;
|
||||
this.challenge = null;
|
||||
this.image = null;
|
||||
|
||||
if (failureDrawable == null) {
|
||||
failureDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_failure), 0.6f);
|
||||
failureDrawable.setBackgroundColor(Color.GRAY);
|
||||
failureDrawable.setTextColor(Color.WHITE);
|
||||
}
|
||||
load(failureDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
SavedState ss = new SavedState(super.onSaveInstanceState());
|
||||
ss.loading = loading;
|
||||
ss.challenge = challenge;
|
||||
ss.image = image;
|
||||
return ss;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
if (!(state instanceof SavedState)) {
|
||||
super.onRestoreInstanceState(state);
|
||||
return;
|
||||
}
|
||||
|
||||
SavedState ss = (SavedState) state;
|
||||
super.onRestoreInstanceState(ss.getSuperState());
|
||||
|
||||
if (ss.loading) {
|
||||
load();
|
||||
} else if (!TextUtils.isEmpty(ss.challenge) && !TextUtils.isEmpty(ss.image)) {
|
||||
onSuccess(ss.challenge, ss.image);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SavedState extends BaseSavedState {
|
||||
|
||||
private boolean loading;
|
||||
private String challenge;
|
||||
private String image;
|
||||
|
||||
public SavedState(Parcelable superState) {
|
||||
super(superState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
super.writeToParcel(out, flags);
|
||||
out.writeByte(loading ? (byte) 1 : (byte) 0);
|
||||
out.writeString(challenge);
|
||||
out.writeString(image);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR
|
||||
= new Parcelable.Creator<SavedState>() {
|
||||
@Override
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
};
|
||||
|
||||
public SavedState(Parcel source) {
|
||||
super(source);
|
||||
loading = source.readByte() != 0;
|
||||
challenge = source.readString();
|
||||
image = source.readString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.network;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import com.hippo.database.MSQLiteBuilder;
|
||||
import com.hippo.util.SqlUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import okhttp3.Cookie;
|
||||
|
||||
class CookieDatabase {
|
||||
|
||||
private static final String LOG_TAG = CookieDatabase.class.getSimpleName();
|
||||
|
||||
private static final int VERSION_1 = 1;
|
||||
private static final String TABLE_COOKIE = "OK_HTTP_3_COOKIE";
|
||||
private static final String COLUMN_ID = "_id";
|
||||
private static final String COLUMN_NAME = "NAME";
|
||||
private static final String COLUMN_VALUE = "VALUE";
|
||||
private static final String COLUMN_EXPIRES_AT = "EXPIRES_AT";
|
||||
private static final String COLUMN_DOMAIN = "DOMAIN";
|
||||
private static final String COLUMN_PATH = "PATH";
|
||||
private static final String COLUMN_SECURE = "SECURE";
|
||||
private static final String COLUMN_HTTP_ONLY = "HTTP_ONLY";
|
||||
private static final String COLUMN_PERSISTENT = "PERSISTENT";
|
||||
private static final String COLUMN_HOST_ONLY = "HOST_ONLY";
|
||||
|
||||
private static final int DB_VERSION = VERSION_1;
|
||||
|
||||
private final Map<Cookie, Long> cookieIdMap = new HashMap<>();
|
||||
private final SQLiteOpenHelper helper;
|
||||
private final SQLiteDatabase db;
|
||||
|
||||
public CookieDatabase(Context context, String name) {
|
||||
helper = new MSQLiteBuilder()
|
||||
.version(VERSION_1)
|
||||
.createTable(TABLE_COOKIE)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_NAME, String.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_VALUE, String.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_EXPIRES_AT, long.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_DOMAIN, String.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_PATH, String.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_SECURE, boolean.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_HTTP_ONLY, boolean.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_PERSISTENT, boolean.class)
|
||||
.insertColumn(TABLE_COOKIE, COLUMN_HOST_ONLY, boolean.class)
|
||||
.build(context, name, DB_VERSION);
|
||||
db = helper.getWritableDatabase();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Cookie getCookie(Cursor cursor, long now) {
|
||||
String name = SqlUtils.getString(cursor, COLUMN_NAME, null);
|
||||
String value = SqlUtils.getString(cursor, COLUMN_VALUE, null);
|
||||
long expiresAt = SqlUtils.getLong(cursor, COLUMN_EXPIRES_AT, 0);
|
||||
String domain = SqlUtils.getString(cursor, COLUMN_DOMAIN, null);
|
||||
String path = SqlUtils.getString(cursor, COLUMN_PATH, null);
|
||||
boolean secure = SqlUtils.getBoolean(cursor, COLUMN_SECURE, false);
|
||||
boolean httpOnly = SqlUtils.getBoolean(cursor, COLUMN_HTTP_ONLY, false);
|
||||
boolean persistent = SqlUtils.getBoolean(cursor, COLUMN_PERSISTENT, false);
|
||||
boolean hostOnly = SqlUtils.getBoolean(cursor, COLUMN_HOST_ONLY, false);
|
||||
|
||||
if (name == null || domain == null || path == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check non-persistent or expired
|
||||
if (!persistent || expiresAt <= now) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Cookie.Builder builder = new Cookie.Builder();
|
||||
builder.name(name);
|
||||
builder.value(value);
|
||||
if (hostOnly) {
|
||||
builder.hostOnlyDomain(domain);
|
||||
} else {
|
||||
builder.domain(domain);
|
||||
}
|
||||
builder.path(path);
|
||||
builder.expiresAt(expiresAt);
|
||||
if (secure) builder.secure();
|
||||
if (httpOnly) builder.httpOnly();
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public Map<String, CookieSet> getAllCookies() {
|
||||
long now = System.currentTimeMillis();
|
||||
Map<String, CookieSet> map = new HashMap<>();
|
||||
List<Long> toRemove = new ArrayList<>();
|
||||
|
||||
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_COOKIE + ";", null);
|
||||
try {
|
||||
while (cursor.moveToNext()) {
|
||||
long id = SqlUtils.getLong(cursor, COLUMN_ID, 0);
|
||||
Cookie cookie = getCookie(cursor, now);
|
||||
|
||||
if (cookie != null) {
|
||||
// Save id of the cookie in db
|
||||
cookieIdMap.put(cookie, id);
|
||||
|
||||
// Put cookie to set
|
||||
CookieSet set = map.get(cookie.domain());
|
||||
if (set == null) {
|
||||
set = new CookieSet();
|
||||
map.put(cookie.domain(), set);
|
||||
}
|
||||
set.add(cookie);
|
||||
} else {
|
||||
// Mark to remove the cookie
|
||||
toRemove.add(id);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
// Remove invalid or expired cookie
|
||||
if (!toRemove.isEmpty()) {
|
||||
SQLiteStatement statement = db.compileStatement(
|
||||
"DELETE FROM " + TABLE_COOKIE + " WHERE " + COLUMN_ID + " = ?;");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
for (long id : toRemove) {
|
||||
statement.bindLong(1, id);
|
||||
statement.executeUpdateDelete();
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public ContentValues toContentValues(Cookie cookie) {
|
||||
ContentValues contentValues = new ContentValues(9);
|
||||
contentValues.put(COLUMN_NAME, cookie.name());
|
||||
contentValues.put(COLUMN_VALUE, cookie.value());
|
||||
contentValues.put(COLUMN_EXPIRES_AT, cookie.expiresAt());
|
||||
contentValues.put(COLUMN_DOMAIN, cookie.domain());
|
||||
contentValues.put(COLUMN_PATH, cookie.path());
|
||||
contentValues.put(COLUMN_SECURE, cookie.secure());
|
||||
contentValues.put(COLUMN_HTTP_ONLY, cookie.httpOnly());
|
||||
contentValues.put(COLUMN_PERSISTENT, cookie.persistent());
|
||||
contentValues.put(COLUMN_HOST_ONLY, cookie.hostOnly());
|
||||
return contentValues;
|
||||
}
|
||||
|
||||
public void add(Cookie cookie) {
|
||||
long id = db.insert(TABLE_COOKIE, null, toContentValues(cookie));
|
||||
if (id != -1L) {
|
||||
Long oldId = cookieIdMap.put(cookie, id);
|
||||
if (oldId != null) Log.e(LOG_TAG, "Add a duplicate cookie");
|
||||
} else {
|
||||
Log.e(LOG_TAG, "An error occurred when insert a cookie");
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Cookie from, Cookie to) {
|
||||
Long id = cookieIdMap.get(from);
|
||||
if (id == null) {
|
||||
Log.e(LOG_TAG, "Can't get id when update the cookie");
|
||||
return;
|
||||
}
|
||||
|
||||
ContentValues values = toContentValues(to);
|
||||
String whereClause = COLUMN_ID + " = ?";
|
||||
String[] whereArgs = { id.toString() };
|
||||
int count = db.update(TABLE_COOKIE, values, whereClause, whereArgs);
|
||||
if (count != 1) {
|
||||
Log.e(LOG_TAG, "Bad result when update cookie: " + count);
|
||||
}
|
||||
|
||||
// Update it in cookie-id map
|
||||
cookieIdMap.remove(from);
|
||||
cookieIdMap.put(to, id);
|
||||
}
|
||||
|
||||
public void remove(Cookie cookie) {
|
||||
Long id = cookieIdMap.get(cookie);
|
||||
if (id == null) {
|
||||
Log.e(LOG_TAG, "Can't get id when remove the cookie");
|
||||
return;
|
||||
}
|
||||
|
||||
String whereClause = COLUMN_ID + " = ?";
|
||||
String[] whereArgs = { id.toString() };
|
||||
int count = db.delete(TABLE_COOKIE, whereClause, whereArgs);
|
||||
if (count != 1) {
|
||||
Log.e(LOG_TAG, "Bad result when remove cookie: " + count);
|
||||
}
|
||||
|
||||
// Remove it from cookie-id map
|
||||
cookieIdMap.remove(cookie);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
db.delete(TABLE_COOKIE, null, null);
|
||||
cookieIdMap.clear();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
db.close();
|
||||
helper.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.network;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import com.hippo.yorozuya.ObjectUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.CookieJar;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class CookieRepository implements CookieJar {
|
||||
|
||||
private CookieDatabase db;
|
||||
private Map<String, CookieSet> map;
|
||||
|
||||
public CookieRepository(Context context, String name) {
|
||||
db = new CookieDatabase(context, name);
|
||||
map = db.getAllCookies();
|
||||
}
|
||||
|
||||
public synchronized void addCookie(Cookie cookie) {
|
||||
// For cookie database
|
||||
Cookie toAdd = null;
|
||||
Cookie toUpdate = null;
|
||||
Cookie toRemove = null;
|
||||
|
||||
CookieSet set = map.get(cookie.domain());
|
||||
if (set == null) {
|
||||
set = new CookieSet();
|
||||
map.put(cookie.domain(), set);
|
||||
}
|
||||
|
||||
if (cookie.expiresAt() <= System.currentTimeMillis()) {
|
||||
toRemove = set.remove(cookie);
|
||||
// If the cookie is not persistent, it's not in database
|
||||
if (toRemove != null && !toRemove.persistent()) {
|
||||
toRemove = null;
|
||||
}
|
||||
} else {
|
||||
toAdd = cookie;
|
||||
toUpdate = set.add(cookie);
|
||||
// If the cookie is not persistent, it's not in database
|
||||
if (!toAdd.persistent()) toAdd = null;
|
||||
if (toUpdate != null && !toUpdate.persistent()) toUpdate = null;
|
||||
// Remove the cookie if it updates to null
|
||||
if (toAdd == null && toUpdate != null) {
|
||||
toRemove = toUpdate;
|
||||
toUpdate = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (toRemove != null) {
|
||||
db.remove(toRemove);
|
||||
}
|
||||
if (toAdd != null) {
|
||||
if (toUpdate != null) {
|
||||
db.update(toUpdate, toAdd);
|
||||
} else {
|
||||
db.add(toAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized List<Cookie> getCookies(HttpUrl url) {
|
||||
List<Cookie> accepted = new ArrayList<>();
|
||||
List<Cookie> expired = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, CookieSet> entry : map.entrySet()) {
|
||||
String domain = entry.getKey();
|
||||
CookieSet cookieSet = entry.getValue();
|
||||
if (domainMatch(url, domain)) {
|
||||
cookieSet.get(url, accepted, expired);
|
||||
}
|
||||
}
|
||||
|
||||
for (Cookie cookie : expired) {
|
||||
if (cookie.persistent()) {
|
||||
db.remove(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
// RFC 6265 Section-5.4 step 2, sort the cookie-list
|
||||
// Cookies with longer paths are listed before cookies with shorter paths.
|
||||
// Ignore creation-time, we don't store them.
|
||||
Collections.sort(accepted, new Comparator<Cookie>() {
|
||||
@Override
|
||||
public int compare(Cookie o1, Cookie o2) {
|
||||
return o2.path().length() - o1.path().length();
|
||||
}
|
||||
});
|
||||
|
||||
return accepted;
|
||||
}
|
||||
|
||||
public boolean contains(HttpUrl url, String name) {
|
||||
for (Cookie cookie : getCookies(url)) {
|
||||
if (ObjectUtils.equal(cookie.name(), name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all cookies in this {@code CookieRepository}.
|
||||
*/
|
||||
public synchronized void clear() {
|
||||
map.clear();
|
||||
db.clear();
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFromResponse(HttpUrl httpUrl, List<Cookie> list) {
|
||||
for (Cookie cookie : list) {
|
||||
addCookie(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> loadForRequest(HttpUrl httpUrl, Request request) {
|
||||
return getCookies(httpUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick and dirty pattern to differentiate IP addresses from hostnames. This is an approximation
|
||||
* of Android's private InetAddress#isNumeric API.
|
||||
*
|
||||
* This matches IPv6 addresses as a hex string containing at least one colon, and possibly
|
||||
* including dots after the first colon. It matches IPv4 addresses as strings containing only
|
||||
* decimal digits and dots. This pattern matches strings like "a:.23" and "54" that are neither IP
|
||||
* addresses nor hostnames; they will be verified as IP addresses (which is a more strict
|
||||
* verification).
|
||||
*/
|
||||
private static final Pattern VERIFY_AS_IP_ADDRESS = Pattern.compile("([0-9a-fA-F]*:[0-9a-fA-F:.]*)|([\\d.]+)");
|
||||
|
||||
/**
|
||||
* Returns true if `host` is not a host name and might be an IP address.
|
||||
*/
|
||||
private static boolean verifyAsIpAddress(String host) {
|
||||
return VERIFY_AS_IP_ADDRESS.matcher(host).matches();
|
||||
}
|
||||
|
||||
// okhttp3.Cookie.domainMatch(HttpUrl, String)
|
||||
protected static boolean domainMatch(HttpUrl url, String domain) {
|
||||
String urlHost = url.host();
|
||||
|
||||
if (urlHost.equals(domain)) {
|
||||
return true; // As in 'example.com' matching 'example.com'.
|
||||
}
|
||||
|
||||
if (urlHost.endsWith(domain)
|
||||
&& urlHost.charAt(urlHost.length() - domain.length() - 1) == '.'
|
||||
&& !verifyAsIpAddress(urlHost)) {
|
||||
return true; // As in 'example.com' matching 'www.example.com'.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.network;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import com.hippo.util.HashCodeUtils;
|
||||
import com.hippo.yorozuya.ObjectUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
class CookieSet {
|
||||
|
||||
private Map<Key, Cookie> map = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Adds a cookie to this {@code CookieSet}.
|
||||
* Returns a previous cookie with
|
||||
* the same name, domain and path or {@code null}.
|
||||
*/
|
||||
public Cookie add(Cookie cookie) {
|
||||
return map.put(new Key(cookie), cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a cookie with the same name,
|
||||
* domain and path as the cookie.
|
||||
* Returns the removed cookie or {@code null}.
|
||||
*/
|
||||
public Cookie remove(Cookie cookie) {
|
||||
return map.remove(new Key(cookie));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cookies for the url. Fill {@code accepted} and {@code expired}.
|
||||
*/
|
||||
public void get(HttpUrl url, List<Cookie> accepted, List<Cookie> expired) {
|
||||
long now = System.currentTimeMillis();
|
||||
Iterator<Map.Entry<Key, Cookie>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Cookie cookie = iterator.next().getValue();
|
||||
if (cookie.expiresAt() <= now) {
|
||||
iterator.remove();
|
||||
expired.add(cookie);
|
||||
} else if (cookie.matches(url)) {
|
||||
accepted.add(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Key {
|
||||
|
||||
private String name;
|
||||
private String domain;
|
||||
private String path;
|
||||
|
||||
public Key(Cookie cookie) {
|
||||
this.name = cookie.name();
|
||||
this.domain = cookie.domain();
|
||||
this.path = cookie.path();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj instanceof Key) {
|
||||
Key key = (Key) obj;
|
||||
return ObjectUtils.equal(key.name, this.name) &&
|
||||
ObjectUtils.equal(key.domain, this.domain) &&
|
||||
ObjectUtils.equal(key.path, this.path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeUtils.hashCode(name, domain, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.okhttp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import com.hippo.okhttp.dao.DaoMaster;
|
||||
import com.hippo.okhttp.dao.DaoSession;
|
||||
import com.hippo.okhttp.dao.OkHttp3CookieDao;
|
||||
import com.hippo.okhttp.dao.OkHttp3CookieRaw;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
|
||||
public class CookieDB {
|
||||
|
||||
private static DaoSession sDaoSession;
|
||||
|
||||
private static class DBOpenHelper extends DaoMaster.OpenHelper {
|
||||
|
||||
public DBOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
|
||||
super(context, name, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void initialize(Context context) {
|
||||
DBOpenHelper helper = new DBOpenHelper(
|
||||
context.getApplicationContext(), "okhttp3-cookie.db", null);
|
||||
|
||||
SQLiteDatabase db = helper.getWritableDatabase();
|
||||
DaoMaster daoMaster = new DaoMaster(db);
|
||||
|
||||
sDaoSession = daoMaster.newSession();
|
||||
}
|
||||
|
||||
static Map<String, List<CookieWithID>> getAllCookies() {
|
||||
OkHttp3CookieDao dao = sDaoSession.getOkHttp3CookieDao();
|
||||
List<OkHttp3CookieRaw> list = dao.queryBuilder().list();
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
Map<String, List<CookieWithID>> result = new HashMap<>();
|
||||
for (OkHttp3CookieRaw raw : list) {
|
||||
// Check expired
|
||||
if (!raw.getPersistent() || raw.getExpiresAt() <= now) {
|
||||
dao.delete(raw);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Avoid null error
|
||||
String name = raw.getName();
|
||||
String value = raw.getValue();
|
||||
String domain = raw.getDomain();
|
||||
if (name == null || value == null || domain == null) {
|
||||
dao.delete(raw);
|
||||
continue;
|
||||
}
|
||||
|
||||
Cookie.Builder builder = new Cookie.Builder();
|
||||
builder.name(name);
|
||||
builder.value(value);
|
||||
builder.expiresAt(raw.getExpiresAt());
|
||||
if (raw.getHostOnly()) {
|
||||
builder.hostOnlyDomain(domain);
|
||||
} else {
|
||||
builder.domain(raw.getDomain());
|
||||
}
|
||||
builder.path(raw.getPath());
|
||||
if (raw.getSecure()) {
|
||||
builder.secure();
|
||||
}
|
||||
if (raw.getHttpOnly()) {
|
||||
builder.httpOnly();
|
||||
}
|
||||
|
||||
List<CookieWithID> cookies = result.get(domain);
|
||||
if (cookies == null) {
|
||||
cookies = new ArrayList<>();
|
||||
result.put(domain, cookies);
|
||||
}
|
||||
|
||||
cookies.add(new CookieWithID(raw.getId(), builder.build()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void removeCookie(long id) {
|
||||
sDaoSession.getOkHttp3CookieDao().deleteByKey(id);
|
||||
}
|
||||
|
||||
static void removeAllCookies() {
|
||||
sDaoSession.getOkHttp3CookieDao().deleteAll();
|
||||
}
|
||||
|
||||
static long addCookie(Cookie cookie) {
|
||||
OkHttp3CookieDao dao = sDaoSession.getOkHttp3CookieDao();
|
||||
|
||||
OkHttp3CookieRaw raw = new OkHttp3CookieRaw();
|
||||
raw.setName(cookie.name());
|
||||
raw.setValue(cookie.value());
|
||||
raw.setExpiresAt(cookie.expiresAt());
|
||||
raw.setDomain(cookie.domain());
|
||||
raw.setPath(cookie.path());
|
||||
raw.setSecure(cookie.secure());
|
||||
raw.setHttpOnly(cookie.httpOnly());
|
||||
raw.setPersistent(cookie.persistent());
|
||||
raw.setHostOnly(cookie.hostOnly());
|
||||
|
||||
return dao.insert(raw);
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.okhttp;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.CookieJar;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class CookieDBStore implements CookieJar {
|
||||
|
||||
private final Map<String, List<CookieWithID>> map;
|
||||
|
||||
public CookieDBStore() {
|
||||
map = CookieDB.getAllCookies();
|
||||
}
|
||||
|
||||
private static boolean hasExpired(Cookie cookie) {
|
||||
return cookie.expiresAt() < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private static boolean domainMatch(Cookie cookie, String urlHost) {
|
||||
return cookie.hostOnly()
|
||||
? urlHost.equals(cookie.domain())
|
||||
: domainMatch(urlHost, cookie.domain());
|
||||
}
|
||||
|
||||
public static boolean domainMatch(String urlHost, String cookieDomain) {
|
||||
if (urlHost.equals(cookieDomain)) {
|
||||
return true; // As in 'example.com' matching 'example.com'.
|
||||
}
|
||||
|
||||
return urlHost.endsWith(cookieDomain)
|
||||
&& urlHost.charAt(urlHost.length() - cookieDomain.length() - 1) == '.';
|
||||
}
|
||||
|
||||
private static CookieWithID removeCookie(List<CookieWithID> list, String name) {
|
||||
for (int i = 0, n = list.size(); i < n; i++) {
|
||||
CookieWithID cwi = list.get(i);
|
||||
if (cwi.cookie.name().equals(name)) {
|
||||
list.remove(i);
|
||||
return cwi;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean containInternal(String host, String name, List<CookieWithID> cookies) {
|
||||
for (int i = 0, n = cookies.size(); i < n; i++) {
|
||||
Cookie cookie = cookies.get(i).cookie;
|
||||
if (domainMatch(cookie, host) && cookie.name().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public synchronized boolean contain(String host, String name) {
|
||||
for (String key : map.keySet()) {
|
||||
if (domainMatch(host, key)) {
|
||||
List<CookieWithID> cookies = map.get(key);
|
||||
// cookies can not be null
|
||||
if (containInternal(host, name, cookies)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized void removeInternal(Cookie cookie) {
|
||||
String domain = cookie.domain();
|
||||
List<CookieWithID> cookies = map.get(domain);
|
||||
if (cookies != null) {
|
||||
// Remove from list
|
||||
CookieWithID cwi = removeCookie(cookies, cookie.name());
|
||||
if (cwi != null) {
|
||||
// Remove from DB
|
||||
CookieDB.removeCookie(cwi.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeInternal(String host, List<CookieWithID> cookies) {
|
||||
for (Iterator<CookieWithID> i = cookies.iterator(); i.hasNext();) {
|
||||
CookieWithID cwi = i.next();
|
||||
Cookie cookie = cwi.cookie;
|
||||
// Check match host or has expired
|
||||
if (domainMatch(cookie, host) || hasExpired(cookie)) {
|
||||
// Remove from list
|
||||
i.remove();
|
||||
// Remove from DB
|
||||
CookieDB.removeCookie(cwi.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void remove(String host) {
|
||||
for (String key : map.keySet()) {
|
||||
if (domainMatch(host, key)) {
|
||||
List<CookieWithID> cookies = map.get(key);
|
||||
// cookies can not be null
|
||||
removeInternal(host, cookies);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void removeAll() {
|
||||
map.clear();
|
||||
CookieDB.removeAllCookies();
|
||||
}
|
||||
|
||||
public synchronized void add(Cookie cookie) {
|
||||
String domain = cookie.domain();
|
||||
|
||||
// Check expired
|
||||
if (hasExpired(cookie)) {
|
||||
removeInternal(cookie);
|
||||
return;
|
||||
}
|
||||
|
||||
List<CookieWithID> cookies = map.get(domain);
|
||||
if (cookies == null) {
|
||||
cookies = new ArrayList<>();
|
||||
map.put(domain, cookies);
|
||||
} else {
|
||||
// Remove old cookie
|
||||
// Remove from list
|
||||
CookieWithID cwi = removeCookie(cookies, cookie.name());
|
||||
if (cwi != null) {
|
||||
// Remove from DB
|
||||
CookieDB.removeCookie(cwi.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Add to DB
|
||||
long id = CookieDB.addCookie(cookie);
|
||||
// Add to list
|
||||
cookies.add(new CookieWithID(id, cookie));
|
||||
}
|
||||
|
||||
private void getInternal(HttpUrl url, List<CookieWithID> cookies, List<Cookie> result) {
|
||||
for (Iterator<CookieWithID> i = cookies.iterator(); i.hasNext();) {
|
||||
CookieWithID cwi = i.next();
|
||||
Cookie cookie = cwi.cookie;
|
||||
// Check expired
|
||||
if (hasExpired(cookie)) {
|
||||
// Remove from list
|
||||
i.remove();
|
||||
// Remove from DB
|
||||
CookieDB.removeCookie(cwi.id);
|
||||
} else if (cookie.matches(url)) {
|
||||
result.add(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Cookie getInternal(HttpUrl url, String name, List<CookieWithID> cookies) {
|
||||
for (Iterator<CookieWithID> i = cookies.iterator(); i.hasNext();) {
|
||||
CookieWithID cwi = i.next();
|
||||
Cookie cookie = cwi.cookie;
|
||||
// Check expired
|
||||
if (hasExpired(cookie)) {
|
||||
// Remove from list
|
||||
i.remove();
|
||||
// Remove from DB
|
||||
CookieDB.removeCookie(cwi.id);
|
||||
} else if (cookie.name().equals(name) && cookie.matches(url)) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public synchronized Cookie get(HttpUrl url, String name) {
|
||||
String host = url.host();
|
||||
for (String key : map.keySet()) {
|
||||
if (domainMatch(host, key)) {
|
||||
List<CookieWithID> cookies = map.get(key);
|
||||
return getInternal(url, name, cookies);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized List<Cookie> get(HttpUrl url) {
|
||||
List<Cookie> result = new ArrayList<>();
|
||||
|
||||
String host = url.host();
|
||||
for (String key : map.keySet()) {
|
||||
if (domainMatch(host, key)) {
|
||||
List<CookieWithID> cookies = map.get(key);
|
||||
// cookies can not be null
|
||||
getInternal(url, cookies, result);
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
|
||||
for (Cookie cookie: cookies) {
|
||||
add(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> loadForRequest(HttpUrl url, Request request) {
|
||||
return get(url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.util;
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
public class HashCodeUtils {
|
||||
|
||||
private static final int X = 31;
|
||||
|
||||
/**
|
||||
* <pre>{@code
|
||||
* args[0].hashCode()*31^(n-1) + args[1].hashCode()*31^(n-2) + ... + args[n-1].hashCode()
|
||||
* }</pre>
|
||||
* Returns 0 if {@code args == null}.
|
||||
*/
|
||||
public static int hashCode(Object... args) {
|
||||
if (args == null) {
|
||||
return 0;
|
||||
}
|
||||
int hash = 0;
|
||||
for (Object o: args) {
|
||||
hash = X * hash + (o != null ? o.hashCode() : 0);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
@@ -69,4 +69,54 @@ public class SqlUtils {
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean getBoolean(Cursor cursor, String column, boolean defValue) {
|
||||
try {
|
||||
int index = cursor.getColumnIndex(column);
|
||||
if (index != -1) {
|
||||
return cursor.getInt(index) != 0;
|
||||
}
|
||||
} catch (Throwable e) { /* Ignore */ }
|
||||
return defValue;
|
||||
}
|
||||
|
||||
public static int getInt(Cursor cursor, String column, int defValue) {
|
||||
try {
|
||||
int index = cursor.getColumnIndex(column);
|
||||
if (index != -1) {
|
||||
return cursor.getInt(index);
|
||||
}
|
||||
} catch (Throwable e) { /* Ignore */ }
|
||||
return defValue;
|
||||
}
|
||||
|
||||
public static long getLong(Cursor cursor, String column, long defValue) {
|
||||
try {
|
||||
int index = cursor.getColumnIndex(column);
|
||||
if (index != -1) {
|
||||
return cursor.getLong(index);
|
||||
}
|
||||
} catch (Throwable e) { /* Ignore */ }
|
||||
return defValue;
|
||||
}
|
||||
|
||||
public static float getFloat(Cursor cursor, String column, float defValue) {
|
||||
try {
|
||||
int index = cursor.getColumnIndex(column);
|
||||
if (index != -1) {
|
||||
return cursor.getFloat(index);
|
||||
}
|
||||
} catch (Throwable e) { /* Ignore */ }
|
||||
return defValue;
|
||||
}
|
||||
|
||||
public static String getString(Cursor cursor, String column, String defValue) {
|
||||
try {
|
||||
int index = cursor.getColumnIndex(column);
|
||||
if (index != -1) {
|
||||
return cursor.getString(index);
|
||||
}
|
||||
} catch (Throwable e) { /* Ignore */ }
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.FastScroller;
|
||||
import com.hippo.easyrecyclerview.HandlerDrawable;
|
||||
import com.hippo.easyrecyclerview.LayoutManagerUtils;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.refreshlayout.RefreshLayout;
|
||||
import com.hippo.util.DrawableManager;
|
||||
@@ -457,9 +458,11 @@ public class ContentLayout extends FrameLayout {
|
||||
showContent();
|
||||
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
if (mRecyclerView.isAttachedToWindow()) {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TYPE_PRE_PAGE:
|
||||
@@ -485,7 +488,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showContent();
|
||||
|
||||
if (mCurrentTaskType == TYPE_PRE_PAGE) {
|
||||
if (mCurrentTaskType == TYPE_PRE_PAGE && mRecyclerView.isAttachedToWindow()) {
|
||||
// RecyclerView scroll, to top
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
@@ -510,15 +513,17 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showContent();
|
||||
|
||||
// RecyclerView scroll
|
||||
if (mCurrentTaskType == TYPE_PRE_PAGE_KEEP_POS) {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionProperly(mRecyclerView.getLayoutManager(), getContext(),
|
||||
dataSize - 1, mOnScrollToPositionListener);
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
if (mRecyclerView.isAttachedToWindow()) {
|
||||
// RecyclerView scroll
|
||||
if (mCurrentTaskType == TYPE_PRE_PAGE_KEEP_POS) {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionProperly(mRecyclerView.getLayoutManager(), getContext(),
|
||||
dataSize - 1, mOnScrollToPositionListener);
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -542,7 +547,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showContent();
|
||||
|
||||
if (mCurrentTaskType == TYPE_NEXT_PAGE) {
|
||||
if (mCurrentTaskType == TYPE_NEXT_PAGE && mRecyclerView.isAttachedToWindow()) {
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
|
||||
@@ -567,13 +572,15 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showContent();
|
||||
|
||||
if (mCurrentTaskType == TYPE_NEXT_PAGE_KEEP_POS) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView.smoothScrollBy(0, mNextPageScrollSize);
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
|
||||
onScrollToPosition(oldDataSize);
|
||||
if (mRecyclerView.isAttachedToWindow()) {
|
||||
if (mCurrentTaskType == TYPE_NEXT_PAGE_KEEP_POS) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView.smoothScrollBy(0, mNextPageScrollSize);
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
|
||||
onScrollToPosition(oldDataSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -614,10 +621,12 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showContent();
|
||||
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
if (mRecyclerView.isAttachedToWindow()) {
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TYPE_REFRESH_PAGE:
|
||||
@@ -651,7 +660,7 @@ public class ContentLayout extends FrameLayout {
|
||||
showContent();
|
||||
|
||||
// RecyclerView scroll
|
||||
if (newIndexEnd > oldIndexEnd && newIndexEnd > 0) {
|
||||
if (newIndexEnd > oldIndexEnd && newIndexEnd > 0 && mRecyclerView.isAttachedToWindow()) {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), newIndexEnd - 1, 0);
|
||||
onScrollToPosition(newIndexEnd - 1);
|
||||
@@ -700,7 +709,7 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void showText(CharSequence text) {
|
||||
mTipView.setText(text);
|
||||
mTipView.setText(text + "\n\n" + getContext().getString(R.string.help_route));
|
||||
mViewTransition.showView(2);
|
||||
}
|
||||
|
||||
@@ -848,14 +857,24 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private int mSavedDataId = IntIdGenerator.INVALID_ID;
|
||||
|
||||
private Parcelable saveInstanceState(Parcelable superState) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(KEY_SUPER, superState);
|
||||
int shownView = mViewTransition.getShownViewIndex();
|
||||
bundle.putInt(KEY_SHOWN_VIEW, shownView);
|
||||
bundle.putString(KEY_TIP, mTipView.getText().toString());
|
||||
// TODO What if data is large
|
||||
bundle.putParcelableArrayList(KEY_DATA, mData);
|
||||
|
||||
// TODO It's a bad design
|
||||
EhApplication app = (EhApplication) getContext().getApplicationContext();
|
||||
if (mSavedDataId != IntIdGenerator.INVALID_ID) {
|
||||
app.removeGlobalStuff(mSavedDataId);
|
||||
mSavedDataId = IntIdGenerator.INVALID_ID;
|
||||
}
|
||||
mSavedDataId = app.putGlobalStuff(mData);
|
||||
bundle.putInt(KEY_DATA, mSavedDataId);
|
||||
|
||||
bundle.putInt(KEY_NEXT_ID, mIdGenerator.nextId());
|
||||
bundle.putParcelable(KEY_PAGE_DIVIDER, mPageDivider);
|
||||
bundle.putInt(KEY_START_PAGE, mStartPage);
|
||||
@@ -869,7 +888,17 @@ public class ContentLayout extends FrameLayout {
|
||||
Bundle bundle = (Bundle) state;
|
||||
mViewTransition.showView(bundle.getInt(KEY_SHOWN_VIEW), false);
|
||||
mTipView.setText(bundle.getString(KEY_TIP));
|
||||
mData = bundle.getParcelableArrayList(KEY_DATA);
|
||||
|
||||
mSavedDataId = bundle.getInt(KEY_DATA);
|
||||
EhApplication app = (EhApplication) getContext().getApplicationContext();
|
||||
if (mSavedDataId != IntIdGenerator.INVALID_ID) {
|
||||
ArrayList<E> data = (ArrayList<E>) app.removeGlobalStuff(mSavedDataId);
|
||||
mSavedDataId = IntIdGenerator.INVALID_ID;
|
||||
if (data != null) {
|
||||
mData = data;
|
||||
}
|
||||
}
|
||||
|
||||
mIdGenerator.setNextId(bundle.getInt(KEY_NEXT_ID));
|
||||
mPageDivider = bundle.getParcelable(KEY_PAGE_DIVIDER);
|
||||
mStartPage = bundle.getInt(KEY_START_PAGE);
|
||||
|
||||
|
After Width: | Height: | Size: 6.8 KiB |
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2015 The Android Open Source Project
|
||||
~
|
||||
~ 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
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="40.0dp"
|
||||
android:height="40.0dp"
|
||||
android:viewportWidth="40.0"
|
||||
android:viewportHeight="40.0">
|
||||
<path
|
||||
android:pathData="M20.0,0.0C8.96,0.0 0.0,8.95 0.0,20.0s8.96,20.0 20.0,20.0c11.04,0.0 20.0,-8.95 20.0,-20.0S31.04,0.0 20.0,0.0z"
|
||||
android:fillColor="#F4511E"/>
|
||||
<path
|
||||
android:pathData="M21.33,29.33l-2.67,0.0l0.0,-2.67l2.67,0.0L21.33,29.33zM21.33,22.67l-2.67,0.0l0.0,-12.0l2.67,0.0L21.33,22.67z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2015 The Android Open Source Project
|
||||
~
|
||||
~ 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
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="40.0dp"
|
||||
android:height="40.0dp"
|
||||
android:viewportWidth="40.0"
|
||||
android:viewportHeight="40.0">
|
||||
<path
|
||||
android:pathData="M20.0,20.0m-20.0,0.0a20.0,20.0 0.0,1.0 1.0,40.0 0.0a20.0,20.0 0.0,1.0 1.0,-40.0 0.0"
|
||||
android:fillColor="#009688"/>
|
||||
<path
|
||||
android:pathData="M11.2,21.41l1.63,-1.619999 4.17,4.169998 10.59,-10.589999 1.619999,1.63 -12.209999,12.209999z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="48dp"
|
||||
android:width="48dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
|
||||
<path
|
||||
android:fillColor="?attr/colorPrimary"
|
||||
android:pathData="@string/pd_archive"/>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/primary_drawable_dark"
|
||||
android:pathData="@string/pd_check"/>
|
||||
|
||||
</vector>
|
||||
@@ -40,7 +40,16 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<CheckBox
|
||||
android:id="@+id/fingerprint_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/enable_fingerprint" />
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -69,7 +78,7 @@
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
||||
@@ -51,7 +51,16 @@
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<CheckBox
|
||||
android:id="@+id/fingerprint_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/enable_fingerprint" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -79,5 +88,5 @@
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.hippo.widget.ProgressView
|
||||
android:id="@+id/progress"
|
||||
style="@style/ProgressView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/abc_dialog_padding_top_material"
|
||||
android:paddingBottom="@dimen/abc_dialog_padding_top_material">
|
||||
|
||||
<com.hippo.widget.ProgressView
|
||||
android:id="@+id/progress"
|
||||
style="@style/ProgressView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -150,6 +150,13 @@
|
||||
android:text="@string/settings_read_show_battery"
|
||||
android:textColor="@color/primary_text_dark"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_page_interval"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_read_show_page_interval"
|
||||
android:textColor="@color/primary_text_dark"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/volume_page"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/keyline_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/keyline_margin"
|
||||
android:inputType="text"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -32,8 +32,8 @@
|
||||
android:scrollbars="vertical"
|
||||
android:overScrollMode="ifContentScrolls"
|
||||
android:fadingEdge="none"
|
||||
android:paddingTop="@dimen/abc_dialog_list_padding_vertical_material"
|
||||
android:paddingBottom="@dimen/abc_dialog_list_padding_vertical_material"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
style="@style/Indicating"/>
|
||||
|
||||
|
||||
@@ -67,10 +67,11 @@
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/torrent"
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/rate"
|
||||
android:drawablePadding="8dp"
|
||||
android:textColor="@color/primary_text_light"/>
|
||||
|
||||
@@ -84,11 +85,19 @@
|
||||
android:textColor="@color/primary_text_light"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rate"
|
||||
android:id="@+id/torrent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/rate"
|
||||
android:drawablePadding="8dp"
|
||||
android:textColor="@color/primary_text_light"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/archive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/archive"
|
||||
android:gravity="center_horizontal"
|
||||
android:drawablePadding="8dp"
|
||||
android:textColor="@color/primary_text_light"/>
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -88,5 +88,5 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/accept"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -92,18 +92,38 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ipb_pass_hash"
|
||||
android:imeOptions="actionDone"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
tools:ignore="HardcodedText"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/igneous_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/igneous"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="igneous"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -130,5 +150,5 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/ok"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -57,7 +57,7 @@
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -88,5 +88,5 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/send"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -71,19 +71,46 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/password"
|
||||
android:imeOptions="actionDone"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/recaptcha_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/recaptcha"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/recaptcha"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<com.hippo.ehviewer.widget.RecaptchaView
|
||||
android:id="@+id/recaptcha_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:minWidth="@dimen/single_max_width"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -114,7 +141,7 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/sign_in"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sign_in_via_webview"
|
||||
|
||||
@@ -27,12 +27,27 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="32dp"
|
||||
app:maxWidth="320dp"
|
||||
app:maxHeight="320dp">
|
||||
app:maxHeight="360dp">
|
||||
|
||||
<com.hippo.widget.lockpattern.LockPatternView
|
||||
android:id="@+id/pattern_view"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.hippo.widget.lockpattern.LockPatternView
|
||||
android:id="@+id/pattern_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fingerprint_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_fp_40px"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
</FrameLayout>
|
||||
@@ -92,7 +92,7 @@
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -119,5 +119,5 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/ok"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -87,5 +87,5 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/accept"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -14,7 +14,7 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -35,4 +35,4 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_apply"
|
||||
android:icon="@drawable/v_check_dark_x24"
|
||||
android:title="@string/apply"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,621 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<string name="app_name">EhViewer</string>
|
||||
|
||||
<!-- Category -->
|
||||
|
||||
<string name="homepage">Página de inicio</string>
|
||||
<string name="whats_hot">Destacado</string>
|
||||
<string name="favourite">Favoritos</string>
|
||||
<string name="history">Historial</string>
|
||||
<string name="downloads">Descargas</string>
|
||||
<string name="settings">Configuración</string>
|
||||
|
||||
<string name="username">Usuario</string>
|
||||
<string name="password">Contraseña</string>
|
||||
|
||||
<string name="sign_in">Iniciar sesión</string>
|
||||
<string name="register">Registrarse</string>
|
||||
<string name="sign_in_via_webview">Iniciar sesión vía web</string>
|
||||
<string name="sign_in_via_cookies">Iniciar sesión vía cookies</string>
|
||||
<string name="display_name_dialog_title">Ingresa un nombre para mostrar</string>
|
||||
<string name="display_name">Nombre para mostrar</string>
|
||||
<string name="display_name_is_empty">El nombre a mostrar esta vacío</string>
|
||||
<string name="sign_in_first">Por favor, inicie sesión primero</string>
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Una cookie es una pequeña pieza de datos almacenados en el navegador web. Búsquelo si no sabe lo que es o cómo obtenerlo.\n\nIngrese cookies especiales para iniciar sesión.</string>
|
||||
<string name="text_is_empty">El texto está vacío</string>
|
||||
<string name="waring">Advertencia</string>
|
||||
<string name="wrong_cookie_warning">Parece que las cookies que ingresaste son incorrectas. Debe revisarlos.</string>
|
||||
<string name="i_will_check_it">Comprobar ahora</string>
|
||||
<string name="i_dont_think_so">No lo creo</string>
|
||||
<string name="found_cookies">¡Cookies encontradas!</string>
|
||||
|
||||
<string name="invalid_download_location">Parece que la ubicación de descarga no está disponible. Establece la ubicación en Configuración.</string>
|
||||
|
||||
<string name="cellular_network_warning">Conectado a redes móviles</string>
|
||||
|
||||
<string name="error_bad_status_code">Bad status code: %d</string>
|
||||
<string name="error_timeout">Sin tiempo</string>
|
||||
<string name="error_unknown_host">Host desconocido</string>
|
||||
<string name="error_redirection">Demasiadas redirecciones</string>
|
||||
<string name="error_socket">Error de Red</string>
|
||||
<string name="error_unknown">Raro</string>
|
||||
<string name="error_cant_find_activity">No se encuentra la aplicación</string>
|
||||
<string name="error_cannot_parse_the_url">No se puede analizar el URL</string>
|
||||
<string name="error_not_folder_path">Sin ruta del directorio</string>
|
||||
<string name="error_no_provider">Sin proveedor</string>
|
||||
<string name="error_decoding_failed">Decodificacion fallida</string>
|
||||
<string name="error_not_found">No encontrado</string>
|
||||
<string name="error_empty">Vacio</string>
|
||||
<string name="error_invalid_zip_file">Archivo ZIP invalido</string>
|
||||
<string name="error_reading_failed">Lectura Fallida</string>
|
||||
<string name="error_out_of_range">Fuera de rango</string>
|
||||
<string name="error_write_failed">Falla en la escritura</string>
|
||||
<string name="error_parse_error">Análisis erróneo</string>
|
||||
<string name="error_509">509</string>
|
||||
<string name="error_invalid_url">Url invalida</string>
|
||||
<string name="error_get_ptoken_error">Error al obtener token</string>
|
||||
<string name="error_invalid_specify_gallery">Keyword should looks like \"618395 0439fa3666\" for specify gallery</string>
|
||||
<string name="error_cant_create_temp_file">Imposible crear archivo temporal</string>
|
||||
<string name="error_cant_save_image">Imposible guardar la imagen</string>
|
||||
<string name="error_invalid_number">Número invalido</string>
|
||||
|
||||
<string name="app_waring">El contenido de esta aplicación es de Internet. Algunas de ellas pueden causarle daño psicológico. Ahora sabes los riesgos anteriormente mencionado y te gustaría asumirlos</string>
|
||||
<string name="error_username_cannot_empty">El usuario no puede estar vacío</string>
|
||||
<string name="skip_signing_in">Saltar inicio de sesión</string>
|
||||
<string name="sign_in_failed">Inicio de sesión fallido</string>
|
||||
<string name="sign_in_failed_plain">Tal ves sea debido a un error de actualización de el sitio web o algo mal sucedió. Puedes intentar iniciar sesión vía WebView, ingresar una cookie o saltar el inicio de sesión presionando el boton de abajo.\nEs posible que te salga un \"Panda Triste\" después de saltar el inicio de sesión. Intente \"Ingresar via cookies\" primero si ha iniciado sesión en la versión 0.6.x de HeViewer.</string>
|
||||
<string name="press_twice_exit">Presione una vez más para salir</string>
|
||||
<string name="content_layout_restore_tip">Puslar para reintentar</string>
|
||||
<string name="write_rationale">EhViewer solicitará el permiso WRITE_EXTERNAL_STORAGE para descargar galerías. ¿Desea conceder el permiso?</string>
|
||||
<string name="you_rejected_me">Me has rechazado :(</string>
|
||||
<string name="analytics_explain">Would you mind if the developer collected your device information and your usage? It will help the developer a lot.<br><br>Data analysis service is provided by Google Analytics. Its privacy policy can be found at <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a>.<br><br>If you agree to join data analysis, your device information and your usage will be collected, including but not limited to Android API version, equipment model, language residence, the application version, conversion time, function times. The developer promise that these information will NOT be collected, including phone number, e-mail address, IMEI.<br><br>Your information will not be collected until you agree to join data analysis.<br><br>The collected information will be analyzed by Google Analytics. The analysis report can only be viewed by the developer of this application.</string>
|
||||
<string name="get_it">Entendido</string>
|
||||
<string name="accept">Aceptar</string>
|
||||
<string name="reject">Rechazar</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">Enviar</string>
|
||||
<string name="crash_explain">Esta aplicación se cerró inesperadamente la ultima vez. ¿Desea enviarle un logcat (registro) al desarrollador para una mejor experiencia en el futuro? (vía e-mail)</string>
|
||||
|
||||
<!-- Select scene -->
|
||||
<string name="select_scene">¿Qué galería deseas seleccionar?</string>
|
||||
<string name="select_scene_explain">e-hentai: Disponible para cualquiera .\nexhentai: Solo para usuarios que han iniciado sesión</string>
|
||||
<string name="no_select">Por favor seleccione un sitio</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update">Actualizar</string>
|
||||
<string name="update_plain">Versión: %1$s\nSize: %2$s\n\n%3$s</string>
|
||||
<string name="update_to_date">EhViewer está actualizado</string>
|
||||
|
||||
<!-- Gallery List -->
|
||||
<string name="gallery_list_search_bar_hint_exhentai">Buscar ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_e_hentai">Buscar E-Hentai</string>
|
||||
<string name="gallery_list_empty_hit">El mundo es grande y el panda está sentado solo</string>
|
||||
|
||||
<string name="search">Buscar</string>
|
||||
|
||||
<string name="keyword_search">Búsqueda por palabras clave</string>
|
||||
<string name="image_search">Búsqueda de imagen</string>
|
||||
<string name="search_normal">Búsqueda normal</string>
|
||||
<string name="search_advance">Opciones avanzadas</string>
|
||||
<string name="search_image">Búsqueda de imágenes</string>
|
||||
<string name="search_normal_search">Búsqueda general</string>
|
||||
<string name="search_specify_uploader">Uploader específicos</string>
|
||||
<string name="search_specify_tag">Etiquetas específicas</string>
|
||||
<string name="search_specify_gallery">Galerías específicas</string>
|
||||
<string name="search_enable_advance">Habilitar opciones avanzadas</string>
|
||||
|
||||
<string name="search_tip">Búsqueda normal: Solo busca.\n\nUploader especifico: Listar de galerías subidas por el uploader. Otras opciones serán ignoradas.\n\nEtiquetas específicas: Listar las galerías que contienen la etiqueta. Solo se acepta una etiqueta. Otras opciones serán ignoradas.\n\nGalería especifica: Ir a la Galería. La palabra clave debe ser \"gid token\".</string>
|
||||
|
||||
<string name="search_sname">Buscar galerías</string>
|
||||
<string name="search_stags">Buscar etiquetas de galería</string>
|
||||
<string name="search_sdesc">Buscar descripción de galería</string>
|
||||
<string name="search_storr">Buscar nombres de archivo torrent</string>
|
||||
<string name="search_sto">Mostrar solo galerías con torrents</string>
|
||||
<string name="search_sdt1">Buscar etiquetas Low-Power</string>
|
||||
<string name="search_sdt2">Buscar etiquetas pobres</string>
|
||||
<string name="search_sh">Mostrar galerías borradas</string>
|
||||
<string name="search_sr">Valoración mínima:</string>
|
||||
|
||||
<string name="select_image">Seleccionar imagen</string>
|
||||
<string name="search_uss">Usar búsqueda similar</string>
|
||||
<string name="search_osc">Buscar solo portadas</string>
|
||||
<string name="search_se">Mostrar borrados</string>
|
||||
<string name="select_image_first">Seleccione la imagen primero</string>
|
||||
|
||||
<string name="quick_search">Búsqueda rápida</string>
|
||||
<string name="quick_search_tip">Pulsar \"+\" para añadir a la búsqueda rápida</string>
|
||||
<string name="add_quick_search_dialog_title">Añadir búsqueda rápida</string>
|
||||
<string name="name_is_empty">Nombre vacío</string>
|
||||
<string name="delete_quick_search_title">Eliminar búsqueda rápida</string>
|
||||
<string name="delete_quick_search_message">¿Eliminar \"%s\"?</string>
|
||||
<string name="no_quick_search">La búsqueda rápida se muestra acá</string>
|
||||
<string name="add_quick_search_tip">El estado de la lista de galerías se guardará como búsqueda rápida. Aplique la búsqueda primero si desea guardar el estado del panel de búsqueda.</string>
|
||||
<string name="readme">LÉEME</string>
|
||||
<string name="image_search_not_quick_search">No se puede añadir la búsqueda de imágenes como búsqueda rápida</string>
|
||||
<string name="duplicate_quick_search">Búsqueda rápida duplicada. El nombre es \"%s\".</string>
|
||||
<string name="duplicate_name">Nombre duplicado existente</string>
|
||||
|
||||
<string name="go_to_hint">Página %1$d, total %2$d páginas</string>
|
||||
|
||||
<!-- search_min_rating -->
|
||||
<string name="star_2">2 estrellas</string>
|
||||
<string name="star_3">3 estrellas</string>
|
||||
<string name="star_4">4 estrellas</string>
|
||||
<string name="star_5">5 estrellas</string>
|
||||
|
||||
<!-- Gallery detail -->
|
||||
<string name="error_cannot_find_gallery">No se encuentra la galería</string>
|
||||
<string name="download">Descargas</string>
|
||||
<string name="read">Leer</string>
|
||||
<string name="more_information">Más información</string>
|
||||
<plurals name="page_count">
|
||||
<item quantity="one">%d páginas</item>
|
||||
<item quantity="other">%d páginas</item>
|
||||
</plurals>
|
||||
<string name="favored_times">\u2665 %d</string>
|
||||
<string name="rating_text">%1$s (%2$.2f, %3$d)</string>
|
||||
<string name="favorites">Favoritos</string>
|
||||
<string name="torrent_count">Torrent (%d)</string>
|
||||
<string name="share">Compartir</string>
|
||||
<string name="rate">Valorar</string>
|
||||
<string name="similar_gallery">Similar</string>
|
||||
<string name="search_cover">Buscar portada</string>
|
||||
<string name="no_tags">Sin etiquetas</string>
|
||||
<string name="no_comments">Sin comentarios</string>
|
||||
<string name="no_more_comments">No hay más comentarios</string>
|
||||
<string name="more_comment">Más comentarios</string>
|
||||
<string name="no_previews">Sin vistas previas</string>
|
||||
<string name="no_more_previews">No hay más vistas previas</string>
|
||||
<string name="more_previews">Más vistas previas</string>
|
||||
<string name="refresh">Actualizar</string>
|
||||
<string name="open_in_other_app">Abrir en otra aplicación</string>
|
||||
<string name="rate_successfully">Valoración completada</string>
|
||||
<string name="rate_failed">Valoración fallida</string>
|
||||
<string name="no_torrents">Sin torrents</string>
|
||||
<string name="torrents">Torrents</string>
|
||||
<string name="favorited">Favorito</string>
|
||||
<string name="not_favorited">Sin favoritos</string>
|
||||
<string name="add_favorites_dialog_title">Añadir a favoritos</string>
|
||||
<string name="remember_favorite_collection">Recordar favoritos</string>
|
||||
<string name="remove_from_favorite_success">Eliminado de favoritos</string>
|
||||
<string name="add_to_favorite_failure">No se ha podido agregar a favoritos</string>
|
||||
<string name="remove_from_favorite_failure">Error al borrar de favoritos</string>
|
||||
<string name="block_the_uploader">¿Añadir el uploader \"%s\" a la lista de filtros?</string>
|
||||
<string name="filter_added">Filtro añadido</string>
|
||||
|
||||
<!-- Rating -->
|
||||
<string name="rating10">OBRA MAESTRA</string>
|
||||
<string name="rating9">ASOMBROSO</string>
|
||||
<string name="rating8">GRANDIOSO</string>
|
||||
<string name="rating7">BUENO</string>
|
||||
<string name="rating6">DECENTE</string>
|
||||
<string name="rating5">MEDIOCRE</string>
|
||||
<string name="rating4">MALO</string>
|
||||
<string name="rating3">HORRIBLE</string>
|
||||
<string name="rating2">DOLOROSO</string>
|
||||
<string name="rating1">INSORPOTABLE</string>
|
||||
<string name="rating0">DESASTRE</string>
|
||||
|
||||
<!-- Gallery Info -->
|
||||
<string name="gallery_info">Información de la galería</string>
|
||||
<string name="copied_to_clipboard">Copiado al portapapeles</string>
|
||||
<string name="header_key">Clave</string>
|
||||
<string name="header_value">Valor</string>
|
||||
<string name="key_gid">Guía</string>
|
||||
<string name="key_token">Clave</string>
|
||||
<string name="key_url">URL</string>
|
||||
<string name="key_title">Título</string>
|
||||
<string name="key_title_jpn">Título en japonés</string>
|
||||
<string name="key_thumb">Miniatura</string>
|
||||
<string name="key_category">Categoría</string>
|
||||
<string name="key_uploader">Uploader</string>
|
||||
<string name="key_posted">Publicado</string>
|
||||
<string name="key_parent">Padre</string>
|
||||
<string name="key_visible">Visible</string>
|
||||
<string name="key_language">Lenguaje</string>
|
||||
<string name="key_pages">Páginas</string>
|
||||
<string name="key_size">Tamaño</string>
|
||||
<string name="key_favorite_count">Número de favoritos</string>
|
||||
<string name="key_favorited">Favorito</string>
|
||||
<string name="key_rating_count">Número de valoraciones</string>
|
||||
<string name="key_rating">Valoración</string>
|
||||
<string name="key_torrents">Torrents</string>
|
||||
<string name="key_torrent_url">Url de torrent</string>
|
||||
|
||||
<!-- Gallery Comments -->
|
||||
<string name="gallery_comments">Comentarios de la galería</string>
|
||||
<string name="no_one_comments_gallery">Sin comentarios en esta galería</string>
|
||||
<string name="comment_successfully">Comentario publicado</string>
|
||||
<string name="copy_comment_text">Copiar texto de comentario</string>
|
||||
<string name="vote_up">Votar positivo</string>
|
||||
<string name="cancel_vote_up">Cancelar voto</string>
|
||||
<string name="vote_down">Votar negativo</string>
|
||||
<string name="vote_up_successfully">Voto positivo completado</string>
|
||||
<string name="cancel_vote_up_successfully">Voto cancelado</string>
|
||||
<string name="vote_down_successfully">Voto negativo completado</string>
|
||||
<string name="cancel_vote_down_successfully">Voto cancelado</string>
|
||||
<string name="vote_failed">Voto fallido</string>
|
||||
<string name="check_vote_status">Verificar estado del voto</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">Vista previa de la galeria</string>
|
||||
<string name="go_to">Ir a</string>
|
||||
|
||||
<!-- Download -->
|
||||
<string name="scene_download_title">Descargas - %s</string>
|
||||
<string name="no_download_info">Las descargas de galerías se muestran acá</string>
|
||||
<string name="download_state_wait">Esperando</string>
|
||||
<string name="download_state_downloading">Descargando</string>
|
||||
<string name="download_state_downloaded">Descargado</string>
|
||||
<string name="download_state_failed_2">%d incompleto</string>
|
||||
<string name="download_state_finish">Completado</string>
|
||||
<string name="stat_509_alert_title">Alerta 509</string>
|
||||
<string name="stat_509_alert_text">Se alcanzó el límite de imágenes. Detenga la descarga y espere un poco</string>
|
||||
<string name="stat_download_done_title">Descarga completada</string>
|
||||
<string name="stat_download_done_text_succeeded">%d completada</string>
|
||||
<string name="stat_download_done_text_failed">%d fallido</string>
|
||||
<string name="stat_download_done_text_mix">%1$d completado, %2$d fallido</string>
|
||||
<string name="stat_download_done_line_succeeded">Completado: %s</string>
|
||||
<string name="stat_download_done_line_failed">Fallido: %s</string>
|
||||
<string name="download_remove_dialog_title">Borrar galería descargada</string>
|
||||
<string name="download_remove_dialog_message">¿Borrar %s de la lista de descargas?</string>
|
||||
<string name="download_remove_dialog_message_2">¿Borrar %d galerías de la lista de descargas?</string>
|
||||
<string name="download_remove_dialog_check_text">Borrar imágenes</string>
|
||||
<string name="stat_download_action_stop_all">Detener todo</string>
|
||||
<string name="drawer_download_label_title">Etiquetas</string>
|
||||
<string name="default_download_label_name">Predeterminado</string>
|
||||
<string name="download_move_dialog_title">Mover</string>
|
||||
<string name="download_labels">Descargar etiquetas</string>
|
||||
<string name="download_start_all">Iniciar todo</string>
|
||||
<string name="download_stop_all">Detener todo</string>
|
||||
<string name="download_service_label">Servicio de descarga EhViewer</string>
|
||||
<string name="download_speed_text">%s</string>
|
||||
<string name="download_speed_text_2">%1$s, %2$s restantes</string>
|
||||
<string name="remember_download_label">Recordar etiqueta de descarga</string>
|
||||
<string name="default_download_label">Etiqueta predeterminada de descarga</string>
|
||||
<string name="added_to_download_list">Añadido a la lista de descargas</string>
|
||||
|
||||
<!-- Download label -->
|
||||
<string name="no_download_label">Las etiquetas de descarga se muestran acá</string>
|
||||
<string name="add">Añadir</string>
|
||||
<string name="new_label_title">Nueva etiqueta</string>
|
||||
<string name="label_text_is_empty">Nombre de la etiqueta vacía</string>
|
||||
<string name="label_text_is_invalid">\"Defecto\" es una etiqueta invalida</string>
|
||||
<string name="label_text_exist">Etiqueta existente</string>
|
||||
<string name="rename_label_title">Renombrar etiqueta</string>
|
||||
<string name="delete_label_title">Eliminar etiqueta</string>
|
||||
<string name="delete_label_message">¿Eliminar \"%s\"?</string>
|
||||
|
||||
<!-- History -->
|
||||
<string name="no_history">Las galerías visualizadas se muestran aquí</string>
|
||||
<string name="clear_all_history">¿Limpiar historial?</string>
|
||||
|
||||
<!-- Filter -->
|
||||
<string name="filter">Filtros</string>
|
||||
<string name="no_filter">Los filtros se muestran acá</string>
|
||||
<string name="filter_title">Título</string>
|
||||
<string name="filter_uploader">Uploader</string>
|
||||
<string name="filter_tag">Etiqueta</string>
|
||||
<string name="filter_tag_namespace">Etiqueta de espacio de nombres</string>
|
||||
<string name="delete_title_filter">¿Eliminar filtro de título \"%s\"?</string>
|
||||
<string name="delete_uploader_filter">¿Eliminar filtro de uploader \"%s\"?</string>
|
||||
<string name="delete_tag_filter">¿Eliminar filtro de etiquetas \"%s\"?</string>
|
||||
<string name="delete_filter">¿Eliminar filtro \"%s\"?</string>
|
||||
<string name="tip">Sugerencia</string>
|
||||
<string name="add_filter">Añadir filtro</string>
|
||||
<string name="show_definition">Mostrar definición</string>
|
||||
<string name="filter_text">Filtro de texto</string>
|
||||
<string name="filter_tip">Filtro de título: excluye la galería cuyo título contiene la palabra.\n\nFiltro de uploader: excluye las galerías subidas por el uploader.\n\nFiltro de etiquetas: excluye la galería que contiene la etiqueta, toma más tiempo para cargar la lista de galerías.\n\nFiltro de etiqueta de nombre de espacio: excluye la galería que contiene el espacio de nombres de la etiqueta, toma más tiempo para cargar la lista de galerías.</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">Establecer protección por patrón</string>
|
||||
<string name="set_pattern_protection_tip">Dibuje un patrón para establecer la protección por patrón. \nDéjelo en blanco para quitar la protección por patrón</string>
|
||||
<string name="set">Establecer</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">Página %d</string>
|
||||
<string name="page_menu_refresh">@string/refresh</string>
|
||||
<string name="page_menu_share">@string/share</string>
|
||||
<string name="page_menu_save">Guardar</string>
|
||||
<string name="page_menu_add_bookmark">Añadir a marcadores</string>
|
||||
<string name="gallery_menu_title">Menú</string>
|
||||
<string name="share_image">Compartir imagen</string>
|
||||
<string name="image_saved">Imagen guardada en %s</string>
|
||||
|
||||
<string name="settings_eh">EH</string>
|
||||
<string name="settings_eh_sign_out">Cerrar sesión</string>
|
||||
<string name="settings_eh_sign_out_summary">Reinicie la aplicación para iniciar sesiónn</string>
|
||||
<string name="settings_eh_sign_out_warning">¿Estás seguro de cerrar sesión?</string>
|
||||
<string name="settings_eh_sign_out_yes">@android:string/ok</string>
|
||||
<string name="settings_eh_sign_out_tip">Sesión cerrada. Reinicie la aplicación para iniciar sesión</string>
|
||||
<string name="settings_eh_gallery_site">Seleccionar galería</string>
|
||||
<string name="settings_eh_list_mode">Modo lista</string>
|
||||
<string name="settings_eh_list_mode_detail">Detallado</string>
|
||||
<string name="settings_eh_list_mode_thumb">Vista previa</string>
|
||||
<string name="settings_eh_detail_size">Detalles de tamaño</string>
|
||||
<string name="settings_eh_detail_size_long">Largo</string>
|
||||
<string name="settings_eh_detail_size_short">Corto</string>
|
||||
<string name="settings_eh_thumb_size">Tamaño de vista previa</string>
|
||||
<string name="settings_eh_thumb_size_large">Largo</string>
|
||||
<string name="settings_eh_thumb_size_middle">Medio</string>
|
||||
<string name="settings_eh_thumb_size_small">Pequeño</string>
|
||||
<string name="settings_eh_thumb_resolution">Resolución de vista previa</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s, las resoluciones especiales podrían causar errores en la vista previa</string>
|
||||
<string name="settings_eh_thumb_resolution_auto">Automático</string>
|
||||
<string name="settings_eh_fix_thumb_url">Reparar URL de vistas previas</string>
|
||||
<string name="settings_eh_default_categories">Categorías en la página de inicio</string>
|
||||
<string name="settings_eh_default_categories_summary">Categorías que se muestran en la página de inicio por defecto.</string>
|
||||
<string name="settings_eh_excluded_languages">Idiomas excluidos</string>
|
||||
<string name="settings_eh_excluded_languages_summary">Ocultar galerías en ciertos idiomas de la lista de galerías y búsquedas</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces">Excluir etiquetas espacios de nombres</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces_summary">Excluir ciertos espacios de nombres de una búsqueda de etiquetas por defecto</string>
|
||||
<string name="settings_eh_hath_proxy">H@H proxy</string>
|
||||
<string name="settings_eh_hath_proxy_summary_1">%1$s %2$s:%3$d</string>
|
||||
<string name="settings_eh_hath_proxy_summary_2">Sin establecer</string>
|
||||
<string name="settings_eh_show_jpn_title">Mostrar título en japonés</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_on">Intentar mostrar títulos en japonés. Tomará más tiempo en cargar la lista de galerías</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_off">Mostrar títulos por defecto, usualmente es en inglés</string>
|
||||
<string name="settings_eh_filter">Filtros</string>
|
||||
<string name="settings_eh_filter_summary">Filtrar por titulo, uploader, etiqueta y etiquetas variables</string>
|
||||
<string name="settings_eh_cellular_network_warning">Advertencia de redes moviles</string>
|
||||
|
||||
<string name="settings_read">Lectura</string>
|
||||
<string name="settings_read_screen_rotation">Orientación de la pantalla</string>
|
||||
<string name="settings_read_screen_rotation_default">Defecto</string>
|
||||
<string name="settings_read_screen_rotation_portrait">Retrato</string>
|
||||
<string name="settings_read_screen_rotation_landscape">Paisaje</string>
|
||||
<string name="settings_read_reading_direction">Dirección de lectura</string>
|
||||
<string name="settings_read_reading_direction_left_to_right">Izquierda a derecha</string>
|
||||
<string name="settings_read_reading_direction_right_to_Left">Derecha a izquierda</string>
|
||||
<string name="settings_read_reading_direction_top_to_bottom">Arriba hacia abajo</string>
|
||||
<string name="settings_read_page_scaling">Escala de página</string>
|
||||
<string name="settings_read_page_scaling_actual_size">Tamaño actual</string>
|
||||
<string name="settings_read_page_scaling_fit_to_width">Ajustar a lo ancho</string>
|
||||
<string name="settings_read_page_scaling_fit_to_height">Ajustar a la altura</string>
|
||||
<string name="settings_read_page_scaling_fit_to_screen">Ajustar a la pantalla</string>
|
||||
<string name="settings_read_page_scaling_fixed_scale">Escala fija</string>
|
||||
<string name="settings_read_start_position">Posición de inicio</string>
|
||||
<string name="settings_read_start_position_top_left">Arriba a la izquierda</string>
|
||||
<string name="settings_read_start_position_top_right">Abajo a la derecha</string>
|
||||
<string name="settings_read_start_position_bottom_left">Abajo a la izquierda</string>
|
||||
<string name="settings_read_start_position_bottom_right">Abajo a la derecha</string>
|
||||
<string name="settings_read_start_position_center">Centro</string>
|
||||
<string name="settings_read_keep_screen_on">Pantalla siempre encendida</string>
|
||||
<string name="settings_read_show_clock">Mostrar hora</string>
|
||||
<string name="settings_read_show_progress">Mostrar progreso</string>
|
||||
<string name="settings_read_show_battery">Mostrar batería</string>
|
||||
<string name="settings_read_volume_page">Pasar páginas con tecla de volumen</string>
|
||||
<string name="settings_read_reading_fullscreen">Pantalla completa</string>
|
||||
<string name="settings_read_custom_screen_lightness">Brillo de pantalla personalizado</string>
|
||||
<string name="settings_read_screen_lightness">Brillo de la pantalla</string>
|
||||
|
||||
<string name="settings_download">Descargas</string>
|
||||
<string name="settings_download_download_location">Localización de descargas</string>
|
||||
<string name="settings_download_invalid_download_location">Ruta de descarga invalida</string>
|
||||
<string name="settings_download_cant_get_download_location">No se puede obtener ruta de descargas</string>
|
||||
<string name="settings_download_pick_dir_kk">No puedes escribir ningún tipo de datos en tu memoria SD externa en Android 4.4+ a no ser que la hayas hakeado. Pero <SD card>/Android/data/com.hippo.ehviewer es especial, puedes escribir en ello.</string>
|
||||
<string name="settings_download_pick_dir_l">Anroid 5.0+ proporciona una nueva API para escribir en una tarjeta SD externa. Haga click en el boton \"DOCUMENT\" si desea establecer la ruta de descarga en una tarjeta SD.</string>
|
||||
<string name="settings_download_document">Document</string>
|
||||
<string name="settings_download_continue">Continuar</string>
|
||||
<string name="settings_download_media_scan">Permitir escaneo de medios</string>
|
||||
<string name="settings_download_media_scan_summary_on">Mantenga las aplicaciones de galería fuera del alcanze de otra personas (podrán ver las galerías almacenadas)</string>
|
||||
<string name="settings_download_media_scan_summary_off">Las aplicaciones de galería de imágenes ignoraran la ruta de descargas de galerías</string>
|
||||
<string name="settings_download_multi_thread_download">Multi-hilos al descargar</string>
|
||||
<string name="settings_download_multi_thread_download_summary">Máximo de %s imágenes</string>
|
||||
<string name="settings_download_preload_image">Precargar Imagen</string>
|
||||
<string name="settings_download_preload_image_summary">Precargar las siguientes %s imágenes</string>
|
||||
<string name="settings_download_image_resolution">Resolución de la imagen</string>
|
||||
<string name="settings_download_image_resolution_summary">%s, resoluciones mayores a 1280x podrían dar error</string>
|
||||
<string name="settings_download_image_resolution_auto">Auto</string>
|
||||
<string name="settings_download_download_origin_image">Descargar imagen original</string>
|
||||
<string name="settings_download_download_origin_image_summary">¡Cuidado! Podrías recibir error 509</string>
|
||||
<string name="settings_download_restore_download_items">Restaurar los elementos de descarga</string>
|
||||
<string name="settings_download_restore_download_items_summary">Restaurar todos los elementos de descarga en la ubicación de descarga</string>
|
||||
<string name="settings_download_restoring">Restaurando...</string>
|
||||
<string name="settings_download_restore_not_found">No se han encontrado elementos para restaurar</string>
|
||||
<string name="settings_download_restore_failed">Restauración fallida</string>
|
||||
<string name="settings_download_restore_successfully">Restauración de %d elementos completados</string>
|
||||
<string name="settings_download_clean_redundancy">Borrar descargas innecesarias</string>
|
||||
<string name="settings_download_clean_redundancy_summary">Eliminar las imágenes de la galería que no se encuentran en la lista de descarga pero sí la ubicación de descarga</string>
|
||||
<string name="settings_download_clean_redundancy_no_redundancy">Sin elementos innecesarios</string>
|
||||
<string name="settings_download_clean_redundancy_done">Borrado de redundancia completado, un total de %d elementos borrados</string>
|
||||
|
||||
<string name="settings_advanced">Avanzado</string>
|
||||
<string name="settings_advanced_save_parse_error_body">Guardar contenido en HTML al analizar el error</string>
|
||||
<string name="settings_advanced_save_parse_error_body_summary">El contenido HTML puede ser sensible a la privacidad</string>
|
||||
<string name="settings_advanced_dump_logcat">Guardado de logcat</string>
|
||||
<string name="settings_advanced_dump_logcat_summary">Guardar logcat en almacenamiento externo</string>
|
||||
<string name="settings_advanced_dump_logcat_failed">Guardado de logcat fallido</string>
|
||||
<string name="settings_advanced_dump_logcat_to">Logcat guardado en %s</string>
|
||||
<string name="settings_advanced_clear_download_path_cache">Borrar caché de la ruta de descarga</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_summary">La ruta de descarga de la galería podría ser incorrecta y necesita ser descargada de nuevo. Borrar el caché de la ruta de descarga debería resolver el problema</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_message">¿Borrar caché de la ruta de descarga?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">Borrar caché de memoria</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">Borrar vistas previas, galerías, información y caché de memoria</string>
|
||||
<string name="settings_advanced_read_cache_size">Tamaño del caché (archivos temporales)</string>
|
||||
<string name="settings_advanced_pattern_protection_title">Protección por patrón</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">No se ha configurado la protección por patrón</string>
|
||||
<string name="settings_advanced_pattern_protection_set">La protección por patrón ha sido configurado</string>
|
||||
<string name="settings_advanced_export_data">Exportar datos</string>
|
||||
<string name="settings_advanced_export_data_summary">Guardar datos en almacenamiento externo, tales como la lista de descarga, lista de búsqueda rápida, entre otros</string>
|
||||
<string name="settings_advanced_export_data_to">Datos exportados en %s</string>
|
||||
<string name="settings_advanced_export_data_failed">Exportación de datos fallido</string>
|
||||
<string name="settings_advanced_import_data">Importar datos</string>
|
||||
<string name="settings_advanced_import_data_summary">Cargar datos que han sido guardado antes</string>
|
||||
<string name="settings_advanced_import_data_successfully">Importación de datos completo</string>
|
||||
|
||||
<string name="settings_about">Acerca de</string>
|
||||
<string name="settings_about_author">Autor</string>
|
||||
<string name="settings_about_google_plus">Comunidad en Google+</string>
|
||||
<string name="settings_about_website">PaginaWeb</string>
|
||||
<string name="settings_about_source">Código fuente</string>
|
||||
<string name="settings_about_changelog">Registro de cambios</string>
|
||||
<string name="settings_about_help">Ayuda</string>
|
||||
<string name="settings_about_license">Licencia</string>
|
||||
<string name="settings_about_license_summary">EhViewer es posible gracias a varios proyectos de código abierto</string>
|
||||
<string name="settings_about_donate">Donar</string>
|
||||
<string name="settings_about_donate_summary">Alipay: seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">Tu donación me ayuda a desarrollar más y mejores aplicaciones.\n\nAlipay: seven332$163.com</string>
|
||||
<string name="settings_about_donate_toast">Email copiado al portapapeles</string>
|
||||
<string name="settings_about_enable_analytics">Habilitar analytics</string>
|
||||
<string name="settings_about_about_analytics">Acerca de analytics</string>
|
||||
<string name="settings_about_version">Versión de compilación</string>
|
||||
<string name="settings_about_check_for_updates">Verificar actualizaciones</string>
|
||||
<string name="settings_about_beta_update_channel">Canal de versiones de prueba</string>
|
||||
<string name="settings_about_beta_update_channel_summary">Las versiones de prueba podrían tener errores</string>
|
||||
|
||||
<string name="enable">Habilitar</string>
|
||||
<string name="enabled">Habilitado</string>
|
||||
<string name="ip">IP</string>
|
||||
<string name="port">Puerto</string>
|
||||
<string name="Passkey">Clave Maestra</string>
|
||||
<string name="domain_not_supported">Dominio no soportado</string>
|
||||
<string name="invalid_port">Puerto Invalido</string>
|
||||
|
||||
<string name="cant_get_data_dir">No se puede obtener el directorio de datos</string>
|
||||
<string name="cant_find_any_data">No se pueden encuentran datos</string>
|
||||
<string name="cant_read_the_file">No se puede leer el archivo</string>
|
||||
|
||||
<!-- ExcludedLanguagesScene -->
|
||||
<string name="excluded_languages">Excluir idiomas</string>
|
||||
<string name="select_all">Seleccionar todo</string>
|
||||
<string name="deselect_all">Ninguno</string>
|
||||
<string name="invert_selection">Invertir</string>
|
||||
<string name="language">Idioma</string>
|
||||
<string name="original">Original</string>
|
||||
<string name="translated">Traducido</string>
|
||||
<string name="rewrite">Reescrito</string>
|
||||
<string name="language_japanese">Japonés</string>
|
||||
<string name="language_english">Inglés</string>
|
||||
<string name="language_chinese">Chino</string>
|
||||
<string name="language_dutch">Holandés</string>
|
||||
<string name="language_french">Francés</string>
|
||||
<string name="language_german">Alemán</string>
|
||||
<string name="language_hungarian">Húngaro</string>
|
||||
<string name="language_italian">Italiano</string>
|
||||
<string name="language_korean">Coreano</string>
|
||||
<string name="language_polish">Polaco</string>
|
||||
<string name="language_portuguese">Portugués</string>
|
||||
<string name="language_russian">Ruso</string>
|
||||
<string name="language_spanish">Español</string>
|
||||
<string name="language_thai">Tailandes</string>
|
||||
<string name="language_vietnamese">Vietnamita</string>
|
||||
<string name="language_na">N/A</string>
|
||||
<string name="language_other">Otros</string>
|
||||
|
||||
<string name="please_wait">Espere</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="license">Licencia</string>
|
||||
|
||||
<!-- Dir Picker-->
|
||||
|
||||
<!-- Favorites -->
|
||||
<string name="cloud_favorites">Favoritos en la nube</string>
|
||||
<string name="local_favorites">Favoritos locales</string>
|
||||
<string name="favorites_search_bar_hint">Buscar %s</string>
|
||||
<string name="favorites_title">%s</string>
|
||||
<string name="favorites_title_2">%1$s - %2$s</string>
|
||||
<string name="delete_favorites_dialog_title">Eliminar de favoritos</string>
|
||||
<string name="delete_favorites_dialog_message">¿Eliminar %d galerías de favoritos?</string>
|
||||
<string name="move_favorites_dialog_title">Mover favoritos</string>
|
||||
<string name="default_favorites_collection">Colección de favoritos por defecto</string>
|
||||
<string name="let_me_select">Déjame elegir</string>
|
||||
<string name="favorites_info">Información de favoritos</string>
|
||||
<string name="collections">Colección</string>
|
||||
<string name="need_sign_in">Se necesita iniciar sesión</string>
|
||||
|
||||
<!-- Progress Scene -->
|
||||
|
||||
<!-- Guide -->
|
||||
<string name="guide_quick_search_title">Búsqueda rápida</string>
|
||||
<string name="guide_quick_search_text">Desliza a la derecha para abrir el panel de búsqueda rápida</string>
|
||||
<string name="guide_collections_title">Colección</string>
|
||||
<string name="guide_collections_text">Desliza hacia la derecha para elegir favoritos</string>
|
||||
<string name="guide_download_labels_title">Descargas</string>
|
||||
<string name="guide_download_labels_text">Desliza hacia la derecha para abrir el panel de descarga</string>
|
||||
<string name="guide_download_thumb_title">Detalles de galería</string>
|
||||
<string name="guide_download_thumb_text">Pulsar en la imagen para ver detalles de la galería</string>
|
||||
<string name="guide_gallery_left">Cambiar de página</string>
|
||||
<string name="guide_gallery_right">Cambiar de página</string>
|
||||
<string name="guide_gallery_menu">Menú</string>
|
||||
<string name="guide_gallery_progress">Progreso</string>
|
||||
<string name="guide_gallery_long_click">Pulso largo para abrir el menú de página</string>
|
||||
|
||||
<!-- Readable Time -->
|
||||
<string name="from_the_future">Desde el futuro</string>
|
||||
<string name="just_now">Ahora</string>
|
||||
<plurals name="some_minutes_ago">
|
||||
<item quantity="one">Hace un minuto</item>
|
||||
<item quantity="other">Hace %d minutos</item>
|
||||
</plurals>
|
||||
<plurals name="some_hours_ago">
|
||||
<item quantity="one">Hace una hora</item>
|
||||
<item quantity="other">Hace %d horas</item>
|
||||
</plurals>
|
||||
<string name="yesterday">Ayer</string>
|
||||
<string name="some_days_ago">Hace %d días atrás</string>
|
||||
<plurals name="second">
|
||||
<item quantity="one">segundo</item>
|
||||
<item quantity="other">segundos</item>
|
||||
</plurals>
|
||||
<plurals name="minute">
|
||||
<item quantity="one">minuto</item>
|
||||
<item quantity="other">minutos</item>
|
||||
</plurals>
|
||||
<plurals name="hour">
|
||||
<item quantity="one">hora</item>
|
||||
<item quantity="other">horas</item>
|
||||
</plurals>
|
||||
<plurals name="day">
|
||||
<item quantity="one">día</item>
|
||||
<item quantity="other">días</item>
|
||||
</plurals>
|
||||
<plurals name="year">
|
||||
<item quantity="one">año</item>
|
||||
<item quantity="other">años</item>
|
||||
</plurals>
|
||||
<string name="no_archives">Sin archivos</string>
|
||||
<string name="download_archive_started">Descarga de archivos iniciada</string>
|
||||
<string name="download_archive_failure">Error al descargar archivo</string>
|
||||
<string name="download_archive_failure_no_hath">Necesita un cliente H@H para descargar archivo</string>
|
||||
<string name="add_to_favorite_success">Añadido a favoritos</string>
|
||||
<string name="add_to_favourites">Agregar a favoritos</string>
|
||||
<string name="cancel_vote_down">Cancelar voto negativo</string>
|
||||
<string name="clear_all">Limpiar todo</string>
|
||||
<string name="comment_failed">Comentario fallido</string>
|
||||
<string name="count">Contar</string>
|
||||
<string name="archive">Archivo</string>
|
||||
<string name="delete">Eliminar</string>
|
||||
<string name="dir_picker">Seleccionar directorio</string>
|
||||
<string name="directory_not_writable">No se puede escribir en el directorio</string>
|
||||
<string name="disabled">Deshabilitado</string>
|
||||
<string name="download_state_failed">Descarga fallida</string>
|
||||
<string name="download_state_none">Descarga en pausa</string>
|
||||
<string name="error_password_cannot_empty">La contraseña no puede estar vacía</string>
|
||||
<string name="error_something_wrong_happened">Ocurrió algo malo</string>
|
||||
<string name="dialog_archive_title">H@H Downloader</string>
|
||||
|
||||
</resources>
|
||||
@@ -28,11 +28,16 @@
|
||||
|
||||
<string name="username">用户名</string>
|
||||
<string name="password">密码</string>
|
||||
<string name="recaptcha">验证码(非必需)</string>
|
||||
|
||||
<string name="sign_in">登陆</string>
|
||||
<string name="recaptcha_none">点我</string>
|
||||
<string name="recaptcha_loading">加载中…</string>
|
||||
<string name="recaptcha_failure">失败</string>
|
||||
|
||||
<string name="sign_in">登录</string>
|
||||
<string name="register">注册</string>
|
||||
<string name="sign_in_via_webview">通过网页登陆</string>
|
||||
<string name="sign_in_via_cookies">通过 Cookie 登陆</string>
|
||||
<string name="sign_in_via_webview">通过网页登录</string>
|
||||
<string name="sign_in_via_cookies">通过 Cookie 登录</string>
|
||||
<string name="display_name_dialog_title">输入昵称</string>
|
||||
<string name="display_name">昵称</string>
|
||||
<string name="display_name_is_empty">昵称为空</string>
|
||||
@@ -40,7 +45,7 @@
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n请输入特定的 Cookie 来登陆。</string>
|
||||
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n请输入特定的 Cookie 来登录。</string>
|
||||
<string name="text_is_empty">文本为空</string>
|
||||
<string name="waring">警告</string>
|
||||
<string name="wrong_cookie_warning">看起来您输入的 Cookie 是错误的,最好检查一下。</string>
|
||||
@@ -81,9 +86,9 @@
|
||||
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的任何后果负责。</string>
|
||||
<string name="error_username_cannot_empty">用户名不可为空</string>
|
||||
<string name="error_password_cannot_empty">密码不可为空</string>
|
||||
<string name="skip_signing_in">跳过登陆</string>
|
||||
<string name="sign_in_failed">登陆失败</string>
|
||||
<string name="sign_in_failed_plain">这可能是网站更新导致的,也有可能是发生了奇怪的事情。您可以选择在登陆按钮下方通过网页登陆或者输入 cookie,或者跳过登陆。跳过登陆可能导致无法正常使用应用。如果你已经在 0.6.x 版登陆过了,请优先尝试选择“通过 Cookie 登陆”。</string>
|
||||
<string name="skip_signing_in">跳过登录</string>
|
||||
<string name="sign_in_failed">登录失败</string>
|
||||
<string name="sign_in_failed_plain">这可能是网站更新导致的,也有可能是发生了奇怪的事情。您可以选择在登录按钮下方通过网页登录或者输入 cookie,或者跳过登录。跳过登录可能导致无法正常使用应用。如果你已经在 0.6.x 版登录过了,请优先尝试选择“通过 Cookie 登录”。</string>
|
||||
<string name="press_twice_exit">再按一次退出</string>
|
||||
<string name="content_layout_restore_tip">点击重试</string>
|
||||
<string name="write_rationale">EhViewer 将申请设备存储空间访问权限以便下载画廊。您愿意授权吗?</string>
|
||||
@@ -93,13 +98,15 @@
|
||||
<string name="accept">接受</string>
|
||||
<string name="reject">拒绝</string>
|
||||
|
||||
<string name="help_route">设置->关于->帮助</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">发送</string>
|
||||
<string name="crash_explain">上次应用崩溃了。你愿意把错误日志发送给开发者以便以后得到更好的用户体验?(以电子邮件的形式发送)</string>
|
||||
|
||||
<!-- Select scene -->
|
||||
<string name="select_scene">你想选择哪个画廊站点?</string>
|
||||
<string name="select_scene_explain">e-hentai:对任何人开放\nexhentai:仅对登陆用户开放</string>
|
||||
<string name="select_scene_explain">e-hentai:对任何人开放\nexhentai:仅对登录用户开放</string>
|
||||
<string name="no_select">请选择一个站点</string>
|
||||
|
||||
<!-- Update -->
|
||||
@@ -341,6 +348,12 @@
|
||||
<string name="set_pattern_protection">设置图案保护</string>
|
||||
<string name="set_pattern_protection_tip">绘制图案来设置图案保护\n留空来取消图案保护</string>
|
||||
<string name="set">设置</string>
|
||||
<string name="enable_fingerprint">允许使用指纹解锁</string>
|
||||
|
||||
<!-- UConfig Activity -->
|
||||
<string name="u_config">EHentai 设置</string>
|
||||
<string name="apply">应用</string>
|
||||
<string name="apply_tip">点击右上角的对勾来保存设置</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 页</string>
|
||||
@@ -354,11 +367,13 @@
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings_eh">EH</string>
|
||||
<string name="settings_eh_sign_out">退出登陆</string>
|
||||
<string name="settings_eh_sign_out_summary">退出登陆后重启应用以便再次登陆</string>
|
||||
<string name="settings_eh_sign_out">退出登录</string>
|
||||
<string name="settings_eh_sign_out_summary">退出登录后重启应用以便再次登录</string>
|
||||
<string name="settings_eh_sign_out_warning">天哪,我的老伙计,你要退出登录吗?我是说,你真的要退出登录吗?</string>
|
||||
<string name="settings_eh_sign_out_yes">是的,我是说,真的</string>
|
||||
<string name="settings_eh_sign_out_tip">已退出登陆,重启应用以便再次登陆</string>
|
||||
<string name="settings_eh_sign_out_tip">已退出登录,重启应用以便再次登录</string>
|
||||
<string name="settings_u_config">EHentai 设置</string>
|
||||
<string name="settings_u_config_summary">EHentai 网站上的设置</string>
|
||||
<string name="settings_eh_gallery_site">画廊站点</string>
|
||||
<string name="settings_eh_list_mode">列表模式</string>
|
||||
<string name="settings_eh_list_mode_detail">详情</string>
|
||||
@@ -373,6 +388,7 @@
|
||||
<string name="settings_eh_thumb_resolution">缩略图分辨率</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s,指定分辨率可能使获取缩略图失败</string>
|
||||
<string name="settings_eh_thumb_resolution_auto">自动</string>
|
||||
<string name="settings_eh_fix_thumb_url">修正缩略图链接</string>
|
||||
<string name="settings_eh_default_categories">主页分类显示</string>
|
||||
<string name="settings_eh_default_categories_summary">默认在主页所显示的分类</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces">排除标签组</string>
|
||||
@@ -414,6 +430,7 @@
|
||||
<string name="settings_read_show_clock">显示时钟</string>
|
||||
<string name="settings_read_show_progress">显示进度</string>
|
||||
<string name="settings_read_show_battery">显示电量</string>
|
||||
<string name="settings_read_show_page_interval">显示页面间隔</string>
|
||||
<string name="settings_read_volume_page">使用音量键翻页</string>
|
||||
<string name="settings_read_reading_fullscreen">全屏</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定义屏幕亮度</string>
|
||||
@@ -471,7 +488,7 @@
|
||||
<string name="settings_advanced_export_data_to">已导出数据至 %s</string>
|
||||
<string name="settings_advanced_export_data_failed">导出数据失败</string>
|
||||
<string name="settings_advanced_import_data">导入数据</string>
|
||||
<string name="settings_advanced_import_data_summary">从置存储器已导出的数据</string>
|
||||
<string name="settings_advanced_import_data_summary">从置存储器导入数据</string>
|
||||
<string name="settings_advanced_import_data_successfully">导入数据成功</string>
|
||||
|
||||
<string name="settings_about">关于</string>
|
||||
@@ -604,5 +621,11 @@
|
||||
<plurals name="year">
|
||||
<item quantity="other">年</item>
|
||||
</plurals>
|
||||
<string name="dialog_archive_title">通过 H@H 下载</string>
|
||||
<string name="no_archives">没有压缩包</string>
|
||||
<string name="download_archive_started">开始下载压缩包</string>
|
||||
<string name="download_archive_failure">无法下载压缩包</string>
|
||||
<string name="archive">压缩包</string>
|
||||
<string name="download_archive_failure_no_hath">下载压缩包需要 H@H 客户端</string>
|
||||
|
||||
</resources>
|
||||
@@ -28,11 +28,16 @@
|
||||
|
||||
<string name="username">用户名</string>
|
||||
<string name="password">密碼</string>
|
||||
<string name="recaptcha">驗證碼(非必需)</string>
|
||||
|
||||
<string name="sign_in">登陸</string>
|
||||
<string name="recaptcha_none">點我</string>
|
||||
<string name="recaptcha_loading">加載中…</string>
|
||||
<string name="recaptcha_failure">失敗</string>
|
||||
|
||||
<string name="sign_in">登錄</string>
|
||||
<string name="register">註冊</string>
|
||||
<string name="sign_in_via_webview">通過網頁登陸</string>
|
||||
<string name="sign_in_via_cookies">通過 Cookie 登陸</string>
|
||||
<string name="sign_in_via_webview">通過網頁登錄</string>
|
||||
<string name="sign_in_via_cookies">通過 Cookie 登錄</string>
|
||||
<string name="display_name_dialog_title">輸入暱稱</string>
|
||||
<string name="display_name">暱稱</string>
|
||||
<string name="display_name_is_empty">暱稱為空</string>
|
||||
@@ -40,7 +45,7 @@
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n請輸入特定的 Cookie 來登陸。</string>
|
||||
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n請輸入特定的 Cookie 來登錄。</string>
|
||||
<string name="text_is_empty">文本為空</string>
|
||||
<string name="waring">警告</string>
|
||||
<string name="wrong_cookie_warning">看起來您輸入的 Cookie 是錯誤的,最好檢查一下。</string>
|
||||
@@ -81,9 +86,9 @@
|
||||
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。</string>
|
||||
<string name="error_username_cannot_empty">用户名不可為空</string>
|
||||
<string name="error_password_cannot_empty">密碼不可為空</string>
|
||||
<string name="skip_signing_in">跳過登陸</string>
|
||||
<string name="sign_in_failed">登陸失敗</string>
|
||||
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登陸按鈕下方通過網頁登陸或者輸入 cookie,或者跳過登陸。跳過登陸可能導致無法正常使用應用。如果你已經在 0.6.x 版登陸過了,請優先嚐試選擇“通過 Cookie 登陸”。</string>
|
||||
<string name="skip_signing_in">跳過登錄</string>
|
||||
<string name="sign_in_failed">登錄失敗</string>
|
||||
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登錄按鈕下方通過網頁登錄或者輸入 cookie,或者跳過登錄。跳過登錄可能導致無法正常使用應用。如果你已經在 0.6.x 版登錄過了,請優先嚐試選擇“通過 Cookie 登錄”。</string>
|
||||
<string name="press_twice_exit">再按一次退出</string>
|
||||
<string name="content_layout_restore_tip">點擊重試</string>
|
||||
<string name="write_rationale">EhViewer 將申請設備存儲空間訪問權限以便下載畫廊。您願意授權嗎?</string>
|
||||
@@ -93,13 +98,15 @@
|
||||
<string name="accept">接受</string>
|
||||
<string name="reject">拒絕</string>
|
||||
|
||||
<string name="help_route">設置->關於->幫助</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">發送</string>
|
||||
<string name="crash_explain">上次應用崩潰了。你願意把錯誤日誌發送給開發者以便以後得到更好的用户體驗?(以電子郵件的形式發送)</string>
|
||||
|
||||
<!-- Select scene -->
|
||||
<string name="select_scene">你想選擇哪個畫廊站點?</string>
|
||||
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登陸用户開放</string>
|
||||
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登錄用户開放</string>
|
||||
<string name="no_select">請選擇一個站點</string>
|
||||
|
||||
<!-- Update -->
|
||||
@@ -341,6 +348,12 @@
|
||||
<string name="set_pattern_protection">設置圖案保護</string>
|
||||
<string name="set_pattern_protection_tip">繪製圖案來設置圖案保護\n留空來取消圖案保護</string>
|
||||
<string name="set">設置</string>
|
||||
<string name="enable_fingerprint">允許使用指紋解鎖</string>
|
||||
|
||||
<!-- UConfig Activity -->
|
||||
<string name="u_config">EHentai 設置</string>
|
||||
<string name="apply">應用</string>
|
||||
<string name="apply_tip">點擊右上角的對勾來保存設置</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 頁</string>
|
||||
@@ -354,11 +367,13 @@
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings_eh">EH</string>
|
||||
<string name="settings_eh_sign_out">退出登陸</string>
|
||||
<string name="settings_eh_sign_out_summary">退出登陸後重啟應用以便再次登陸</string>
|
||||
<string name="settings_eh_sign_out">退出登錄</string>
|
||||
<string name="settings_eh_sign_out_summary">退出登錄後重啟應用以便再次登錄</string>
|
||||
<string name="settings_eh_sign_out_warning">天哪,我的老夥計,你要退出登錄嗎?我是説,你真的要退出登錄嗎?</string>
|
||||
<string name="settings_eh_sign_out_yes">是的,我是説,真的</string>
|
||||
<string name="settings_eh_sign_out_tip">已退出登陸,重啟應用以便再次登陸</string>
|
||||
<string name="settings_eh_sign_out_tip">已退出登錄,重啟應用以便再次登錄</string>
|
||||
<string name="settings_u_config">EHentai 設置</string>
|
||||
<string name="settings_u_config_summary">EHentai 網站上的設置</string>
|
||||
<string name="settings_eh_gallery_site">畫廊站點</string>
|
||||
<string name="settings_eh_list_mode">列表模式</string>
|
||||
<string name="settings_eh_list_mode_detail">詳情</string>
|
||||
@@ -373,6 +388,7 @@
|
||||
<string name="settings_eh_thumb_resolution">縮略圖分辨率</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s,指定分辨率可能使獲取縮略圖失敗</string>
|
||||
<string name="settings_eh_thumb_resolution_auto">自動</string>
|
||||
<string name="settings_eh_fix_thumb_url">修正縮略圖鏈接</string>
|
||||
<string name="settings_eh_default_categories">主頁分類顯示</string>
|
||||
<string name="settings_eh_default_categories_summary">默認在主頁所顯示的分類</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces">排除標籤組</string>
|
||||
@@ -414,6 +430,7 @@
|
||||
<string name="settings_read_show_clock">顯示時鐘</string>
|
||||
<string name="settings_read_show_progress">顯示進度</string>
|
||||
<string name="settings_read_show_battery">顯示電量</string>
|
||||
<string name="settings_read_show_page_interval">顯示頁面間隔</string>
|
||||
<string name="settings_read_volume_page">使用音量鍵翻頁</string>
|
||||
<string name="settings_read_reading_fullscreen">全屏</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定義屏幕亮度</string>
|
||||
@@ -471,7 +488,7 @@
|
||||
<string name="settings_advanced_export_data_to">已導出數據至 %s</string>
|
||||
<string name="settings_advanced_export_data_failed">導出數據失敗</string>
|
||||
<string name="settings_advanced_import_data">導入數據</string>
|
||||
<string name="settings_advanced_import_data_summary">從置存儲器已導出的數據</string>
|
||||
<string name="settings_advanced_import_data_summary">從置存儲器導入數據</string>
|
||||
<string name="settings_advanced_import_data_successfully">導入數據成功</string>
|
||||
|
||||
<string name="settings_about">關於</string>
|
||||
@@ -604,5 +621,11 @@
|
||||
<plurals name="year">
|
||||
<item quantity="other">年</item>
|
||||
</plurals>
|
||||
<string name="dialog_archive_title">通過 H@H 下載</string>
|
||||
<string name="no_archives">沒有壓縮包</string>
|
||||
<string name="download_archive_started">開始下載壓縮包</string>
|
||||
<string name="download_archive_failure">無法下載壓縮包</string>
|
||||
<string name="archive">壓縮包</string>
|
||||
<string name="download_archive_failure_no_hath">下載壓縮包需要 H@H 客户端</string>
|
||||
|
||||
</resources>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<string name="app_name">EhViewer</string>
|
||||
|
||||
<string name="homepage">主頁</string>
|
||||
<string name="homepage">首頁</string>
|
||||
<string name="whats_hot">熱門</string>
|
||||
<string name="favourite">收藏</string>
|
||||
<string name="history">歷史</string>
|
||||
@@ -28,79 +28,86 @@
|
||||
|
||||
<string name="username">使用者名稱</string>
|
||||
<string name="password">密碼</string>
|
||||
<string name="recaptcha">驗證碼(非必需)</string>
|
||||
|
||||
<string name="sign_in">登陸</string>
|
||||
<string name="recaptcha_none">點我</string>
|
||||
<string name="recaptcha_loading">載入中…</string>
|
||||
<string name="recaptcha_failure">失敗</string>
|
||||
|
||||
<string name="sign_in">登入</string>
|
||||
<string name="register">註冊</string>
|
||||
<string name="sign_in_via_webview">通過網頁登陸</string>
|
||||
<string name="sign_in_via_cookies">通過 Cookie 登陸</string>
|
||||
<string name="sign_in_via_webview">透過網頁登入</string>
|
||||
<string name="sign_in_via_cookies">透過 Cookie 登入</string>
|
||||
<string name="display_name_dialog_title">輸入暱稱</string>
|
||||
<string name="display_name">暱稱</string>
|
||||
<string name="display_name_is_empty">暱稱為空</string>
|
||||
<string name="display_name_is_empty">暱稱是空的</string>
|
||||
<string name="sign_in_first">請先登入</string>
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Cookie 是儲存在瀏覽器裡的一小塊資料。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜尋一下。\n\n請輸入特定的 Cookie 來登陸。</string>
|
||||
<string name="text_is_empty">文字為空</string>
|
||||
<string name="cookie_explain">Cookie 是儲存在瀏覽器裡的一小塊資料。如果您不清楚 Cookie 是什麼或者如何取得 Cookie,最好去查一下。\n\n請輸入特定的 Cookie 來登入。</string>
|
||||
<string name="text_is_empty">文字是空的</string>
|
||||
<string name="waring">警告</string>
|
||||
<string name="wrong_cookie_warning">看起來您輸入的 Cookie 是錯誤的,最好檢查一下。</string>
|
||||
<string name="wrong_cookie_warning">看來您輸入的 Cookie 是錯誤的,最好再檢查一下。</string>
|
||||
<string name="i_will_check_it">好的</string>
|
||||
<string name="i_dont_think_so">我沒輸錯</string>
|
||||
<string name="found_cookies">找到舊版 Cookie</string>
|
||||
<string name="i_dont_think_so">我覺得沒打錯</string>
|
||||
<string name="found_cookies">找到 Cookie了!</string>
|
||||
|
||||
<string name="invalid_download_location">似乎下載路徑不可用。請到重新設定下載路徑。</string>
|
||||
<string name="invalid_download_location">看來下載路徑似乎沒辦法使用。請至設定重新設定下載路徑。</string>
|
||||
|
||||
<string name="cellular_network_warning">正在使用行動網路</string>
|
||||
<string name="cellular_network_warning">正在使用行動數據</string>
|
||||
|
||||
<string name="error_bad_status_code">錯誤的狀態碼:%d</string>
|
||||
<string name="error_timeout">超時</string>
|
||||
<string name="error_unknown_host">未知主機</string>
|
||||
<string name="error_redirection">太多重定向</string>
|
||||
<string name="error_bad_status_code">錯誤狀態碼:%d</string>
|
||||
<string name="error_timeout">逾時</string>
|
||||
<string name="error_unknown_host">未知的主機</string>
|
||||
<string name="error_redirection">重新導向迴圈</string>
|
||||
<string name="error_socket">網路錯誤</string>
|
||||
<string name="error_unknown">奇怪的錯誤</string>
|
||||
<string name="error_cant_find_activity">找不到相應的應用</string>
|
||||
<string name="error_cant_find_activity">找不到相對應的應用程式</string>
|
||||
<string name="error_cannot_parse_the_url">無法解析連結</string>
|
||||
<string name="error_not_folder_path">非資料夾路徑</string>
|
||||
<string name="error_no_provider">無 provider</string>
|
||||
<string name="error_decoding_failed">解碼失敗</string>
|
||||
<string name="error_not_found">未找到</string>
|
||||
<string name="error_not_found">沒能找到</string>
|
||||
<string name="error_empty">空</string>
|
||||
<string name="error_invalid_zip_file">無效 zip 檔案</string>
|
||||
<string name="error_invalid_zip_file">無效的 zip 檔案</string>
|
||||
<string name="error_reading_failed">讀取失敗</string>
|
||||
<string name="error_out_of_range">越界</string>
|
||||
<string name="error_out_of_range">超出範圍</string>
|
||||
<string name="error_write_failed">寫入失敗</string>
|
||||
<string name="error_parse_error">解析失敗</string>
|
||||
<string name="error_509">509</string>
|
||||
<string name="error_invalid_url">無效連結</string>
|
||||
<string name="error_get_ptoken_error">獲取 pToken 錯誤</string>
|
||||
<string name="error_invalid_specify_gallery">指定畫廊的關鍵字應該看起來像 “618395 0439fa3666”</string>
|
||||
<string name="error_cant_create_temp_file">無法建立臨時檔案</string>
|
||||
<string name="error_invalid_url">不正確的連結</string>
|
||||
<string name="error_get_ptoken_error">取得 pToken 時發生錯誤</string>
|
||||
<string name="error_invalid_specify_gallery">指定的圖庫關鍵字應該看起來像 “618395 0439fa3666”</string>
|
||||
<string name="error_cant_create_temp_file">無法建立暫存檔案</string>
|
||||
<string name="error_cant_save_image">無法儲存圖片</string>
|
||||
<string name="error_invalid_number">非法數字</string>
|
||||
<string name="error_invalid_number">無效的數字</string>
|
||||
|
||||
<string name="app_waring">本應用中內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。</string>
|
||||
<string name="error_username_cannot_empty">使用者名稱不可為空</string>
|
||||
<string name="error_password_cannot_empty">密碼不可為空</string>
|
||||
<string name="skip_signing_in">跳過登陸</string>
|
||||
<string name="sign_in_failed">登陸失敗</string>
|
||||
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登陸按鈕下方通過網頁登陸或者輸入 cookie,或者跳過登陸。跳過登陸可能導致無法正常使用應用。如果你已經在 0.6.x 版登陸過了,請優先嚐試選擇“通過 Cookie 登陸”。</string>
|
||||
<string name="press_twice_exit">再按一次退出</string>
|
||||
<string name="content_layout_restore_tip">點選重試</string>
|
||||
<string name="write_rationale">EhViewer 將申請裝置儲存空間訪問許可權以便下載畫廊。您願意授權嗎?</string>
|
||||
<string name="you_rejected_me">好痛</string>
|
||||
<string name="analytics_explain">您同意讓開發者收集您的裝置資訊與使用情況嗎?這將對開發有很大幫助。<br><br>資料統計服務由 Google Analytics 提供,其隱私政策可在 <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a> 檢視。<br><br>若您同意參與資料統計,您的裝置資訊與應用使用情況將會被記錄,其包括但不限於:Android API 版本、裝置型號、語言所在地、本應用版本號、會話時長、應用功能使用次數。開發者承諾以下資訊並不會被記錄:電話號碼、電子郵件地址、IMEI。<br><br>在您同意參與資料統計之前,您的資訊不會被記錄。<br><br>被記錄的資料會由 Google Analytics 進行分析,分析報表僅可被本應用開發者訪問。</string>
|
||||
<string name="app_waring">本應用程式中內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用程式的作者不會對由其所造成的任何影響負責。</string>
|
||||
<string name="error_username_cannot_empty">使用者名稱不能是空的</string>
|
||||
<string name="error_password_cannot_empty">密碼不能是空的</string>
|
||||
<string name="skip_signing_in">略過登入</string>
|
||||
<string name="sign_in_failed">登入失敗</string>
|
||||
<string name="sign_in_failed_plain">這可能是網站更新造成的,也有可能是哪裡出錯了。您可以選擇在登入按鈕下方透過網頁登入或者輸入 cookie,也可以略過登入。略過登入可能導致無法正常使用應用程式。如果你已經在 0.6.x 版登入過了,請先試試“透過 Cookie 登入”。</string>
|
||||
<string name="press_twice_exit">再按一次離開</string>
|
||||
<string name="content_layout_restore_tip">點擊重試</string>
|
||||
<string name="write_rationale">EhViewer 將請求裝置外部儲存空間的存取許可以下載圖庫。您願意授權嗎?</string>
|
||||
<string name="you_rejected_me">好難過</string>
|
||||
<string name="analytics_explain">您同意讓開發者收集您的裝置資訊與使用方式嗎?這對開發有很大幫助。<br><br>資料統計服務由 Google Analytics 提供,其隱私政策可在 <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a> 檢視。<br><br>若您同意參與資料統計,您的裝置資訊與應用使用情況將會被記錄,其包括但不限於:Android API 版本、裝置型號、語言所在地、本應用版本號、會話時長、應用功能使用次數。開發者承諾以下資訊並不會被記錄:電話號碼、電子郵件地址、IMEI。<br><br>在您同意參與資料統計之前,您的資訊不會被記錄。<br><br>被記錄的資料會由 Google Analytics 進行分析,分析報表僅由此應用程式開發者存取。</string>
|
||||
<string name="get_it">知道了</string>
|
||||
<string name="accept">接受</string>
|
||||
<string name="reject">拒絕</string>
|
||||
|
||||
<string name="help_route">設定->關於->幫助</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">傳送</string>
|
||||
<string name="crash_explain">上次應用崩潰了。你願意把錯誤日誌傳送給開發者以便以後得到更好的使用者體驗?(以電子郵件的形式傳送)</string>
|
||||
<string name="crash_explain">剛剛當掉了。你是否願意把錯誤紀錄傳送給開發者讓未來的使用者體驗變得更好?(以電子郵件傳送)</string>
|
||||
|
||||
<!-- Select scene -->
|
||||
<string name="select_scene">你想選擇哪個畫廊站點?</string>
|
||||
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登陸使用者開放</string>
|
||||
<string name="no_select">請選擇一個站點</string>
|
||||
<string name="select_scene">你想選擇哪個圖庫站台?</string>
|
||||
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登入使用者開放</string>
|
||||
<string name="no_select">請選擇一個站台</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update">更新</string>
|
||||
@@ -108,57 +115,57 @@
|
||||
<string name="update_to_date">EhViewer 已是最新版本</string>
|
||||
|
||||
<!-- Gallery List -->
|
||||
<string name="gallery_list_search_bar_hint_exhentai">搜尋 ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_e_hentai">搜尋 E-Hentai</string>
|
||||
<string name="gallery_list_empty_hit">什麼都沒有找到</string>
|
||||
<string name="gallery_list_search_bar_hint_exhentai">在 ExHentai 中搜尋</string>
|
||||
<string name="gallery_list_search_bar_hint_e_hentai">在 E-Hentai 搜尋</string>
|
||||
<string name="gallery_list_empty_hit">什麼都沒找到</string>
|
||||
|
||||
<string name="search">搜尋</string>
|
||||
|
||||
<string name="keyword_search">關鍵字搜尋</string>
|
||||
<string name="image_search">圖片搜尋</string>
|
||||
|
||||
<string name="search_normal">普通搜尋</string>
|
||||
<string name="search_advance">高階選項</string>
|
||||
<string name="search_normal">一般搜尋</string>
|
||||
<string name="search_advance">進階選項</string>
|
||||
<string name="search_image">圖片搜尋</string>
|
||||
<string name="search_normal_search">一般搜尋</string>
|
||||
<string name="search_specify_uploader">指定上傳者</string>
|
||||
<string name="search_specify_tag">指定標籤</string>
|
||||
<string name="search_specify_gallery">指定畫廊</string>
|
||||
<string name="search_enable_advance">啟用高階選項</string>
|
||||
<string name="search_specify_gallery">指定圖庫</string>
|
||||
<string name="search_enable_advance">啟用進階選項</string>
|
||||
|
||||
<string name="search_tip">一般搜尋:就是搜尋。\n\n指定上傳者:列出該上傳者上傳的畫廊。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的畫廊。其他選項會被忽略。\n\n指定畫廊:跳轉至該畫廊。關鍵字應為“gid token”。</string>
|
||||
<string name="search_tip">一般搜尋:就是搜尋。\n\n指定上傳者:列出該上傳者上傳的圖庫。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的圖庫。其他選項會被忽略。\n\n指定圖庫:直接前往圖庫。關鍵字應為“gid token”。</string>
|
||||
|
||||
<string name="search_sname">搜尋畫廊</string>
|
||||
<string name="search_stags">搜尋畫廊標籤</string>
|
||||
<string name="search_sdesc">搜尋畫廊描述</string>
|
||||
<string name="search_sname">搜尋圖庫</string>
|
||||
<string name="search_stags">搜尋圖庫的標籤</string>
|
||||
<string name="search_sdesc">搜尋圖庫的描述</string>
|
||||
<string name="search_storr">搜尋種子檔名</string>
|
||||
<string name="search_sto">僅顯示有種子的畫廊</string>
|
||||
<string name="search_sdt1">搜尋低願力標籤</string>
|
||||
<string name="search_sdt2">搜尋差評標籤</string>
|
||||
<string name="search_sh">顯示被刪除的畫廊</string>
|
||||
<string name="search_sto">只顯示有種子的圖庫</string>
|
||||
<string name="search_sdt1">搜尋標籤:低願力</string>
|
||||
<string name="search_sdt2">搜尋標籤:被噓爆的</string>
|
||||
<string name="search_sh">顯示已被移除的的圖庫</string>
|
||||
<string name="search_sr">最低評分:</string>
|
||||
|
||||
<string name="select_image">選擇圖片</string>
|
||||
<string name="search_uss">使用相似搜尋</string>
|
||||
<string name="search_uss">使用相似性搜尋</string>
|
||||
<string name="search_osc">只搜尋封面</string>
|
||||
<string name="search_se">顯示被刪除的畫廊</string>
|
||||
<string name="search_se">顯示被刪除的圖庫</string>
|
||||
<string name="select_image_first">請先選擇圖片</string>
|
||||
|
||||
<string name="add_to_favourites">收藏</string>
|
||||
|
||||
<string name="quick_search">快速搜尋</string>
|
||||
<string name="quick_search_tip">點選“+”來新增快速搜尋</string>
|
||||
<string name="quick_search_tip">點擊“+”以新增快速搜尋</string>
|
||||
<string name="add_quick_search_dialog_title">新增快速搜尋</string>
|
||||
<string name="name_is_empty">名稱為空</string>
|
||||
<string name="name_is_empty">名稱是空的</string>
|
||||
<string name="delete">刪除</string>
|
||||
<string name="delete_quick_search_title">刪除快速搜尋</string>
|
||||
<string name="delete_quick_search_message">刪除“%s”?</string>
|
||||
<string name="no_quick_search">這裡是快速搜尋</string>
|
||||
<string name="add_quick_search_tip">畫廊列表的狀態將被儲存為快速搜尋。如果你想儲存搜尋面板的狀態,請先執行搜尋。</string>
|
||||
<string name="readme">讀我</string>
|
||||
<string name="image_search_not_quick_search">無法新增圖片搜尋為快速搜尋</string>
|
||||
<string name="delete_quick_search_message">刪除“%s”嗎?</string>
|
||||
<string name="no_quick_search">快速搜尋會顯示在這裡</string>
|
||||
<string name="add_quick_search_tip">圖庫列表的狀態將被儲存為快速搜尋。如果你想儲存搜尋面板的狀態,請先進行搜尋。</string>
|
||||
<string name="readme">讀我檔</string>
|
||||
<string name="image_search_not_quick_search">無法將圖片搜尋加入快速搜尋</string>
|
||||
<string name="duplicate_quick_search">已存在相同的快速搜尋,名稱為“%s”。</string>
|
||||
<string name="duplicate_name">已存在相同名稱</string>
|
||||
<string name="duplicate_name">已經由重複的名稱了</string>
|
||||
|
||||
<string name="go_to_hint">第 %1$d 頁,共 %2$d 頁</string>
|
||||
|
||||
@@ -169,10 +176,10 @@
|
||||
<string name="star_5">5 星</string>
|
||||
|
||||
<!-- Gallery detail -->
|
||||
<string name="error_cannot_find_gallery">找不到畫廊</string>
|
||||
<string name="error_cannot_find_gallery">找不到圖庫</string>
|
||||
<string name="download">下載</string>
|
||||
<string name="read">閱讀</string>
|
||||
<string name="more_information">檢視更多資訊</string>
|
||||
<string name="more_information">更多資訊</string>
|
||||
<plurals name="page_count">
|
||||
<item quantity="other">%d 頁</item>
|
||||
</plurals>
|
||||
@@ -182,114 +189,114 @@
|
||||
<string name="torrent_count">種子 (%d)</string>
|
||||
<string name="share">分享</string>
|
||||
<string name="rate">評分</string>
|
||||
<string name="similar_gallery">相似畫廊</string>
|
||||
<string name="search_cover">搜尋封面</string>
|
||||
<string name="no_tags">暫無標籤</string>
|
||||
<string name="no_comments">暫無評論</string>
|
||||
<string name="no_more_comments">已顯示所有評論</string>
|
||||
<string name="more_comment">檢視更多評論</string>
|
||||
<string name="similar_gallery">類似的圖庫</string>
|
||||
<string name="search_cover">以封面搜尋</string>
|
||||
<string name="no_tags">還沒有標籤</string>
|
||||
<string name="no_comments">沒有留言</string>
|
||||
<string name="no_more_comments">已顯示所有的留言了</string>
|
||||
<string name="more_comment">更多留言</string>
|
||||
<string name="no_previews">沒有預覽</string>
|
||||
<string name="no_more_previews">已顯示所有預覽</string>
|
||||
<string name="more_previews">檢視更多預覽</string>
|
||||
<string name="no_more_previews">已經顯示所有預覽了</string>
|
||||
<string name="more_previews">更多預覽</string>
|
||||
<string name="refresh">重新整理</string>
|
||||
<string name="open_in_other_app">在其他應用中開啟</string>
|
||||
<string name="open_in_other_app">在其他應用程式中開啟</string>
|
||||
<string name="rate_successfully">評分成功</string>
|
||||
<string name="rate_failed">評分失敗</string>
|
||||
<string name="no_torrents">沒有種子</string>
|
||||
<string name="torrents">種子</string>
|
||||
<string name="favorited">已收藏</string>
|
||||
<string name="not_favorited">未收藏</string>
|
||||
<string name="add_favorites_dialog_title">新增收藏</string>
|
||||
<string name="remember_favorite_collection">記住收藏夾</string>
|
||||
<string name="add_to_favorite_success">已新增至收藏</string>
|
||||
<string name="remove_from_favorite_success">移除收藏</string>
|
||||
<string name="add_to_favorite_failure">新增收藏失敗</string>
|
||||
<string name="remove_from_favorite_failure">移除收藏失敗</string>
|
||||
<string name="block_the_uploader">新增上傳者過濾項“%s”?</string>
|
||||
<string name="filter_added">已新增過濾項</string>
|
||||
<string name="add_favorites_dialog_title">新增到收藏裡</string>
|
||||
<string name="remember_favorite_collection">記住常用收藏</string>
|
||||
<string name="add_to_favorite_success">已新增至收藏中</string>
|
||||
<string name="remove_from_favorite_success">從收藏中移除</string>
|
||||
<string name="add_to_favorite_failure">無法新增至收藏</string>
|
||||
<string name="remove_from_favorite_failure">無法從收藏中移除</string>
|
||||
<string name="block_the_uploader">把上傳者“%s”加入濾除列表?</string>
|
||||
<string name="filter_added">已經新增篩選條件</string>
|
||||
|
||||
<!-- Rating -->
|
||||
<string name="rating10">根本把持不住</string>
|
||||
<string name="rating9">好極了</string>
|
||||
<string name="rating9">太神啦</string>
|
||||
<string name="rating8">很棒</string>
|
||||
<string name="rating7">不錯</string>
|
||||
<string name="rating6">還行</string>
|
||||
<string name="rating5">一般般</string>
|
||||
<string name="rating6">還好</string>
|
||||
<string name="rating5">普通</string>
|
||||
<string name="rating4">不行</string>
|
||||
<string name="rating3">糟糕</string>
|
||||
<string name="rating2">瞎眼</string>
|
||||
<string name="rating3">超爛</string>
|
||||
<string name="rating2">快瞎了</string>
|
||||
<string name="rating1">快要窒息了</string>
|
||||
<string name="rating0">…</string>
|
||||
<string name="rating0">下去 !</string>
|
||||
|
||||
<!-- Gallery Info -->
|
||||
<string name="gallery_info">畫廊資訊</string>
|
||||
<string name="copied_to_clipboard">已複製到剪下板</string>
|
||||
<string name="header_key">鍵</string>
|
||||
<string name="header_value">值</string>
|
||||
<string name="gallery_info">圖庫資訊</string>
|
||||
<string name="copied_to_clipboard">已複製到剪貼簿</string>
|
||||
<string name="header_key">索引鍵</string>
|
||||
<string name="header_value">數值</string>
|
||||
<string name="key_gid">Gid</string>
|
||||
<string name="key_token">Token</string>
|
||||
<string name="key_url">連結</string>
|
||||
<string name="key_url">網址</string>
|
||||
<string name="key_title">標題</string>
|
||||
<string name="key_title_jpn">日文標題</string>
|
||||
<string name="key_thumb">縮圖</string>
|
||||
<string name="key_category">分類</string>
|
||||
<string name="key_uploader">上傳者</string>
|
||||
<string name="key_posted">上傳時間</string>
|
||||
<string name="key_parent">父畫廊</string>
|
||||
<string name="key_visible">可見性</string>
|
||||
<string name="key_parent">上層圖庫</string>
|
||||
<string name="key_visible">可見</string>
|
||||
<string name="key_language">語言</string>
|
||||
<string name="key_pages">頁數</string>
|
||||
<string name="key_size">大小</string>
|
||||
<string name="key_favorite_count">收藏次數</string>
|
||||
<string name="key_favorited">收藏</string>
|
||||
<string name="key_rating_count">評價次數</string>
|
||||
<string name="key_rating">評分</string>
|
||||
<string name="key_torrents">種子個數</string>
|
||||
<string name="key_torrent_url">種子</string>
|
||||
<string name="key_rating_count">評分次數</string>
|
||||
<string name="key_rating">分數</string>
|
||||
<string name="key_torrents">種子數</string>
|
||||
<string name="key_torrent_url">種子連結</string>
|
||||
|
||||
<!-- Gallery Comments -->
|
||||
<string name="gallery_comments">畫廊評論</string>
|
||||
<string name="no_one_comments_gallery">暫時沒有評論</string>
|
||||
<string name="comment_successfully">評論成功</string>
|
||||
<string name="comment_failed">評論失敗</string>
|
||||
<string name="copy_comment_text">複製評論文字</string>
|
||||
<string name="vote_up">深表贊同</string>
|
||||
<string name="cancel_vote_up">不再深表贊同</string>
|
||||
<string name="vote_down">垃圾評論</string>
|
||||
<string name="cancel_vote_down">不是垃圾評論</string>
|
||||
<string name="vote_up_successfully">已深表贊同</string>
|
||||
<string name="cancel_vote_up_successfully">已不再深表贊同</string>
|
||||
<string name="vote_down_successfully">已欽定為垃圾評論</string>
|
||||
<string name="cancel_vote_down_successfully">已不再欽定為垃圾評論</string>
|
||||
<string name="vote_failed">投票失敗</string>
|
||||
<string name="check_vote_status">檢視投票情況</string>
|
||||
<string name="gallery_comments">圖庫留言</string>
|
||||
<string name="no_one_comments_gallery">目前沒有留言</string>
|
||||
<string name="comment_successfully">留言成功</string>
|
||||
<string name="comment_failed">留言失敗</string>
|
||||
<string name="copy_comment_text">複製留言文字</string>
|
||||
<string name="vote_up">推</string>
|
||||
<string name="cancel_vote_up">收回推</string>
|
||||
<string name="vote_down">噓</string>
|
||||
<string name="cancel_vote_down">收回噓</string>
|
||||
<string name="vote_up_successfully">發出推了</string>
|
||||
<string name="cancel_vote_up_successfully">已經收回推了</string>
|
||||
<string name="vote_down_successfully">發出噓了</string>
|
||||
<string name="cancel_vote_down_successfully">已經收回噓了</string>
|
||||
<string name="vote_failed">推噓失敗</string>
|
||||
<string name="check_vote_status">檢視推噓狀態</string>
|
||||
|
||||
<!-- Gallery Previews -->
|
||||
<string name="gallery_previews">畫廊預覽</string>
|
||||
<string name="go_to">跳頁</string>
|
||||
<string name="gallery_previews">圖庫預覽</string>
|
||||
<string name="go_to">跳到</string>
|
||||
|
||||
<!-- Download -->
|
||||
<string name="scene_download_title">下載 - %s</string>
|
||||
<string name="no_download_info">這裡是下載專案</string>
|
||||
<string name="download_state_none">未啟動</string>
|
||||
<string name="scene_download_title">正在下載 - %s</string>
|
||||
<string name="no_download_info">下載的物件將會顯示在此</string>
|
||||
<string name="download_state_none">閒置中</string>
|
||||
<string name="download_state_wait">等待中</string>
|
||||
<string name="download_state_downloading">下載中</string>
|
||||
<string name="download_state_downloaded">已下載</string>
|
||||
<string name="download_state_failed">失敗</string>
|
||||
<string name="download_state_failed_2">%d 未完成</string>
|
||||
<string name="download_state_finish">已完成</string>
|
||||
<string name="download_state_failed">下載失敗</string>
|
||||
<string name="download_state_failed_2">還有 %d 尚未完成</string>
|
||||
<string name="download_state_finish">大功告成</string>
|
||||
<string name="stat_509_alert_title">509 警告</string>
|
||||
<string name="stat_509_alert_text">圖片配額已用盡。請停止下載,休息一下。</string>
|
||||
<string name="stat_509_alert_text">圖片流量已用盡。請停止下載,休息一下。</string>
|
||||
<string name="stat_download_done_title">下載結束</string>
|
||||
<string name="stat_download_done_text_succeeded">%d 項下載成功</string>
|
||||
<string name="stat_download_done_text_failed">%d 項下載失敗</string>
|
||||
<string name="stat_download_done_text_mix">%1$d 項下載成功,%2$d 項下載失敗</string>
|
||||
<string name="stat_download_done_line_succeeded">下載成功:%s</string>
|
||||
<string name="stat_download_done_line_failed">下載失敗:%s</string>
|
||||
<string name="download_remove_dialog_title">移除下載項</string>
|
||||
<string name="download_remove_dialog_message">從下載列表移除 %s ?</string>
|
||||
<string name="download_remove_dialog_message_2">從下載列表移除 %d 項?</string>
|
||||
<string name="download_remove_dialog_check_text">刪除圖片檔案</string>
|
||||
<string name="stat_download_done_text_succeeded">有 %d 項已成功下載</string>
|
||||
<string name="stat_download_done_text_failed">有 %d 項下載失敗</string>
|
||||
<string name="stat_download_done_text_mix">%1$d 項成功下載,%2$d 項下載失敗</string>
|
||||
<string name="stat_download_done_line_succeeded"> %s 下載成功</string>
|
||||
<string name="stat_download_done_line_failed"> %s 下載失敗</string>
|
||||
<string name="download_remove_dialog_title">移除下載佇列</string>
|
||||
<string name="download_remove_dialog_message">將 %s 從下載佇列中移除嗎?</string>
|
||||
<string name="download_remove_dialog_message_2">從下載佇列中移除 %s 項任務嗎?</string>
|
||||
<string name="download_remove_dialog_check_text">刪除圖檔</string>
|
||||
<string name="stat_download_action_stop_all">全部停止</string>
|
||||
<string name="drawer_download_label_title">標籤</string>
|
||||
<string name="default_download_label_name">預設</string>
|
||||
@@ -305,42 +312,48 @@
|
||||
<string name="added_to_download_list">已新增至下載列表</string>
|
||||
|
||||
<!-- Download label -->
|
||||
<string name="no_download_label">這裡是下載標籤</string>
|
||||
<string name="no_download_label">下載標籤將會顯示在這裡</string>
|
||||
<string name="add">新增</string>
|
||||
<string name="new_label_title">新標籤</string>
|
||||
<string name="label_text_is_empty">標籤文字為空</string>
|
||||
<string name="label_text_is_invalid">“預設”是無效標籤</string>
|
||||
<string name="label_text_is_empty">標籤文字是空的</string>
|
||||
<string name="label_text_is_invalid">“預設”是無效的標籤</string>
|
||||
<string name="label_text_exist">標籤已存在</string>
|
||||
<string name="rename_label_title">重新命名標籤</string>
|
||||
<string name="delete_label_title">刪除標籤</string>
|
||||
<string name="delete_label_message">刪除“%s”?</string>
|
||||
<string name="delete_label_message">將 “%s”刪除?</string>
|
||||
|
||||
<!-- History -->
|
||||
<string name="no_history">這裡是閱讀歷史</string>
|
||||
<string name="no_history">歷史紀錄將會顯示在這裡</string>
|
||||
<string name="clear_all">全部清除</string>
|
||||
<string name="clear_all_history">清除所有閱讀歷史?</string>
|
||||
<string name="clear_all_history">清除所有歷史紀錄?</string>
|
||||
|
||||
<!-- Filter -->
|
||||
<string name="filter">過濾</string>
|
||||
<string name="no_filter">這裡是過濾列表</string>
|
||||
<string name="filter">篩選器</string>
|
||||
<string name="no_filter">篩選列表將會顯示在這裡</string>
|
||||
<string name="filter_title">標題</string>
|
||||
<string name="filter_uploader">上傳者</string>
|
||||
<string name="filter_tag">標籤</string>
|
||||
<string name="filter_tag_namespace">標籤組</string>
|
||||
<string name="delete_title_filter">刪除標題過濾項“%s”?</string>
|
||||
<string name="delete_uploader_filter">刪除上傳者過濾項“%s”?</string>
|
||||
<string name="delete_tag_filter">刪除標籤過濾項“%s”?</string>
|
||||
<string name="delete_filter">刪除過濾項“%s”?</string>
|
||||
<string name="filter_tag_namespace">標籤命名空間</string>
|
||||
<string name="delete_title_filter">要將標題篩選項目“%s”移除嗎?</string>
|
||||
<string name="delete_uploader_filter">要將上傳者篩選項目“%s”移除嗎?</string>
|
||||
<string name="delete_tag_filter">要將標籤篩選項目“%s”移除嗎?</string>
|
||||
<string name="delete_filter">要將篩選項目“%s”嗎?</string>
|
||||
<string name="tip">提示</string>
|
||||
<string name="add_filter">新增過濾項</string>
|
||||
<string name="add_filter">新增篩選條件</string>
|
||||
<string name="show_definition">檢視定義</string>
|
||||
<string name="filter_text">過濾項文字</string>
|
||||
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該標籤的畫廊,這會使獲取畫廊列表花費更多時間。\n\n標籤組過濾項:排除包含該標籤組的畫廊,這會使獲取畫廊列表花費更多時間。</string>
|
||||
<string name="filter_text">篩選文字</string>
|
||||
<string name="filter_tip">標題篩選:排除標題含有該關鍵字的圖庫。\n\n上傳者篩選:排除該上傳者上傳的圖庫。\n\n標籤篩選:排除包含該標籤的圖庫,這會使獲取圖庫列表花費更多時間。\n\n標籤命名空間篩選:排除包含該標籤命名空間(標籤標題)的圖庫,這會使獲取圖庫列表花費更多時間。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">設定圖案保護</string>
|
||||
<string name="set_pattern_protection_tip">繪製圖案來設定圖案保護\n留空來取消圖案保護</string>
|
||||
<string name="set_pattern_protection">設定繪圖解鎖</string>
|
||||
<string name="set_pattern_protection_tip">繪製圖案來設定繪圖解鎖\n留白以取消圖案保護</string>
|
||||
<string name="set">設定</string>
|
||||
<string name="enable_fingerprint">允許使用指紋解鎖</string>
|
||||
|
||||
<!-- UConfig Activity -->
|
||||
<string name="u_config">EHentai 設定</string>
|
||||
<string name="apply">應用</string>
|
||||
<string name="apply_tip">點選右上角的對勾來儲存設定</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 頁</string>
|
||||
@@ -350,20 +363,22 @@
|
||||
<string name="page_menu_add_bookmark">新增書籤</string>
|
||||
<string name="gallery_menu_title">選單</string>
|
||||
<string name="share_image">分享圖片</string>
|
||||
<string name="image_saved">圖片已儲存至 %s</string>
|
||||
<string name="image_saved">已將圖片儲存至 %s</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings_eh">EH</string>
|
||||
<string name="settings_eh_sign_out">退出登陸</string>
|
||||
<string name="settings_eh_sign_out_summary">退出登陸後重啟應用以便再次登陸</string>
|
||||
<string name="settings_eh_sign_out_warning">天哪,我的老夥計,你要退出登入嗎?我是說,你真的要退出登入嗎?</string>
|
||||
<string name="settings_eh_sign_out_yes">是的,我是說,真的</string>
|
||||
<string name="settings_eh_sign_out_tip">已退出登陸,重啟應用以便再次登陸</string>
|
||||
<string name="settings_eh_gallery_site">畫廊站點</string>
|
||||
<string name="settings_eh_sign_out">登出</string>
|
||||
<string name="settings_eh_sign_out_summary">登出後重新啟動程式以再次登入</string>
|
||||
<string name="settings_eh_sign_out_warning">天哪,老兄,你真的要登出嗎?我是說,你真的要登出嗎?</string>
|
||||
<string name="settings_eh_sign_out_yes">沒錯,我是說,對</string>
|
||||
<string name="settings_eh_sign_out_tip">已登出,重新啟動程式以再次登入</string>
|
||||
<string name="settings_u_config">EHentai 設定</string>
|
||||
<string name="settings_u_config_summary">EHentai 網站上的設定</string>
|
||||
<string name="settings_eh_gallery_site">圖庫站台</string>
|
||||
<string name="settings_eh_list_mode">列表模式</string>
|
||||
<string name="settings_eh_list_mode_detail">詳情</string>
|
||||
<string name="settings_eh_list_mode_detail">詳細資料</string>
|
||||
<string name="settings_eh_list_mode_thumb">縮圖</string>
|
||||
<string name="settings_eh_detail_size">詳情大小</string>
|
||||
<string name="settings_eh_detail_size">詳細大小</string>
|
||||
<string name="settings_eh_detail_size_long">長</string>
|
||||
<string name="settings_eh_detail_size_short">短</string>
|
||||
<string name="settings_eh_thumb_size">縮圖大小</string>
|
||||
@@ -371,108 +386,110 @@
|
||||
<string name="settings_eh_thumb_size_middle">中</string>
|
||||
<string name="settings_eh_thumb_size_small">小</string>
|
||||
<string name="settings_eh_thumb_resolution">縮圖解析度</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s,指定解析度可能使獲取縮圖失敗</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s,指定解析度可能會使縮圖取得失敗</string>
|
||||
<string name="settings_eh_thumb_resolution_auto">自動</string>
|
||||
<string name="settings_eh_default_categories">主頁分類顯示</string>
|
||||
<string name="settings_eh_default_categories_summary">預設在主頁所顯示的分類</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces">排除標籤組</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces_summary">在預設搜尋中排除指定標籤組</string>
|
||||
<string name="settings_eh_fix_thumb_url">修正縮圖連結</string>
|
||||
<string name="settings_eh_default_categories">顯示在首頁的分類</string>
|
||||
<string name="settings_eh_default_categories_summary">顯示在首頁的分類就跟預設一樣</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces">除標籤命名空間</string>
|
||||
<string name="settings_eh_excluded_tag_namespaces_summary">在預設標籤搜尋中排除特定的標籤命名空間</string>
|
||||
<string name="settings_eh_excluded_languages">排除語言</string>
|
||||
<string name="settings_eh_excluded_languages_summary">在主頁與搜尋中隱藏指定語言的畫廊</string>
|
||||
<string name="settings_eh_excluded_languages_summary">在首頁與搜尋中隱藏指定語言的圖庫</string>
|
||||
<string name="settings_eh_hath_proxy">H@H </string>
|
||||
<string name="settings_eh_hath_proxy_summary_1">%1$s %2$s:%3$d</string>
|
||||
<string name="settings_eh_hath_proxy_summary_2">未設定</string>
|
||||
<string name="settings_eh_hath_proxy_summary_2">無</string>
|
||||
<string name="settings_eh_show_jpn_title">顯示日文標題</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_on">嘗試顯示日文標題。這會使獲取畫廊列表花費更多時間</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_off">顯示預設標題。一般是英文標題</string>
|
||||
<string name="settings_eh_filter">過濾</string>
|
||||
<string name="settings_eh_filter_summary">過濾標題,上傳者,標籤和標籤組</string>
|
||||
<string name="settings_eh_cellular_network_warning">行動網路警告</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_on">嘗試顯示日文標題。這會使取得圖庫列表時間增加</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_off">顯示預設的標題。通常是英文的</string>
|
||||
<string name="settings_eh_filter">篩選</string>
|
||||
<string name="settings_eh_filter_summary">篩選標題,上傳者,標籤和標籤命名空間</string>
|
||||
<string name="settings_eh_cellular_network_warning">行動數據警告</string>
|
||||
|
||||
<string name="settings_read">閱讀</string>
|
||||
<string name="settings_read_screen_rotation">螢幕方向</string>
|
||||
<string name="settings_read_screen_rotation_default">系統預設</string>
|
||||
<string name="settings_read_screen_rotation_portrait">豎屏</string>
|
||||
<string name="settings_read_screen_rotation_landscape">橫屏</string>
|
||||
<string name="settings_read_screen_rotation_portrait">直向</string>
|
||||
<string name="settings_read_screen_rotation_landscape">橫向</string>
|
||||
<string name="settings_read_reading_direction">閱讀方向</string>
|
||||
<string name="settings_read_reading_direction_left_to_right">從左至右</string>
|
||||
<string name="settings_read_reading_direction_right_to_Left">從右至左</string>
|
||||
<string name="settings_read_reading_direction_top_to_bottom">從上至下</string>
|
||||
<string name="settings_read_reading_direction_left_to_right">由左到右</string>
|
||||
<string name="settings_read_reading_direction_right_to_Left">由右到左</string>
|
||||
<string name="settings_read_reading_direction_top_to_bottom">由上到下</string>
|
||||
<string name="settings_read_page_scaling">頁面縮放</string>
|
||||
<string name="settings_read_page_scaling_actual_size">原始尺寸</string>
|
||||
<string name="settings_read_page_scaling_fit_to_width">匹配寬度</string>
|
||||
<string name="settings_read_page_scaling_fit_to_height">匹配長度</string>
|
||||
<string name="settings_read_page_scaling_fit_to_screen">匹配螢幕</string>
|
||||
<string name="settings_read_page_scaling_fixed_scale">固定縮放</string>
|
||||
<string name="settings_read_start_position">開頁位置</string>
|
||||
<string name="settings_read_page_scaling_fit_to_width">貼齊寬度</string>
|
||||
<string name="settings_read_page_scaling_fit_to_height">貼齊長度</string>
|
||||
<string name="settings_read_page_scaling_fit_to_screen">以螢幕大小縮放</string>
|
||||
<string name="settings_read_page_scaling_fixed_scale">固定尺寸</string>
|
||||
<string name="settings_read_start_position">開始位置</string>
|
||||
<string name="settings_read_start_position_top_left">左上角</string>
|
||||
<string name="settings_read_start_position_top_right">右上角</string>
|
||||
<string name="settings_read_start_position_bottom_left">左下角</string>
|
||||
<string name="settings_read_start_position_bottom_right">右下角</string>
|
||||
<string name="settings_read_start_position_center">中心</string>
|
||||
<string name="settings_read_keep_screen_on">螢幕常亮</string>
|
||||
<string name="settings_read_start_position_center">中間</string>
|
||||
<string name="settings_read_keep_screen_on">讓螢幕開著</string>
|
||||
<string name="settings_read_show_clock">顯示時鐘</string>
|
||||
<string name="settings_read_show_progress">顯示進度</string>
|
||||
<string name="settings_read_show_battery">顯示電量</string>
|
||||
<string name="settings_read_show_page_interval">顯示頁面間隔</string>
|
||||
<string name="settings_read_volume_page">使用音量鍵翻頁</string>
|
||||
<string name="settings_read_reading_fullscreen">全屏</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定義螢幕亮度</string>
|
||||
<string name="settings_read_reading_fullscreen">全螢幕</string>
|
||||
<string name="settings_read_custom_screen_lightness">自訂螢幕亮度</string>
|
||||
<string name="settings_read_screen_lightness">螢幕亮度</string>
|
||||
|
||||
<string name="settings_download">下載</string>
|
||||
<string name="settings_download_download_location">下載路徑</string>
|
||||
<string name="settings_download_invalid_download_location">無效的下載路徑</string>
|
||||
<string name="settings_download_cant_get_download_location">無法獲取下載路徑</string>
|
||||
<string name="settings_download_pick_dir_kk">在 KitKat 中您無法把資料寫入外接 SD 卡,除非您做了奇怪的事情。不過 <SD card>/Android/data/com.hippo.ehviewer 這個路徑比較特殊,是可以寫入的。</string>
|
||||
<string name="settings_download_pick_dir_l">Lollipop 提供了新的寫入外接 SD 卡的 API。如果您想把下載路徑設定到外接 SD 卡上,點選“文件”按鈕</string>
|
||||
<string name="settings_download_document">文件</string>
|
||||
<string name="settings_download_cant_get_download_location">無法取得下載路徑</string>
|
||||
<string name="settings_download_pick_dir_kk">在 Android 4.4+ KitKat 中您無法把數據寫到外接 SD 卡裡,除非你駭了他。不過 <SD card>/Android/data/com.hippo.ehviewer 這個路徑比較特別,可以寫入。</string>
|
||||
<string name="settings_download_pick_dir_l">Android 5.0+ Lollipop 提供了新的寫入外接 SD 卡的 API。如果您想把下載路徑設定到外接 SD 卡上,點擊“檔案”按鈕</string>
|
||||
<string name="settings_download_document">檔案</string>
|
||||
<string name="settings_download_continue">繼續</string>
|
||||
<string name="settings_download_multi_thread_download">下載執行緒數</string>
|
||||
<string name="settings_download_multi_thread_download">同時多重下載</string>
|
||||
<string name="settings_download_multi_thread_download_summary">最多同時下載 %s 張圖片</string>
|
||||
<string name="settings_download_preload_image">預載圖片</string>
|
||||
<string name="settings_download_preload_image_summary">向後預載 %s 張圖片</string>
|
||||
<string name="settings_download_image_resolution">圖片解析度</string>
|
||||
<string name="settings_download_image_resolution_summary">%s,大於 1280x 的解析度可能不好使</string>
|
||||
<string name="settings_download_image_resolution_summary">%s,大於 1280x 的解析度可能不會生效</string>
|
||||
<string name="settings_download_image_resolution_auto">自動</string>
|
||||
<string name="settings_download_download_origin_image">下載原圖</string>
|
||||
<string name="settings_download_download_origin_image_summary">這很危險!勾選此項會導致下載配額迅速流失</string>
|
||||
<string name="settings_download_media_scan">允許媒體掃描</string>
|
||||
<string name="settings_download_media_scan_summary_on">請避免他人翻看你的相簿應用</string>
|
||||
<string name="settings_download_media_scan_summary_off">大多數相簿應用將不會顯示下載目錄中的圖片</string>
|
||||
<string name="settings_download_restore_download_items">恢復下載項</string>
|
||||
<string name="settings_download_restore_download_items_summary">恢復下載目錄裡的所有下載項</string>
|
||||
<string name="settings_download_restoring">恢復中</string>
|
||||
<string name="settings_download_restore_not_found">未找到可恢復下載項</string>
|
||||
<string name="settings_download_restore_failed">恢復失敗</string>
|
||||
<string name="settings_download_restore_successfully">成功恢復 %s 項</string>
|
||||
<string name="settings_download_clean_redundancy">清理下載冗餘</string>
|
||||
<string name="settings_download_clean_redundancy_summary">清理下載目錄中不在下載列表裡的圖片檔案</string>
|
||||
<string name="settings_download_clean_redundancy_no_redundancy">未發現冗餘</string>
|
||||
<string name="settings_download_clean_redundancy_done">完成冗餘清理,共清理 %d 項</string>
|
||||
<string name="settings_download_download_origin_image_summary">這很危險!勾選這個選項會導致圖片流量配額快速耗用</string>
|
||||
<string name="settings_download_media_scan">允許其他程式進行媒體掃描</string>
|
||||
<string name="settings_download_media_scan_summary_on">請別讓別人看到你的相簿</string>
|
||||
<string name="settings_download_media_scan_summary_off">大部分相簿軟體將會忽略顯示下載路徑中的影像</string>
|
||||
<string name="settings_download_restore_download_items">回復下載的檔案</string>
|
||||
<string name="settings_download_restore_download_items_summary">回復下載路徑中的所有下載的檔案</string>
|
||||
<string name="settings_download_restoring">回復中</string>
|
||||
<string name="settings_download_restore_not_found">未尋獲可回復的已下載檔案</string>
|
||||
<string name="settings_download_restore_failed">回復失敗</string>
|
||||
<string name="settings_download_restore_successfully">成功回復 %s 項</string>
|
||||
<string name="settings_download_clean_redundancy">清除冗餘的檔案</string>
|
||||
<string name="settings_download_clean_redundancy_summary">清除已下載但不在下載列表中的圖檔</string>
|
||||
<string name="settings_download_clean_redundancy_no_redundancy">未發現冗餘檔案</string>
|
||||
<string name="settings_download_clean_redundancy_done">完成冗餘檔案清理,共清理了 %d 個檔案</string>
|
||||
|
||||
<string name="settings_advanced">高階</string>
|
||||
<string name="settings_advanced_save_parse_error_body">解析失敗時儲存頁面內容</string>
|
||||
<string name="settings_advanced_save_parse_error_body_summary">頁面內容可能含有隱私敏感資訊</string>
|
||||
<string name="settings_advanced_dump_logcat">匯出日誌</string>
|
||||
<string name="settings_advanced_dump_logcat_summary">儲存日誌至外接儲存器</string>
|
||||
<string name="settings_advanced_dump_logcat_failed">匯出日誌失敗</string>
|
||||
<string name="settings_advanced_dump_logcat_to">已儲存日誌至 %s</string>
|
||||
<string name="settings_advanced_clear_download_path_cache">清除畫廊下載路徑快取</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_summary">畫廊下載路徑可能出錯了,導致重新下載。清除畫廊下載路徑快取可能解決這個問題。</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_message">清除畫廊下載路徑快取?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">清理記憶體快取</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">清理縮圖、畫廊資訊的記憶體快取</string>
|
||||
<string name="settings_advanced">進階</string>
|
||||
<string name="settings_advanced_save_parse_error_body">解析失敗時儲存網頁的內容</string>
|
||||
<string name="settings_advanced_save_parse_error_body_summary">網頁內容可能含有敏感的隱私資料</string>
|
||||
<string name="settings_advanced_dump_logcat">傾印log</string>
|
||||
<string name="settings_advanced_dump_logcat_summary">儲存log紀錄至外接儲存裝置中</string>
|
||||
<string name="settings_advanced_dump_logcat_failed">無法傾印log紀錄</string>
|
||||
<string name="settings_advanced_dump_logcat_to">已儲存log紀錄至 %s</string>
|
||||
<string name="settings_advanced_clear_download_path_cache">清除下載路徑的快取</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_summary">圖庫下載路徑可能錯了,所以需要重新下載。清除圖庫下載路徑的快取可能可以解決這個問題。</string>
|
||||
<string name="settings_advanced_clear_download_path_cache_message">清除圖庫下載路徑的快取?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">清除記憶體快取</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">清除縮圖、圖庫詳細資料的記憶體快取</string>
|
||||
<string name="settings_advanced_read_cache_size">閱讀快取大小</string>
|
||||
<string name="settings_advanced_pattern_protection_title">圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未設定圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已設定圖案保護</string>
|
||||
<string name="settings_advanced_export_data">匯出資料</string>
|
||||
<string name="settings_advanced_export_data_summary">儲存資料至外接儲存器,例如下載列表,快速搜尋列表</string>
|
||||
<string name="settings_advanced_pattern_protection_title">繪圖解鎖</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">尚未設定繪圖解鎖</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已設定繪圖解鎖</string>
|
||||
<string name="settings_advanced_export_data">匯出檔案</string>
|
||||
<string name="settings_advanced_export_data_summary">儲存資料至外接儲存設備,例如下載列表,快速搜尋列表</string>
|
||||
<string name="settings_advanced_export_data_to">已匯出資料至 %s</string>
|
||||
<string name="settings_advanced_export_data_failed">匯出資料失敗</string>
|
||||
<string name="settings_advanced_import_data">匯入資料</string>
|
||||
<string name="settings_advanced_import_data_summary">從置儲存器已匯出的資料</string>
|
||||
<string name="settings_advanced_import_data_successfully">匯入資料成功</string>
|
||||
<string name="settings_advanced_export_data_failed">無法匯出資料</string>
|
||||
<string name="settings_advanced_import_data">匯入檔案</string>
|
||||
<string name="settings_advanced_import_data_summary">從之前儲存的檔案匯入</string>
|
||||
<string name="settings_advanced_import_data_successfully">成功將資料匯入</string>
|
||||
|
||||
<string name="settings_about">關於</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
@@ -480,28 +497,28 @@
|
||||
<string name="settings_about_website">網站</string>
|
||||
<string name="settings_about_source">原始碼</string>
|
||||
<string name="settings_about_changelog">更新日誌</string>
|
||||
<string name="settings_about_help">幫助</string>
|
||||
<string name="settings_about_license">開源許可</string>
|
||||
<string name="settings_about_help">說明</string>
|
||||
<string name="settings_about_license">授權</string>
|
||||
<string name="settings_about_license_summary">EhViewer 的誕生離不開許多開源專案</string>
|
||||
<string name="settings_about_donate">捐贈</string>
|
||||
<string name="settings_about_donate">贊助</string>
|
||||
<string name="settings_about_donate_summary">支付寶:seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">你的捐贈能幫助我開發更多更好的應用。\n\n支付寶:seven332$163.com</string>
|
||||
<string name="settings_about_donate_toast">郵箱地址已複製到剪下板</string>
|
||||
<string name="settings_about_donate_message">你的贊助能幫助我開發更多更好的軟體。\n\n支付寶:seven332$163.com</string>
|
||||
<string name="settings_about_donate_toast">已將電子信箱地址複製到剪貼簿</string>
|
||||
<string name="settings_about_enable_analytics">啟用資料統計</string>
|
||||
<string name="settings_about_about_analytics">關於資料統計</string>
|
||||
<string name="settings_about_version">版本號</string>
|
||||
<string name="settings_about_version">版本號碼</string>
|
||||
<string name="settings_about_check_for_updates">檢查更新</string>
|
||||
<string name="settings_about_beta_update_channel">更新測試版</string>
|
||||
<string name="settings_about_beta_update_channel_summary">測試版可能在你的裝置上出現不可預知的錯誤</string>
|
||||
<string name="settings_about_beta_update_channel_summary">測試版可能在你的裝置上可能出現不可預測的錯誤</string>
|
||||
|
||||
<!-- ExcludedLanguagesScene -->
|
||||
<string name="excluded_languages">排除語言</string>
|
||||
<string name="select_all">全選</string>
|
||||
<string name="deselect_all">全取消</string>
|
||||
<string name="invert_selection">反選</string>
|
||||
<string name="invert_selection">反轉選取</string>
|
||||
<string name="language">語言</string>
|
||||
<string name="original">原作</string>
|
||||
<string name="translated">翻譯</string>
|
||||
<string name="original">原史作品</string>
|
||||
<string name="translated">翻譯版</string>
|
||||
<string name="rewrite">改寫</string>
|
||||
<string name="language_japanese">日語</string>
|
||||
<string name="language_english">英語</string>
|
||||
@@ -527,30 +544,30 @@
|
||||
<string name="enabled">已啟用</string>
|
||||
<string name="disabled">未啟用</string>
|
||||
<string name="ip">IP</string>
|
||||
<string name="port">埠</string>
|
||||
<string name="port">通訊埠</string>
|
||||
<string name="Passkey">金鑰</string>
|
||||
<string name="domain_not_supported">不支援域名</string>
|
||||
<string name="invalid_port">無效的埠</string>
|
||||
<string name="domain_not_supported">不支援的域名</string>
|
||||
<string name="invalid_port">無效的通訊埠</string>
|
||||
|
||||
<string name="cant_get_data_dir">無法獲取資料資料夾</string>
|
||||
<string name="cant_get_data_dir">無法取得檔案資料夾</string>
|
||||
<string name="cant_find_any_data">找不到任何資料</string>
|
||||
<string name="cant_read_the_file">無法讀取檔案</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="license">開源許可</string>
|
||||
<string name="license">授權</string>
|
||||
|
||||
<!-- Dir Picker-->
|
||||
<string name="dir_picker">選擇資料夾</string>
|
||||
<string name="directory_not_writable">該資料夾不可寫</string>
|
||||
<string name="directory_not_writable">該資料夾無法寫入</string>
|
||||
|
||||
<!-- Favorites -->
|
||||
<string name="cloud_favorites">雲端收藏</string>
|
||||
<string name="local_favorites">本地收藏</string>
|
||||
<string name="local_favorites">本機收藏</string>
|
||||
<string name="favorites_search_bar_hint">搜尋 %s</string>
|
||||
<string name="favorites_title">%s</string>
|
||||
<string name="favorites_title_2">%1$s - %2$s</string>
|
||||
<string name="delete_favorites_dialog_title">刪除收藏</string>
|
||||
<string name="delete_favorites_dialog_message">刪除 %d 項收藏?</string>
|
||||
<string name="delete_favorites_dialog_title">移除收藏</string>
|
||||
<string name="delete_favorites_dialog_message">將 %d 項收藏移除?</string>
|
||||
<string name="move_favorites_dialog_title">移動收藏</string>
|
||||
<string name="default_favorites_collection">預設收藏夾</string>
|
||||
<string name="let_me_select">讓我選擇</string>
|
||||
@@ -564,18 +581,18 @@
|
||||
|
||||
<!-- Guide -->
|
||||
<string name="guide_quick_search_title">快速搜尋</string>
|
||||
<string name="guide_quick_search_text">從右側滑動開啟快速搜尋面板</string>
|
||||
<string name="guide_quick_search_text">從右側滑動以開啟快速搜尋面板</string>
|
||||
<string name="guide_collections_title">收藏夾</string>
|
||||
<string name="guide_collections_text">從右側滑動來選擇收藏夾</string>
|
||||
<string name="guide_collections_text">從右側滑動選擇收藏夾</string>
|
||||
<string name="guide_download_labels_title">下載標籤</string>
|
||||
<string name="guide_download_labels_text">從右側滑動開啟下載標籤面板</string>
|
||||
<string name="guide_download_thumb_title">畫廊詳情</string>
|
||||
<string name="guide_download_thumb_text">點選縮圖檢視畫廊詳情</string>
|
||||
<string name="guide_download_labels_text">從右側滑動以開啟下載標籤面板</string>
|
||||
<string name="guide_download_thumb_title">圖庫詳細資訊</string>
|
||||
<string name="guide_download_thumb_text">點擊縮圖檢視圖庫詳細資訊</string>
|
||||
<string name="guide_gallery_left">翻頁</string>
|
||||
<string name="guide_gallery_right">翻頁</string>
|
||||
<string name="guide_gallery_menu">選單</string>
|
||||
<string name="guide_gallery_progress">進度條</string>
|
||||
<string name="guide_gallery_long_click">長按開啟頁面選單</string>
|
||||
<string name="guide_gallery_long_click">長按以開啟頁面選單</string>
|
||||
|
||||
<!-- Readable Time -->
|
||||
<string name="from_the_future">來自未來</string>
|
||||
@@ -604,5 +621,11 @@
|
||||
<plurals name="year">
|
||||
<item quantity="other">年</item>
|
||||
</plurals>
|
||||
<string name="dialog_archive_title">透過 H@H 下載</string>
|
||||
<string name="no_archives">沒有壓縮檔</string>
|
||||
<string name="download_archive_started">開始下載壓縮檔</string>
|
||||
<string name="download_archive_failure">下載失敗</string>
|
||||
<string name="archive">壓縮檔</string>
|
||||
<string name="download_archive_failure_no_hath">下載壓縮檔需要 H@H 客戶端</string>
|
||||
|
||||
</resources>
|
||||
@@ -60,6 +60,7 @@
|
||||
<string name="pd_similar" translatable="false">M2,20L17,10L22,22M14,9L2,8L11,2Z</string>
|
||||
<string name="pd_refresh" translatable="false">M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z</string>
|
||||
<string name="pd_file_find" translatable="false">M9,13A3,3 0 0,0 12,16A3,3 0 0,0 15,13A3,3 0 0,0 12,10A3,3 0 0,0 9,13M20,19.59V8L14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18C18.45,22 18.85,21.85 19.19,21.6L14.76,17.17C13.96,17.69 13,18 12,18A5,5 0 0,1 7,13A5,5 0 0,1 12,8A5,5 0 0,1 17,13C17,14 16.69,14.96 16.17,15.75L20,19.59Z</string>
|
||||
<string name="pd_check" translatable="false">M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z</string>
|
||||
|
||||
<string name="pd_big_label" translatable="false">M12.88,2H4V11L14.97,22.14L24,13.1L12.88,2ZM7.26,5.26C7.96,4.58,9.06,4.58,9.74,5.26C10.42,5.96,10.42,7.06,9.74,7.74S7.94,8.42,7.26,7.74S6.58,5.94,7.26,5.26ZM14.98,19.3L8.76,12.95L14.88,6.83L21.18,13.11L14.98,19.31ZM11.6,21.56L10.23,23L0,12.74V5H2V11.9L11.6,21.56Z</string>
|
||||
<string name="pd_big_search" translatable="false">M20.46,14.65C21.86,16.15,20.31,18.6,18.32,17.87C19.78,17.57,20.79,16.37,20.46,14.65ZM4.32,17.87C6.32,18.6,7.86,16.17,6.46,14.65C6.79,16.38,5.78,17.55,4.32,17.87ZM16.87,4.3C16.6,3.56,15.87,3,15,3C13.7,3,12.7,4.24,13.1,5.58C14.2,5.18,15.44,4.48,16.87,4.31ZM24,16C24,18.76,21.76,21,19,21C14.96,21,14.84,16.88,12,16.88S9.04,21,5,21C2.24,21,0,18.76,0,16C0,13.87,1.53,11.43,3.94,7.18C5.84,3.81,8.69,5.92,10.76,6.58C11.54,6.85,12.41,6.88,13.24,6.58C15.3,5.92,18.14,3.81,20.06,7.18C22.46,11.43,24,13.88,24,16ZM8,16C8,14.35,6.65,13,5,13S2,14.35,2,16S3.35,19,5,19S8,17.65,8,16ZM13,14C13,13.45,12.55,13,12,13S11,13.45,11,14S11.45,15,12,15S13,14.55,13,14ZM22,16C22,14.35,20.65,13,19,13S16,14.35,16,16S17.35,19,19,19S22,17.65,22,16ZM9,3C8.14,3,7.4,3.55,7.13,4.3C8.56,4.48,9.79,5.2,10.9,5.58C11.3,4.24,10.3,3,9,3Z</string>
|
||||
@@ -77,5 +78,6 @@
|
||||
<string name="pd_sad_panda_nose" translatable="false">M12,17C12.8,17,13.5,17.4,13.5,18S12.8,19,12,19S10.5,18.6,10.5,18S11.2,17,12,17Z</string>
|
||||
<string name="pd_sad_panda" translatable="false">M21.1,7.8C22.2,7.4,23,6.3,23,5C23,3.3,21.7,2,20,2C18.9,2,17.9,2.6,17.4,3.6L21.1,7.8M6.6,3.6C6.1,2.6,5.1,2,4,2C2.3,2,1,3.3,1,5C1,6.3,1.8,7.4,2.9,7.8L6.6,3.6M10.1,13L8,15.1C7.4,15.7,6.5,15.7,5.9,15.1L5.9,15.1C5.3,14.5,5.3,13.6,5.9,13L8,10.9C8.6,10.3,9.5,10.3,10.1,10.9L10.1,10.9C10.7,11.5,10.7,12.4,10.1,13M16,15.1L13.9,13C13.3,12.4,13.3,11.5,13.9,10.9L13.9,10.9C14.5,10.3,15.4,10.3,16,10.9L18.1,13C18.7,13.6,18.7,14.5,18.1,15.1L18.1,15.1C17.5,15.7,16.6,15.7,16,15.1M12,17C12.8,17,13.5,17.4,13.5,18S12.8,19,12,19S10.5,18.6,10.5,18S11.2,17,12,17Z</string>
|
||||
<string name="pd_sad_panda_face" translatable="false">M17.4,3.6C15.8,2.6,14,2,12,2S8.2,2.6,6.6,3.6L2.9,7.8C2.3,9.1,2,10.5,2,12C2,17.5,6.5,22,12,22S22,17.5,22,12C22,10.5,21.7,9.1,21.1,7.8L17.4,3.6Z</string>
|
||||
<string name="pd_archive" translatable="false">M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM10,17l-3.5,-3.5 1.41,-1.41L10,14.17 15.18,9l1.41,1.41L10,17z</string>
|
||||
|
||||
</resources>
|
||||
@@ -44,6 +44,11 @@
|
||||
|
||||
<string name="username">Username</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="recaptcha">Recaptcha (Not required)</string>
|
||||
|
||||
<string name="recaptcha_none">Click me</string>
|
||||
<string name="recaptcha_loading">Loading…</string>
|
||||
<string name="recaptcha_failure">Failed</string>
|
||||
|
||||
<string name="sign_in">Sign in</string>
|
||||
<string name="register">Register</string>
|
||||
@@ -135,6 +140,8 @@
|
||||
<string name="accept">Accept</string>
|
||||
<string name="reject">Reject</string>
|
||||
|
||||
<string name="help_route">Settings->About->Help</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">Send</string>
|
||||
<string name="crash_explain">This application crashed last time. Would you mind to send logcat to the developer for a better user experience in future ? (via e-mail)</string>
|
||||
@@ -385,6 +392,12 @@
|
||||
<string name="set_pattern_protection">Set pattern protection</string>
|
||||
<string name="set_pattern_protection_tip">Draw a pattern to set pattern protection\nLeave blank to clear pattern protection</string>
|
||||
<string name="set">Set</string>
|
||||
<string name="enable_fingerprint">Also allow unlock with fingerprint</string>
|
||||
|
||||
<!-- UConfig Activity -->
|
||||
<string name="u_config">EHentai settings</string>
|
||||
<string name="apply">Apply</string>
|
||||
<string name="apply_tip">Click the check mark to save the settings</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">Page %d</string>
|
||||
@@ -402,6 +415,8 @@
|
||||
<string name="settings_eh_sign_out_warning">Do you really want to sign out?</string>
|
||||
<string name="settings_eh_sign_out_yes">@android:string/ok</string>
|
||||
<string name="settings_eh_sign_out_tip">Signed out, restart the application to sign in</string>
|
||||
<string name="settings_u_config">EHentai settings</string>
|
||||
<string name="settings_u_config_summary">Settings on EHentai website</string>
|
||||
<string name="settings_eh_gallery_site">Gallery site</string>
|
||||
<string name="settings_eh_list_mode">List mode</string>
|
||||
<string name="settings_eh_list_mode_detail">Detail</string>
|
||||
@@ -416,6 +431,7 @@
|
||||
<string name="settings_eh_thumb_resolution">Thumb resolution</string>
|
||||
<string name="settings_eh_thumb_resolution_summary">%s, special resolutions might cause getting thumb failed</string>
|
||||
<string name="settings_eh_thumb_resolution_auto">Auto</string>
|
||||
<string name="settings_eh_fix_thumb_url">Fix thumb url</string>
|
||||
<string name="settings_eh_default_categories">Categories on Homepage</string>
|
||||
<string name="settings_eh_default_categories_summary">The categories shown as default on Homepage</string>
|
||||
<string name="settings_eh_excluded_languages">Excluded languages</string>
|
||||
@@ -457,6 +473,7 @@
|
||||
<string name="settings_read_show_clock">Show clock</string>
|
||||
<string name="settings_read_show_progress">Show progress</string>
|
||||
<string name="settings_read_show_battery">Show battery</string>
|
||||
<string name="settings_read_show_page_interval">Show page interval</string>
|
||||
<string name="settings_read_volume_page">Use volume key to turn pages</string>
|
||||
<string name="settings_read_reading_fullscreen">Fullscreen</string>
|
||||
<string name="settings_read_custom_screen_lightness">Custom screen lightness</string>
|
||||
@@ -520,6 +537,7 @@
|
||||
<string name="settings_about">About</string>
|
||||
<string name="settings_about_author">Author</string>
|
||||
<string name="settings_about_author_summary" translatable="false">Hippo <ehviewersu$gmail.com></string>
|
||||
<string name="settings_about_telegram">Telegram</string>
|
||||
<string name="settings_about_google_plus">Google+ Community</string>
|
||||
<string name="settings_about_website">Website</string>
|
||||
<string name="settings_about_source">Source</string>
|
||||
@@ -654,5 +672,11 @@
|
||||
<item quantity="one">year</item>
|
||||
<item quantity="other">years</item>
|
||||
</plurals>
|
||||
<string name="dialog_archive_title">H@H Downloader</string>
|
||||
<string name="no_archives">No Archives</string>
|
||||
<string name="download_archive_started">Archive download started</string>
|
||||
<string name="download_archive_failure">Failed to download archive</string>
|
||||
<string name="archive">Archive</string>
|
||||
<string name="download_archive_failure_no_hath">Need H@H client for archive download</string>
|
||||
|
||||
</resources>
|
||||
@@ -23,6 +23,11 @@
|
||||
android:key="author"
|
||||
android:title="@string/settings_about_author"/>
|
||||
|
||||
<com.hippo.preference.UrlPreference
|
||||
android:key="telegram"
|
||||
android:title="@string/settings_about_telegram"
|
||||
app:url="https://t.me/ehviewer"/>
|
||||
|
||||
<com.hippo.preference.UrlPreference
|
||||
android:key="google_plus"
|
||||
android:title="@string/settings_about_google_plus"
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
app:entryValues="@array/gallery_site_entry_values"
|
||||
android:defaultValue="1"/>
|
||||
|
||||
<com.hippo.preference.ActivityPreference
|
||||
android:key="u_config"
|
||||
android:title="@string/settings_u_config"
|
||||
android:summary="@string/settings_u_config_summary"
|
||||
app:activity="com.hippo.ehviewer.ui.UConfigActivity"/>
|
||||
|
||||
<com.hippo.preference.ListPreference
|
||||
android:key="list_mode"
|
||||
android:title="@string/settings_eh_list_mode"
|
||||
@@ -64,25 +70,10 @@
|
||||
app:entryValues="@array/thumb_resolution_entry_values"
|
||||
android:defaultValue="0"/>
|
||||
|
||||
<com.hippo.ehviewer.preference.DefaultCategoryPreference
|
||||
android:key="default_categories"
|
||||
android:title="@string/settings_eh_default_categories"
|
||||
android:summary="@string/settings_eh_default_categories_summary"/>
|
||||
|
||||
<com.hippo.ehviewer.preference.ExcludedTagNamespacesPreference
|
||||
android:key="excluded_tag_namespaces"
|
||||
android:title="@string/settings_eh_excluded_tag_namespaces"
|
||||
android:summary="@string/settings_eh_excluded_tag_namespaces_summary"/>
|
||||
|
||||
<com.hippo.preference.ActivityPreference
|
||||
android:key="excluded_languages"
|
||||
android:title="@string/settings_eh_excluded_languages"
|
||||
android:summary="@string/settings_eh_excluded_languages_summary"
|
||||
app:activity="com.hippo.ehviewer.ui.ExcludedLanguagesActivity"/>
|
||||
|
||||
<com.hippo.ehviewer.preference.HatHProxyPreference
|
||||
android:key="hath_proxy"
|
||||
android:title="@string/settings_eh_hath_proxy"/>
|
||||
<com.hippo.preference.SwitchPreference
|
||||
android:key="fix_thumb_url"
|
||||
android:title="@string/settings_eh_fix_thumb_url"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<com.hippo.preference.SwitchPreference
|
||||
android:key="show_jpn_title"
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
<path xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<cache-path name="temp" path="temp/"/>
|
||||
<external-path name="image" path="EhViewer/image"/>
|
||||
|
||||
</path>
|
||||
@@ -71,6 +71,11 @@
|
||||
android:title="@string/settings_read_show_battery"
|
||||
android:defaultValue="true"/>
|
||||
|
||||
<com.hippo.preference.SwitchPreference
|
||||
android:key="gallery_show_page_interval"
|
||||
android:title="@string/settings_read_show_page_interval"
|
||||
android:defaultValue="true"/>
|
||||
|
||||
<com.hippo.preference.SwitchPreference
|
||||
android:key="volume_page"
|
||||
android:title="@string/settings_read_volume_page"
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.database;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@Config(manifest = Config.NONE)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class MSQLiteBuilderTest {
|
||||
|
||||
@Test
|
||||
public void testGetStatements() {
|
||||
MSQLiteBuilder builder = new MSQLiteBuilder()
|
||||
.version(1)
|
||||
.statement("11")
|
||||
.statement("12")
|
||||
.version(3)
|
||||
.statement("31")
|
||||
.statement("32");
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("31");
|
||||
list.add("32");
|
||||
assertEquals(list, builder.getStatements(1, 3));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* Copyright 2017 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.network;
|
||||
|
||||
/*
|
||||
* Created by Hippo on 2017/9/4.
|
||||
*/
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.content.Context;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
import org.joor.Reflect;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@Config(manifest = Config.NONE)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class CookieRepositoryTest {
|
||||
|
||||
private void equals(CookieSet cookieSet, List<Cookie> cookies) {
|
||||
assertNotNull(cookieSet);
|
||||
assertNotNull(cookies);
|
||||
|
||||
Map<CookieSet.Key, Cookie> map = Reflect.on(cookieSet).field("map").get();
|
||||
assertEquals(cookies.size(), map.size());
|
||||
for (Cookie cookie: cookies) {
|
||||
assertEquals(cookie, map.get(new CookieSet.Key(cookie)));
|
||||
}
|
||||
}
|
||||
|
||||
private void equals(List<Cookie> cookies1, List<Cookie> cookies2) {
|
||||
assertNotNull(cookies1);
|
||||
assertNotNull(cookies2);
|
||||
|
||||
assertEquals(cookies1.size(), cookies2.size());
|
||||
for (Cookie cookie: cookies1) {
|
||||
assertTrue(cookies2.contains(cookie));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPersistent() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
Cookie cookieEh1 = new Cookie.Builder()
|
||||
.name("user")
|
||||
.value("1234567890")
|
||||
.domain("ehviewer.com")
|
||||
.path("/")
|
||||
.build();
|
||||
Cookie cookieEh2 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("999")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
Cookie cookieEh3 = new Cookie.Builder()
|
||||
.name("speed")
|
||||
.value("10")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
|
||||
HttpUrl urlNMB = HttpUrl.parse("http://h.nimingban.com/");
|
||||
Cookie cookieNMB = new Cookie.Builder()
|
||||
.name("hash")
|
||||
.value("0987654321")
|
||||
.domain("nimingban.com")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.path("/")
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(urlEh, Arrays.asList(cookieEh1, cookieEh2, cookieEh3));
|
||||
repository.saveFromResponse(urlNMB, Collections.singletonList(cookieNMB));
|
||||
|
||||
Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(3, map.size());
|
||||
equals(map.get("ehviewer.com"), Collections.singletonList(cookieEh1));
|
||||
equals(map.get("www.ehviewer.com"), Arrays.asList(cookieEh2, cookieEh3));
|
||||
equals(map.get("nimingban.com"), Collections.singletonList(cookieNMB));
|
||||
repository.close();
|
||||
|
||||
repository = new CookieRepository(app, "cookie.db");
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(2, map.size());
|
||||
equals(map.get("www.ehviewer.com"), Arrays.asList(cookieEh2, cookieEh3));
|
||||
equals(map.get("nimingban.com"), Collections.singletonList(cookieNMB));
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
Cookie cookieEh1 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("999")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
Cookie cookieEh2 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("0")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
|
||||
Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(1, map.size());
|
||||
equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
|
||||
repository.close();
|
||||
|
||||
repository = new CookieRepository(app, "cookie.db");
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(1, map.size());
|
||||
equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveByExpired() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
Cookie cookieEh1 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("999")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
Cookie cookieEh2 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("0")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() - 100000)
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
|
||||
Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(1, map.size());
|
||||
equals(map.get("www.ehviewer.com"), Collections.<Cookie>emptyList());
|
||||
repository.close();
|
||||
|
||||
repository = new CookieRepository(app, "cookie.db");
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(0, map.size());
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveByNonPersistent() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
Cookie cookieEh1 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("999")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 100000)
|
||||
.build();
|
||||
Cookie cookieEh2 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("0")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
|
||||
repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
|
||||
Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(1, map.size());
|
||||
equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
|
||||
repository.close();
|
||||
|
||||
|
||||
repository = new CookieRepository(app, "cookie.db");
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(0, map.size());
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGet() throws InterruptedException {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl urlEh1 = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
HttpUrl urlEh2 = HttpUrl.parse("http://ehviewer.com/");
|
||||
Cookie cookieEh1 = new Cookie.Builder()
|
||||
.name("user")
|
||||
.value("1234567890")
|
||||
.domain("ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 3000)
|
||||
.build();
|
||||
Cookie cookieEh2 = new Cookie.Builder()
|
||||
.name("level")
|
||||
.value("999")
|
||||
.domain("www.ehviewer.com")
|
||||
.path("/")
|
||||
.build();
|
||||
Cookie cookieEh3 = new Cookie.Builder()
|
||||
.name("speed")
|
||||
.value("10")
|
||||
.domain("ehviewer.com")
|
||||
.path("/")
|
||||
.build();
|
||||
|
||||
HttpUrl urlNMB = HttpUrl.parse("http://h.nimingban.com/");
|
||||
Cookie cookieNMB = new Cookie.Builder()
|
||||
.name("hash")
|
||||
.value("0987654321")
|
||||
.domain("nimingban.com")
|
||||
.path("/")
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(urlEh1, Arrays.asList(cookieEh1, cookieEh2));
|
||||
repository.saveFromResponse(urlEh1, Collections.singletonList(cookieEh3));
|
||||
repository.saveFromResponse(urlNMB, Collections.singletonList(cookieNMB));
|
||||
equals(Arrays.asList(cookieEh1, cookieEh3), repository.loadForRequest(urlEh2, null));
|
||||
Thread.sleep(3000);
|
||||
equals(Collections.singletonList(cookieEh3), repository.loadForRequest(urlEh2, null));
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClear() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl url = HttpUrl.parse("http://www.ehviewer.com/");
|
||||
Cookie cookie = new Cookie.Builder()
|
||||
.name("user")
|
||||
.value("1234567890")
|
||||
.domain("ehviewer.com")
|
||||
.path("/")
|
||||
.expiresAt(System.currentTimeMillis() + 3000)
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(url, Collections.singletonList(cookie));
|
||||
Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(1, map.size());
|
||||
equals(map.get("ehviewer.com"), Collections.singletonList(cookie));
|
||||
repository.clear();
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(0, map.size());
|
||||
repository.close();
|
||||
|
||||
repository = new CookieRepository(app, "cookie.db");
|
||||
map = Reflect.on(repository).field("map").get();
|
||||
assertEquals(0, map.size());
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSort() {
|
||||
Context app = RuntimeEnvironment.application;
|
||||
|
||||
HttpUrl url = HttpUrl.parse("http://www.ehviewer.com/long/long/long/");
|
||||
Cookie cookie1 = new Cookie.Builder()
|
||||
.name("user")
|
||||
.value("1234567890")
|
||||
.domain("ehviewer.com")
|
||||
.path("/")
|
||||
.build();
|
||||
Cookie cookie2 = new Cookie.Builder()
|
||||
.name("supersuperme")
|
||||
.value("99999")
|
||||
.domain("ehviewer.com")
|
||||
.path("/long/")
|
||||
.build();
|
||||
Cookie cookie3 = new Cookie.Builder()
|
||||
.name("a")
|
||||
.value("b")
|
||||
.domain("ehviewer.com")
|
||||
.path("/long/long/long/")
|
||||
.build();
|
||||
Cookie cookie4 = new Cookie.Builder()
|
||||
.name("speed")
|
||||
.value("100")
|
||||
.domain("ehviewer.com")
|
||||
.path("/long/long/")
|
||||
.build();
|
||||
|
||||
CookieRepository repository = new CookieRepository(app, "cookie.db");
|
||||
repository.saveFromResponse(url, Arrays.asList(cookie1, cookie2, cookie3, cookie4));
|
||||
List<Cookie> list = repository.loadForRequest(url, null);
|
||||
List<Cookie> expected = Arrays.asList(cookie3, cookie4, cookie2, cookie1);
|
||||
assertEquals(expected.size(), list.size());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
assertEquals(expected.get(i), list.get(i));
|
||||
}
|
||||
repository.close();
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.github.seven332:android-chinese-string-gradle-plugin:0.1.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
@@ -22,3 +24,19 @@ allprojects {
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
ext {
|
||||
supportLibrary = '25.3.1'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
project.configurations.all {
|
||||
resolutionStrategy.eachDependency { details ->
|
||||
// Keep all android support library update to date
|
||||
if (details.requested.group == 'com.android.support'
|
||||
&& !details.requested.name.contains('multidex') ) {
|
||||
details.useVersion "$supportLibrary"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.daogenerator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import de.greenrobot.daogenerator.DaoGenerator;
|
||||
import de.greenrobot.daogenerator.Entity;
|
||||
import de.greenrobot.daogenerator.Schema;
|
||||
|
||||
public class CookieDaoGenerator {
|
||||
|
||||
private static final String PACKAGE = "com.hippo.okhttp.dao";
|
||||
private static final String OUT_DIR = "../app/src/main/java-gen";
|
||||
private static final String DELETE_DIR = "../app/src/main/java-gen/com/hippo/okhttp/dao";
|
||||
|
||||
public static void generate() throws Exception {
|
||||
Utilities.deleteContents(new File(DELETE_DIR));
|
||||
File outDir = new File(OUT_DIR);
|
||||
outDir.delete();
|
||||
outDir.mkdirs();
|
||||
|
||||
Schema schema = new Schema(1, PACKAGE);
|
||||
addOkHttp3Cookie(schema);
|
||||
new DaoGenerator().generateAll(schema, OUT_DIR);
|
||||
}
|
||||
|
||||
private static void addOkHttp3Cookie(Schema schema) {
|
||||
Entity entity = schema.addEntity("OkHttp3CookieRaw");
|
||||
entity.setTableName("OK_HTTP_3_COOKIE");
|
||||
entity.setClassNameDao("OkHttp3CookieDao");
|
||||
|
||||
entity.addIdProperty();
|
||||
entity.addStringProperty("name");
|
||||
entity.addStringProperty("value");
|
||||
entity.addLongProperty("expiresAt");
|
||||
entity.addStringProperty("domain");
|
||||
entity.addStringProperty("path");
|
||||
entity.addBooleanProperty("secure");
|
||||
entity.addBooleanProperty("httpOnly");
|
||||
entity.addBooleanProperty("persistent");
|
||||
entity.addBooleanProperty("hostOnly");
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class EhDaoGenerator {
|
||||
private static final String OUT_DIR = "../app/src/main/java-gen";
|
||||
private static final String DELETE_DIR = "../app/src/main/java-gen/com/hippo/ehviewer/dao";
|
||||
|
||||
private static final int VERSION = 2;
|
||||
private static final int VERSION = 3;
|
||||
|
||||
private static final String DOWNLOAD_INFO_PATH = "../app/src/main/java-gen/com/hippo/ehviewer/dao/DownloadInfo.java";
|
||||
private static final String HISTORY_INFO_PATH = "../app/src/main/java-gen/com/hippo/ehviewer/dao/HistoryInfo.java";
|
||||
@@ -190,6 +190,7 @@ public class EhDaoGenerator {
|
||||
entity.addIdProperty();
|
||||
entity.addIntProperty("mode").notNull();
|
||||
entity.addStringProperty("text");
|
||||
entity.addBooleanProperty("enable");
|
||||
}
|
||||
|
||||
private static void adjustDownloadInfo() throws Exception {
|
||||
@@ -496,6 +497,7 @@ public class EhDaoGenerator {
|
||||
// Set field public
|
||||
javaClass.getField("mode").setPublic();
|
||||
javaClass.getField("text").setPublic();
|
||||
javaClass.getField("enable").setPublic();
|
||||
// Add equals method
|
||||
javaClass.addImport("com.hippo.yorozuya.ObjectUtils");
|
||||
javaClass.addMethod("\t@Override\n" +
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.hippo.ehviewer.daogenerator;
|
||||
public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
CookieDaoGenerator.generate();
|
||||
EhDaoGenerator.generate();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#Mon Jan 18 22:31:05 CST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
|
||||
#Mon Jan 18 22:31:05 CST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
|
||||