From 92c6af6a0d0dde5758852e3b741546843b36e11d Mon Sep 17 00:00:00 2001 From: Blenner Silva Date: Thu, 24 Aug 2017 12:27:22 -0300 Subject: [PATCH] first commit --- .gitignore | 9 + .idea/compiler.xml | 22 +++ .idea/copyright/profiles_settings.xml | 3 + .idea/gradle.xml | 19 +++ .idea/misc.xml | 46 +++++ .idea/modules.xml | 10 ++ .idea/runConfigurations.xml | 12 ++ app/.gitignore | 1 + app/build.gradle | 31 ++++ app/proguard-rules.pro | 25 +++ .../ExampleInstrumentedTest.java | 26 +++ app/src/main/AndroidManifest.xml | 21 +++ .../awesomedialog/MainActivity.java | 94 ++++++++++ app/src/main/res/layout/activity_main.xml | 44 +++++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4208 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2555 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 6114 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10056 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 14696 bytes app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/strings.xml | 5 + app/src/main/res/values/styles.xml | 11 ++ .../awesomedialog/ExampleUnitTest.java | 17 ++ awesomedialoglib/.gitignore | 1 + awesomedialoglib/build.gradle | 31 ++++ awesomedialoglib/proguard-rules.pro | 25 +++ .../ExampleInstrumentedTest.java | 26 +++ awesomedialoglib/src/main/AndroidManifest.xml | 10 ++ .../AwesomeDialogBuilder.java | 148 ++++++++++++++++ .../AwesomeErrorDialog.java | 56 ++++++ .../AwesomeInfoDialog.java | 87 ++++++++++ .../AwesomeProgressDialog.java | 33 ++++ .../interfaces/Closure.java | 9 + .../src/main/res/anim/rubber_band.xml | 13 ++ .../main/res/drawable/circle_background.xml | 12 ++ .../main/res/drawable/dialog_btn_rounded.xml | 8 + .../src/main/res/drawable/dialog_circle.xml | 8 + .../src/main/res/drawable/dialog_round.xml | 12 ++ .../src/main/res/drawable/ic_dialog_error.xml | 4 + .../src/main/res/drawable/ic_dialog_info.xml | 12 ++ .../drawable/internal_circle_background.xml | 10 ++ .../main/res/drawable/shape_btn_rounded.xml | 14 ++ .../src/main/res/layout/dialog_error.xml | 87 ++++++++++ .../src/main/res/layout/dialog_info.xml | 103 +++++++++++ .../src/main/res/layout/dialog_progress.xml | 81 +++++++++ .../src/main/res/values/colors.xml | 9 + .../src/main/res/values/strings.xml | 4 + .../src/main/res/values/styles.xml | 13 ++ .../awesomedialoglibrary/ExampleUnitTest.java | 17 ++ build.gradle | 23 +++ gradle.properties | 17 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 160 ++++++++++++++++++ gradlew.bat | 90 ++++++++++ settings.gradle | 1 + 61 files changed, 1532 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/awesomedialog/blennersilva/awesomedialog/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/awesomedialog/blennersilva/awesomedialog/MainActivity.java create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/test/java/com/awesomedialog/blennersilva/awesomedialog/ExampleUnitTest.java create mode 100644 awesomedialoglib/.gitignore create mode 100644 awesomedialoglib/build.gradle create mode 100644 awesomedialoglib/proguard-rules.pro create mode 100644 awesomedialoglib/src/androidTest/java/com/awesomedialog/blennersilva/awesomedialoglibrary/ExampleInstrumentedTest.java create mode 100644 awesomedialoglib/src/main/AndroidManifest.xml create mode 100644 awesomedialoglib/src/main/java/com/awesomedialog/blennersilva/awesomedialoglibrary/AwesomeDialogBuilder.java create mode 100644 awesomedialoglib/src/main/java/com/awesomedialog/blennersilva/awesomedialoglibrary/AwesomeErrorDialog.java create mode 100644 awesomedialoglib/src/main/java/com/awesomedialog/blennersilva/awesomedialoglibrary/AwesomeInfoDialog.java create mode 100644 awesomedialoglib/src/main/java/com/awesomedialog/blennersilva/awesomedialoglibrary/AwesomeProgressDialog.java create mode 100644 awesomedialoglib/src/main/java/com/awesomedialog/blennersilva/awesomedialoglibrary/interfaces/Closure.java create mode 100644 awesomedialoglib/src/main/res/anim/rubber_band.xml create mode 100644 awesomedialoglib/src/main/res/drawable/circle_background.xml create mode 100644 awesomedialoglib/src/main/res/drawable/dialog_btn_rounded.xml create mode 100644 awesomedialoglib/src/main/res/drawable/dialog_circle.xml create mode 100644 awesomedialoglib/src/main/res/drawable/dialog_round.xml create mode 100644 awesomedialoglib/src/main/res/drawable/ic_dialog_error.xml create mode 100644 awesomedialoglib/src/main/res/drawable/ic_dialog_info.xml create mode 100644 awesomedialoglib/src/main/res/drawable/internal_circle_background.xml create mode 100644 awesomedialoglib/src/main/res/drawable/shape_btn_rounded.xml create mode 100644 awesomedialoglib/src/main/res/layout/dialog_error.xml create mode 100644 awesomedialoglib/src/main/res/layout/dialog_info.xml create mode 100644 awesomedialoglib/src/main/res/layout/dialog_progress.xml create mode 100644 awesomedialoglib/src/main/res/values/colors.xml create mode 100644 awesomedialoglib/src/main/res/values/strings.xml create mode 100644 awesomedialoglib/src/main/res/values/styles.xml create mode 100644 awesomedialoglib/src/test/java/com/awesomedialog/blennersilva/awesomedialoglibrary/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..faf93b7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..692a1cc --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..540e306 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + buildToolsVersion "26.0.0" + defaultConfig { + applicationId "com.awesomedialog.blennersilva.awesomedialog" + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:26.+' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' + compile project(path: ':awesomedialoglib') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..c3a6151 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/blennersilva/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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/awesomedialog/blennersilva/awesomedialog/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/awesomedialog/blennersilva/awesomedialog/ExampleInstrumentedTest.java new file mode 100644 index 0000000..988ae0d --- /dev/null +++ b/app/src/androidTest/java/com/awesomedialog/blennersilva/awesomedialog/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.awesomedialog.blennersilva.awesomedialog; + +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 Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.awesomedialog.blennersilva.awesomedialog", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..1c3660a --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/awesomedialog/blennersilva/awesomedialog/MainActivity.java b/app/src/main/java/com/awesomedialog/blennersilva/awesomedialog/MainActivity.java new file mode 100644 index 0000000..f772ca6 --- /dev/null +++ b/app/src/main/java/com/awesomedialog/blennersilva/awesomedialog/MainActivity.java @@ -0,0 +1,94 @@ +package com.awesomedialog.blennersilva.awesomedialog; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; + +import com.awesomedialog.blennersilva.awesomedialoglibrary.AwesomeErrorDialog; +import com.awesomedialog.blennersilva.awesomedialoglibrary.AwesomeInfoDialog; +import com.awesomedialog.blennersilva.awesomedialoglibrary.AwesomeProgressDialog; +import com.awesomedialog.blennersilva.awesomedialoglibrary.interfaces.Closure; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button btnError = (Button) findViewById(R.id.btnError); + btnError.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showErrorDialog(); + } + }); + + Button btnInfo = (Button) findViewById(R.id.btnInfo); + btnInfo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showInfoDialog(); + } + }); + + Button btnProgress = (Button) findViewById(R.id.btnProgress); + btnProgress.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showProgressDialog(); + } + }); + } + + private void showErrorDialog() { + new AwesomeErrorDialog(this) + .setTitle(R.string.app_name) + .setMessage(R.string.app_name) + .setColoredCircle(R.color.dialogErrorBackgroundColor) + .setDialogIconAndColor(R.drawable.ic_dialog_error, R.color.white) + .setCancelable(true) + .setButtonColorTextAndTextColor(R.color.dialogErrorBackgroundColor, R.color.white, getString(R.string.dialog_ok_button)) + .setErrorButton(new Closure() { + @Override + public void exec() { + + } + }).show(); + } + + private void showInfoDialog() { + new AwesomeInfoDialog(this) + .setTitle(R.string.app_name) + .setMessage(R.string.app_name) + .setColoredCircle(R.color.dialogInfoBackgroundColor) + .setDialogIconAndColor(R.drawable.ic_dialog_info, R.color.white) + .setCancelable(true) + .setPositiveButtonColorTextAndTextColor(R.color.dialogInfoBackgroundColor, R.color.white, getString(R.string.dialog_yes_button)) + .setNegativeButtonColorTextAndTextColor(R.color.dialogInfoBackgroundColor, R.color.white, getString(R.string.dialog_no_button)) + .setPositiveButton(new Closure() { + @Override + public void exec() { + + } + }) + .setNegativeButton(new Closure() { + @Override + public void exec() { + + } + }) + .show(); + } + + private void showProgressDialog(){ + new AwesomeProgressDialog(this) + .setTitle(R.string.app_name) + .setMessage(R.string.app_name) + .setColoredCircle(R.color.dialogProgressBackgroundColor) + .setCancelable(true) + .setProgressBarColor(R.color.white) + .show(); + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..0527efe --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,44 @@ + + + +