use of android.support.design.widget.CollapsingToolbarLayout in project xabber-android by redsolution.
the class AboutViewer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about_viewer);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavUtils.navigateUpFromSameTask(AboutViewer.this);
}
});
findViewById(R.id.about_github).setOnClickListener(this);
findViewById(R.id.about_twitter).setOnClickListener(this);
findViewById(R.id.about_redsolution).setOnClickListener(this);
findViewById(R.id.about_text_xmpp_protocol).setOnClickListener(this);
((TextView) findViewById(R.id.about_text_developers)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) findViewById(R.id.about_text_translators)).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) findViewById(R.id.about_text_license)).setMovementMethod(LinkMovementMethod.getInstance());
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(getString(R.string.application_title_short));
((TextView) findViewById(R.id.about_version)).setText(getVersionName());
loadBackdrop();
}
use of android.support.design.widget.CollapsingToolbarLayout in project android-design-support-lib-demo by sagar-viradiya.
the class CollapsingToolbarFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_collapsing_toolbar, container, false);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
setupToolbar();
((CollapsingToolbarLayout) view.findViewById(R.id.collapsing_toolbar)).setTitle(getString(R.string.collapsing_toolbar_fragment_title));
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
setupRecyclerView();
return view;
}
use of android.support.design.widget.CollapsingToolbarLayout in project Synthese_2BIN by TheYoungSensei.
the class ItemDetailFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
mItem = ArtistContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
Activity activity = this.getActivity();
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null) {
appBarLayout.setTitle(mItem.content);
}
}
}
use of android.support.design.widget.CollapsingToolbarLayout in project Synthese_2BIN by TheYoungSensei.
the class BusinessDayDetailFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
mItem = DetailsContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
Activity activity = this.getActivity();
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null) {
appBarLayout.setTitle(mItem.content);
}
}
this.model = ((Builder) this.getContext().getApplicationContext()).getModel();
model.registerCompaniesObserver(this);
ConnectivityManager connMgr = (ConnectivityManager) this.getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
ShowMyCompaniesTask task = new ShowMyCompaniesTask();
if (networkInfo != null && networkInfo.isConnected()) {
task.execute();
}
}
use of android.support.design.widget.CollapsingToolbarLayout in project NavigationTabBar by Devlight.
the class HorizontalCoordinatorNtbActivity method initUI.
private void initUI() {
final ViewPager viewPager = (ViewPager) findViewById(R.id.vp_horizontal_ntb);
viewPager.setAdapter(new PagerAdapter() {
@Override
public int getCount() {
return 5;
}
@Override
public boolean isViewFromObject(final View view, final Object object) {
return view.equals(object);
}
@Override
public void destroyItem(final View container, final int position, final Object object) {
((ViewPager) container).removeView((View) object);
}
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
final View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.item_vp_list, null, false);
final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.rv);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getBaseContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(new RecycleAdapter());
container.addView(view);
return view;
}
});
final String[] colors = getResources().getStringArray(R.array.default_preview);
final NavigationTabBar navigationTabBar = (NavigationTabBar) findViewById(R.id.ntb_horizontal);
final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();
models.add(new NavigationTabBar.Model.Builder(getResources().getDrawable(R.drawable.ic_first), Color.parseColor(colors[0])).title("Heart").build());
models.add(new NavigationTabBar.Model.Builder(getResources().getDrawable(R.drawable.ic_second), Color.parseColor(colors[1])).title("Cup").build());
models.add(new NavigationTabBar.Model.Builder(getResources().getDrawable(R.drawable.ic_third), Color.parseColor(colors[2])).title("Diploma").build());
models.add(new NavigationTabBar.Model.Builder(getResources().getDrawable(R.drawable.ic_fourth), Color.parseColor(colors[3])).title("Flag").build());
models.add(new NavigationTabBar.Model.Builder(getResources().getDrawable(R.drawable.ic_fifth), Color.parseColor(colors[4])).title("Medal").build());
navigationTabBar.setModels(models);
navigationTabBar.setViewPager(viewPager, 2);
//IMPORTANT: ENABLE SCROLL BEHAVIOUR IN COORDINATOR LAYOUT
navigationTabBar.setBehaviorEnabled(true);
navigationTabBar.setOnTabBarSelectedIndexListener(new NavigationTabBar.OnTabBarSelectedIndexListener() {
@Override
public void onStartTabSelected(final NavigationTabBar.Model model, final int index) {
}
@Override
public void onEndTabSelected(final NavigationTabBar.Model model, final int index) {
model.hideBadge();
}
});
navigationTabBar.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {
}
@Override
public void onPageSelected(final int position) {
}
@Override
public void onPageScrollStateChanged(final int state) {
}
});
final CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.parent);
findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
for (int i = 0; i < navigationTabBar.getModels().size(); i++) {
final NavigationTabBar.Model model = navigationTabBar.getModels().get(i);
navigationTabBar.postDelayed(new Runnable() {
@Override
public void run() {
final String title = String.valueOf(new Random().nextInt(15));
if (!model.isBadgeShowed()) {
model.setBadgeTitle(title);
model.showBadge();
} else
model.updateBadgeTitle(title);
}
}, i * 100);
}
coordinatorLayout.postDelayed(new Runnable() {
@Override
public void run() {
final Snackbar snackbar = Snackbar.make(navigationTabBar, "Coordinator NTB", Snackbar.LENGTH_SHORT);
snackbar.getView().setBackgroundColor(Color.parseColor("#9b92b3"));
((TextView) snackbar.getView().findViewById(R.id.snackbar_text)).setTextColor(Color.parseColor("#423752"));
snackbar.show();
}
}, 1000);
}
});
final CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar);
collapsingToolbarLayout.setExpandedTitleColor(Color.parseColor("#009F90AF"));
collapsingToolbarLayout.setCollapsedTitleTextColor(Color.parseColor("#9f90af"));
}
Aggregations