本文整理汇总了Java中ru.dimorinny.floatingtextbutton.FloatingTextButton类的典型用法代码示例。如果您正苦于以下问题:Java FloatingTextButton类的具体用法?Java FloatingTextButton怎么用?Java FloatingTextButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FloatingTextButton类属于ru.dimorinny.floatingtextbutton包,在下文中一共展示了FloatingTextButton类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
final Alert alert = alerts.get(position);
final Crate crate = alert.getCrate();
FloatingTextButton fab = holder.itemView.findViewById(R.id.delete_button);
TextView title = holder.itemView.findViewById(R.id.crate_title);
title.setText(crate.getName());
fab.setOnClickListener(v -> {
alerts.remove(holder.getAdapterPosition());
notifyItemRemoved(holder.getAdapterPosition());
Utility.saveData("alerts", alerts);
});
holder.itemView.setOnClickListener(v -> {
Intent intent = new Intent(context, CrateActivity.class);
intent.putExtra("crate", crate);
context.startActivity(intent);
});
}
示例2: onDependentViewChanged
import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
public boolean onDependentViewChanged(
CoordinatorLayout parent,
FloatingTextButton child,
View dependency
) {
if (child.getTranslationY() > 0) {
return true;
}
if (animation != null) {
animation.cancel();
animation = null;
}
child.setTranslationY(
Math.min(0f, dependency.getTranslationY() - dependency.getHeight())
);
return true;
}
示例3: onDependentViewRemoved
import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
public void onDependentViewRemoved(
CoordinatorLayout parent,
FloatingTextButton child,
View dependency
) {
if (dependency instanceof Snackbar.SnackbarLayout) {
animation = ViewCompat.animate(child)
.translationY(0f)
.setInterpolator(HIDE_INTERPOLATOR)
.setDuration(HIDE_DURATION);
animation.start();
}
super.onDependentViewRemoved(parent, child, dependency);
}
示例4: onCreate
import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final CoordinatorLayout container = (CoordinatorLayout) findViewById(R.id.container);
FloatingTextButton callButton = (FloatingTextButton) findViewById(R.id.call_button);
callButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(container, "Call button clicked", Snackbar.LENGTH_SHORT).show();
}
});
}
示例5: layoutDependsOn
import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
public boolean layoutDependsOn(
CoordinatorLayout parent,
FloatingTextButton child,
View dependency
) {
return dependency instanceof Snackbar.SnackbarLayout;
}