当前位置: 首页>>代码示例>>Java>>正文


Java FloatingTextButton类代码示例

本文整理汇总了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);
    });
}
 
开发者ID:TheUberCatman,项目名称:crates-io-android,代码行数:23,代码来源:SubscribedAdapter.java

示例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;
}
 
开发者ID:dimorinny,项目名称:floating-text-button,代码行数:20,代码来源:SnackbarBehavior.java

示例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);
}
 
开发者ID:dimorinny,项目名称:floating-text-button,代码行数:18,代码来源:SnackbarBehavior.java

示例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();
        }
    });
}
 
开发者ID:dimorinny,项目名称:floating-text-button,代码行数:16,代码来源:MainActivity.java

示例5: layoutDependsOn

import ru.dimorinny.floatingtextbutton.FloatingTextButton; //导入依赖的package包/类
@Override
public boolean layoutDependsOn(
        CoordinatorLayout parent,
        FloatingTextButton child,
        View dependency
) {
    return dependency instanceof Snackbar.SnackbarLayout;
}
 
开发者ID:dimorinny,项目名称:floating-text-button,代码行数:9,代码来源:SnackbarBehavior.java


注:本文中的ru.dimorinny.floatingtextbutton.FloatingTextButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。