Skip to content

Commit

Permalink
Completed project
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-manshu committed Jul 4, 2018
1 parent 53243d1 commit f752533
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val drawable_editText: EditDrawableText = findViewById(R.id.drawable_editText)
onClickListeners(drawable_editText)
val drawable_editText_left: EditDrawableText = findViewById(R.id.drawable_editText_left)
onClickListeners(
drawable_editText,
drawable_editText_left
)

}

private fun onClickListeners(drawable_editText: EditDrawableText) {
private fun onClickListeners(drawable_editText: EditDrawableText, drawable_editText_left: EditDrawableText) {
drawable_editText.setDrawableClickListener(object : onDrawableClickListener {
override fun onClick(target: DrawablePosition) {
when (target) {
DrawablePosition.RIGHT -> displayToastMessage("Clicked Right Drawable").show()
}
}


})
drawable_editText_left.setDrawableClickListener(object : onDrawableClickListener {
override fun onClick(target: DrawablePosition) {
when (target) {
DrawablePosition.LEFT -> displayToastMessage("Clicked Left Drawable").show()
}
}
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
tools:context=".MainActivity">

Expand All @@ -12,6 +13,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_remove_red_eye_black_24dp"
android:hint="@string/clickTheDrawables"
android:inputType="text"
android:textAlignment="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mindorks.editdrawabletext.EditDrawableText
android:id="@+id/drawable_editText_left"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_remove_red_eye_black_24dp"
android:hint="@string/clickTheDrawables"
android:inputType="text"
Expand All @@ -21,4 +34,4 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</RelativeLayout>
</LinearLayout>

0 comments on commit f752533

Please sign in to comment.