Skip to content

Instantly share code, notes, and snippets.

@krugloid
krugloid / RowView.java
Created April 27, 2020 07:27
androidx-master-dev/frameworks/support/slices/view/src/main/java/slice/widget/RowView.java
private void addRange() {
if (mHandler == null) {
mHandler = new Handler();
}
SliceItem style = SliceQuery.findSubtype(mRangeItem, FORMAT_INT, SUBTYPE_RANGE_MODE);
final boolean isIndeterminate = style != null && style.getInt() == INDETERMINATE_RANGE;
final boolean isSeekBar = FORMAT_ACTION.equals(mRangeItem.getFormat());
final boolean renderInNewLine = mStartItem == null;
final ProgressBar progressBar;
Style.Input.layout(() -> {
Style.Input.text(() -> {
text(mInput);
...
});
// clear input button
Style.deleteButton(() -> onClick(v -> mInput = ""));
});
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable name="counter" type="com.example.Counter"/>
<variable name="counter" type="com.example.ClickHandler"/>
</data>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
@Bind(R.id.tv_clicks) mCounterText;
@OnClick(R.id.btn_increment)
public void onSubmitClicked(View v) {
mClicks++;
mCounterText.setText("" + mClicks);
}
var clicks = 0;
$('.incr-button').on('click', function() {
clicks++;
$('.counter').text(clicks);
});
TextView mCounterText;
Button mCounterIncrementButton;
int mClicks = 0;
public void onCreate(Bundle b) {
super.onCreate(b);
mCounterText = (TextView) findViewById(R.id.tv_clicks);
mCounterIncrementButton = (Button) findViewById(R.id.btn_increment);