From 2ec34c5992c24976a61c533858044e528934495a Mon Sep 17 00:00:00 2001 From: "MD. Sad Adnan" Date: Fri, 12 Mar 2021 16:16:44 +0600 Subject: [PATCH] V1.0 will be released. --- app/build.gradle | 1 + .../customtoastproject/MainActivity.java | 50 +++++++++- .../ic_baseline_auto_delete_24.xml | 7 ++ app/src/main/res/layout/activity_main.xml | 91 ++++++++++++++++--- app/src/main/res/values/colors.xml | 2 + 5 files changed, 135 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/drawable-v24/ic_baseline_auto_delete_24.xml diff --git a/app/build.gradle b/app/build.gradle index b08d2c9..740b6ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,6 +33,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation project(path: ':CustomToastLib') testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' diff --git a/app/src/main/java/com/sadadnan/customtoastproject/MainActivity.java b/app/src/main/java/com/sadadnan/customtoastproject/MainActivity.java index 4d1a88f..d8b374b 100644 --- a/app/src/main/java/com/sadadnan/customtoastproject/MainActivity.java +++ b/app/src/main/java/com/sadadnan/customtoastproject/MainActivity.java @@ -3,16 +3,64 @@ import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; +import android.view.View; +import android.widget.Button; import com.sadadnan.customtoastlib.CustomToast; public class MainActivity extends AppCompatActivity { + private Button btn1,btn2,btn3,btn4,btn5; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + getSupportActionBar().hide(); + + initializeIDs(); + + clickListeners(); + } + + private void clickListeners() { + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomToast.ShowSuccessToast(MainActivity.this,false,"Congratulations"); + } + }); + btn2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomToast.ShowErrorToast(MainActivity.this,false,"We are extremely sorry."); + } + }); + btn3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomToast.ShowInfoToast(MainActivity.this,false,"We have updated your status."); + } + }); + btn4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomToast.showToastWithCustomDrawableAndBG(MainActivity.this,false,"Custom Icon",R.drawable.ic_baseline_auto_delete_24,R.color.toastColor); + } + }); + btn5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomToast.showToastWithoutIcon(MainActivity.this,false,"Without icon",R.color.toastColor2); + } + }); + } - CustomToast.ShowSuccessToast(this,false,"Congratulations"); + private void initializeIDs() { + btn1 = findViewById(R.id.btn1); + btn2 = findViewById(R.id.btn2); + btn3 = findViewById(R.id.btn3); + btn4 = findViewById(R.id.btn4); + btn5 = findViewById(R.id.btn5); } } \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_baseline_auto_delete_24.xml b/app/src/main/res/drawable-v24/ic_baseline_auto_delete_24.xml new file mode 100644 index 0000000..26de5dc --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_baseline_auto_delete_24.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4fc2444..cd40c48 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,18 +1,79 @@ - + - +