@SuppressLint("JavascriptInterface")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    Activity activity = this.getActivity();
    appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
    Intent i_getvalue = activity.getIntent();
    String action = i_getvalue.getAction();

    if (Intent.ACTION_VIEW.equals(action)) {
      Uri uri = i_getvalue.getData();
      if (uri != null) {
        String title = uri.getQueryParameter("title");
        postid = uri.getQueryParameter("postid");
        appBarLayout.setTitle(title); // 设置文章标题
      }
    } else if (getArguments().containsKey(ARG_ITEM_ID)) {
      // Load the models rawData specified by the fragment
      // arguments. In a real-world scenario, use a Loader
      // to load rawData from a rawData provider.
      postid = getArguments().getString(ARG_ITEM_ID);
      String title = getArguments().getString(ARG_POST_TITLE);
      appBarLayout.setTitle(title); // 设置文章标题
      SinglePostActivity.shareTitle = title;
    }
  }
  private void setupCollapsingToolbarLayout() {

    if (collapsingToolbarLayout != null) {
      collapsingToolbarLayout.setContentScrimColor(getResources().getColor(R.color.colorPrimary));
      collapsingToolbarLayout.setStatusBarScrimColor(getResources().getColor(R.color.colorPrimary));
    }
  }
  protected void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    if (ab != null) {
      ab.setDisplayHomeAsUpEnabled(true);
    }

    // Status bar
    if (Build.VERSION.SDK_INT >= 21) {
      getWindow().setStatusBarColor(Color.parseColor(mColors[GridActivity.DARK_PRIMARY]));
    }

    // Entire bar layout
    int barColor = Color.parseColor(mColors[GridActivity.PRIMARY]);
    AppBarLayout barLayout = (AppBarLayout) this.findViewById(R.id.app_bar);
    if (barLayout != null) {
      barLayout.setBackgroundColor(barColor);
    }
    toolbar.setBackgroundColor(barColor);

    CollapsingToolbarLayout collapsingToolbarLayout =
        (CollapsingToolbarLayout) this.findViewById(R.id.toolbar_layout);
    if (collapsingToolbarLayout != null) {
      collapsingToolbarLayout.setBackgroundColor(barColor);
      collapsingToolbarLayout.setContentScrimColor(barColor);
    }
  }
 private void setTypefaces() {
   collapsingToolbarLayout.setCollapsedTitleTypeface(Preferences.getInstance().getTypeface());
   collapsingToolbarLayout.setExpandedTitleTypeface(Preferences.getInstance().getTypeface());
   TextView detailsTitle = (TextView) findViewById(R.id.details_text_details);
   detailsTitle.setTypeface(Preferences.getInstance().getTypeface());
   cityTextView.setTypeface(Preferences.getInstance().getTypeface());
   countryTextView.setTypeface(Preferences.getInstance().getTypeface());
   coordinatesTextView.setTypeface(Preferences.getInstance().getTypeface());
   googleMapsHintTextView.setTypeface(Preferences.getInstance().getTypeface());
   attributionTextView.setTypeface(Preferences.getInstance().getTypeface());
   shareLinkTextView.setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_text_region))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_country_title))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_coords_title))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_gmaps_link_icon_title))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_others_title))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_attribution_title))
       .setTypeface(Preferences.getInstance().getTypeface());
   ((TextView) findViewById(R.id.details_share_link_title))
       .setTypeface(Preferences.getInstance().getTypeface());
 }
 private void setHeader() {
   ImageView picture;
   CollapsingToolbarLayout header = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
   header.setTitle(gnome.getName());
   picture = (ImageView) header.findViewById(R.id.header_picture);
   Picasso.with(this).load(gnome.getPicture()).fit().centerCrop().into(picture);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);

    setupDrawerContent();

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(getResources().getString(R.string.app_name));

    final ImageView imageView = (ImageView) findViewById(R.id.backdrop);
    Glide.with(this).load(R.drawable.cheese_3).centerCrop().into(imageView);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.shatgombuj);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle("Shat Gombuj Masjid");

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(
                    view,
                    "Thanks for reading, Plz visit Bangladesh for more.",
                    Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });
  }
 @AfterViews
 void init() {
   initToolbar();
   CollapsingToolbarLayout collapsingToolbar =
       (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
   collapsingToolbar.setTitle(title);
   loadData();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_car_details);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(getString(R.string.carro_detalhes_nome));
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_article_detail, container, false);

    // Show the Article content
    if (mItem != null) {
      Picasso.with(getActivity())
          .load(mItem.getImageUrl())
          .error(R.drawable.ckl_logo)
          .placeholder(R.drawable.ckl_logo)
          .into(((ImageView) rootView.findViewById(R.id.articleImageDetail)));

      ((TextView) rootView.findViewById(R.id.articleTitleDetail)).setText(mItem.getTitle());
      ((TextView) rootView.findViewById(R.id.articleAuthorDetail)).setText(mItem.getAuthors());
      ((TextView) rootView.findViewById(R.id.articleWebsiteDetail)).setText(mItem.getWebsite());
      String date = new JsonDateConverter().getDateFormat().format(mItem.getDate());
      ((TextView) rootView.findViewById(R.id.articleDateDetail)).setText(date);
      ((TextView) rootView.findViewById(R.id.articleContentDetail)).setText(mItem.getContent());

      FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabRead);
      fab.setSelected(mItem.getRead());
      fab.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              boolean val = !mItem.getRead();
              mItem.setRead(val);

              Snackbar.make(
                      v,
                      val
                          ? R.string.snackbar_message_mark_read
                          : R.string.snackbar_message_unmark_read,
                      Snackbar.LENGTH_SHORT)
                  .show();
              v.setSelected(val);

              ArticleDAO.getInstance().updateReadState(mItem);
            }
          });
    }

    // Prevent from exception when toolbar is half-way collapsed and a touch is made on image
    final CollapsingToolbarLayout collapsingToolbarLayout =
        (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
    collapsingToolbarLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    return rootView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    CollapsingToolbarLayout ctl = (CollapsingToolbarLayout) findViewById(R.id.collapsing_tool_bar);
    ctl.setTitle("Test");
  }
 @Override
 public void onWeatherUpdateFinished(CurrentWeather weather) {
   hideProgressIndicator();
   String name = AppSettings.getInstance(this).getString(AppSettings.Key.CURRENT_LOCATION_NAME);
   CollapsingToolbarLayout collapsingToolbarLayout =
       (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
   collapsingToolbarLayout.setTitle(
       WeatherHelper.getFormattedTemperature(weather.getMain().getTemp()) + " " + name);
   updateAllWidgets();
 }
  private void setupToolbar() {
    mCollapsingToolbarLayout.setExpandedTitleColor(Color.WHITE);
    mCollapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);

    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
 /** 根据类型设置头部,图片,文字等 */
 private void setHeader() {
   if (mCategory.equals(Constant.CATEGORY_EXERCISE)) {
     mCollapsingToolbarLayout.setTitle("运动");
     mHeader.setBackgroundResource(R.mipmap.exerise_header);
   } else if (mCategory.equals(Constant.CATEGORY_FOOD)) {
     mCollapsingToolbarLayout.setTitle("美食");
     mHeader.setBackgroundResource(R.mipmap.food_header);
   } else if (mCategory.equals(Constant.CATEGORY_MOVIE)) {
     mCollapsingToolbarLayout.setTitle("电影");
     mHeader.setBackgroundResource(R.mipmap.movie_header);
   }
 }
Beispiel #15
0
  private void initTitle() {
    CollapsingToolbarLayout collapsingTbL;
    collapsingTbL = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout);
    collapsingTbL.setTitle("Candy Heart");

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    if (getSupportActionBar() != null) {
      getSupportActionBar().setHomeButtonEnabled(true);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
  }
Beispiel #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle("我的课程");
  }
  private void bindViews() {
    if (mRootView == null) {
      return;
    }

    CollapsingToolbarLayout collapsingToolbarLayout =
        (CollapsingToolbarLayout) mRootView.findViewById(R.id.collapsing_toolbar);

    TextView bylineView = (TextView) mRootView.findViewById(R.id.article_byline);
    TextView bodyView = (TextView) mRootView.findViewById(R.id.article_body);

    if (mCursor != null) {
      mRootView.setAlpha(0);
      mRootView.setVisibility(View.VISIBLE);
      mRootView.animate().alpha(1);
      collapsingToolbarLayout.setTitle(mCursor.getString(ArticleLoader.Query.TITLE));
      bylineView.setText(
          DateUtils.getRelativeTimeSpanString(
                      mCursor.getLong(ArticleLoader.Query.PUBLISHED_DATE),
                      System.currentTimeMillis(),
                      DateUtils.HOUR_IN_MILLIS,
                      DateUtils.FORMAT_ABBREV_ALL)
                  .toString()
              + " by "
              + mCursor.getString(ArticleLoader.Query.AUTHOR));
      bodyView.setText(Html.fromHtml(mCursor.getString(ArticleLoader.Query.BODY)));
      ImageLoaderHelper.getInstance(getActivity())
          .getImageLoader()
          .get(
              mCursor.getString(ArticleLoader.Query.PHOTO_URL),
              new ImageLoader.ImageListener() {
                @Override
                public void onResponse(ImageLoader.ImageContainer imageContainer, boolean b) {
                  Bitmap bitmap = imageContainer.getBitmap();
                  if (bitmap != null) {
                    Palette p = Palette.generate(bitmap, 12);
                    mPhotoView.setImageBitmap(imageContainer.getBitmap());
                    p.getLightVibrantColor(R.color.theme_primary);
                  }
                }

                @Override
                public void onErrorResponse(VolleyError volleyError) {}
              });
    } else {
      mRootView.setVisibility(View.GONE);
      collapsingToolbarLayout.setTitle("N/A");
      bylineView.setText("N/A");
      bodyView.setText("N/A");
    }
  }
  public void displayInfo(String[] data) {
    TextView body = (TextView) findViewById(R.id.body);
    TextView title = (TextView) findViewById(R.id.title);
    TextView description = (TextView) findViewById(R.id.description);
    TextView school = (TextView) findViewById(R.id.school);
    TextView dep = (TextView) findViewById(R.id.fixed);
    CollapsingToolbarLayout toolbar = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    switch (data[0]) {
      case "8":
      case "9":
      case "11":
      case "14":
        school.setText("School of Engineering");
        break;
      case "6":
      case "12":
      case "34":
      case "7":
        school.setText("School of Science");
        break;
      case "19":
        school.setText("Engineering/Science");
        break;
      case "3":
        school.setText("Library");

        break;
      case "1":
        school.setText("Central Perk");
        toolbar.setBackgroundResource(R.drawable.square);
        break;
      case "2":
        school.setText("Administration");
        toolbar.setBackgroundResource(R.drawable.ku);
        break;
      case "35":
        dep.setText("Nepal");
        school.setText("Department of Information Technology");
        toolbar.setBackgroundResource(R.drawable.itpark);
        break;
      default:
        school.setText("Blocks");
        break;
    }
    body.setText(data[3]);
    title.setText(data[1]);
    if (data[2] != null) {
      description.setText(data[2]);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_collapsing);

    /* Setup your toolbar */
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle("Pluto first flyby");
  }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   MainActivity mainActivity = (MainActivity) this.getActivity();
   ActionBar actionBar = (mainActivity).getSupportActionBar();
   CollapsingToolbarLayout toolbarLayout =
       (CollapsingToolbarLayout) mainActivity.findViewById(R.id.toolbar_layout);
   if (mainActivity.focusOnFragment) // focus is on Fragment
   {
     if (actionBar.getTitle() == null
         || !actionBar.getTitle().equals(this.getString(R.string.local_title)))
       toolbarLayout.setTitle(getString(R.string.local_title));
     inflater.inflate(R.menu.local, menu);
   } else menu.clear();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments().containsKey(ARG_GROUP)) {
      // Load the dummy content specified by the fragment
      // arguments. In a real-world scenario, use a Loader
      // to load content from a content provider.
      mGroup = getArguments().getParcelable(ARG_GROUP);
      if (mGroup != null) {
        Log.d("GroupDetailFragment", "mGroup old size is " + mGroup.size());
        if (mGroup.size() == 0) {
          // double check to see if anyone is in the group
          PeopleDatabase db = new PeopleDatabase(getActivity());
          db.open();
          mGroup.addPeople(db.getPeopleForGroup(mGroup.getId()));
          db.close();
          Log.d("GroupDetailFragment", "mGroup new size is " + mGroup.size());
        }
        Activity activity = this.getActivity();

        final String picPath = mGroup.getPicture();
        Log.d("GroupDetailFragment", "picPath is " + picPath);

        if (picPath != null && !picPath.isEmpty()) {
          ImageView img = (ImageView) activity.findViewById(R.id.toolbar_image);
          try {
            Drawable pic = Drawable.createFromStream(activity.openFileInput(picPath), null);
            img.setImageDrawable(pic);
            Log.d("GroupDetailFragment", "set background");
          } catch (IOException e) {
            e.printStackTrace();
          }
        }

        CollapsingToolbarLayout appBarLayout =
            (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
        if (appBarLayout != null) {
          appBarLayout.setTitle(mGroup.getName());
          appBarLayout.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View view) {}
              });
        }
      }
    }
  }
  private void updateUIContent() {
    collapsingToolbar.setTitle(book.title);
    collapsingToolbar.invalidate();
    $(R.id.toolbar).invalidate();
    $(R.id.appbar).invalidate();

    mFAB.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            GalleryActivity.launch(BookDetailsActivity.this, book, 0);
          }
        });

    updateDetailsContent();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    mMovie = (Movie) getIntent().getParcelableExtra(this.getString(R.string.movie_key));
    DetailFragment fragment =
        (DetailFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_detail);
    fragment.setMovie(mMovie);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(mMovie.getTitle());
  }
