add fishing event notification on home page
continuous-integration/drone/push Build is passing Details

OpenWeatherApi
Lucas Delanier 2 years ago
parent bb0b05ed91
commit 6635825713

@ -1,11 +1,11 @@
package com.example.shakecraft
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
@ -26,6 +26,7 @@ class HomeFragment : Fragment() {
private lateinit var buttonForge : ConstraintLayout
private lateinit var playermage : ImageView
private lateinit var equipeditem: ImageView
private lateinit var event: LinearLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -37,10 +38,11 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle?
): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val isRaining = (activity as MainActivity).isRaining
val view = inflater.inflate(R.layout.fragment_home,container,false)
// Initialize views
initializeViews(view, currentPlayer)
initializeViews(view, currentPlayer, isRaining)
return view
}
@ -50,7 +52,7 @@ class HomeFragment : Fragment() {
val
}
}*/
private fun initializeViews(view: View, currentPlayer : Player) {
private fun initializeViews(view: View, currentPlayer : Player, isRaining : Boolean) {
pseudo = view.findViewById(R.id.pseudoTextView)
progressbar = view.findViewById(R.id.levelProgressBar)
level = view.findViewById(R.id.levelTextView)
@ -60,6 +62,7 @@ class HomeFragment : Fragment() {
playermage = view.findViewById(R.id.playerImage)
buttonCollect = view.findViewById(R.id.buttonCollect)
equipeditem = view.findViewById(R.id.equipedItemAttack)
event = view.findViewById(R.id.event_container)
buttonCollect.setOnClickListener{
findNavController().navigate(R.id.action_homeFragment_to_collectFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build())
}
@ -81,6 +84,10 @@ class HomeFragment : Fragment() {
playermage.setImageResource(currentPlayer.image)
if(currentPlayer.equipedItem?.type?.image != null) equipeditem.setImageResource(
currentPlayer.equipedItem!!.type.image)
if(isRaining == false){
event.visibility = View.VISIBLE
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@ -301,7 +301,7 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Craft ever more powerful tools."
android:text="Collect ressources to became powerfull."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
@ -357,7 +357,7 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Craft ever more powerful tools."
android:text="Defeat boss to gain Mystic rewards."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
@ -365,6 +365,51 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:orientation="vertical"
android:id="@+id/event_container"
android:layout_height="wrap_content"
android:gravity="center"
android:visibility="gone"
android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:paddingBottom="20dp">
<ImageView
android:id="@+id/event_message"
android:visibility="visible"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="300dip"
android:src="@drawable/event_message"
android:scaleType="centerCrop"
android:adjustViewBounds ="true">
</ImageView>
<ImageView
android:id="@+id/buttonFishing"
android:visibility="visible"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="380dip"
android:src="@drawable/fishing_event"
android:scaleType="centerCrop"
android:adjustViewBounds ="true">
</ImageView>
</LinearLayout>

Loading…
Cancel
Save