Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.

Commit ef20d03

Browse files
authored
Add files via upload
0 parents  commit ef20d03

Some content is hidden

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

46 files changed

+1305
-0
lines changed

AnimationDialog/build.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.2"
6+
7+
8+
defaultConfig {
9+
minSdkVersion 19
10+
targetSdkVersion 29
11+
versionCode 1
12+
versionName "1.0"
13+
14+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15+
consumerProguardFiles 'consumer-rules.pro'
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
25+
}
26+
27+
dependencies {
28+
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
implementation 'com.airbnb.android:lottie:3.0.7'
30+
implementation 'androidx.appcompat:appcompat:1.1.0'
31+
testImplementation 'junit:junit:4.12'
32+
androidTestImplementation 'androidx.test:runner:1.2.0'
33+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
34+
}

AnimationDialog/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.example.animationdialog;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("com.example.animationdialog.test", appContext.getPackageName());
26+
}
27+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.animationdialog" />
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
package com.example.animationdialogexample;
2+
3+
4+
import android.app.Dialog;
5+
import android.content.Context;
6+
import android.graphics.Bitmap;
7+
import android.graphics.Color;
8+
import android.graphics.drawable.Drawable;
9+
import android.media.MediaPlayer;
10+
import android.view.LayoutInflater;
11+
import android.view.View;
12+
import android.view.Window;
13+
import android.widget.Button;
14+
import android.widget.ImageView;
15+
import android.widget.LinearLayout;
16+
import android.widget.RelativeLayout;
17+
import android.widget.TextView;
18+
19+
import com.airbnb.lottie.LottieAnimationView;
20+
21+
public class AnimationDialog {
22+
23+
public static Context context_full;
24+
public static View v;
25+
public static Dialog dialog;
26+
public static LayoutInflater inflater;
27+
public static Button Red_BTN ;
28+
public static Button Green_BTN;
29+
public static ImageView img;
30+
public static TextView txt,titleb;
31+
public static LottieAnimationView lottieAnimationView;
32+
public static RelativeLayout parent;
33+
public static boolean isgride;
34+
public static Button[] init(Context context,boolean isGrideViewButton){
35+
isgride=isGrideViewButton;
36+
context_full=context;
37+
inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
38+
dialog = new Dialog(context);
39+
if (isGrideViewButton){
40+
v = inflater.inflate(R.layout.animation_dialog_gride_b, null);
41+
}else {
42+
v = inflater.inflate(R.layout.animation_dialog, null);
43+
}
44+
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
45+
dialog.setContentView(v);
46+
Red_BTN =dialog.findViewById(R.id.btn1);
47+
parent =dialog.findViewById(R.id.parent);
48+
Green_BTN =dialog.findViewById(R.id.btn2);
49+
img =dialog.findViewById(R.id.img);
50+
txt =dialog.findViewById(R.id.txt);
51+
lottieAnimationView=dialog.findViewById(R.id.animation_view);
52+
titleb =dialog.findViewById(R.id.title);
53+
return new Button[]{Red_BTN,Green_BTN};
54+
}
55+
56+
public static Dialog create(String title, String msg, String button_msg){
57+
58+
titleb.setText(title);
59+
txt.setText(msg);
60+
Red_BTN.setText(button_msg);
61+
return dialog;
62+
}
63+
public static void change_text_color(String color){
64+
txt.setTextColor(Color.parseColor(color));
65+
titleb.setTextColor(Color.parseColor(color));
66+
}
67+
public static LottieAnimationView set_animation(String file_name,String color_hex){
68+
if (lottieAnimationView.getVisibility()==View.GONE){
69+
lottieAnimationView.setVisibility(View.VISIBLE);
70+
}
71+
if (img.getVisibility()==View.VISIBLE){
72+
img.setVisibility(View.GONE);
73+
}
74+
lottieAnimationView.setAnimation (file_name);
75+
lottieAnimationView.setBackgroundColor(Color.parseColor(color_hex));
76+
lottieAnimationView.setVisibility(View.VISIBLE);
77+
return lottieAnimationView;
78+
}
79+
public static void custom_button_background(String color_btn){
80+
Red_BTN.setBackgroundColor(Color.parseColor(color_btn));
81+
}
82+
public static void custom_button_background(Drawable drawable){
83+
Red_BTN.setBackground(drawable);
84+
}
85+
public static void custom_button_background(int resid){
86+
Red_BTN.setBackgroundResource(resid);
87+
}
88+
public static void add_secend_button(String msg){
89+
Green_BTN.setVisibility(View.VISIBLE);
90+
Green_BTN.setText(msg);
91+
92+
if (isgride){
93+
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)Red_BTN.getLayoutParams();
94+
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
95+
params.addRule(RelativeLayout.LEFT_OF, R.id.relred);
96+
Red_BTN.setLayoutParams(params);
97+
}
98+
}
99+
public static void add_secend_button(String msg,String color_btn){
100+
Green_BTN.setVisibility(View.VISIBLE);
101+
Green_BTN.setBackgroundColor(Color.parseColor(color_btn));
102+
Green_BTN.setText(msg);
103+
104+
if (isgride){
105+
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)Red_BTN.getLayoutParams();
106+
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
107+
params.addRule(RelativeLayout.LEFT_OF, R.id.relred);
108+
Red_BTN.setLayoutParams(params);
109+
}
110+
}
111+
public static void add_secend_button(String msg,Drawable drawable){
112+
Green_BTN.setVisibility(View.VISIBLE);
113+
Green_BTN.setBackground(drawable);
114+
Green_BTN.setText(msg);
115+
116+
if (isgride){
117+
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)Red_BTN.getLayoutParams();
118+
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
119+
params.addRule(RelativeLayout.LEFT_OF, R.id.relred);
120+
Red_BTN.setLayoutParams(params);
121+
}
122+
}
123+
public static void add_secend_button(String msg,int resid){
124+
Green_BTN.setVisibility(View.VISIBLE);
125+
Green_BTN.setBackgroundResource(resid);
126+
Green_BTN.setText(msg);
127+
if (isgride){
128+
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)Red_BTN.getLayoutParams();
129+
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
130+
params.addRule(RelativeLayout.LEFT_OF, R.id.relred);
131+
Red_BTN.setLayoutParams(params);
132+
}
133+
134+
}
135+
public static void close(){
136+
dialog.dismiss();
137+
}
138+
public static void show(){
139+
dialog.show();
140+
}
141+
public static void setCanceledOnTouchOutside(boolean setCanceledOnTouchOutside){
142+
dialog.setCanceledOnTouchOutside(setCanceledOnTouchOutside);
143+
}
144+
public static ImageView set_image(Drawable drawable){
145+
if (lottieAnimationView.getVisibility()==View.VISIBLE){
146+
lottieAnimationView.setVisibility(View.GONE);
147+
}
148+
if (img.getVisibility()==View.GONE){
149+
img.setVisibility(View.VISIBLE);
150+
}
151+
img.setImageDrawable(drawable);
152+
return img;
153+
}
154+
public static ImageView set_image(Bitmap bitmap){
155+
if (lottieAnimationView.getVisibility()==View.VISIBLE){
156+
lottieAnimationView.setVisibility(View.GONE);
157+
}
158+
if (img.getVisibility()==View.GONE){
159+
img.setVisibility(View.VISIBLE);
160+
}
161+
img.setImageBitmap(bitmap);
162+
return img;
163+
}
164+
public static ImageView set_image(int resid){
165+
if (lottieAnimationView.getVisibility()==View.VISIBLE){
166+
lottieAnimationView.setVisibility(View.GONE);
167+
}
168+
if (img.getVisibility()==View.GONE){
169+
img.setVisibility(View.VISIBLE);
170+
}
171+
img.setImageResource(resid);
172+
return img;
173+
}
174+
public static void set_parent_background(String color){
175+
parent.setBackgroundColor(Color.parseColor(color));
176+
}
177+
public static MediaPlayer set_Sound(int sound_row_resid){
178+
MediaPlayer mp = MediaPlayer.create(context_full,sound_row_resid);
179+
mp.start();
180+
return mp;
181+
}
182+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<translate xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:duration="600"
4+
android:fromXDelta="100%"
5+
android:toXDelta="0%"/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<translate xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:fromXDelta="0%" android:toXDelta="100%"
4+
android:fromYDelta="0%" android:toYDelta="0%"
5+
android:duration="600"/>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<item android:state_pressed="true">
5+
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
6+
<stroke
7+
android:width="1dp"
8+
android:color="#b64945" />
9+
<solid android:color="#b64945" />
10+
<padding
11+
android:left="1dp"
12+
android:right="1dp"
13+
android:bottom="1dp"
14+
android:top="1dp" />
15+
<corners android:radius="7dp" />
16+
</shape>
17+
18+
</item>
19+
<item>
20+
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
21+
<stroke
22+
android:width="1dp"
23+
android:color="#d9534f" />
24+
25+
<solid android:color="#d9534f" />
26+
27+
<padding
28+
android:left="1dp"
29+
android:right="1dp"
30+
android:bottom="1dp"
31+
android:top="1dp" />
32+
33+
<corners android:radius="7dp" />
34+
</shape>
35+
</item>
36+
37+
</selector>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<item android:state_pressed="true">
5+
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
6+
<stroke
7+
android:width="1dp"
8+
android:color="#329c48" />
9+
<solid android:color="#329c48" />
10+
<padding
11+
android:left="1dp"
12+
android:right="1dp"
13+
android:bottom="1dp"
14+
android:top="1dp" />
15+
<corners android:radius="7dp" />
16+
</shape>
17+
18+
</item>
19+
<item>
20+
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
21+
<stroke
22+
android:width="1dp"
23+
android:color="#42ae59" />
24+
25+
<solid android:color="#42ae59" />
26+
27+
<padding
28+
android:left="1dp"
29+
android:right="1dp"
30+
android:bottom="1dp"
31+
android:top="1dp" />
32+
33+
<corners android:radius="7dp" />
34+
</shape>
35+
</item>
36+
37+
</selector>

0 commit comments

Comments
 (0)