Beispiel #24
0
 private void setupCollapsingToolbarLayout() {
   mCollapsingToolbarLayout =
       (CollapsingToolbarLayout) findViewById(R.id.activity_main_collapsing);
   if (mCollapsingToolbarLayout != null) {
     mCollapsingToolbarLayout.setTitle("I LOVE ANDROID !!!");
   }
 }
  private void initProfileData() {
    UserDto userDto = getIntent().getParcelableExtra(ConstantManager.PARCELABLE_KEY);
    final List<String> repositories = userDto.getRepositories();
    final RepositoriesAdapter repositoriesAdapter = new RepositoriesAdapter(this, repositories);
    mRepoListView.setAdapter(repositoriesAdapter);
    mRepoListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String link = repositories.get(position);
            if (!link.startsWith("http://") && !link.startsWith("https://")) {
              link = "http://" + link;
            }
            Intent openLinkIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
            startActivity(openLinkIntent);
          }
        });

    mUserBio.setText(userDto.getBio());
    mUserRating.setText(userDto.getRating());
    mUserCodeLines.setText(userDto.getCodeLines());
    mUserProjects.setText(userDto.getProjects());

    mCollapsingToolbarLayout.setTitle(userDto.getFullName());

    Picasso.with(this)
        .load(userDto.getPhoto())
        .placeholder(R.drawable.user_bg)
        .error(R.drawable.user_bg)
        .into(mProfileImage);
  }
