本文整理匯總了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;
}