-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ScUtils | ||
This is a library of utilities classes | ||
|
||
- **[ScChecker](ScChecker.md)**<br /> | ||
This is very simple class that periodically repeat a check method. | ||
|
||
# Usage | ||
|
||
via Gradle: | ||
```java | ||
android { | ||
... | ||
buildTypes { | ||
... | ||
repositories { | ||
... | ||
maven { url "https://jitpack.io" } | ||
} | ||
} | ||
} | ||
... | ||
dependencies { | ||
... | ||
compile 'com.github.paroca72:scutils:0.9-beta' | ||
} | ||
``` | ||
|
||
#License | ||
<pre> | ||
Copyright 2015 Samuele Carassai | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
</pre> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# ScChecker | ||
This is very simple class utility that periodically repeat a check method. | ||
This is an abstract class and cannot be instanced directly. | ||
<br /> | ||
Through the listener implementation you can know when the status of check changed. | ||
This can be very useful in some case. | ||
For example when you must check the internet connection status or all kind of checks when the user must be advised only when some changed happen. | ||
|
||
#### Getter and Setter | ||
- **get/setStartDelay()** -> long value, default: <code>100 milliseconds</code><br /> | ||
When start to check the delay in milliseconds | ||
- **get/getCheckRate()** -> long value, default: <code>1000 milliseconds</code><br /> | ||
The waiting millisecond between a check and the next | ||
- **get/getMode()** -> Modes value, default: <code>FIXED_DELAY</code><br /> | ||
The waiting mode between a check and the next.<br /> | ||
Modes.FIXED_DELAY: start to wait once check is finished<br /> | ||
Modes.FIXED_RATE: check at fixed rate time | ||
|
||
#### Methods | ||
- **boolean check()**<br /> | ||
Abstract method must be overridden. This method will be called periodically in according with the specified settings. | ||
- **void start()**<br /> | ||
Start to check. | ||
- **void stop()**<br /> | ||
- **void stop(boolean force)**<br /> | ||
Stop to check. If <code>force</code> the check will be interrupted even if not finished. | ||
- **void setCheckerListener(CheckerListener listener)**<br /> | ||
Attach the listener. | ||
|
||
### Listener | ||
```java | ||
public interface CheckerListener { | ||
|
||
void onSuccess(); | ||
|
||
void onFail(); | ||
|
||
void onChangeState(boolean result); | ||
|
||
} | ||
``` | ||
|
||
### Example | ||
For an example please take a look the demo section in the project structure. | ||
|
||
#License | ||
<pre> | ||
Copyright 2015 Samuele Carassai | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
</pre> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.sccomponents.utils.demo" | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
compile 'com.android.support:appcompat-v7:23.2.1' | ||
compile project(':library') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\Users\Samuele\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.sccomponents.utils.demo; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.sccomponents.utils.demo" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |