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

teams: add plan (fixes #5259) #5261

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class PlanFragment : BaseTeamFragment() {
private var missionText: String? = null
private var servicesText: String? = null
private var rulesText = ""

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
fragmentPlanBinding = FragmentPlanBinding.inflate(inflater, container, false)
return fragmentPlanBinding.root
Expand Down Expand Up @@ -47,11 +48,40 @@ class PlanFragment : BaseTeamFragment() {
fragmentPlanBinding.tvDescription.text = team?.description
}
fragmentPlanBinding.tvDate.text = getString(R.string.two_strings, getString(R.string.created_on), team?.createdDate?.let { formatDate(it) })

fragmentPlanBinding.btnAddPlan.setOnClickListener {
editTeam()
}
}

private fun editTeam() {
if (!isAdded) {
return
}

val existingTeamFragment = parentFragmentManager.findFragmentByTag("TeamFragment") as? TeamFragment

if (existingTeamFragment != null) {
team?.let { existingTeamFragment.createTeamAlert(it) }
} else {
val newTeamFragment = TeamFragment()
parentFragmentManager.beginTransaction()
.add(newTeamFragment, "TeamFragment")
.commit()

parentFragmentManager.executePendingTransactions()

newTeamFragment.view?.post {
team?.let { newTeamFragment.createTeamAlert(it) }

}
}
}


override fun onNewsItemClick(news: RealmNews?) {}
override fun clearImages() {
imageList.clear()
llImage?.removeAllViews()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TeamFragment : Fragment(), AdapterTeamList.OnClickTeamItem {
return fragmentTeamBinding.root
}

private fun createTeamAlert(team: RealmMyTeam?) {
fun createTeamAlert(team: RealmMyTeam?) {
alertCreateTeamBinding = AlertCreateTeamBinding.inflate(LayoutInflater.from(context))
if (TextUtils.equals(type, "enterprise")) {
alertCreateTeamBinding.spnTeamType.visibility = View.GONE
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/res/layout/fragment_plan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
android:padding="@dimen/padding_normal"
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_large" />
<Button
android:id="@+id/btn_add_plan"
style="@style/YellowButtons"
android:background="@drawable/buttonyellow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Plan" />
<TextView
android:id="@+id/tv_date"
android:layout_width="match_parent"
Expand All @@ -26,4 +33,4 @@
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_mid" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
Loading