Skip to content

Commit

Permalink
Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
n3o-d4rk3r committed Feb 28, 2023
1 parent aebacdc commit a53105a
Show file tree
Hide file tree
Showing 35 changed files with 1,930 additions and 16 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
viewBinding true
}
}

Expand Down
49 changes: 47 additions & 2 deletions app/src/main/java/bd/com/bangal/bangalmasterpack/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,62 @@ package bd.com.bangal.bangalmasterpack
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.view.View
import android.widget.CompoundButton
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import bd.com.bangal.bangalmasterpack.databinding.ActivityMainBinding
import bd.com.bangal.masterpacklib.CameraVideoButton
import bd.com.bangal.masterpacklib.ReactionPopup
import bd.com.bangal.masterpacklib.ReactionsConfigBuilder
import bd.com.bangal.masterpacklib.toast.MotionToast
import bd.com.bangal.masterpacklib.toast.MotionToastStyle

class MainActivity : AppCompatActivity() {
class MainActivity : AppCompatActivity(), View.OnClickListener,
CompoundButton.OnCheckedChangeListener {

private lateinit var binding: ActivityMainBinding
private val strings = arrayOf("wow")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)

binding.successBtn.setOnClickListener(this)

}

private fun setToastColors(newColorsEnabled: Boolean) {
if (newColorsEnabled) {
MotionToast.setSuccessBackgroundColor(R.color.success_bg_color)
MotionToast.setErrorBackgroundColor(R.color.error_bg_color)
MotionToast.setDeleteBackgroundColor(R.color.delete_bg_color)
MotionToast.setWarningBackgroundColor(R.color.warning_bg_color)
MotionToast.setInfoBackgroundColor(R.color.info_bg_color)
} else {
MotionToast.resetToastColors()
}
}

override fun onClick(v: View?) {
when (v!!.id) {
R.id.successBtn -> {
MotionToast.createColorToast(
this,
"Post create 😍",
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
MotionToastStyle.SUCCESS,
MotionToast.GRAVITY_BOTTOM,
MotionToast.LONG_DURATION,
ResourcesCompat.getFont(this, R.font.futurabold)
)
}
}
}

override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
setToastColors(isChecked)
}

}
11 changes: 11 additions & 0 deletions app/src/main/res/anim/pulse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toXScale="0.7"
android:toYScale="0.7" />
Binary file added app/src/main/res/font/futurabold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/futurabook.ttf
Binary file not shown.
Binary file added app/src/main/res/font/futuraheavy.ttf
Binary file not shown.
Binary file added app/src/main/res/font/futuramedium.ttf
Binary file not shown.
Binary file added app/src/main/res/font/helvetica_regular.ttf
Binary file not shown.
Binary file added app/src/main/res/font/helveticabold.ttf
Binary file not shown.
21 changes: 8 additions & 13 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,18 @@
android:layout_marginBottom="16dp"
app:cvb_recording_color="#D438A2"/>

<Button
android:id="@+id/facebook_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button"
android:layout_gravity="bottom"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Facebook" />

<bd.com.bangal.masterpacklib.slidetoact.SlideToActView
android:id="@+id/example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/facebook_btn"
android:layout_below="@+id/button"
app:text="Example" />
<Button
android:id="@+id/successBtn"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Success"
android:gravity="center"
android:layout_below="@id/example"/>

</RelativeLayout>
70 changes: 70 additions & 0 deletions app/src/main/res/layout/full_color_toast.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/color_toast_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="@dimen/dimen_24"
android:background="@drawable/toast_round_background"
android:backgroundTint="@color/warning_color">


<ImageView
android:id="@+id/color_toast_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dimen_12"
android:background="@drawable/color_view_background"
android:src="@drawable/ic_warning_yellow"
android:contentDescription="@string/app_name"
android:padding="@dimen/dimen_8" />

<LinearLayout
android:id="@+id/custom_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dimen_8"
android:layout_marginEnd="@dimen/dimen_8"
android:layout_toEndOf="@id/color_toast_image"
android:gravity="start"
android:orientation="vertical">

<TextView
android:id="@+id/color_toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dimen_12"
android:layout_marginTop="@dimen/dimen_12"
android:layout_marginEnd="@dimen/dimen_12"
android:letterSpacing="0.10"
android:text="@string/text_warning"
android:textAllCaps="true"
android:textAlignment="textStart"
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
android:textColor="@android:color/white"
app:layout_constraintStart_toEndOf="@id/color_toast_image"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/color_toast_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dimen_12"
android:layout_marginTop="@dimen/dimen_4"
android:layout_marginEnd="@dimen/dimen_12"
android:layout_marginBottom="@dimen/dimen_12"
android:ellipsize="marquee"
android:maxLines="2"
android:text="@string/text_mock_description"
android:textAlignment="textStart"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/color_toast_image"
app:layout_constraintTop_toBottomOf="@id/color_toast_text" />

</LinearLayout>

</RelativeLayout>
80 changes: 80 additions & 0 deletions app/src/main/res/layout/motion_toast.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/motion_toast_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="@dimen/dimen_24"
android:background="@android:color/white">

<View
android:id="@+id/colorView"
android:layout_width="@dimen/dimen_12"
android:layout_height="100dp"
android:layout_alignParentStart="true"
android:background="@drawable/color_view_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/custom_toast_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="@dimen/dimen_8"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/colorView"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_info_yellow" />

<LinearLayout
android:id="@+id/custom_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dimen_8"
android:layout_marginEnd="@dimen/dimen_8"
android:layout_toEndOf="@id/custom_toast_image"
android:gravity="start"
android:orientation="vertical">

<TextView
android:id="@+id/custom_toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dimen_12"
android:layout_marginTop="@dimen/dimen_12"
android:layout_marginEnd="@dimen/dimen_12"
android:textStyle="bold"
android:letterSpacing="0.10"
android:text="@string/text_warning"
android:textAllCaps="true"
android:textAlignment="textStart"
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
android:textColor="@android:color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/custom_toast_image"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/custom_toast_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dimen_12"
android:layout_marginTop="@dimen/dimen_4"
android:layout_marginEnd="@dimen/dimen_12"
android:layout_marginBottom="@dimen/dimen_12"
android:ellipsize="marquee"
android:maxLines="2"
android:text="@string/text_mock_description"
android:textAlignment="textStart"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/custom_toast_image"
app:layout_constraintTop_toBottomOf="@id/custom_toast_text" />

</LinearLayout>

</RelativeLayout>
19 changes: 19 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,23 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>

<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#0340DA</color>

<!-- Background Colors-->

<color name="warning_color">#FBC02D</color>
<color name="error_color">#D50000</color>
<color name="success_color">#17B978</color>
<color name="info_color">#0004FF</color>
<color name="delete_color">#0288D1</color>

<!-- Background Transparent Colors-->
<color name="warning_bg_color">#33FBC02D</color>
<color name="error_bg_color">#33D32F2F</color>
<color name="success_bg_color">#3317B978</color>
<color name="info_bg_color">#330004FF</color>
<color name="delete_bg_color">#330288D1</color>
</resources>
5 changes: 4 additions & 1 deletion masterpacklib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ android {
namespace 'bd.com.bangal.masterpacklib'
compileSdk 33

buildFeatures {
viewBinding true
}
defaultConfig {
minSdk 23
targetSdk 33
Expand Down Expand Up @@ -45,7 +48,7 @@ afterEvaluate {
release(MavenPublication) {
groupId = 'com.github.n3o-d4rk3r'
artifactId = 'masterpacklib'
version = '1.9.3'
version = '1.9.4'
artifact(bundleReleaseAar)
}
}
Expand Down
Loading

0 comments on commit a53105a

Please sign in to comment.