Skip to content

Commit ca729a8

Browse files
committed
first commit
0 parents  commit ca729a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2449
-0
lines changed

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# OSX
2+
*.DS_Store
3+
4+
# Gradle files
5+
build/
6+
.gradle/
7+
*/build/
8+
9+
10+
# IDEA
11+
*.iml
12+
.idea/
13+
14+
# Built application files
15+
*.apk
16+
*.ap_
17+
18+
# Files for the Dalvik VM
19+
*.dex
20+
21+
# Java class files
22+
*.class
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Log Files
28+
*.log

Example/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
*.iml

Example/build.gradle

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.2"
6+
7+
defaultConfig {
8+
applicationId "com.pranavj7.example.TimerDialog"
9+
minSdkVersion 15
10+
targetSdkVersion 26
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+
allprojects {
21+
repositories {
22+
maven { url 'https://jitpack.io' }
23+
google()
24+
}
25+
}
26+
}
27+
28+
dependencies {
29+
compile fileTree(dir: 'libs', include: ['*.jar'])
30+
testCompile 'junit:junit:4.12'
31+
compile 'com.android.support:appcompat-v7:26.+'
32+
compile project(':TimerDialog')
33+
}

Example/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/andy/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+
#}

Example/src/main/AndroidManifest.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.pranavj7.example.TimerDialog" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme" >
11+
<activity android:name=".MainActivity" >
12+
<intent-filter>
13+
<action android:name="android.intent.action.MAIN" />
14+
15+
<category android:name="android.intent.category.LAUNCHER" />
16+
</intent-filter>
17+
</activity>
18+
</application>
19+
20+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.pranavj7.example.TimerDialog;
2+
import android.content.Context;
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.view.View;
6+
import android.view.animation.AlphaAnimation;
7+
import android.view.animation.Animation;
8+
import android.view.animation.AnimationSet;
9+
import android.view.animation.ScaleAnimation;
10+
import android.widget.Toast;
11+
12+
import com.pranavj7.TimerDialog.TimerDialog;
13+
14+
public class MainActivity extends AppCompatActivity {
15+
16+
@Override
17+
protected void onCreate(Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
setContentView(R.layout.activity_main);
20+
}
21+
public void showTextDialog(View view) {
22+
TimerDialog dialog = new TimerDialog(this);
23+
dialog.setColor("#8ECB54");
24+
dialog.setAnimationEnable(true);
25+
dialog.setTitle(getString(R.string.operation));
26+
dialog.setDuration(10000);
27+
dialog.setContentText(getString(R.string.content_text));
28+
dialog.setPositiveListener(getString(R.string.text_iknow), new TimerDialog.OnPositiveListener() {
29+
@Override
30+
public void onClick(TimerDialog dialog) {
31+
Toast.makeText(MainActivity.this, dialog.getPositiveText().toString(), Toast.LENGTH_SHORT).show();
32+
}
33+
}).show();
34+
}
35+
36+
public void showPicDialog(View v) {
37+
TimerDialog dialog = new TimerDialog(this);
38+
dialog.setTitle(getString(R.string.operation));
39+
dialog.setAnimationEnable(true);
40+
dialog.setDuration(10000);
41+
dialog.setAnimationIn(getInAnimationTest(this));
42+
dialog.setAnimationOut(getOutAnimationTest(this));
43+
dialog.setContentImage(getResources().getDrawable(R.mipmap.sample_img));
44+
dialog.setPositiveListener(getString(R.string.delete), new TimerDialog.OnPositiveListener() {
45+
@Override
46+
public void onClick(TimerDialog dialog) {
47+
Toast.makeText(MainActivity.this, dialog.getPositiveText().toString(), Toast.LENGTH_SHORT).show();
48+
}
49+
})
50+
.setNegativeListener(getString(R.string.cancel), new TimerDialog.OnNegativeListener() {
51+
@Override
52+
public void onClick(TimerDialog dialog) {
53+
Toast.makeText(MainActivity.this, dialog.getNegativeText().toString(), Toast.LENGTH_SHORT).show();
54+
dialog.dismiss();
55+
}
56+
}).show();
57+
}
58+
public void showAllModeDialog(View view) {
59+
TimerDialog dialog = new TimerDialog(this);
60+
dialog.setTitle(getString(R.string.operation));
61+
dialog.setAnimationEnable(true);
62+
dialog.setDuration(10000);
63+
dialog.setContentText(getString(R.string.content_text));
64+
dialog.setContentImage(getResources().getDrawable(R.mipmap.sample_img));
65+
dialog.setPositiveListener(getString(R.string.delete), new TimerDialog.OnPositiveListener() {
66+
@Override
67+
public void onClick(TimerDialog dialog) {
68+
Toast.makeText(MainActivity.this, dialog.getPositiveText().toString(), Toast.LENGTH_SHORT).show();
69+
}
70+
})
71+
.setNegativeListener(getString(R.string.cancel), new TimerDialog.OnNegativeListener() {
72+
@Override
73+
public void onClick(TimerDialog dialog) {
74+
Toast.makeText(MainActivity.this, dialog.getNegativeText().toString(), Toast.LENGTH_SHORT).show();
75+
dialog.dismiss();
76+
dialog.setColor("#");
77+
}
78+
}).show();
79+
}
80+
81+
public static AnimationSet getInAnimationTest(Context context) {
82+
AnimationSet out = new AnimationSet(context, null);
83+
AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f);
84+
alpha.setDuration(150);
85+
ScaleAnimation scale = new ScaleAnimation(0.6f, 1.0f, 0.6f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
86+
scale.setDuration(150);
87+
out.addAnimation(alpha);
88+
out.addAnimation(scale);
89+
return out;
90+
}
91+
92+
public static AnimationSet getOutAnimationTest(Context context) {
93+
AnimationSet out = new AnimationSet(context, null);
94+
AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
95+
alpha.setDuration(150);
96+
ScaleAnimation scale = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
97+
scale.setDuration(150);
98+
out.addAnimation(alpha);
99+
out.addAnimation(scale);
100+
return out;
101+
}
102+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:padding="@dimen/activity_horizontal_margin"
6+
android:orientation="vertical">
7+
8+
<Button
9+
android:onClick="showPromptDialog"
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:text="@string/prompt_dialog"/>
13+
14+
<Button
15+
android:onClick="showPicDialog"
16+
android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:text="@string/pic"/>
19+
20+
<Button
21+
android:onClick="showTextDialog"
22+
android:layout_width="match_parent"
23+
android:layout_height="wrap_content"
24+
android:text="@string/text"/>
25+
26+
<Button
27+
android:onClick="showAllModeDialog"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
android:text="@string/text_and_pic"/>
31+
32+
</LinearLayout>
3.34 KB
Loading
2.15 KB
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
3+
(such as screen margins) for screens with more than 820dp of available width. This
4+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5+
<dimen name="activity_horizontal_margin">64dp</dimen>
6+
</resources>
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#ed7861</color>
4+
<color name="colorPrimaryDark">#ed7861</color>
5+
<color name="colorAccent">#ed7861</color>
6+
</resources>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<!-- Default screen margins, per the Android Design guidelines. -->
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="activity_vertical_margin">16dp</dimen>
5+
</resources>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<resources>
2+
<string name="app_name">ColorDialog</string>
3+
<string name="operation">Operation</string>
4+
<string name="content_text">This is content message.</string>
5+
<string name="delete">Delete</string>
6+
<string name="cancel">Cancel</string>
7+
<string name="text_iknow">I Know</string>
8+
<string name="ok">OK</string>
9+
<string name="success">Success</string>
10+
<string name="help">Help</string>
11+
<string name="info">Info</string>
12+
<string name="error">Error</string>
13+
<string name="warning">Warning</string>
14+
<string name="text_data">Your info text goes here. Loremipsum dolor sit amet, consecteturn adipisicing elit, sed do eiusmod.</string>
15+
<string name="prompt_dialog">Prompt Dialog</string>
16+
<string name="pic">Pic</string>
17+
<string name="text">Text</string>
18+
<string name="text_and_pic">Text And Pic</string>
19+
</resources>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
9+
</style>
10+
11+
</resources>

0 commit comments

Comments
 (0)