Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add features to storage module(android) #1296

Merged
merged 8 commits into from
Sep 26, 2016
Merged

add features to storage module(android) #1296

merged 8 commits into from
Sep 26, 2016

Conversation

Rowandjj
Copy link
Contributor

Features

  1. Add Total storage limit to 50M. No limit in original version.
  2. Add setItemPersistent method to save persistent data. Original setItem method is now used to save cached data.
  3. Apply LRU policy on storage limit control.

@Rowandjj
Copy link
Contributor Author

2016-09-23 3 59 51

Copy link
Contributor

@sospartan sospartan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请修改我提的几个问题,确认已自测通过.

public class DefaultWXStorage implements IWXStorageAdapter {

private WXSQLiteOpenHelper mDatabaseSupplier;

private ExecutorService mExecutorService;


//setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
private boolean once = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议给performSetItem加个参数boolean allowRetryWhenFull,这个成员变量可以去掉.

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉没必要的空行

@Override
public void run() {
Map<String, Object> data = StorageResultHandler.setItemResult(performSetItem(key, value, true));
listener.onReceived(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

判断listener空值

return false;
} finally {
statement.close();
}
}

private boolean trimToSize(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加注释说明trim策略

@Rowandjj
Copy link
Contributor Author

已修改 @sospartan

@@ -236,17 +239,23 @@ public DefaultWXStorage(Context context) {

@Override
public void setItem(final String key, final String value, final OnResultReceivedListener listener) {
if(listener == null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的意思在回调前判断是否为空就行了,数据库操作可以继续执行,即使listener为空

listener.onReceived(data);
}
});
}

@Override
public void getItem(final String key, final OnResultReceivedListener listener) {
if(listener == null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@sospartan sospartan merged commit f60c292 into alibaba:dev Sep 26, 2016
sospartan pushed a commit that referenced this pull request Sep 26, 2016
* storage enhance. add LRU strategy to remove item

* add storage compatible function

* add test

* add note/remove space

* code defense for storage

* add log

* update

* update
sospartan pushed a commit that referenced this pull request Sep 26, 2016
* storage enhance. add LRU strategy to remove item

* add storage compatible function

* add test

* add note/remove space

* code defense for storage

* add log

* update

* update
luics pushed a commit that referenced this pull request Oct 18, 2016
* * [test] jsfm update 0.15.8

* * [html5] fix img lazyload

* * [ios] change variable type.

* * [android] fix log utility

* * [ios] fix css node children count invalid while change from or change to fixed position.

* * [ios] move callAddElement outside so that devtool can work

* * [ios] fix compile error

* - [ios] remove unused import

* * [ios] fix css node children count invalid while change from or change to fixed position.

* * [ios] add uuid for utility

* * [ios] fix warning

* * [android] update the devtools version adapt to the added method in IWXBridge

* * [android] update add callback(....keepalive) method

* * [android]  add GeolocationModule

* * [android]  update WXApplication register geolocation

* * [android] close perf switch

* * [ios] upgrade sdk version to 0.9.1

* * [ios] upgrade sdk version to 0.9.1

* * [android]  update WXpageActivity permission request

* * [android]  update remove judge version to use persimmon

* * [android]  update annotate

* * [ios] fix debug value

* * [ios] playground iOS 10 camera adapter

* * [ios] show refresh when load remote bundle js

* * [android]  update isDestroy

* * [android]  update Defaultlocation

* * [android]  update inspector version

* * [ios] width/height animation should be 750 pixel type.

* [iOS] fix bug , can not auto play and always toast

* [ios] fix bug, iOS 10 crash if not set camera usage description

* * [android]  update DefaultLocation

* * [Android] Cherry-Pick commit f3204b0, 942c77f, 0f0fedb, 5a2ad91
    + animation.style{width, height}
    + timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1)
    * crash of textWidth

* * [android] add embedmanager

* * [ios] fix issue that transform-origin not works in rotation transform

* * [ios] list only support cell/header/refresh/loading/fixed-component as child.

* * [ios] garbage collect in release mode

* * [android] update wxembed add parse _wx_tpl

* * [android]  update judge np

* Revert "* [android]  update judge np"

This reverts commit c43d8a9.

* Revert "* [android] update wxembed add parse _wx_tpl"

This reverts commit e2a27f9.

* * [android] update get real src from _wx_tpl

* Revert "* [android] update get real src from _wx_tpl"

This reverts commit e9cd7aa.

* * [ios] slider-neighbor scale adjust

* * [Android] Fix image resize is stretch even if the resize of image is cover or contain

* * [android]  update add transform url method

* * [ios] clip bounds for slider-neighbor view

* * [ios] correct slider-neighbor index in event

* * [ios] adjust neighbor space

* * [ios]  stop the Xcode 8 iOS Simulator from logging like crazy

* Update cheatsheet.md

<switch> attr add `disabled `

* * [android] mrege 0.7.1-dev remote

* * [android] fix slider start auto scroll after activity resume.

* * [doc] fix a bug, actually, self-defined class cannot be passed as params properly

* slider neighbor update (#1226)

* slider neighbor update

* bug fix

* bug fix

* remove unused note

* slider neighbor update (#1226)

* slider neighbor update

* bug fix

* bug fix

* remove unused note

* * [ios] revert iOS version to 0.8.0

* * [android]  update rename location

* * [jsfm] v0.16.4

* * [test] jsfm rx

* * [ios] add slider-neighbor view alpha when init

* * [ios] indexDict must be accessed on component thread, fix componentForRef crash

* * [ios] add foundation.h

* * [ios] public WXComponentMananger.h

* * [jsfm] upgrade weex-rx-framework to 0.1.8

* * [jsfm] v0.16.5

* * [ios] roll back jsfm

* * [ios] correct  neighbor-space

* * [jsfm] upgrade weex-rx-framework to 0.1.9

* * [html5] add geolocation module

* * [html5] support timeout and maximumAge

* * [jsfm] v0.16.6

* add Attributes `index`

add Attributes `index`

* * [android] refactor video load lazy load

* * [android] Module NPE Fix

* * [android] fix circle ci

* Update circle ci config 

add JVM config for avoiding exceed memory limit

* slider-neighbor bug fixed.(split problem)

* * [ios] fix issue that fixed-position component's view be reallocated while it is in a cell.

* * [android] disable coverage report in circle ci

* * [android] test ci

* slider-neighbor bug fixed.(split problem)

* * [android] no flush to avoid SIGILL

* Adjust link path.

* * [ios] add description for camera and location privacy

* * [ios] fix #1188, support for converting string to NSUInteger.

* * [ios] jsfm update to 0.15.9

* * [android] bug fix classcast exception

* * [android] add callAddElement debug log

* Revert "* [ios] jsfm update to 0.15.9"

This reverts commit a4dcf33.

* + [jsfm] add static support

* * [android] update fix global event Memory leak

* * [android] update location

* * [ios] fix keyboard cover input sometime

* add test array and test dict methods.

* * [android] clear Instance fields when destory

* signing CLA, add email again for git

* Revert "add test array and test dict methods."

This reverts commit 5ea8f10.

* * [android] update modify javadoc error

* * [android] process prop to avoid reflection

* * [jsfm] fix bug

* * [android]  add none-lazy load component

* * [android] cache MethodInvoker  Parameter

* * [android] filter unused  style set

* * [android] avoid useless setProperty invocation.

* typo Module

* * [android] update style, avoid setProperty invocation for "value"

* * [ios] fix slider example href

* Revert "* [ios] fix keyboard cover input sometime"

This reverts commit 0ad56dc.

* * [jsfm] fix #1237, fix binding event bug of components which have repeat attribute

* * [ios] fix style line-height conflict with text-align

* * [html5] fix class name

* * [jsfm] upgrade weex-rx-framework to 0.1.11

* * [html5] add addRule to dom module for iconfont support.

* * [android] add log filter &perf log

* * [html5] fix lint

* * [android] perf log

* [ios] bugfix - url : 打开url的时候需要先判断一下有没有参数,以决定拼接random参数是用?还是&连接,要不然url会拼错

* * [doc] add devtool link to README

* * [doc] add devtool link to README

* * [html5] test appear in next tick

* * [android] update JSF 0.15.9

* * [jsfm] fix callAddElement callback -1

* * [jsfm] v0.15.9

* * [android] update 0.15.9-release

* * [android] destroyInstance bugfix

* * [android] expose  GC api to js

* * [android] update WXModule.java add some constants

* * [android] update GelocationModule.java Reconstruction

* * [android] update location requestcode

* add features to storage module(android) (#1296)

* storage enhance. add LRU strategy to remove item

* add storage compatible function

* add test

* add note/remove space

* code defense for storage

* add log

* update

* update

* add features to storage module(android) (#1296)

* storage enhance. add LRU strategy to remove item

* add storage compatible function

* add test

* add note/remove space

* code defense for storage

* add log

* update

* update

* add features to storage module(android) (#1296)

* storage enhance. add LRU strategy to remove item

* add storage compatible function

* add test

* add note/remove space

* code defense for storage

* add log

* update

* update

* * [ios] fix review problem

* * [ios] change return type to void

* * [android] fix editComponent set non-string value

* * [android] opt Opacity attribute's FPS performance

* * [jsfm] v0.16.8

* * [jsfm] upgrade weex-rx-framework to 0.1.12

* * [jsfm] v0.16.9

* * [android] set View.LAYER_TYPE_NONE to release GL

* * [android] bug fix native crash

* Correct typos

* * [doc] add latest version badge (#1305)

* * [android] fix #1102

* * [doc] add latest sdk version badge

* modify repo link

* + [jsfm] add Array.from polyfill and tests

* + [jsfm] add Object.setPrototypeOf polyfill and tests

* * [test] set eslint-disable for polyfill tests

* * [test] modify the test suit timeout in reset style

* Fix NPE in WXEmbed

* * [ios] fix update WeexSDK podspec version to 0.7.0

* * [jsfm] v0.16.10

* Fix #1200

* * [jsfm] upgrade weex-rx-framework to 0.1.13

* * [jsfm] v0.16.11

* * [android] jsfm update to 0.16.11

* * [android] update WXImageView support gif

* * [android] support emoji

* * [android] callNative &nativeLog api  support emoji

* * [ios] upgrade podspec version to 0.8.0

* * [jsfm] fix bug for clear common modules (pr #1097)

* * [jsfm] fix the test of clearCommonModules

* + [jsfm] add test suit for define custom modules

* * [jsfm] set specific version for weex-rx-framework

* * [jsfm] v0.16.12

* * [jsfm] supported framework flag in the beginning of a JS bundle but after some spaces

* * [jsfm] v0.16.14

* + [jsfm] add test case for Dep.target bug

* * [jsfm] fix the bug of Dep.target

* * [jsfm] v0.16.15

* * [android] fix #1380, update method getOffsetAmount in WXCircleViewPager.java (#1382)

* * [ios] fix #1192, #FFF display error in iOS

* * [jsfm] removed rx temporarily

* * [jsfm] adapted native version that not support callAddElement

* * [jsfm] v0.16.17

* * [html5] fix conflicts with jsfm 0.16

* * [html5] update subversion

* * [android] enable node test

* *[ios]remove devtool file,modify podfile in playground

* * [ios] fix playground Podfile   remove c header file  include in WXUtility.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants