@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 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); } }
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"); } }
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); }
@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); }
private void setupCollapsingToolbarLayout() { mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.activity_main_collapsing); if (mCollapsingToolbarLayout != null) { mCollapsingToolbarLayout.setTitle("I LOVE ANDROID !!!"); } }
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 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(); }
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); }
@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 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 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(); }
@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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle("hola"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(toolbBar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ctl.setTitle("计科学院"); }
@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_tweet, container, false); settingsToolbar(rootView, ""); ButterKnife.bind(this, rootView); setUpRecyclerView(recyclerViewTweets); collapsingToolbarLayout.setTitle("Lista de Tweets"); return rootView; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app_bar); recyclerView = (RecyclerView) findViewById(R.id.recyclerView); toolBar = (Toolbar) findViewById(R.id.toolbar); collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); setSupportActionBar(toolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); collapsingToolbarLayout.setTitle(getString(R.string.title_activity_app_bar)); }
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); } }
@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("我的课程"); }
@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()); }
@Override protected void setViews() { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); collapsingToolbar.setTitle(getResources().getString(R.string.string_2048)); txtVersion.setText("版本信息:" + BuildConfig.VERSION_NAME); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "欢迎提出意见~喜欢的话可以关注我的GitHub哦~", Snackbar.LENGTH_LONG).show(); } }); }
@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 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 initLayout(View view) { getAActivity().setSupportActionBar(toolbar); getAActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true); getAActivity().getSupportActionBar().setTitle("Practice"); collapsingToolbarLayout.setTitle("My Practice"); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setHasFixedSize(true); list.clear(); list.addAll(ResourceManager.getInstance().getListHelloChaoDaily()); Logger.debug(TAG, ">>>" + "size:" + list.size()); adapterFull = new AdapterFull(getContext(), list); recyclerView.setAdapter(adapterFull); }
@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(); }