java.lang.Object | |
↳ | chan.content.ChanConfiguration |
Provides extension configuration.
During construction you can enable the following options using request(String)
method:
OPTION_SINGLE_BOARD_MODE
OPTION_READ_THREAD_PARTIALLY
OPTION_READ_SINGLE_POST
OPTION_READ_POSTS_COUNT
OPTION_READ_USER_BOARDS
OPTION_ALLOW_CAPTCHA_PASS
OPTION_ALLOW_USER_AUTHORIZATION
This configuration remains in RAM only while client is launched. You must configure these settings during construction.
You can configure poster's default name using setDefaultName(String)
and
setDefaultName(String, String)
.
You can configure board title and description using setBoardTitle(String, String)
and
setBoardDescription(String, String)
.
You can configure bump limit using setBumpLimit(int)
and setBumpLimit(String, int)
.
You can change bump limit mode using setBumpLimitMode(BumpLimitMode)
.
You can configure pages count using setPagesCount(String, int)
.
You can add supported captchas using addCaptchaType(String)
.
This configuration can be written to client's preferences and read every time client launches.
You can store poster's default name using storeDefaultName(String, String)
.
You can store board title and description using storeBoardTitle(String, String)
and
storeBoardDescription(String, String)
.
You can store bump limit using storeBumpLimit(String, int)
.
You can store pages count using storePagesCount(String, int)
.
You can store any another properties using set(String, String, boolean)
,
set(String, String, int)
and set(String, String, String)
methods.
You can get stored properties using get(String, String, boolean)
,
get(String, String, int)
and get(String, String, String)
methods.
You can store cookies using storeCookie(String, String, String)
. Later you can get it using
getCookie(String)
. User can clear cookies in application preferences.
You can get chan's resources using getResources()
.
You can add additional preferences to chan preferences screen using
addCustomPreference(String, boolean)
and obtainCustomPreferenceConfiguration(String)
.
You can configure board features using obtainBoardConfiguration(String)
.
You can configure custom captcha using obtainCustomCaptchaConfiguration(String)
.
You can configure posting using obtainPostingConfiguration(String, boolean)
.
You can configure deleting using obtainDeletingConfiguration(String)
.
You can configure reporting using obtainReportingConfiguration(String)
.
You can configure captcha pass using obtainCaptchaPassConfiguration()
.
You can configure authorization using obtainUserAuthorizationConfiguration()
.
You can configure archivation using obtainArchivationConfiguration()
.
You can configure displayed statistics data using obtainStatisticsConfiguration()
.
You can configure custom preferences using obtainStatisticsConfiguration()
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ChanConfiguration.Archivation | Archivation configuration holder. |
||||||||||
ChanConfiguration.Authorization | Authorization configuration holder. |
||||||||||
ChanConfiguration.Board | Board configuration holder. |
||||||||||
ChanConfiguration.BumpLimitMode | Mode of bump limit handling. |
||||||||||
ChanConfiguration.Captcha | Captcha configuration holder. |
||||||||||
ChanConfiguration.CustomPreference | Custom preference configuration holder. |
||||||||||
ChanConfiguration.Deleting | Deleting configuration holder. |
||||||||||
ChanConfiguration.Posting | Posting configuration holder. |
||||||||||
ChanConfiguration.Reporting | Reporting configuration holder. |
||||||||||
ChanConfiguration.Statistics | Statistics configuration holder. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CAPTCHA_TYPE_MAILRU | |||||||||||
CAPTCHA_TYPE_RECAPTCHA_1 | |||||||||||
CAPTCHA_TYPE_RECAPTCHA_2 | |||||||||||
OPTION_ALLOW_CAPTCHA_PASS | Allows user to enter authorization data and skip the captcha. |
||||||||||
OPTION_ALLOW_USER_AUTHORIZATION | Allows user to enter authorization data to access some features. |
||||||||||
OPTION_READ_POSTS_COUNT | Allows client to download posts count in thread. |
||||||||||
OPTION_READ_SINGLE_POST | Allows client to download single post knowing it's board name and post number. |
||||||||||
OPTION_READ_THREAD_PARTIALLY | Allows client to download thread partially. |
||||||||||
OPTION_READ_USER_BOARDS | Allows client to download user boards. |
||||||||||
OPTION_SINGLE_BOARD_MODE | Allows client to use only one board. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add captcha type to list of supported capthas. | |||||||||||
Add custom preference to chan preferences screen. | |||||||||||
Return linked | |||||||||||
Returns stored string value. | |||||||||||
Returns stored int value. | |||||||||||
Returns stored boolean value. | |||||||||||
Returns application context. | |||||||||||
Returns stored cookie. | |||||||||||
Returns download directory. | |||||||||||
Returns resources from chan APK file. | |||||||||||
Returns a chan title. | |||||||||||
Returns user authorization data. | |||||||||||
Calls every time client requests archivation configuration. | |||||||||||
Calls every time client requests board configuration. | |||||||||||
Calls every time client requests captcha pass configuration. | |||||||||||
Calls every time client requests custom captcha configuration. | |||||||||||
Calls every time client requests custom captcha configuration. | |||||||||||
Calls every time client requests deleting configuration. | |||||||||||
Calls every time client requests posting configuration. | |||||||||||
Calls every time client requests reporting configuration. | |||||||||||
Calls every time client requests statistics configuration. | |||||||||||
Calls every time client requests user authorization configuration. | |||||||||||
Requests | |||||||||||
Stores boolean value. | |||||||||||
Stores int value. | |||||||||||
Stores string value. | |||||||||||
Set | |||||||||||
Set | |||||||||||
Set | |||||||||||
Set | |||||||||||
Set specified | |||||||||||
Set poster's | |||||||||||
Set poster's | |||||||||||
Set | |||||||||||
Set | |||||||||||
Store | |||||||||||
Store | |||||||||||
Store | |||||||||||
Stores cookie. | |||||||||||
Store poster's | |||||||||||
Store |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Allows user to enter authorization data and skip the captcha.
With entered data you will receive captchaPass
argument.
You can perform authorization and save cookies or another data that represents authorization state.
Then you can use them to skip captcha.
If you enable this option, you must implement
onCheckAuthorization(chan.content.ChanPerformer.CheckAuthorizationData)
.
You should also implement obtainCaptchaPassConfiguration()
.
See also:
Allows user to enter authorization data to access some features.
You can obtain authorization data using getUserAuthorizationData()
.
With this data you can perform authorization and save cookies or another data that represents authorization
state. Then you can grant user rights to read some threads or something like this.
If you enable this option, you must implement
onCheckAuthorization(chan.content.ChanPerformer.CheckAuthorizationData)
.
You should also implement obtainUserAuthorizationConfiguration()
.
Allows client to download posts count in thread. This option is necessary for threads watcher.
If you enable this option, you must implement
onReadPostsCount(chan.content.ChanPerformer.ReadPostsCountData)
.
Allows client to download single post knowing it's board name and post number.
If you enable this option, you must implement
onReadSinglePost(chan.content.ChanPerformer.ReadSinglePostData)
.
Allows client to download thread partially.
Allows client to download user boards.
If you enable this option, you must implement
onReadUserBoards(chan.content.ChanPerformer.ReadUserBoardsData)
.
Allows client to use only one board. That exempts you from obligation to override
onReadBoards(chan.content.ChanPerformer.ReadBoardsData)
method.
The boardName
argument in all methods will be equal to null
. You can change this argument
using setSingleBoardName(String)
method.
Add captcha type to list of supported capthas. User may choose captcha in application preferences.
Client will obtain configuration of custom captchas with obtainCustomCaptchaConfiguration(String)
.
There is a list of default captcha types: CAPTCHA_TYPE_RECAPTCHA_1
,
CAPTCHA_TYPE_RECAPTCHA_2
and CAPTCHA_TYPE_MAILRU
. Client is able to handle these
captchas by itself.
Parameters | |
---|---|
captchaType |
String :
Captcha type string.
|
Add custom preference to chan preferences screen. You can obtain a value using
get(String, String, boolean)
method with null
boardName
argument. You also must override
obtainCustomPreferenceConfiguration(String)
to configure such values as title and summary.
Parameters | |
---|---|
key |
String :
Custom preference key. |
defaultValue |
boolean :
Default value.
|
Return linked ChanConfiguration
instance.
Parameters | |
---|---|
object |
Object :
Linked object: ChanConfiguration , ChanPerformer ,
ChanLocator or ChanMarkup . |
Returns | |
---|---|
T |
ChanConfiguration instance.
|
Returns stored string value.
Parameters | |
---|---|
boardName |
String :
Board name part of real key. |
key |
String :
Key name. |
defaultValue |
String :
Value to return if this preference does not exist. |
Returns | |
---|---|
String |
Stored value. |
Returns stored int value.
Parameters | |
---|---|
boardName |
String :
Board name part of real key. |
key |
String :
Key name. |
defaultValue |
int :
Value to return if this preference does not exist. |
Returns | |
---|---|
int |
Stored value. |
Returns stored boolean value.
Parameters | |
---|---|
boardName |
String :
Board name part of real key. |
key |
String :
Key name. |
defaultValue |
boolean :
Value to return if this preference does not exist. |
Returns | |
---|---|
boolean |
Stored value. |
Returns application context.
Returns | |
---|---|
Context |
Returns stored cookie.
Parameters | |
---|---|
cookie |
String :
Cookie name. |
Returns | |
---|---|
String |
Cookie value or null if cookie not found. |
Returns download directory.
Returns | |
---|---|
File |
Returns resources from chan APK file.
Returns | |
---|---|
Resources |
Returns a chan title. This title is display name used in client.
Returns | |
---|---|
String |
Returns user authorization data. User can specify authorization data when
OPTION_ALLOW_USER_AUTHORIZATION
enabled.
Returns | |
---|---|
String[] |
User authorization fields values. |
Calls every time client requests archivation configuration. You must return new instance of
ChanConfiguration.Archivation
with archivation configuration.
Returns | |
---|---|
ChanConfiguration.Archivation |
Calls every time client requests board configuration. You must return new instance of ChanConfiguration.Board
with configuration for given boardName
.
The boardName
argument may be null
! In this case you must return the widest
configuration for your chan.
Parameters | |
---|---|
boardName |
String :
Board name string.
|
Returns | |
---|---|
ChanConfiguration.Board |
Calls every time client requests captcha pass configuration. You must return new instance of
ChanConfiguration.Authorization
with captcha pass configuration.
Returns | |
---|---|
ChanConfiguration.Authorization |
Calls every time client requests custom captcha configuration. You must return new instance of ChanConfiguration.Captcha
with configuration for given captchaType
.
Parameters | |
---|---|
captchaType |
String :
Captcha type string.
|
Returns | |
---|---|
ChanConfiguration.Captcha |
Calls every time client requests custom captcha configuration. You must return new instance of
ChanConfiguration.CustomPreference
with configuration for given key
.
Parameters | |
---|---|
key |
String :
Custom preference key.
|
Returns | |
---|---|
ChanConfiguration.CustomPreference |
Calls every time client requests deleting configuration. You must return new instance of ChanConfiguration.Deleting
with configuration for given boardName
.
The boardName
argument may be null
! In this case you must return the widest
configuration for your chan.
Parameters | |
---|---|
boardName |
String :
Board name string.
|
Returns | |
---|---|
ChanConfiguration.Deleting |
Calls every time client requests posting configuration. You must return new instance of ChanConfiguration.Posting
with configuration for given boardName
.
The boardName
argument may be null
! In this case you must return the widest
configuration for your chan.
Parameters | |
---|---|
boardName |
String :
Board name string. |
newThread |
boolean :
True if user starts new thread.
|
Returns | |
---|---|
ChanConfiguration.Posting |
Calls every time client requests reporting configuration. You must return new instance of ChanConfiguration.Reporting
with configuration for given boardName
.
The boardName
argument may be null
! In this case you must return the widest
configuration for your chan.
Parameters | |
---|---|
boardName |
String :
Board name string.
|
Returns | |
---|---|
ChanConfiguration.Reporting |
Calls every time client requests statistics configuration. You must return new instance of
ChanConfiguration.Statistics
with statistics configuration.
Returns | |
---|---|
ChanConfiguration.Statistics |
Calls every time client requests user authorization configuration. You must return new instance of
ChanConfiguration.Authorization
with user authorization configuration.
Returns | |
---|---|
ChanConfiguration.Authorization |
Requests option
. You can do it only during construction.
Parameters | |
---|---|
option |
String :
Option to request.
|
Stores boolean value.
Parameters | |
---|---|
boardName |
String :
Board name part of key. |
key |
String :
Key name. |
value |
boolean :
Value to store.
|
Stores int value.
Parameters | |
---|---|
boardName |
String :
Board name part of key. |
key |
String :
Key name. |
value |
int :
Value to store.
|
Stores string value.
Parameters | |
---|---|
boardName |
String :
Board name part of key. |
key |
String :
Key name. |
value |
String :
Value to store.
|
Set description
for board with given boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
description |
String :
Board description.
|
Set title
for board with given boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
title |
String :
Board title.
|
Set bumpLimit
for all boards.
Parameters | |
---|---|
bumpLimit |
int :
Bump limit value.
|
Set bumpLimit
for specified boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
bumpLimit |
int :
Bump limit value.
|
Set specified ChanConfiguration.BumpLimitMode
.
Parameters | |
---|---|
mode |
ChanConfiguration.BumpLimitMode :
Bump limit mode.
|
Set poster's defaultName
for all boards.
Parameters | |
---|---|
defaultName |
String :
Default name.
|
Set poster's defaultName
for specified boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
defaultName |
String :
Default name.
|
Set pagesCount
for boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
pagesCount |
int :
Pages count value.
|
Set boardName
argument for all requests when OPTION_SINGLE_BOARD_MODE
enabled.
That allow you disable this option in the future when chan add multiple boards for example.
Parameters | |
---|---|
boardName |
String :
Default board name string.
|
Store description
for board with given boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
description |
String :
Board description.
|
Store title
for board with given boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
title |
String :
Board title.
|
Store bumpLimit
for specified boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
bumpLimit |
int :
Bump limit value.
|
Stores cookie. You can specify human-friendly displayName of cookie. User can remove this cookie using cookie manager.
Parameters | |
---|---|
cookie |
String :
Cookie name. |
value |
String :
Cookie value. Set this argument to null to remove the cookie. |
displayName |
String :
Human-friendly name of cookie. May be null if value is null too.
|
Store poster's defaultName
for specified boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
defaultName |
String :
Default name.
|
Store pagesCount
for boardName
.
Parameters | |
---|---|
boardName |
String :
Board name. |
pagesCount |
int :
Pages count value.
|