Search in sources :

Example 71 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project react-native-navigation by wix.

the class FloatingActionButtonCoordinator method createAction.

private FloatingActionButton createAction(int index) {
    final FabActionParams actionParams = params.actions.get(index);
    FloatingActionButton action = createFab(actionParams.icon);
    action.setLayoutParams(createActionLayoutParams(index));
    action.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavigationApplication.instance.getEventEmitter().sendNavigatorEvent(actionParams.id, actionParams.navigatorEventId);
            fabAnimator.collapse();
        }
    });
    if (actionParams.backgroundColor.hasColor()) {
        action.setBackgroundTintList(ColorStateList.valueOf(actionParams.backgroundColor.getColor()));
    }
    action.setSize(FloatingActionButton.SIZE_MINI);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        action.setCompatElevation(0);
    }
    return action;
}
Also used : FabActionParams(com.reactnativenavigation.params.FabActionParams) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View)

Example 72 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Small by wequick.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // 统计Small加载时间
    SharedPreferences sp = this.getSharedPreferences("profile", 0);
    long setUpStart = sp.getLong("setUpStart", 0);
    long setUpFinish = sp.getLong("setUpFinish", 0);
    long setUpTime = setUpFinish - setUpStart;
    float t = setUpTime / 1000000.0f;
    System.out.println("## Small setUp in " + t + " ms.");
    String key = Small.getIsNewHostApp() ? "setUpFirst" : "setUpNext";
    AnalyticsManager.traceTime(this, key, (int) t);
    // 统计加载完成到启动首个Activity时间
    t = (System.nanoTime() - setUpFinish) / 1000000.0f;
    System.out.println("## Small start first activity in " + t + " ms.");
    AnalyticsManager.traceTime(this, "startFirst", (int) t);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mTabLayout = (TabLayout) findViewById(R.id.tabs);
    mTabLayout.setupWithViewPager(mViewPager);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            //                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
            //                        .setAction("Action", null).show();
            Small.openUri("https://github.com/wequick/Small/issues", MainActivity.this);
        }
    });
}
Also used : SharedPreferences(android.content.SharedPreferences) FloatingActionButton(android.support.design.widget.FloatingActionButton) TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 73 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project LeMondeRssReader by MBach.

the class ArticleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initActivityTransitions();
    setContentView(R.layout.activity_article);
    appBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    articleActivityRecyclerView = (ScrollFeedbackRecyclerView) findViewById(R.id.articleActivityRecyclerView);
    articleActivityRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fabProgressCircle = (FABProgressCircle) findViewById(R.id.fabProgressCircle);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            fabProgressCircle.show();
            List<Model> comments = loadMoreComments();
            fabProgressCircle.hide();
            if (comments.isEmpty()) {
                Snackbar.make(findViewById(R.id.coordinatorArticle), "Pas de nouveau commentaire", Snackbar.LENGTH_LONG).show();
            } else {
                ArticleAdapter adapter = (ArticleAdapter) articleActivityRecyclerView.getAdapter();
                adapter.insertItems(comments);
            }
        }
    });
    //ViewCompat.setTransitionName(appBarLayout, Constants.EXTRA_RSS_IMAGE);
    //supportPostponeEnterTransition();
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
        collapsingToolbar.setTitle(extras.getString(Constants.EXTRA_NEWS_CATEGORY));
        final ImageView imageView = (ImageView) findViewById(R.id.imageArticle);
        Picasso.with(getBaseContext()).load(extras.getString(Constants.EXTRA_RSS_IMAGE)).into(imageView);
        try {
            Document doc = Jsoup.connect(extras.getString(Constants.EXTRA_RSS_LINK)).get();
            if (doc.getElementById("teaser_article") != null) {
                TextView paidArticle = (TextView) findViewById(R.id.paidArticle);
                paidArticle.setVisibility(View.VISIBLE);
            }
            Elements articles = doc.getElementsByTag("article");
            List<Model> items = null;
            if (!articles.isEmpty()) {
                Elements category = doc.select("div.tt_rubrique_ombrelle");
                if (atLeastOneChild(category)) {
                    getSupportActionBar().setTitle(category.text());
                }
                items = extractStandardArticle(articles);
                items.addAll(loadAndExtractCommentPreview(doc.getElementById("liste_reactions")));
            } else if (doc.getElementById("content") != null) {
                items = extractBlogArticle(doc);
            }
            if (items != null && !items.isEmpty()) {
                articleActivityRecyclerView.setAdapter(new ArticleAdapter(items));
            }
        } catch (IOException e) {
            Log.d(TAG, e.getMessage());
        }
    }
}
Also used : Bundle(android.os.Bundle) IOException(java.io.IOException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Document(org.jsoup.nodes.Document) Elements(org.jsoup.select.Elements) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) FloatingActionButton(android.support.design.widget.FloatingActionButton) CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) ArrayList(java.util.ArrayList) List(java.util.List) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 74 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project LeMondeRssReader by MBach.

the class ScrollFeedbackRecyclerView method onScrolled.

@Override
public void onScrolled(int dx, int dy) {
    LinearLayoutManager layout = (LinearLayoutManager) getLayoutManager();
    if (layout.findFirstCompletelyVisibleItemPosition() == 0) {
        if (callbacks != null && callbacks.get().isAppBarCollapsed()) {
            callbacks.get().setExpanded(true);
        }
    }
    if (layout.findLastCompletelyVisibleItemPosition() == getLayoutManager().getItemCount() - 1) {
        fab.show(new FloatingActionButton.OnVisibilityChangedListener() {

            @Override
            public void onShown(FloatingActionButton fab) {
                super.onShown(fab);
                fabProgressCircle.setVisibility(VISIBLE);
            }
        });
    } else {
        fab.hide(new FloatingActionButton.OnVisibilityChangedListener() {

            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onShown(fab);
                fabProgressCircle.setVisibility(INVISIBLE);
            }
        });
    }
    super.onScrolled(dx, dy);
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 75 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Android by WilliamYi96.

the class DisplayMessageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_message);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
        }
    });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)84 View (android.view.View)58 Toolbar (android.support.v7.widget.Toolbar)28 TextView (android.widget.TextView)20 ImageView (android.widget.ImageView)16 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)12 ColorStateList (android.content.res.ColorStateList)9 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 Bundle (android.os.Bundle)7 NavigationView (android.support.design.widget.NavigationView)7 TabLayout (android.support.design.widget.TabLayout)7 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 UiController (android.support.test.espresso.UiController)6 ViewAction (android.support.test.espresso.ViewAction)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)5 DrawerLayout (android.support.v4.widget.DrawerLayout)4 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)4