Search in sources :

Example 6 with CollapsingToolbarLayout

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();
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with CollapsingToolbarLayout

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;
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 8 with CollapsingToolbarLayout

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);
        }
    }
}
Also used : Activity(android.app.Activity) CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout)

Example 9 with CollapsingToolbarLayout

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();
    }
}
Also used : NetworkInfo(android.net.NetworkInfo) ConnectivityManager(android.net.ConnectivityManager) Activity(android.app.Activity) CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout)

Example 10 with CollapsingToolbarLayout

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"));
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) PagerAdapter(android.support.v4.view.PagerAdapter) Random(java.util.Random) CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) TextView(android.widget.TextView) NavigationTabBar(devlight.io.library.ntb.NavigationTabBar) ViewGroup(android.view.ViewGroup) ViewPager(android.support.v4.view.ViewPager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) RecyclerView(android.support.v7.widget.RecyclerView) Snackbar(android.support.design.widget.Snackbar)

Aggregations

CollapsingToolbarLayout (android.support.design.widget.CollapsingToolbarLayout)18 View (android.view.View)9 Toolbar (android.support.v7.widget.Toolbar)6 AppBarLayout (android.support.design.widget.AppBarLayout)4 TextView (android.widget.TextView)4 Activity (android.app.Activity)3 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)3 ViewGroup (android.view.ViewGroup)3 ImageView (android.widget.ImageView)3 Intent (android.content.Intent)2 UiController (android.support.test.espresso.UiController)2 ViewAction (android.support.test.espresso.ViewAction)2 ViewPager (android.support.v4.view.ViewPager)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Window (android.view.Window)2 ArrayList (java.util.ArrayList)2 ValueAnimator (android.animation.ValueAnimator)1 Context (android.content.Context)1 SharedPreferences (android.content.SharedPreferences)1