forked from oppia/oppia-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* display profile name in navigation drawer * Updated code implementation * adding tests * added testcases * Update NavigationDrawerFragmentPresenter.kt * updated nit changes.
- Loading branch information
1 parent
52e1eb4
commit 9bbd10b
Showing
9 changed files
with
314 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/oppia/app/drawer/NavigationDrawerHeaderViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.oppia.app.drawer | ||
|
||
import androidx.databinding.ObservableField | ||
import org.oppia.app.viewmodel.ObservableViewModel | ||
import javax.inject.Inject | ||
|
||
class NavigationDrawerHeaderViewModel @Inject constructor() : ObservableViewModel() { | ||
val profileName = ObservableField<String>("") | ||
} |
14 changes: 12 additions & 2 deletions
14
app/src/main/java/org/oppia/app/testing/NavigationDrawerTestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<com.google.android.material.navigation.NavigationView | ||
android:id="@+id/fragment_drawer_nav_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="start" | ||
android:fitsSystemWindows="true" | ||
app:itemBackground="@android:color/transparent" | ||
app:itemIconTint="@color/drawer_item" | ||
app:itemTextColor="@color/drawer_item" | ||
app:menu="@menu/navigation_drawer_menu"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom" | ||
android:orientation="horizontal" | ||
android:padding="16dp"> | ||
|
||
<ImageView | ||
android:layout_width="24dp" | ||
android:layout_height="24dp" | ||
android:layout_gravity="center_vertical" | ||
android:layout_margin="12dp" | ||
android:src="@drawable/ic_admin_settings_icon_grey_24dp" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_vertical" | ||
android:layout_marginStart="32dp" | ||
android:layout_marginEnd="32dp" | ||
android:fontFamily="sans-serif-medium" | ||
android:text="@string/admin_settings" | ||
android:textColor="@color/black" | ||
android:textSize="14sp" /> | ||
</LinearLayout> | ||
</com.google.android.material.navigation.NavigationView> | ||
</layout> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="176dp" | ||
android:background="@drawable/side_nav_bar" | ||
android:gravity="bottom" | ||
android:orientation="vertical" | ||
android:paddingStart="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingEnd="@dimen/activity_horizontal_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:theme="@style/ThemeOverlay.AppCompat.Dark"> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<ImageView | ||
android:layout_width="64dp" | ||
android:layout_height="64dp" | ||
android:contentDescription="@string/nav_header_desc" | ||
android:paddingTop="8dp" | ||
app:srcCompat="@mipmap/ic_launcher_round" /> | ||
<data> | ||
<variable | ||
name="viewModel" | ||
type="org.oppia.app.drawer.NavigationDrawerHeaderViewModel" /> | ||
</data> | ||
|
||
<TextView | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-medium" | ||
android:paddingTop="8dp" | ||
android:textColor="@color/white" | ||
android:text="@string/nav_header_title" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||
android:textSize="14sp" /> | ||
android:layout_height="176dp" | ||
android:background="@drawable/side_nav_bar" | ||
android:gravity="bottom" | ||
android:orientation="vertical" | ||
android:paddingStart="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingEnd="@dimen/activity_horizontal_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:theme="@style/ThemeOverlay.AppCompat.Dark"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif" | ||
android:textColor="@color/white" | ||
android:text="@string/nav_header_subtitle" | ||
android:textSize="14sp" /> | ||
</LinearLayout> | ||
<ImageView | ||
android:layout_width="64dp" | ||
android:layout_height="64dp" | ||
android:contentDescription="@string/nav_header_desc" | ||
android:paddingTop="8dp" | ||
app:srcCompat="@mipmap/ic_launcher_round" /> | ||
|
||
<TextView | ||
android:id="@+id/nav_header_profile_name" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-medium" | ||
android:paddingTop="8dp" | ||
android:text="@{viewModel.profileName}" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||
android:textColor="@color/white" | ||
android:textSize="14sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif" | ||
android:text="@string/nav_header_subtitle" | ||
android:textColor="@color/white" | ||
android:textSize="14sp" /> | ||
</LinearLayout> | ||
</layout> |
Oops, something went wrong.