mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 12:22:08 +01:00
Made navdrawer header section with profile image and name clickable as replacement for removed profile navdrawer item
This commit is contained in:
parent
4cb91d430a
commit
16e1a4ea0c
3 changed files with 15 additions and 15 deletions
|
@ -378,6 +378,18 @@ public class MainActivity extends AppCompatActivity
|
||||||
navView.setNavigationItemSelectedListener(this);
|
navView.setNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
View navHeader = navView.getHeaderView(0);
|
View navHeader = navView.getHeaderView(0);
|
||||||
|
LinearLayout navheaderProfileSection = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
|
||||||
|
navheaderProfileSection.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
navDrawer.closeDrawer(GravityCompat.START);
|
||||||
|
if (WebHelper.isOnline(MainActivity.this)) {
|
||||||
|
webView.loadUrl(urls.getProfileUrl());
|
||||||
|
} else {
|
||||||
|
snackbarNoInternet.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
navheaderTitle = ButterKnife.findById(navHeader, R.id.navheader_title);
|
navheaderTitle = ButterKnife.findById(navHeader, R.id.navheader_title);
|
||||||
navheaderDescription = ButterKnife.findById(navHeader, R.id.podselection__podupti_notice);
|
navheaderDescription = ButterKnife.findById(navHeader, R.id.podselection__podupti_notice);
|
||||||
navheaderImage = ButterKnife.findById(navHeader, R.id.navheader_user_image);
|
navheaderImage = ButterKnife.findById(navHeader, R.id.navheader_user_image);
|
||||||
|
@ -939,15 +951,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.nav_profile: {
|
|
||||||
if (WebHelper.isOnline(MainActivity.this)) {
|
|
||||||
webView.loadUrl(urls.getProfileUrl());
|
|
||||||
} else {
|
|
||||||
snackbarNoInternet.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.nav_followed_tags: {
|
case R.id.nav_followed_tags: {
|
||||||
if (WebHelper.isOnline(MainActivity.this)) {
|
if (WebHelper.isOnline(MainActivity.this)) {
|
||||||
WebHelper.showFollowedTagsList(webView, app);
|
WebHelper.showFollowedTagsList(webView, app);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
android:src="@drawable/header" />
|
android:src="@drawable/header" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/nav_profile_picture"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
@ -20,7 +21,8 @@
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:clickable="true">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/navheader_user_image"
|
android:id="@+id/navheader_user_image"
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
android:icon="@drawable/jb_stream"
|
android:icon="@drawable/jb_stream"
|
||||||
android:title="@string/nav_stream" />
|
android:title="@string/nav_stream" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_profile"
|
|
||||||
android:icon="@drawable/ic_person_black_48px"
|
|
||||||
android:title="@string/nav_profile" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_followed_tags"
|
android:id="@+id/nav_followed_tags"
|
||||||
android:icon="@drawable/ic_local_offer_black_48px"
|
android:icon="@drawable/ic_local_offer_black_48px"
|
||||||
|
|
Loading…
Reference in a new issue