Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Added a text clearing function
Browse files Browse the repository at this point in the history
  • Loading branch information
lirannl committed Nov 18, 2018
1 parent 081450a commit 8d5ffc3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
7 changes: 2 additions & 5 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ class DisplayMessageActivity : AppCompatActivity() {
setContentView(R.layout.activity_display_message)
val kittycode = "Show the kitty"
val message = intent.getStringExtra(EXTRA_MESSAGE)
val textView = findViewById<TextView>(R.id.textView).apply {
findViewById<TextView>(R.id.textView).apply {
text = message
}
if (message == kittycode)
{
//Make the image visible
val imageView = findViewById<ImageView>(R.id.imageView).apply {
visibility = View.VISIBLE }
findViewById<ImageView>(R.id.imageView).apply {
visibility = View.VISIBLE
}
}

}
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/liran/com/wallpaper/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package liran.com.wallpaper

import android.annotation.SuppressLint
import android.content.Intent
import android.opengl.Visibility
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.provider.AlarmClock.EXTRA_MESSAGE
import android.view.View
import android.widget.EditText
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.view.*
import org.w3c.dom.Text

class MainActivity : AppCompatActivity() {

Expand All @@ -15,6 +20,15 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
@SuppressLint("ResourceAsColor")
fun setTextBox(view: View)
{
findViewById<TextView>(R.id.editText).apply {
var contentment = ""
text = contentment }
findViewById<TextView>(R.id.editText).apply {
setTextColor(R.color.black) }
}
fun sendMessage(view: View)
{
val editText = findViewById<EditText>(R.id.editText)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="text"
android:text="@string/edit_message"
android:ems="10"
android:id="@+id/editText"
android:id="@+id/editText" android:onClick="setTextBox"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toStartOf="@+id/button"
android:importantForAutofill="no"/>
android:importantForAutofill="no" tools:text="@string/edit_message"
android:textColor="@color/colorAccent"/>
<Button
android:text="@string/button_send"
android:layout_width="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="black">#000000</color>
</resources>

0 comments on commit 8d5ffc3

Please sign in to comment.