├── FileCacher
├── .idea
│ ├── .name
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── vcs.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── gradle.xml
│ ├── compiler.xml
│ └── misc.xml
├── app
│ ├── .gitignore
│ ├── release
│ │ └── FileCacher.jar
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── 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
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── values-v21
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── values-w820dp
│ │ │ │ │ └── dimens.xml
│ │ │ │ ├── menu
│ │ │ │ │ └── menu_main.xml
│ │ │ │ └── layout
│ │ │ │ │ ├── content_main.xml
│ │ │ │ │ └── activity_main.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── kosalgeek
│ │ │ │ └── android
│ │ │ │ └── caching
│ │ │ │ ├── FileCacheManager.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── FileCacher.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── kosalgeek
│ │ │ │ └── android
│ │ │ │ └── filecacher
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── kosalgeek
│ │ │ └── android
│ │ │ └── caching
│ │ │ └── ApplicationTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── Sample
├── TestFileCacher
│ ├── .idea
│ │ ├── .name
│ │ ├── copyright
│ │ │ └── profiles_settings.xml
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ ├── runConfigurations.xml
│ │ ├── gradle.xml
│ │ ├── compiler.xml
│ │ └── misc.xml
│ ├── app
│ │ ├── .gitignore
│ │ ├── libs
│ │ │ └── FileCacher.jar
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── 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
│ │ │ │ │ │ ├── colors.xml
│ │ │ │ │ │ ├── dimens.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── values-v21
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── values-w820dp
│ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ ├── menu
│ │ │ │ │ │ └── menu_main.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── content_main.xml
│ │ │ │ │ │ └── activity_main.xml
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── kosalgeek
│ │ │ │ │ └── android
│ │ │ │ │ └── testfilecacher
│ │ │ │ │ └── MainActivity.java
│ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── kosalgeek
│ │ │ │ │ └── android
│ │ │ │ │ └── testfilecacher
│ │ │ │ │ └── ExampleUnitTest.java
│ │ │ └── androidTest
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── kosalgeek
│ │ │ │ └── android
│ │ │ │ └── testfilecacher
│ │ │ │ └── ApplicationTest.java
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── settings.gradle
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
├── TestFileCacher2
│ ├── app
│ │ ├── .gitignore
│ │ ├── libs
│ │ │ └── FileCacher.jar
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── 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
│ │ │ │ │ │ ├── colors.xml
│ │ │ │ │ │ ├── dimens.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── values-v21
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── values-w820dp
│ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ ├── menu
│ │ │ │ │ │ └── menu_main.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── content_sub.xml
│ │ │ │ │ │ ├── content_main.xml
│ │ │ │ │ │ ├── activity_sub.xml
│ │ │ │ │ │ └── activity_main.xml
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── kosalgeek
│ │ │ │ │ │ └── android
│ │ │ │ │ │ └── testfilecacher2
│ │ │ │ │ │ ├── Product.java
│ │ │ │ │ │ ├── MD5.java
│ │ │ │ │ │ ├── SubActivity.java
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── kosalgeek
│ │ │ │ │ └── android
│ │ │ │ │ └── testfilecacher2
│ │ │ │ │ └── ExampleUnitTest.java
│ │ │ └── androidTest
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── kosalgeek
│ │ │ │ └── android
│ │ │ │ └── testfilecacher2
│ │ │ │ └── ApplicationTest.java
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── .idea
│ │ ├── .name
│ │ ├── copyright
│ │ │ └── profiles_settings.xml
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ ├── runConfigurations.xml
│ │ ├── gradle.xml
│ │ ├── compiler.xml
│ │ └── misc.xml
│ ├── settings.gradle
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
└── .DS_Store
├── .DS_Store
├── FileCacher.jar
└── README.md
/FileCacher/.idea/.name:
--------------------------------------------------------------------------------
1 | FileCacher
--------------------------------------------------------------------------------
/FileCacher/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/FileCacher/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/.name:
--------------------------------------------------------------------------------
1 | TestFileCacher
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/.name:
--------------------------------------------------------------------------------
1 | TestFileCacher2
--------------------------------------------------------------------------------
/Sample/TestFileCacher/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/.DS_Store
--------------------------------------------------------------------------------
/FileCacher.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher.jar
--------------------------------------------------------------------------------
/Sample/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/.DS_Store
--------------------------------------------------------------------------------
/FileCacher/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/FileCacher/app/release/FileCacher.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/release/FileCacher.jar
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/FileCacher/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/libs/FileCacher.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/libs/FileCacher.jar
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/libs/FileCacher.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/libs/FileCacher.jar
--------------------------------------------------------------------------------
/FileCacher/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/FileCacher/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FileCacher
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kosalgeek/FileCacher/HEAD/Sample/TestFileCacher2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TestFileCacher
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/FileCacher/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TestFileCacher2
3 | Settings
4 | SubActivity
5 |
6 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/FileCacher/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 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/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 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/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 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/FileCacher/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/java/com/kosalgeek/android/testfilecacher2/Product.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Product implements Serializable{
6 |
7 | public int id;
8 | public String name;
9 |
10 | public Product(int id, String name){
11 | this.id = id;
12 | this.name = name;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/FileCacher/app/src/test/java/com/kosalgeek/android/filecacher/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.caching;
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 | }
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/test/java/com/kosalgeek/android/testfilecacher/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher;
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 | }
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/test/java/com/kosalgeek/android/testfilecacher2/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
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 | }
--------------------------------------------------------------------------------
/FileCacher/app/src/androidTest/java/com/kosalgeek/android/caching/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.caching;
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 | }
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/androidTest/java/com/kosalgeek/android/testfilecacher/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher;
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 | }
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/androidTest/java/com/kosalgeek/android/testfilecacher2/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
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 | }
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/FileCacher/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/FileCacher/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FileCacher/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/FileCacher/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kosalmac/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kosalmac/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kosalmac/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/FileCacher/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/layout/content_sub.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.0"
6 |
7 | defaultConfig {
8 | applicationId "com.kosalgeek.android.testfilecacher"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | compile files('libs/FileCacher.jar')
28 | }
29 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.0"
6 |
7 | defaultConfig {
8 | applicationId "com.kosalgeek.android.testfilecacher2"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | compile files('libs/FileCacher.jar')
28 | }
29 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/FileCacher/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/Sample/TestFileCacher/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/FileCacher/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.0"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 23
10 | }
11 | buildTypes {
12 | release {
13 | minifyEnabled false
14 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
15 | }
16 | }
17 | }
18 |
19 | dependencies {
20 | compile fileTree(dir: 'libs', include: ['*.jar'])
21 | testCompile 'junit:junit:4.12'
22 | compile 'com.android.support:appcompat-v7:23.1.1'
23 | compile 'com.android.support:design:23.1.1'
24 | }
25 |
26 | task deleteOldJar(type: Delete){
27 | delete 'release/FileCacher.jar'
28 | }
29 |
30 | task exportJar(type: Copy){
31 | from('build/intermediates/bundles/release')
32 | into('release/')
33 | include('classes.jar')
34 | rename('classes.jar', 'FileCacher.jar')
35 | }
36 |
37 | exportJar.dependsOn(deleteOldJar, build)
38 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/java/com/kosalgeek/android/testfilecacher2/MD5.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
2 |
3 |
4 | import java.security.MessageDigest;
5 | import java.security.NoSuchAlgorithmException;
6 |
7 | /**
8 | * MD5 Encryption
9 | */
10 | public final class MD5{
11 |
12 | /**
13 | * Encrypt a text into MD5
14 | * @param text
15 | * @return MD5 encrypted text
16 | */
17 | public final static String encrypt(final String text) {
18 | try {
19 | // Create MD5 Hash
20 | MessageDigest digest = java.security.MessageDigest
21 | .getInstance("MD5");
22 | digest.update(text.getBytes());
23 | byte messageDigest[] = digest.digest();
24 |
25 | // Create Hex String
26 | StringBuffer hexString = new StringBuffer();
27 | for (int i = 0; i < messageDigest.length; i++) {
28 | String h = Integer.toHexString(0xFF & messageDigest[i]);
29 | while (h.length() < 2)
30 | h = "0" + h;
31 | hexString.append(h);
32 | }
33 | return hexString.toString();
34 |
35 | } catch (NoSuchAlgorithmException e) {
36 | e.printStackTrace();
37 | }
38 | return "";
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/layout/activity_sub.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/java/com/kosalgeek/android/caching/FileCacheManager.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.caching;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.File;
6 |
7 | public class FileCacheManager {
8 | private final String LOG = this.getClass().getName();
9 |
10 | private Context context;
11 |
12 | /**
13 | * create an instance of FilCacheManager
14 | * @param context context
15 | */
16 | public FileCacheManager(Context context){
17 | this.context = context;
18 | }
19 |
20 | /**
21 | * delete the whole cache files from the cache folder
22 | */
23 | public void deleteAllCaches(){
24 | File filePath = context.getFilesDir();
25 | if (filePath.isDirectory())
26 | {
27 | String[] files = filePath.list();
28 | for(String file : files){
29 | context.deleteFile(file);
30 | }
31 | }
32 | }
33 |
34 | /**
35 | * get a list of cache file names
36 | * @return array of String of file names
37 | */
38 | public String[] getCacheFileNames(){
39 | File filePath = context.getFilesDir();
40 |
41 | String[] files = null;
42 |
43 | if (filePath.isDirectory())
44 | {
45 | files = filePath.list();
46 | }
47 | return files;
48 | }
49 |
50 |
51 | /**
52 | * Check whether the cache file exists or not.
53 | * @return 'true' if cache exists or 'false' if cache does not exists.
54 | */
55 | public boolean hasCacheFiles(){
56 | File filePath = context.getFilesDir();
57 |
58 | if (filePath.isDirectory())
59 | {
60 | if(filePath.list().length > 0){
61 | return true;
62 | }
63 | }
64 | return false;
65 | }
66 |
67 | /**
68 | * get cache path
69 | *
70 | * @return String of cache path
71 | */
72 | public String getPath(){
73 | return context.getFilesDir().getPath();
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/java/com/kosalgeek/android/caching/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.caching;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | private final String TAG = this.getClass().getName();
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_main);
20 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
21 | setSupportActionBar(toolbar);
22 |
23 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
24 | fab.setOnClickListener(new View.OnClickListener() {
25 | @Override
26 | public void onClick(View view) {
27 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
28 | .setAction("Action", null).show();
29 | }
30 | });
31 | }
32 |
33 | @Override
34 | public boolean onCreateOptionsMenu(Menu menu) {
35 | // Inflate the menu; this adds items to the action bar if it is present.
36 | getMenuInflater().inflate(R.menu.menu_main, menu);
37 | return true;
38 | }
39 |
40 | @Override
41 | public boolean onOptionsItemSelected(MenuItem item) {
42 | // Handle action bar item clicks here. The action bar will
43 | // automatically handle clicks on the Home/Up button, so long
44 | // as you specify a parent activity in AndroidManifest.xml.
45 | int id = item.getItemId();
46 |
47 | //noinspection SimplifiableIfStatement
48 | if (id == R.id.action_settings) {
49 | return true;
50 | }
51 |
52 | return super.onOptionsItemSelected(item);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/java/com/kosalgeek/android/testfilecacher2/SubActivity.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.View;
10 |
11 | import com.kosalgeek.android.caching.FileCacher;
12 |
13 | import java.io.IOException;
14 | import java.util.ArrayList;
15 |
16 | public class SubActivity extends AppCompatActivity {
17 | private final String TAG = this.getClass().getName();
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_sub);
23 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
24 | setSupportActionBar(toolbar);
25 |
26 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
27 | fab.setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View view) {
30 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
31 | .setAction("Action", null).show();
32 | }
33 | });
34 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
35 |
36 | FileCacher> cacher = new FileCacher<>(this, "sometext.txt");
37 |
38 | ArrayList products = new ArrayList<>();
39 | products.add("Coke");
40 | products.add("Pepsi");
41 | products.add("Zenya");
42 |
43 | try {
44 | cacher.writeCache(products);
45 | } catch (IOException e) {
46 | e.printStackTrace();
47 | }
48 |
49 | if(cacher.hasCache()){
50 | try {
51 | ArrayList cacheProduct = cacher.readCache();
52 | for(String p: cacheProduct){
53 | Log.d(TAG, p);
54 | }
55 |
56 | } catch (IOException e) {
57 | e.printStackTrace();
58 | } catch(ClassCastException e){
59 | e.printStackTrace();
60 | }
61 | }
62 |
63 |
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/FileCacher/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/FileCacher/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher/app/src/main/java/com/kosalgeek/android/testfilecacher/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 |
13 | import com.kosalgeek.android.caching.FileCacher;
14 |
15 | import java.io.IOException;
16 |
17 | public class MainActivity extends AppCompatActivity {
18 | private final String LOG = this.getClass().getName();
19 |
20 | FileCacher stringCacher = new FileCacher<>(this, "sometext.txt");
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_main);
26 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
27 | setSupportActionBar(toolbar);
28 |
29 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
30 | fab.setOnClickListener(new View.OnClickListener() {
31 | @Override
32 | public void onClick(View view) {
33 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
34 | .setAction("Action", null).show();
35 | }
36 | });
37 |
38 | try {
39 | stringCacher.writeCache("This is some text");
40 | } catch (IOException e) {
41 | e.printStackTrace();
42 | }
43 |
44 | // try {
45 | // stringCacher.clearCache();
46 | // } catch (IOException e) {
47 | // e.printStackTrace();
48 | // }
49 |
50 | Log.d(LOG, "has file is " + stringCacher.hasCache());
51 |
52 | try {
53 | if(stringCacher.hasCache()){
54 | Log.d(LOG, "read: " + stringCacher.readCache());
55 | }
56 | } catch (IOException e) {
57 | e.printStackTrace();
58 | }
59 | }
60 |
61 | @Override
62 | public boolean onCreateOptionsMenu(Menu menu) {
63 | // Inflate the menu; this adds items to the action bar if it is present.
64 | getMenuInflater().inflate(R.menu.menu_main, menu);
65 | return true;
66 | }
67 |
68 | @Override
69 | public boolean onOptionsItemSelected(MenuItem item) {
70 | // Handle action bar item clicks here. The action bar will
71 | // automatically handle clicks on the Home/Up button, so long
72 | // as you specify a parent activity in AndroidManifest.xml.
73 | int id = item.getItemId();
74 |
75 | //noinspection SimplifiableIfStatement
76 | if (id == R.id.action_settings) {
77 | return true;
78 | }
79 |
80 | return super.onOptionsItemSelected(item);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Sample/TestFileCacher2/app/src/main/java/com/kosalgeek/android/testfilecacher2/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.testfilecacher2;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.design.widget.FloatingActionButton;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 |
13 | import com.kosalgeek.android.caching.FileCacher;
14 |
15 | import java.io.IOException;
16 | import java.util.ArrayList;
17 | import java.util.List;
18 |
19 | public class MainActivity extends AppCompatActivity {
20 |
21 | private final String TAG = this.getClass().getName();
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_main);
27 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
28 | setSupportActionBar(toolbar);
29 |
30 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
31 | fab.setOnClickListener(new View.OnClickListener() {
32 | @Override
33 | public void onClick(View view) {
34 | Intent in = new Intent(MainActivity.this, SubActivity.class);
35 | startActivity(in);
36 | }
37 | });
38 |
39 | FileCacher> cacher = new FileCacher<>(MainActivity.this, "somearray.txt");
40 |
41 | // ArrayList products = new ArrayList<>();
42 | // products.add(new Product(1, "Milk"));
43 | // products.add(new Product(2, "Coffee"));
44 | //
45 | // try {
46 | // cacher.writeCache(products);
47 | // } catch (IOException e) {
48 | // e.printStackTrace();
49 | // }
50 |
51 | //// ArrayList products = new ArrayList<>();
52 | //// products.add(new Product(1, "Cappuccino"));
53 | //// products.add(new Product(2, "Americano"));
54 | //
55 | // try {
56 | // cacher.appendOrWriteCache(products);
57 | // } catch (IOException e) {
58 | // e.printStackTrace();
59 | // }
60 |
61 | if(cacher.hasCache()){
62 | try {
63 | // List> list = cacher.getAllCaches();
64 | //
65 | // for(ArrayList productList: list){
66 | // for(Product p: productList){
67 | // Log.d(TAG, p.name);
68 | // }
69 | // }
70 |
71 | ArrayList productList = getMergedList(cacher.getAllCaches());
72 | for(Product p: productList){
73 | Log.d(TAG, p.name);
74 | }
75 |
76 | } catch (IOException e) {
77 | e.printStackTrace();
78 | }
79 | }
80 |
81 |
82 | }
83 |
84 | private ArrayList getMergedList(List> outerList){
85 | ArrayList mergedList = new ArrayList<>();
86 | for(ArrayList productList: outerList){
87 | for(Product p: productList){
88 | mergedList.add(p);
89 | }
90 | }
91 | return mergedList;
92 | }
93 |
94 | @Override
95 | public boolean onCreateOptionsMenu(Menu menu) {
96 | // Inflate the menu; this adds items to the action bar if it is present.
97 | getMenuInflater().inflate(R.menu.menu_main, menu);
98 | return true;
99 | }
100 |
101 | @Override
102 | public boolean onOptionsItemSelected(MenuItem item) {
103 | // Handle action bar item clicks here. The action bar will
104 | // automatically handle clicks on the Home/Up button, so long
105 | // as you specify a parent activity in AndroidManifest.xml.
106 | int id = item.getItemId();
107 |
108 | //noinspection SimplifiableIfStatement
109 | if (id == R.id.action_settings) {
110 | return true;
111 | }
112 |
113 | return super.onOptionsItemSelected(item);
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/FileCacher/app/src/main/java/com/kosalgeek/android/caching/FileCacher.java:
--------------------------------------------------------------------------------
1 | package com.kosalgeek.android.caching;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.EOFException;
6 | import java.io.File;
7 | import java.io.FileInputStream;
8 | import java.io.FileOutputStream;
9 | import java.io.IOException;
10 | import java.io.ObjectInputStream;
11 | import java.io.ObjectOutputStream;
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * File Cacher is for caching an object.
17 | *
18 | * Created by Oum Saokosal (2016)
19 | * Source Code at github.com/kosalgeek/FileCacher
20 | * YouTube Channel at youtube.com/user/oumsaokosal
21 | * Facebook Page at facebook.com/kosalgeek
22 | *
23 | * @param generic T type
24 | */
25 | public class FileCacher{
26 | private final String LOG = this.getClass().getName();
27 |
28 | private Context context;
29 | private String fileName;
30 |
31 | /**
32 | * Create an instance of FileCacher
33 | * @param context App context
34 | * @param fileName fileName
35 | */
36 | public FileCacher(Context context, String fileName) {
37 | this.context = context;
38 | this.fileName = fileName;
39 | }
40 |
41 | /**
42 | * Overwrite an object to cache. It simply deletes a old file and create a new one. Use it carefully.
43 | *
44 | * @param object any object which could be anything, e.g. int, String[], ArrayList