forked from Tapadoo/Alerter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit - added library, code quality and tests
- Loading branch information
0 parents
commit 5006925
Showing
80 changed files
with
3,057 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# OSX icon metadata file | ||
.DS_Store | ||
|
||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, checkstyles, pmd etc) | ||
local.properties | ||
/config | ||
|
||
# Log and generated Files | ||
*.log | ||
/reports | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# Intellij | ||
*.iml | ||
.idea | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
#NDK | ||
obj/ | ||
libs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2017 Tapadoo, Dublin. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Alerter | ||
|
||
### General | ||
|
||
This library aims to overcome the limitations of Toasts and Snackbars, while reducing the | ||
complexity of your layouts. | ||
|
||
![Default Alert](./documentation/alert_default.gif) | ||
|
||
A customisable Alert view is dynamically added to the Decor View of the Window, overlaying | ||
all content. | ||
|
||
# Usage | ||
|
||
With simplicity in mind, the Alerter employs the builder pattern to facilitate easy integration | ||
into any app. | ||
|
||
From an Activity - | ||
|
||
```java | ||
Alerter.create(this) | ||
.setTitle("Alert Title") | ||
.setText("Alert text...") | ||
.show(); | ||
``` | ||
|
||
Or from a Fragment - | ||
|
||
```java | ||
Alerter.create(getActivity()) | ||
.setTitle("Alert Title") | ||
.setText("Alert text...") | ||
.show(); | ||
``` | ||
|
||
# Customisation | ||
|
||
### Background Colour | ||
|
||
```java | ||
Alerter.create(this) | ||
.setTitle("Alert Title") | ||
.setText("Alert text...") | ||
.setBackgroundColor(R.color.colorAccent) | ||
.show(); | ||
``` | ||
|
||
![Coloured Alert](./documentation/alert_coloured.gif) | ||
|
||
### Icon | ||
|
||
```java | ||
Alerter.create(this) | ||
.setText("Alert text...") | ||
.setIcon(R.drawable.ic_face) | ||
.show(); | ||
``` | ||
|
||
![Custom Icon Alert](./documentation/alert_icon.gif) | ||
|
||
### On screen duration, in milliseconds | ||
|
||
```java | ||
Alerter.create(this) | ||
.setTitle("Alert Title") | ||
.setText("Alert text...") | ||
.setDuration(10000) | ||
.show(); | ||
``` | ||
|
||
### Without title | ||
|
||
```java | ||
Alerter.create(this) | ||
.setText("Alert text...") | ||
.show(); | ||
``` | ||
|
||
![Text Only Alert](./documentation/alert_text_only.gif) | ||
|
||
### Adding an On Click Listener | ||
|
||
```java | ||
Alerter.create(ExampleActivity.this) | ||
.setTitle("Alert Title") | ||
.setText("Alert text...") | ||
.setDuration(10000) | ||
.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Toast.makeText(ExampleActivity.this, "OnClick Called", Toast.LENGTH_LONG).show(); | ||
} | ||
}) | ||
.show(); | ||
``` | ||
|
||
![On Click Alert](./documentation/alert_on_click.gif) | ||
|
||
### Verbose text | ||
|
||
```java | ||
Alerter.create(ExampleActivity.this) | ||
.setTitle("Alert Title") | ||
.setText("The alert scales to accommodate larger bodies of text. " + | ||
"The alert scales to accommodate larger bodies of text. " + | ||
"The alert scales to accommodate larger bodies of text.") | ||
.show(); | ||
``` | ||
|
||
![Verbose Alert](./documentation/alert_verbose.gif) | ||
|
||
## Gradle | ||
|
||
A work in progress... | ||
|
||
```groovy | ||
dependecies { | ||
compile 'com.tapadoo.android:alerter:1.0.0' | ||
} | ||
``` | ||
|
||
## Sample | ||
|
||
Clone this repo and check out the `app` module. | ||
|
||
## Licence | ||
|
||
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). | ||
|
||
Copyright 2016 Tapadoo, Dublin. | ||
|
||
![Alt Text](http://tapadoo.com/wp-content/themes/tapadoo/img/tapadoo-logo@2x.png) | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
|
||
compileSdkVersion rootProject.ext.compileSdkVersion | ||
buildToolsVersion rootProject.ext.buildToolsVersion | ||
|
||
defaultConfig { | ||
applicationId "com.tapadoo.example" | ||
|
||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
|
||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
lintOptions { | ||
abortOnError true | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
|
||
compile project(":library") | ||
|
||
compile rootProject.ext.libs.support_v4 | ||
compile rootProject.ext.libs.appcompat_v7 | ||
compile rootProject.ext.libs.support_design | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /Users/kevinmurphy/Library/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 *; | ||
#} |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/tapadoo/example/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.tapadoo.alerter; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.tapadoo.alerter", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.tapadoo.example" | ||
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=".ExampleActivity" | ||
android:label="@string/title_activity_example" | ||
android:theme="@style/AppTheme"> | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
|
||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.