Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc53832
commit 7828db3
Showing
5 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/taskail/mixion/dialog/EnterTagDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.taskail.mixion.dialog | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.support.v7.app.AppCompatDialog | ||
import com.taskail.mixion.R | ||
import com.taskail.mixion.ui.TextInputValidator | ||
import kotlinx.android.synthetic.main.dialog_enter_tag.* | ||
|
||
/** | ||
*Created by ed on 2/17/18. | ||
*/ | ||
|
||
class EnterTagDialog(context: Context, | ||
private val addTag: (String) -> Unit) : AppCompatDialog(context){ | ||
|
||
init { | ||
setContentView(R.layout.dialog_enter_tag) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
TextInputValidator({ | ||
submitTagBtn.isEnabled = it | ||
}, tag_input) | ||
|
||
submitTagBtn.setOnClickListener { | ||
addTag(getTag()) | ||
this.dismiss() | ||
} | ||
} | ||
|
||
private fun getTag(): String{ | ||
return tag_input.editText?.text.toString().toLowerCase() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="200dp" | ||
android:orientation="vertical" | ||
android:padding="4dp" | ||
android:layout_height="wrap_content"> | ||
|
||
<android.support.design.widget.TextInputLayout | ||
android:id="@+id/tag_input" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:hint="@string/enter_tag"> | ||
|
||
<EditText | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:inputType="text" | ||
android:imeOptions="flagNoExtractUi" | ||
android:maxLines="1" /> | ||
</android.support.design.widget.TextInputLayout> | ||
|
||
<TextView | ||
android:id="@+id/submitTagBtn" | ||
style="@style/App.Button.Login" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:enabled="false" | ||
android:text="@string/submit" | ||
android:layout_marginLeft="0dp" | ||
android:layout_marginRight="0dp"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters