diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f885ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.gradle +/local.properties +/.idea/workspace.xml +.DS_Store +/build diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..33b64dd --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +L Dialogs \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + 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/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..736c7b5 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/.idea/libraries/appcompat_v7_19_1_0.xml b/.idea/libraries/appcompat_v7_19_1_0.xml new file mode 100644 index 0000000..d253471 --- /dev/null +++ b/.idea/libraries/appcompat_v7_19_1_0.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/support_v4_19_1_0.xml b/.idea/libraries/support_v4_19_1_0.xml new file mode 100644 index 0000000..3f6ff2d --- /dev/null +++ b/.idea/libraries/support_v4_19_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b153e48 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ff39940 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + 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/app.iml b/app/app.iml new file mode 100644 index 0000000..edb8e70 --- /dev/null +++ b/app/app.iml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..696ab87 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 19 + buildToolsVersion "20.0.0" + + defaultConfig { + applicationId "uk.me.lewisdeane.ldialogs" + minSdkVersion 10 + targetSdkVersion 19 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:19.+' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..3ec7c25 --- /dev/null +++ b/app/proguard-rules.pro @@ -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\Lewis\AppData\Local\Android\android-studio1\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 *; +#} diff --git a/app/src/androidTest/java/uk/me/lewisdeane/ldialogs/ApplicationTest.java b/app/src/androidTest/java/uk/me/lewisdeane/ldialogs/ApplicationTest.java new file mode 100644 index 0000000..a7577e4 --- /dev/null +++ b/app/src/androidTest/java/uk/me/lewisdeane/ldialogs/ApplicationTest.java @@ -0,0 +1,13 @@ +package uk.me.lewisdeane.myapplication; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..1f92c5e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/assets/Roboto-Light.ttf b/app/src/main/assets/Roboto-Light.ttf new file mode 100644 index 0000000..664e1b2 Binary files /dev/null and b/app/src/main/assets/Roboto-Light.ttf differ diff --git a/app/src/main/assets/Roboto-Medium.ttf b/app/src/main/assets/Roboto-Medium.ttf new file mode 100644 index 0000000..aa00de0 Binary files /dev/null and b/app/src/main/assets/Roboto-Medium.ttf differ diff --git a/app/src/main/assets/Roboto-Regular.ttf b/app/src/main/assets/Roboto-Regular.ttf new file mode 100644 index 0000000..3e6e2e7 Binary files /dev/null and b/app/src/main/assets/Roboto-Regular.ttf differ diff --git a/app/src/main/java/uk/me/lewisdeane/ldialogs/CustomDialog.java b/app/src/main/java/uk/me/lewisdeane/ldialogs/CustomDialog.java new file mode 100644 index 0000000..a1efda7 --- /dev/null +++ b/app/src/main/java/uk/me/lewisdeane/ldialogs/CustomDialog.java @@ -0,0 +1,121 @@ +package uk.me.lewisdeane.ldialogs; + +import android.app.AlertDialog; +import android.content.Context; +import android.graphics.Color; +import android.graphics.Typeface; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + + +/** + * Created by Lewis on 12/08/2014. + */ +public class CustomDialog extends AlertDialog { + + private Context mContext; + private View mRootView; + private String mTitle, mContent, mConfirm, mCancel; + private TextView mTitleView, mContentView; + private Button mConfirmView, mCancelView; + private Typeface mTypeface; + + public CustomDialog(Context _context){ + super(_context); + mContext = _context; + init(); + } + + public CustomDialog(Context _context, String _title, String _content, String _confirm, String _cancel){ + super(_context); + mContext = _context; + init(); + setTitle(_title); + setContent(_content); + setConfirm(_confirm); + setCancel(_cancel); + } + + private void init(){ + mRootView = LayoutInflater.from(mContext).inflate( + R.layout.dialog_custom, + null); + + mTitleView = (TextView) mRootView.findViewById(R.id.dialog_custom_title); + mContentView = (TextView) mRootView.findViewById(R.id.dialog_custom_content); + mConfirmView = (Button) mRootView.findViewById(R.id.dialog_custom_confirm); + mCancelView = (Button) mRootView.findViewById(R.id.dialog_custom_cancel); + + mTypeface = Typeface.createFromAsset(getContext().getResources().getAssets(), "Roboto-Medium.ttf"); + + mTitleView.setTypeface(mTypeface); + mContentView.setTypeface(mTypeface); + mConfirmView.setTypeface(mTypeface); + mCancelView.setTypeface(mTypeface); + + setListeners(); + + super.setView(mRootView); + super.show(); + } + + private void setListeners(){ + mConfirmView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // Code when positive button is clicked. + dismiss(); + } + }); + + mCancelView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // Code when negative button is clicked. + dismiss(); + } + }); + } + + public void setConfirmColour(String _hex){ + mConfirmView.setTextColor(Color.parseColor(_hex)); + } + + public void setTitle(String _title){ + mTitle = _title; + mTitleView.setText(mTitle); + } + + public void setContent(String _content){ + mContent = _content; + mContentView.setText(mContent); + } + + public void setConfirm(String _confirm){ + mConfirm = _confirm; + mConfirmView.setText(mConfirm); + } + + public void setCancel(String _cancel){ + mCancel = _cancel; + mCancelView.setText(mCancel); + } + + public String getTitle(){ + return mTitle; + } + + public String getContent(){ + return mContent; + } + + public String getConfirm(){ + return mConfirm; + } + + public String getCancel(){ + return mCancel; + } +} diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/layout/dialog_custom.xml b/app/src/main/res/layout/dialog_custom.xml new file mode 100644 index 0000000..be3ad58 --- /dev/null +++ b/app/src/main/res/layout/dialog_custom.xml @@ -0,0 +1,50 @@ + + + + + + + + + + +