Beispiel #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_activity_content);
    ButterKnife.bind(this);
    mContentId = getIntent().getStringExtra(AcString.CONTENT_ID);

    ViewUtils.setToolbar(AcContentActivity.this, mToolbar, true);
    mCollapsingToolbarLayout.setTitle("AC" + mContentId);
    mCollapsingToolbarLayout.setExpandedTitleTextAppearance(R.style.ExpandedTitleText);

    mAdapter = new AcContentFmAdapter(getSupportFragmentManager());
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOffscreenPageLimit(2);

    mTabLayout.setTabMode(TabLayout.MODE_FIXED);
    mTabLayout.setupWithViewPager(mViewPager);

    //        View contentView = findViewById(android.R.id.content);
    //        contentView.getViewTreeObserver()
    //                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    //                    @Override
    //                    public void onGlobalLayout() {
    //                        if (mContentId != null) {
    //                            for (int i = 0; i < mAdapter.getCount(); i++) {
    //                                String tag = mAdapter.getFragmentTag(i);
    //                                Fragment fragment =
    // getSupportFragmentManager().findFragmentByTag(tag);
    //
    //                                if (fragment instanceof AcContentInfoFragment) {
    //                                    ((AcContentInfoFragment) fragment)
    //                                            .onAcContentResult(mContentId);
    //                                } else if (fragment instanceof AcContentReplyFragment) {
    //                                    ((AcContentReplyFragment) fragment)
    //                                            .onAcContentResult(mContentId);
    //                                }
    //                            }
    //                        }
    //                    }
    //                });

    ((AcContentInfoFragment) getAcContentFragment(FRAGMENT_TPE_CONTENT_INFO))
        .onAcContentResult(mContentId);
    ((AcContentReplyFragment) getAcContentFragment(FRAGMENT_TPE_CONTENT_REPLY))
        .onAcContentResult(mContentId);
  }
 private void setData(MovieDetails details) {
   collapsingToolbarLayout.setTitle(details.getTitle());
   Picasso.with(this)
       .load("http://image.tmdb.org/t/p/w780" + details.getBackdrop_path())
       .into(backdrop);
   adapter = new MovieDetailListAdapter(details);
   recyclerView.setAdapter(adapter);
 }
  private void setUpToolBar() {

    ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
    mToolbar.inflateMenu(R.menu.menu_movie_details);

    if (!Utils.isTablet(mContext)) {
      ((AppCompatActivity) getActivity()).getSupportActionBar().setHomeButtonEnabled(true);
      ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    collapsingToolbarLayout.setTitle(mMovie.getTitle());
    collapsingToolbarLayout.setExpandedTitleColor(
        getResources().getColor(android.R.color.transparent));
    Glide.with(mContext)
        .load(mMovie.getBackdrop_url())
        .asBitmap()
        .error(R.drawable.not_available)
        .placeholder(R.drawable.placeholder)
        .into(
            new BitmapImageViewTarget(backdrop) {
              @Override
              public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
                super.onResourceReady(bitmap, anim);
                Palette.from(bitmap)
                    .generate(
                        new Palette.PaletteAsyncListener() {
                          @SuppressWarnings("ResourceType")
                          @Override
                          public void onGenerated(Palette palette) {
                            mutedColor = palette.getMutedColor(R.color.colorPrimary);
                            if (getLuminance(mutedColor) < 240) {
                              collapsingToolbarLayout.setContentScrimColor(mutedColor);
                              collapsingToolbarLayout.setStatusBarScrimColor(
                                  getDarkerColor(mutedColor));
                              return;
                            }
                          }
                        });
              }
            });

    collapsingToolbarLayout.setContentScrimColor(getResources().getColor(R.color.colorPrimary));
    collapsingToolbarLayout.setStatusBarScrimColor(
        getResources().getColor(R.color.colorPrimaryDark));
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.event_bookcricket);
    //        rv = (RecyclerView) findViewById(R.id.scrollableview);
    //        adapter = new MenuAdapter(this,getData());
    //        rv.setAdapter(adapter);
    //        rv.setLayoutManager(new LinearLayoutManager(this));

    // sv = (ScrollView) findViewById(R.id.scrollableview);
    toolbar = (Toolbar) findViewById(R.id.anim_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(EVENT_NAME);
    ImageView maps = (ImageView) findViewById(R.id.maps);
    ImageView alarm = (ImageView) findViewById(R.id.alarm);
    ImageView header = (ImageView) findViewById(R.id.header);

    favButton = (ImageView) findViewById(R.id.favButton);
    favButton.setOnClickListener(this);
    maps.setOnClickListener(this);
    alarm.setOnClickListener(this);
    an = AnimationUtils.loadAnimation(this, R.anim.interpolate);

    Intent intent = getIntent();
    intentNaam = intent.getStringExtra("INTENT");
    // String name = intent.getStringExtra("name");

    if (getFav().equals("1")) {
      // fav is set

      favButton.setImageResource(R.mipmap.ic_favorite_grey600_36dp);

    } else {
      // fav is not set

      favButton.setImageResource(R.mipmap.ic_favorite_outline_grey600_36dp);
    }

    // organisers area
    num1 = (TextView) findViewById(R.id.number1book);
    org1 = (LinearLayout) findViewById(R.id.organiser1book);
    org1.setOnClickListener(this);
    // end organisers area

    //        Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
    //                R.mipmap.navbackg);
    //        Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
    //            @Override
    //            public void onGenerated(Palette palette) {
    //                mutedColor = palette.getMutedColor(R.attr.colorPrimary);
    //                collapsingToolbar.setContentScrimColor(mutedColor);
    //            }
    //        });

  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    Intent intent = getIntent();
    final String cheeseName = intent.getStringExtra(EXTRA_NAME);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(cheeseName);

    loadBackdrop();
  }