Skip to content

Commit

Permalink
Release Student 6.14.1 (231) (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
hermannakos authored Sep 10, 2021
1 parent 7cbac9f commit 745ce14
Show file tree
Hide file tree
Showing 58 changed files with 1,085 additions and 407 deletions.
4 changes: 2 additions & 2 deletions apps/student/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ android {
applicationId "com.instructure.candroid"
minSdkVersion Versions.MIN_SDK
targetSdkVersion Versions.TARGET_SDK
versionCode = 230
versionName = '6.14.0'
versionCode = 231
versionName = '6.14.1'

vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class FlutterCalendarFragment : FlutterFragment() {

// Perform onBackPressed on the FlutterFragment, which will attempt to pop the current route and update
// the 'shouldPop' value for future use.
onBackPressed()
if (!shouldPop) {
onBackPressed()
}

// If 'shouldPop' was true it means we just popped a CalendarScreen in Flutter and that we should also
// allow this fragment to be popped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ import com.google.android.material.tabs.TabLayout
import com.instructure.canvasapi2.models.CanvasContext
import com.instructure.interactions.router.Route
import com.instructure.pandautils.features.elementary.ElementaryDashboardPagerAdapter
import com.instructure.pandautils.features.elementary.grades.GradesFragment
import com.instructure.pandautils.features.elementary.homeroom.HomeroomFragment
import com.instructure.pandautils.features.elementary.resources.ResourcesFragment
import com.instructure.pandautils.features.elementary.schedule.pager.SchedulePagerFragment
import com.instructure.pandautils.utils.Const
import com.instructure.pandautils.utils.ParcelableArg
import com.instructure.pandautils.utils.isTablet
import com.instructure.pandautils.utils.makeBundle
import com.instructure.student.R
import com.instructure.student.databinding.FragmentElementaryDashboardBinding
import com.instructure.student.fragment.ParentFragment
import kotlinx.android.synthetic.main.fragment_course_grid.toolbar
import kotlinx.android.synthetic.main.fragment_elementary_dashboard.*
Expand All @@ -38,30 +43,40 @@ class ElementaryDashboardFragment : ParentFragment() {

private val canvasContext by ParcelableArg<CanvasContext>(key = Const.CANVAS_CONTEXT)

private val schedulePagerFragment = SchedulePagerFragment.newInstance()

private val fragments = listOf(
HomeroomFragment.newInstance(),
schedulePagerFragment,
GradesFragment.newInstance(),
ResourcesFragment.newInstance()
)

override fun title(): String = if (isAdded) getString(R.string.dashboard) else ""

override fun applyTheme() {
toolbar.title = title()
navigation?.attachNavigationDrawer(this, toolbar)
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
layoutInflater.inflate(R.layout.fragment_elementary_dashboard, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding = FragmentElementaryDashboardBinding.inflate(inflater, container, false)
binding.lifecycleOwner = this
binding.todayButtonVisibility = schedulePagerFragment.getTodayButtonVisibility()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.todayButton.setOnClickListener {
schedulePagerFragment.jumpToToday()
}

dashboardPager.adapter = ElementaryDashboardPagerAdapter(canvasContext, childFragmentManager)
dashboardPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit
binding.dashboardPager.offscreenPageLimit = fragments.size

override fun onPageSelected(position: Int) {
DashboardStateStore.currentPage = position
}
return binding.root
}

override fun onPageScrollStateChanged(state: Int) = Unit
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

})
dashboardPager.adapter = ElementaryDashboardPagerAdapter(fragments, childFragmentManager)
dashboardTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabReselected(tab: TabLayout.Tab?) = Unit

Expand All @@ -70,12 +85,15 @@ class ElementaryDashboardFragment : ParentFragment() {
override fun onTabSelected(tab: TabLayout.Tab?) {
tab?.let {
dashboardPager.setCurrentItem(it.position, !isTablet)
if (it.position != fragments.indexOf(schedulePagerFragment)) {
todayButton.visibility = View.GONE
} else {
todayButton.visibility =
if (schedulePagerFragment.getTodayButtonVisibility().value == true) View.VISIBLE else View.GONE
}
}
}
})

dashboardPager.setCurrentItem(DashboardStateStore.currentPage, false)
dashboardTabLayout.getTabAt(DashboardStateStore.currentPage)?.select()
}

override fun onHiddenChanged(hidden: Boolean) {
Expand All @@ -93,9 +111,4 @@ class ElementaryDashboardFragment : ParentFragment() {

fun makeRoute(canvasContext: CanvasContext?) = Route(ElementaryDashboardFragment::class.java, canvasContext)
}
}

object DashboardStateStore {

var currentPage: Int = 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,82 +14,108 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
~
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/elementaryDashboardPage"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/defaultPrimary"
android:elevation="6dp"
app:layout_constraintTop_toTopOf="parent"
app:theme="@style/ToolBarStyle" />
<data>

<com.google.android.material.tabs.TabLayout
android:id="@+id/dashboardTabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:tabContentStart="8dp"
app:tabIconTint="@color/tab_layout_icon_tint"
app:tabIndicator="@drawable/tab_bar_indicator"
app:tabIndicatorColor="@color/blueAnnotation"
app:tabIndicatorFullWidth="false"
app:tabIndicatorHeight="3dp"
app:tabInlineLabel="true"
app:tabMode="scrollable"
app:tabPaddingEnd="12dp"
app:tabPaddingStart="8dp"
app:tabSelectedTextColor="@color/blueAnnotation"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabTextColor="@color/defaultTextDark">
<import type="android.view.View" />

<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_homeroom"
android:text="@string/dashboardTabHomeroom" />
<variable
name="todayButtonVisibility"
type="androidx.lifecycle.LiveData&lt;Boolean>" />
</data>

<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_schedule"
android:text="@string/dashboardTabSchedule" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/elementaryDashboardPage"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.tabs.TabItem
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_dashboard_grades"
android:text="@string/dashboardTabGrades" />
android:layout_height="?android:attr/actionBarSize"
android:background="@color/defaultPrimary"
android:elevation="6dp"
app:layout_constraintTop_toTopOf="parent"
app:theme="@style/ToolBarStyle">

<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
<ImageView
android:id="@+id/todayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:contentDescription="@string/a11y_content_description_schedule_jump_to_today"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="16dp"
android:src="@drawable/ic_jump_to_today"
android:visibility="@{todayButtonVisibility ? View.VISIBLE : View.GONE, default = gone}" />
</androidx.appcompat.widget.Toolbar>

<com.google.android.material.tabs.TabLayout
android:id="@+id/dashboardTabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_resources"
android:text="@string/dashboardTabResources" />
android:background="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:tabContentStart="8dp"
app:tabIconTint="@color/tab_layout_icon_tint"
app:tabIndicator="@drawable/tab_bar_indicator"
app:tabIndicatorColor="@color/blueAnnotation"
app:tabIndicatorFullWidth="false"
app:tabIndicatorHeight="3dp"
app:tabInlineLabel="true"
app:tabMode="scrollable"
app:tabPaddingEnd="12dp"
app:tabPaddingStart="8dp"
app:tabSelectedTextColor="@color/blueAnnotation"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabTextColor="@color/defaultTextDark">

</com.google.android.material.tabs.TabLayout>
<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_homeroom"
android:text="@string/dashboardTabHomeroom" />

<View
android:id="@+id/tabLayoutDivider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/dividerColor"
app:layout_constraintTop_toBottomOf="@id/dashboardTabLayout" />

<com.instructure.pandautils.views.ViewPagerNonSwipeable
android:id="@+id/dashboardPager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/tabLayoutDivider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_schedule"
android:text="@string/dashboardTabSchedule" />

<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_dashboard_grades"
android:text="@string/dashboardTabGrades" />

<com.google.android.material.tabs.TabItem
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_resources"
android:text="@string/dashboardTabResources" />

</com.google.android.material.tabs.TabLayout>

<View
android:id="@+id/tabLayoutDivider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/dividerColor"
app:layout_constraintTop_toBottomOf="@id/dashboardTabLayout" />

<com.instructure.pandautils.views.ViewPagerNonSwipeable
android:id="@+id/dashboardPager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tabLayoutDivider" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading

0 comments on commit 745ce14

Please sign in to comment.