Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

데모를 이쁘게 수정했습니다 #10

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>