daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layout xmlns:android="http://schemas.android.com/apk/res/android"
  3.         xmlns:app="http://schemas.android.com/apk/res-auto"
  4.         xmlns:tools="http://schemas.android.com/tools"
  5.         tools:context="MainActivity"
  6.     >
  7.     <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
  8.     <android.support.v4.widget.DrawerLayout
  9.         android:id="@+id/drawer_layout"
  10.         android:layout_width="match_parent"
  11.         android:layout_height="match_parent"
  12.         >
  13.  
  14.         <!-- As the main content view, the view below consumes the entire
  15.              space available using match_parent in both dimensions. -->
  16.  
  17.         <RelativeLayout
  18.             android:layout_width="match_parent"
  19.             android:layout_height="match_parent">
  20.  
  21.             <LinearLayout
  22.                 android:id="@+id/ll_container"
  23.                 android:layout_width="match_parent"
  24.                 android:layout_height="match_parent"
  25.                 android:orientation="vertical">
  26.  
  27.                 <android.support.v7.widget.Toolbar
  28.                     android:id="@+id/my_awesome_toolbar"
  29.                     android:layout_width="match_parent"
  30.                     android:layout_height="wrap_content"
  31.                     android:background="@android:color/black"
  32.                     android:fitsSystemWindows="true"
  33.                     >
  34.  
  35.                     <TextView
  36.                         android:id="@+id/toolbar_title"
  37.                         android:layout_width="wrap_content"
  38.                         android:layout_height="wrap_content"
  39.                         android:layout_marginLeft="10dp"
  40.                         android:layout_marginStart="10dp"
  41.                         android:textColor="@android:color/white"
  42.                         android:textSize="@dimen/abc_text_size_title_material_toolbar"
  43.                         tools:text="@string/default_toolbar_title"/>
  44.  
  45.                 </android.support.v7.widget.Toolbar>
  46.  
  47.  
  48.                 <FrameLayout
  49.                     android:id="@+id/container"
  50.                     android:layout_width="match_parent"
  51.                     android:layout_height="match_parent">
  52.  
  53.                 </FrameLayout>
  54.             </LinearLayout>
  55.  
  56.             <android.support.design.widget.FloatingActionButton
  57.                 android:id="@+id/fab_fuf"
  58.                 android:layout_width="wrap_content"
  59.                 android:layout_height="wrap_content"
  60.                 android:layout_alignParentBottom="true"
  61.                 android:layout_alignParentEnd="true"
  62.                 android:layout_alignParentRight="true"
  63.                 android:layout_marginBottom="20dp"
  64.                 android:layout_marginEnd="20dp"
  65.                 android:layout_marginRight="20dp"
  66.                 android:src="@drawable/flamme"
  67.                 app:fabSize="normal"
  68.                 />
  69.         </RelativeLayout>
  70.  
  71.         <android.support.design.widget.NavigationView
  72.             android:id="@+id/navigation_view"
  73.             android:layout_width="wrap_content"
  74.             android:layout_height="match_parent"
  75.             android:layout_gravity="start"
  76.             android:background="@android:color/black"
  77.             **app:headerLayout="@layout/drawer_header"**
  78.             app:itemTextColor="@color/drawer_item_color_selector"
  79.             app:menu="@menu/menu_drawer"/>
  80.  
  81.     </android.support.v4.widget.DrawerLayout>
  82. </layout>
  83.    
  84. ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
  85.  
  86.         Toolbar toolbar = binding.myAwesomeToolbar;
  87.         toolbarTitle = binding.toolbarTitle;
  88.         BalrogFontsHelper.SetKhandBoldToView(toolbarTitle);
  89.         setSupportActionBar(toolbar);
  90.         final ActionBar actionBar = getSupportActionBar();
  91.         if (actionBar != null) {
  92.             actionBar.setHomeAsUpIndicator(R.drawable.ic_dehaze_white_24);
  93.             actionBar.setDisplayHomeAsUpEnabled(true);
  94.             actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
  95.             actionBar.setDisplayShowTitleEnabled(false);
  96.         }
  97.  
  98.  
  99.         drawerLayout = binding.drawerLayout;
  100.         **tvLoggedUserEmail = (TextView) findViewById(R.id.tv_logged_user_email);**
  101.         BalrogFontsHelper.SetKhandBoldToView(tvLoggedUserEmail);
  102.    
  103. <?xml version="1.0" encoding="utf-8"?>
  104.  
  105. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  106.                 android:layout_width="match_parent"
  107.                 android:layout_height="96dp"
  108.                 xmlns:tools="http://schemas.android.com/tools"
  109.                 android:background="@android:color/black"
  110.                 android:theme="@style/ThemeOverlay.AppCompat.Dark">
  111.  
  112.  
  113.     <TextView
  114.         android:id="@+id/tv_logged_user_email"
  115.         android:layout_width="wrap_content"
  116.         android:layout_height="wrap_content"
  117.         android:layout_centerVertical="true"
  118.         android:layout_marginLeft="16dp"
  119.         tools:text="@string/login_placeholder_email"
  120.         android:textAllCaps="true"
  121.         android:textAppearance="@style/TextAppearance.AppCompat.Body2"
  122.         android:textSize="20sp"/>
  123.  
  124.  
  125. </RelativeLayout>
  126.    
  127. **tvLoggedUserEmail = binding.tvLoggedUserEmail;**
  128.    
  129. <data>
  130.     <variable
  131.         name="dashboard"
  132.         type="ramps.view.model.DashboardScreenViewModel"/>
  133. </data>
  134.  
  135. <android.support.v4.widget.DrawerLayout
  136.     android:id="@+id/drawer_layout"
  137.     android:layout_width="match_parent"
  138.     android:layout_height="match_parent"
  139.     android:fitsSystemWindows="true"
  140.     tools:openDrawer="start">
  141.  
  142.     <include
  143.         layout="@layout/activity_dashboard"
  144.         android:layout_width="match_parent"
  145.         android:layout_height="match_parent"
  146.         bind:dashboard="@{dashboard}"
  147.         />
  148.  
  149.     <android.support.design.widget.NavigationView
  150.         android:id="@+id/nav_view"
  151.         android:background="@color/white"
  152.         android:layout_width="wrap_content"
  153.         android:layout_height="match_parent"
  154.         android:layout_gravity="start"
  155.         android:fitsSystemWindows="true"
  156.         app:navigationItemSelectedListener="@{dashboard.onMenuItemSelected}"
  157.         app:model="@{dashboard.score}"
  158.         app:menu="@menu/activity_main_drawer"/>
  159.  
  160. </android.support.v4.widget.DrawerLayout>
  161.    
  162. public class NavigationViewExtensions {
  163.  
  164. @BindingAdapter({"bind:model"})
  165. public static void loadHeader(NavigationView view, ScoreViewModel model) {
  166.     ViewNavigationHeaderBinding binding = ViewNavigationHeaderBinding.inflate(LayoutInflater.from(view.getContext()));
  167.     binding.setScore(model);
  168.     binding.executePendingBindings();
  169.     view.addHeaderView(binding.getRoot());
  170.   }
  171. }
  172.    
  173. <layout xmlns:android="http://schemas.android.com/apk/res/android"
  174.     xmlns:bind="http://schemas.android.com/apk/res-auto"
  175. >
  176.  
  177. <data>
  178.  
  179.     <import type="android.view.View"/>
  180.  
  181.     <variable
  182.         name="score"
  183.         type="ramps.view.model.ScoreViewModel"/>
  184. </data>
  185.  
  186. <LinearLayout
  187.     android:layout_width="match_parent"
  188.     android:layout_height="wrap_content"
  189.     android:background="@color/graphite"
  190.     android:gravity="bottom"
  191.     android:orientation="vertical"
  192.     android:paddingBottom="@dimen/activity_vertical_margin_large"
  193.     android:paddingLeft="@dimen/activity_horizontal_margin"
  194.     android:paddingRight="@dimen/activity_horizontal_margin"
  195.     android:paddingTop="@dimen/activity_vertical_margin_large"
  196.     android:theme="@style/ThemeOverlay.AppCompat.Dark">
  197.  
  198.     <include
  199.         android:id="@+id/player_details_header_score"
  200.         layout="@layout/view_avatar_score_header"
  201.         bind:score="@{score}"/>
  202.  
  203. </LinearLayout>
  204.    
  205. DrawerHeaderBinding drawerHeaderBinding = DrawerHeaderBinding.inflate(LayoutInflater.from(navigationView.getContext()));
  206. navigationView.addHeaderView(drawerHeaderBinding.getRoot());
  207. drawerHeaderBinding.tvLoggedUserEmail = "email";
  208. drawerHeaderBinding.executePendingBindings();
  209.    
  210. ImageView imageView = (ImageView) navigationView.getHeaderView(0).findViewById(R.id.imageButton);
  211.  
  212. imageView.setOnClickListener(new View.OnClickListener() {
  213.     @Override
  214.     public void onClick(View v) {
  215.  
  216.         if (flag) {
  217.             navigationView.getMenu().clear(); //clear old inflated items.
  218.             navigationView.inflateMenu(R.menu.drawer_view1);
  219.             flag = false;
  220.         } else {
  221.             navigationView.getMenu().clear(); //clear old inflated items.
  222.             navigationView.inflateMenu(R.menu.drawer_view);
  223.             flag = true;
  224.         }
  225.     }
  226. });
  227.    
  228. View headerView = binding.navigationView.getHeaderView(0);
  229. DrawerHeaderBinding headerBinding = DrawerHeaderBinding.bind(headerView);
  230.    
  231. <layout xmlns:android="http://schemas.android.com/apk/res/android">
  232. <RelativeLayout
  233.     android:layout_width="match_parent"
  234.     android:layout_height="@dimen/navigation_view_header_height"
  235.     android:paddingLeft="@dimen/navigation_view_padding"
  236.     android:paddingTop="@dimen/navigation_view_top_padding"
  237.     android:background="@color/colorPrimary">
  238.  
  239.  
  240.     <ImageView
  241.         android:id="@+id/avatar"
  242.         android:layout_width="@dimen/avatar_dimen"
  243.         android:layout_height="@dimen/avatar_dimen"
  244.         android:contentDescription="@null"
  245.         android:src="@drawable/default_avatar" />
  246.  
  247.     <TextView
  248.         android:id="@+id/profile_email"
  249.         android:layout_width="match_parent"
  250.         android:layout_height="48dp"
  251.         android:layout_below="@+id/avatar"
  252.         android:text="email"
  253.         android:textColor="@color/white"
  254.         android:layout_alignParentBottom="true"
  255.         android:gravity="center_vertical" />
  256.  
  257. </RelativeLayout>
  258. </layout>
  259.    
  260. <layout xmlns:android="http://schemas.android.com/apk/res/android"
  261.     xmlns:app="http://schemas.android.com/apk/res-auto">
  262.     <data>
  263.         <variable
  264.             name="navigationItemSelectedListener"
  265.             type="com.example.MainActivity"/>
  266.     </data>
  267. <android.support.v4.widget.DrawerLayout
  268.     android:id="@+id/drawer_layout"
  269.     android:layout_width="match_parent"
  270.     android:layout_height="match_parent"
  271.     android:fitsSystemWindows="true"
  272.     android:tag="layout">
  273.  
  274.     <LinearLayout
  275.         android:layout_width="match_parent"
  276.         android:layout_height="match_parent"
  277.         android:orientation="vertical">
  278.  
  279.         <android.support.v7.widget.Toolbar
  280.             android:id="@+id/my_toolbar"
  281.             android:layout_width="match_parent"
  282.             android:layout_height="?attr/actionBarSize"
  283.             app:titleTextColor="@color/white"
  284.             android:background="@color/colorPrimary"
  285.             app:theme="@style/Toolbar.Theme"
  286.             app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
  287.  
  288.         <FrameLayout
  289.             android:id="@+id/fragment_container"
  290.             android:layout_width="match_parent"
  291.             android:layout_height="match_parent" />
  292.     </LinearLayout>
  293.  
  294.     <android.support.design.widget.NavigationView
  295.         android:id="@+id/navigation_view"
  296.         android:layout_width="@dimen/navigation_view_width"
  297.         android:layout_height="match_parent"
  298.         android:layout_gravity="start"
  299.         android:fitsSystemWindows="true"
  300.         app:theme="@style/Theme.AppCompat.Light"
  301.         app:menu="@menu/drawer_menu"
  302.         app:navigationItemSelectedListener="@{navigationItemSelectedListener::onNavigationItemSelected}"/>
  303.  
  304. </android.support.v4.widget.DrawerLayout>
  305. </layout>
  306.    
  307. ActivityMainBinding activityMainBinding = DataBindingUtil.setContentView(this,
  308.                 R.layout.activity_main);
  309. activityMainBinding.setNavigationItemSelectedListener(this);/* with this line navigation menu item selection events are handled in onNavigationItemSelected() specified in navigation_view_header.xml*/
  310.  
  311. NavigationViewHeaderBinding navigationViewHeaderBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.navigation_view_header,activityMainBinding.navigationView,false);
  312.         activityMainBinding.navigationView.addHeaderView(navigationViewHeaderBinding.getRoot());
  313.    
  314. <android.support.design.widget.NavigationView
  315.     android:id="@+id/navigationView"
  316.     android:layout_width="wrap_content"
  317.     android:layout_height="match_parent"
  318.     android:layout_gravity="start"
  319.     android:fitsSystemWindows="true"
  320.     app:headerLayout="@layout/nav_drawer_header"
  321.     app:menu="@menu/menu_nav_drawer"/>
  322.    
  323. View headerContainer = navigationView.getHeaderView(0); // This returns the container layout in nav_drawer_header.xml (e.g., your RelativeLayout or LinearLayout)
  324. TextView textView2 = (TextView)headerContainer.findViewById(R.id.textView2);
  325. textView2.setText("Sorted!");
  326.    
  327. (View) navigationView.findViewById(R.id.idOfViewFromHeaderView);
  328.    
  329. (View) findViewById(R.id.idOfViewFromHeaderView);
  330.    
  331. TextView profile,info;
  332.         NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
  333.         profile = navigationView.getHeaderView(0).findViewById(R.id.profile);
  334.         info = navigationView.getHeaderView(0).findViewById(R.id.info);
  335.         profile.setOnClickListener(this);
  336.         info.setOnClickListener(this);
  337.    
  338. NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
  339.  
  340.     NavHeaderMainBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.nav_header_main, navigationView, false);
  341.  
  342.     navigationView.addHeaderView(binding.getRoot());
  343.    
  344. <android.support.v4.widget.DrawerLayout
  345.     android:id="@+id/drawer_layout"
  346.     android:layout_width="match_parent"
  347.     android:layout_height="match_parent"
  348.     android:fitsSystemWindows="true"
  349.     tools:openDrawer="start">
  350.  
  351.     <RelativeLayout
  352.         android:id="@+id/content_frame"
  353.         android:layout_width="match_parent"
  354.         android:layout_height="match_parent">
  355.  
  356.         <android.support.design.widget.AppBarLayout
  357.             android:layout_width="match_parent"
  358.             android:layout_height="wrap_content">
  359.  
  360.             <include layout="@layout/toolbar" />
  361.  
  362.         </android.support.design.widget.AppBarLayout>
  363.  
  364.     </RelativeLayout>
  365.  
  366.     <android.support.design.widget.NavigationView
  367.         android:id="@+id/nav_view"
  368.         android:layout_width="wrap_content"
  369.         android:layout_height="match_parent"
  370.         android:layout_gravity="start"
  371.         android:fitsSystemWindows="true"
  372.         app:menu="@menu/activity_main_drawer" />
  373.  
  374. </android.support.v4.widget.DrawerLayout>
  375.    
  376. <layout xmlns:android="http://schemas.android.com/apk/res/android"
  377. xmlns:app="http://schemas.android.com/apk/res-auto">
  378.  
  379. <data>
  380.  
  381.     <variable
  382.         name="account"
  383.         type="lonja.dreamteam.su.trainingdiary.view_model.AccountViewModel"/>
  384.  
  385. </data>
  386.  
  387. <LinearLayout
  388.     android:layout_width="match_parent"
  389.     android:layout_height="@dimen/nav_header_height"
  390.     android:background="@drawable/header_background"
  391.     android:gravity="bottom"
  392.     android:orientation="vertical"
  393.     android:paddingBottom="@dimen/activity_vertical_margin"
  394.     android:paddingLeft="@dimen/activity_horizontal_margin"
  395.     android:paddingRight="@dimen/activity_horizontal_margin"
  396.     android:paddingTop="@dimen/activity_vertical_margin"
  397.     android:theme="@style/ThemeOverlay.AppCompat.Dark">
  398.  
  399.     <de.hdodenhof.circleimageview.CircleImageView
  400.         android:id="@+id/imageView"
  401.         android:layout_width="72dp"
  402.         android:layout_height="72dp"
  403.         android:src="@{account.sex}"
  404.         app:civ_border_color="@color/colorAccent"
  405.         app:civ_border_width="0dp" />
  406.  
  407.     <TextView
  408.         android:id="@+id/userName"
  409.         android:layout_width="match_parent"
  410.         android:layout_height="wrap_content"
  411.         android:paddingTop="@dimen/nav_header_vertical_spacing"
  412.         android:text="@{account.name}"
  413.         android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
  414.  
  415. </LinearLayout>
  416.    
  417. NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
  418.    
  419. CircleImageView circleView = (CircleImageView) navigationView.findViewById(R.id.circleView);
  420.     TextView name = (TextView) navigationView.findViewById(R.id.name);
  421.     TextView email = (TextView) navigationView.findViewById(R.id.email);
  422.     LinearLayout header = (LinearLayout) navigationView.findViewById(R.id.header);
  423.    
  424. name.setText(NAME);
  425.         email.setText(EMAIL);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top