Skip to content

Commit

Permalink
Merge pull request #10 from jungh0/master
Browse files Browse the repository at this point in the history
데모를 이쁘게 수정했습니다
  • Loading branch information
PaleCosmos authored Oct 15, 2019
2 parents 19798f1 + 5065a7b commit 70c160f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
29 changes: 19 additions & 10 deletions app/src/main/java/com/bluecat/view404Demo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,39 @@ import androidx.appcompat.app.AppCompatActivity
import com.bluecat.view404.View404
import com.bluecat.view404.show404
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.dismissError
import kotlinx.android.synthetic.main.layout_404.*
import kotlinx.android.synthetic.main.layout_404.view.*

class MainActivity : AppCompatActivity() {

private var view404: View404? = null


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

showError.setOnClickListener {
if (view404 == null) {
view404 = View404(this, R.layout.layout_404)
Toast.makeText(this, "shown", Toast.LENGTH_SHORT).show()

button2.setOnClickListener {
view404 = View404(this, R.layout.layout_404)
Toast.makeText(this, "shown", Toast.LENGTH_SHORT).show()
//parentLayout.show404(view404!!)
errorLayout.show404(view404!!, R.anim.abc_fade_in)
} else {
Toast.makeText(this, "already shown", Toast.LENGTH_SHORT).show()
}
}

view404?.view404?.button?.setOnClickListener {
//view404?.dismiss()
view404?.dismiss(R.anim.abc_fade_out)
dismissError.setOnClickListener {
if (view404 != null) {
Toast.makeText(this, "dismissed", Toast.LENGTH_SHORT).show()
}

//parentLayout.show404(view404!!)
parentLayout.show404(view404!!, R.anim.abc_fade_in)
view404?.dismiss(R.anim.abc_fade_out)
view404 = null
} else {
Toast.makeText(this, "already dismissed", Toast.LENGTH_SHORT).show()
}
}
}
}
22 changes: 20 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,28 @@
android:layout_height="match_parent"
android:background="@color/background">

<RelativeLayout
android:id="@+id/errorLayout"
android:background="#000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="50dp"
android:layout_above="@+id/showError">

</RelativeLayout>

<Button
android:id="@+id/button2"
android:id="@+id/showError"
android:layout_above="@+id/dismissError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Error" />

<Button
android:id="@+id/dismissError"
android:layout_alignParentBottom="true"
android:text="show" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dismiss Error" />

</RelativeLayout>
6 changes: 0 additions & 6 deletions app/src/main/res/layout/layout_404.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@
android:textSize="16sp"
android:textStyle="bold" />

<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="dismiss" />
</RelativeLayout>

0 comments on commit 70c160f

Please sign in to comment.