├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── app ├── .gitignore ├── libs │ ├── volley_lib.jar │ ├── fastjson-1.1.43.jar │ └── universal-image-loader-1.9.3.jar ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── messi.png │ │ │ │ ├── last_page_nor.png │ │ │ │ ├── next_page_nor.png │ │ │ │ ├── last_page_pressed.png │ │ │ │ ├── next_page_pressed.png │ │ │ │ ├── board_list_content_bg.9.png │ │ │ │ ├── image_default.xml │ │ │ │ ├── next_page_selector.xml │ │ │ │ └── last_page_selector.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ └── dimens.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ └── layout │ │ │ │ ├── test.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── activity_hotel_list.xml │ │ │ │ ├── list_footer_layout.xml │ │ │ │ └── hotel_list_item_layout.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── itheima │ │ │ │ └── datastorage │ │ │ │ ├── util │ │ │ │ ├── LogUtil.java │ │ │ │ ├── ToastUtil.java │ │ │ │ └── HotelSQLiteOpenHelper.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── model │ │ │ │ └── Hotel.java │ │ │ │ ├── ui │ │ │ │ └── BaseViewHolder.java │ │ │ │ ├── MainApplication.java │ │ │ │ ├── hotel │ │ │ │ ├── HotelListAdapter.java │ │ │ │ └── HotelListActivity.java │ │ │ │ └── net │ │ │ │ └── DataCenter.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── itheima │ │ │ └── datastorage │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── itheima │ │ └── datastorage │ │ ├── ApplicationTest.java │ │ └── LrucacheTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── screenshot.gif ├── screenshot_1.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | DataStorage -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/screenshot.gif -------------------------------------------------------------------------------- /screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/screenshot_1.png -------------------------------------------------------------------------------- /app/libs/volley_lib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/libs/volley_lib.jar -------------------------------------------------------------------------------- /app/libs/fastjson-1.1.43.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/libs/fastjson-1.1.43.jar -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/messi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/messi.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/libs/universal-image-loader-1.9.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/libs/universal-image-loader-1.9.3.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/last_page_nor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/last_page_nor.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/next_page_nor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/next_page_nor.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/last_page_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/last_page_pressed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/next_page_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/next_page_pressed.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/board_list_content_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiyouliang/DataStorage/HEAD/app/src/main/res/drawable/board_list_content_bg.9.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DataStorage 3 | Settings 4 | HotelListActivity 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/image_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/next_page_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/last_page_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/datastorage/util/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.itheima.datastorage.util; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by youliang.ji on 2016/5/3. 7 | */ 8 | public class LogUtil { 9 | 10 | private static final String TAG = "result"; 11 | 12 | public static void d(String msg){ 13 | Log.d(TAG, msg); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/datastorage/util/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package com.itheima.datastorage.util; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * Created by youliang.ji on 2016/5/4. 8 | */ 9 | public class ToastUtil { 10 | 11 | public static void showToast(Context context, String msg){ 12 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/test/java/com/itheima/datastorage/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.datastorage; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/itheima/datastorage/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.datastorage; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 三级存储:如何将网络json存储到内存,缓存到数据库(文件也是一样的道理) 2 | 3 | ### 1.JSON三级存储 4 | 5 | 你听过图片三级存储,但肯定没听过如何处理json三级存储 6 | 7 | ### 2.截图 8 | 9 | ![](screenshot.gif) 10 | 11 | ### 3.使用技术 12 | 13 | * 1.Lrucache处理内存存储 14 | * 2.Volley请求网络 15 | * 3.UniversalImageLoader加载图片 16 | * 4.Sqllite存储缓存处理 17 | 18 | ### 4.Usage 19 | 20 | 结合服务器使用 21 | 22 | * 1.服务器:[https://github.com/jiyouliang/VolleyTest](https://github.com/jiyouliang/VolleyTest "VolleyTest")部署到MyEclipse 23 | * 2.客户端:DataStorage 24 | * DataCenter类中改成你的ip,如下图 25 | 26 | ![](screenshot_1.png) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |