Skip to content

Commit 4a640a7

Browse files
authored
[MBL-19586][Student][Teacher] Add Portfolio to the Navigation menu (#3432)
refs: MBL-19586 affects: Student, Teacher release note: Added Portfolio to the navigation menu for Student and Teacher apps * Added Portfolio to the navigation drawer. * Fixed domain handling.
1 parent f9ff5fd commit 4a640a7

File tree

7 files changed

+69
-2
lines changed

7 files changed

+69
-2
lines changed

apps/student/src/main/java/com/instructure/student/activity/NavigationActivity.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
254254
R.id.navigationDrawerItem_files -> {
255255
ApiPrefs.user?.let { handleRoute(FileListFragment.makeRoute(it)) }
256256
}
257-
R.id.navigationDrawerItem_gauge, R.id.navigationDrawerItem_studio, R.id.navigationDrawerItem_mastery -> {
257+
R.id.navigationDrawerItem_gauge, R.id.navigationDrawerItem_studio, R.id.navigationDrawerItem_mastery, R.id.navigationDrawerItem_portfolio -> {
258258
val launchDefinition = v.tag as? LaunchDefinition ?: return@weave
259259
launchLti(launchDefinition)
260260
}
@@ -648,6 +648,7 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
648648
navigationDrawerItemGauge.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
649649
navigationDrawerItemStudio.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
650650
navigationDrawerItemMastery.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
651+
navigationDrawerItemPortfolio.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
651652
navigationDrawerItemBookmarks.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
652653
navigationDrawerItemChangeUser.setOnClickListener(mNavigationDrawerItemClickListener)
653654
navigationDrawerItemHelp.onClickWithRequireNetwork(mNavigationDrawerItemClickListener)
@@ -661,6 +662,7 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
661662
navigationDrawerItemGauge,
662663
navigationDrawerItemStudio,
663664
navigationDrawerItemMastery,
665+
navigationDrawerItemPortfolio,
664666
navigationDrawerItemBookmarks,
665667
navigationDrawerItemChangeUser,
666668
navigationDrawerItemHelp,
@@ -775,6 +777,8 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
775777
navigationDrawerOfflineIndicator.setVisible(isOffline)
776778
navigationDrawerItemStudio.alpha = if (isOffline) 0.5f else 1f
777779
navigationDrawerItemGauge.alpha = if (isOffline) 0.5f else 1f
780+
navigationDrawerItemMastery.alpha = if (isOffline) 0.5f else 1f
781+
navigationDrawerItemPortfolio.alpha = if (isOffline) 0.5f else 1f
778782
navigationDrawerItemHelp.alpha = if (isOffline) 0.5f else 1f
779783
navigationDrawerItemBookmarks.alpha = if (isOffline) 0.5f else 1f
780784
navigationDrawerItemFiles.alpha = if (isOffline) 0.5f else 1f
@@ -1269,6 +1273,7 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
12691273
val studioLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.STUDIO_DOMAIN }
12701274
val gaugeLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.GAUGE_DOMAIN }
12711275
val masteryLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.MASTERY_DOMAIN }
1276+
val portfolioLaunchDefinition = launchDefinitions?.firstOrNull { it.domain?.contains(LaunchDefinition.PORTFOLIO_DOMAIN) == true }
12721277

12731278
val studio = findViewById<View>(R.id.navigationDrawerItem_studio)
12741279
studio.visibility = if (studioLaunchDefinition != null) View.VISIBLE else View.GONE
@@ -1281,6 +1286,10 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog.
12811286
val mastery = findViewById<View>(R.id.navigationDrawerItem_mastery)
12821287
mastery.visibility = if (masteryLaunchDefinition != null) View.VISIBLE else View.GONE
12831288
mastery.tag = masteryLaunchDefinition
1289+
1290+
val portfolio = findViewById<View>(R.id.navigationDrawerItem_portfolio)
1291+
portfolio.visibility = if (portfolioLaunchDefinition != null) View.VISIBLE else View.GONE
1292+
portfolio.tag = portfolioLaunchDefinition
12841293
}
12851294

12861295
override fun addBookmark() {

apps/student/src/main/res/layout/navigation_drawer.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,26 @@
219219

220220
</LinearLayout>
221221

222+
<LinearLayout
223+
android:id="@+id/navigationDrawerItem_portfolio"
224+
style="@style/NavigationDrawerItem"
225+
android:visibility="gone"
226+
tools:ignore="UseCompoundDrawables"
227+
tools:visibility="visible">
228+
229+
<androidx.appcompat.widget.AppCompatImageView
230+
style="@style/NavigationDrawerIcon"
231+
app:srcCompat="@drawable/ic_navigation_portfolio" />
232+
233+
<TextView
234+
android:layout_width="wrap_content"
235+
android:layout_height="wrap_content"
236+
android:text="@string/portfolio"
237+
android:textSize="16sp"
238+
android:textColor="@color/textDarkest"/>
239+
240+
</LinearLayout>
241+
222242
<LinearLayout
223243
android:id="@+id/navigationDrawerSettings"
224244
style="@style/NavigationDrawerItem"

apps/teacher/src/main/java/com/instructure/teacher/activities/InitActivity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class InitActivity : BasePresenterActivity<InitActivityPresenter, InitActivityVi
363363
R.id.navigationDrawerItem_files -> {
364364
RouteMatcher.route(this@InitActivity, Route(FileListFragment::class.java, ApiPrefs.user))
365365
}
366-
R.id.navigationDrawerItem_gauge, R.id.navigationDrawerItem_arc, R.id.navigationDrawerItem_mastery -> {
366+
R.id.navigationDrawerItem_gauge, R.id.navigationDrawerItem_arc, R.id.navigationDrawerItem_mastery, R.id.navigationDrawerItem_portfolio -> {
367367
val launchDefinition = v.tag as? LaunchDefinition ?: return@weave
368368
launchLti(launchDefinition)
369369
}
@@ -422,6 +422,7 @@ class InitActivity : BasePresenterActivity<InitActivityPresenter, InitActivityVi
422422
navigationDrawerItemGauge.setOnClickListener(navDrawerOnClick)
423423
navigationDrawerItemArc.setOnClickListener(navDrawerOnClick)
424424
navigationDrawerItemMastery.setOnClickListener(navDrawerOnClick)
425+
navigationDrawerItemPortfolio.setOnClickListener(navDrawerOnClick)
425426
navigationDrawerItemChangeUser.setOnClickListener(navDrawerOnClick)
426427
navigationDrawerItemLogout.setOnClickListener(navDrawerOnClick)
427428
navigationDrawerSettings.setOnClickListener(navDrawerOnClick)
@@ -434,6 +435,7 @@ class InitActivity : BasePresenterActivity<InitActivityPresenter, InitActivityVi
434435
navigationDrawerItemGauge,
435436
navigationDrawerItemArc,
436437
navigationDrawerItemMastery,
438+
navigationDrawerItemPortfolio,
437439
navigationDrawerItemChangeUser,
438440
navigationDrawerItemHelp,
439441
navigationDrawerItemLogout,
@@ -493,6 +495,7 @@ class InitActivity : BasePresenterActivity<InitActivityPresenter, InitActivityVi
493495
val arcLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.STUDIO_DOMAIN }
494496
val gaugeLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.GAUGE_DOMAIN }
495497
val masteryLaunchDefinition = launchDefinitions?.firstOrNull { it.domain == LaunchDefinition.MASTERY_DOMAIN }
498+
val portfolioLaunchDefinition = launchDefinitions?.firstOrNull { it.domain?.contains(LaunchDefinition.PORTFOLIO_DOMAIN) == true }
496499

