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;
}
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);
}
});
}
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());
}
}
}
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);
}
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);
}
Aggregations