497500
navigationDrawerItemArc.setVisible(arcLaunchDefinition != null)
498501
navigationDrawerItemArc.tag = arcLaunchDefinition
@@ -502,6 +505,9 @@ class InitActivity : BasePresenterActivity<InitActivityPresenter, InitActivityVi
502505

503506
navigationDrawerItemMastery.setVisible(masteryLaunchDefinition != null)
504507
navigationDrawerItemMastery.tag = masteryLaunchDefinition
508+
509+
navigationDrawerItemPortfolio.setVisible(portfolioLaunchDefinition != null)
510+
navigationDrawerItemPortfolio.tag = portfolioLaunchDefinition
505511
}
506512

507513
override fun onStartMasquerading(domain: String, userId: Long) {

apps/teacher/src/main/res/layout/navigation_drawer.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,26 @@
170170

171171
</LinearLayout>
172172

173+
<LinearLayout
174+
android:id="@+id/navigationDrawerItem_portfolio"
175+
style="@style/NavigationDrawerItem"
176+
android:visibility="gone"
177+
tools:ignore="UseCompoundDrawables"
178+
tools:visibility="visible">
179+
180+
<androidx.appcompat.widget.AppCompatImageView
181+
style="@style/NavigationDrawerIcon"
182+
app:srcCompat="@drawable/ic_navigation_portfolio" />
183+
184+
<TextView
185+
android:layout_width="wrap_content"
186+
android:layout_height="wrap_content"
187+
android:text="@string/portfolio"
188+
android:textColor="@color/textDarkest"
189+
android:textSize="16sp" />
190+
191+
</LinearLayout>
192+
173193
<LinearLayout
174194
android:id="@+id/navigationDrawerSettings"
175195
style="@style/NavigationDrawerItem"

libs/canvas-api-2/src/main/java/com/instructure/canvasapi2/models/LaunchDefinition.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ data class LaunchDefinition(
3737
const val GAUGE_DOMAIN = "gauge.instructure.com"
3838
const val STUDIO_DOMAIN = "arc.instructure.com" // NOTE: The subdomain hasn't changed to reflect the rebranding of Arc -> Studio yet
3939
const val MASTERY_DOMAIN = "app.masteryconnect.com"
40+
const val PORTFOLIO_DOMAIN = "portfolio.instructure.com"
4041
}
4142
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:pathData="M20.667,21.334H3.333C2.231,21.334 1.333,20.437 1.333,19.334V12.001H8V14.667H16V12.001H22.667V19.334C22.667,20.437 21.769,21.334 20.667,21.334V21.334ZM9.333,13.334H14.667V10.667H9.333V13.334ZM3.333,6.667H8H16H20.667C21.769,6.667 22.667,7.565 22.667,8.667V10.667H16V9.334H8V10.667H1.333V8.667C1.333,7.565 2.231,6.667 3.333,6.667V6.667ZM9.333,3.334C9.333,2.966 9.632,2.667 10,2.667H14C14.368,2.667 14.667,2.966 14.667,3.334V5.334H9.333V3.334ZM20.667,5.334H16V3.334C16,2.231 15.103,1.334 14,1.334H10C8.897,1.334 8,2.231 8,3.334V5.334H3.333C1.496,5.334 0,6.83 0,8.667V19.334C0,21.171 1.496,22.667 3.333,22.667H20.667C22.504,22.667 24,21.171 24,19.334V8.667C24,6.83 22.504,5.334 20.667,5.334V5.334Z"
8+
android:fillColor="#273540"
9+
android:fillType="evenOdd"/>
10+
</vector>

libs/pandares/src/main/res/values/strings_not_translatable.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<string name = "canvasNetwork" translatable="false">Canvas Network</string>
44
<string name="studio" translatable="false">Studio</string>
55
<string name="masteryConnect" translatable="false">Mastery</string>
6+
<string name="portfolio" translatable="false">Portfolio</string>
67
<string name="unsupportedContentMessage" translatable="false">This isn\'t right, you shouldn\'t be here.</string>
78
</resources>

0 commit comments

Comments
 (0)