安卓Chronometer(计时器)
19.1 简单Demo
activity_main.xml
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <Chronometer android:id="@+id/chronometer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:textColor="#ff0000" android:textSize="60dip" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="10dip" android:orientation="horizontal"> <Button android:id="@+id/btnStart" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="开始记时" /> <Button android:id="@+id/btnStop" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="停止记时" /> <Button android:id="@+id/btnReset" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="重置" /> <Button android:id="@+id/btn_format" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="格式化" /> </LinearLayout> </LinearLayout>
MainActivity.java
:
package com.lzhpo.chronometer; import android.os.Bundle; import android.os.SystemClock; import android.view.View; import android.widget.Button; import android.widget.Chronometer; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity implements View.OnClickListener, Chronometer.OnChronometerTickListener{ private Chronometer chronometer; private Button btn_start,btn_stop,btn_base,btn_format; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } private void initView() { chronometer = (Chronometer) findViewById(R.id.chronometer); btn_start = (Button) findViewById(R.id.btnStart); btn_stop = (Button) findViewById(R.id.btnStop); btn_base = (Button) findViewById(R.id.btnReset); btn_format = (Button) findViewById(R.id.btn_format); chronometer.setOnChronometerTickListener(this); btn_start.setOnClickListener(this); btn_stop.setOnClickListener(this); btn_base.setOnClickListener(this); btn_format.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.btnStart: chronometer.start();// 开始计时 break; case R.id.btnStop: chronometer.stop();// 停止计时 break; case R.id.btnReset: chronometer.setBase(SystemClock.elapsedRealtime());// 复位 break; case R.id.btn_format: chronometer.setFormat("Time:%s");// 更改时间显示格式 break; } } @Override public void onChronometerTick(Chronometer chronometer) { String time = chronometer.getText().toString(); if(time.equals("00:00")){ Toast.makeText(MainActivity.this,"时间到了~",Toast.LENGTH_SHORT).show(); } } }
19.2 Chronometer源码
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package android.widget; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.RemoteViews.RemoteView; //说明Chronometer是属于TextView之下的 @RemoteView public class Chronometer extends TextView { public Chronometer(Context context) { super((Context)null); throw new RuntimeException("Stub!"); } public Chronometer(Context context, AttributeSet attrs) { super((Context)null); throw new RuntimeException("Stub!"); } public Chronometer(Context context, AttributeSet attrs, int defStyleAttr) { super((Context)null); throw new RuntimeException("Stub!"); } public Chronometer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super((Context)null); throw new RuntimeException("Stub!"); } public void setCountDown(boolean countDown) { throw new RuntimeException("Stub!"); } public boolean isCountDown() { throw new RuntimeException("Stub!"); } public boolean isTheFinalCountDown() { throw new RuntimeException("Stub!"); } //复位 public void setBase(long base) { throw new RuntimeException("Stub!"); } public long getBase() { throw new RuntimeException("Stub!"); } //更改时间显示格式 public void setFormat(String format) { throw new RuntimeException("Stub!"); } public String getFormat() { throw new RuntimeException("Stub!"); } public void setOnChronometerTickListener(Chronometer.OnChronometerTickListener listener) { throw new RuntimeException("Stub!"); } public Chronometer.OnChronometerTickListener getOnChronometerTickListener() { throw new RuntimeException("Stub!"); } //开始计时 public void start() { throw new RuntimeException("Stub!"); } //停止计时 public void stop() { throw new RuntimeException("Stub!"); } protected void onDetachedFromWindow() { throw new RuntimeException("Stub!"); } protected void onWindowVisibilityChanged(int visibility) { throw new RuntimeException("Stub!"); } protected void onVisibilityChanged(View changedView, int visibility) { throw new RuntimeException("Stub!"); } public CharSequence getContentDescription() { throw new RuntimeException("Stub!"); } public CharSequence getAccessibilityClassName() { throw new RuntimeException("Stub!"); } public interface OnChronometerTickListener { void onChronometerTick(Chronometer var1); } }
19.3 TextView源码
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package android.widget; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.BlendMode; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.LocaleList; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import android.text.Editable; import android.text.InputFilter; import android.text.Layout; import android.text.TextDirectionHeuristic; import android.text.TextPaint; import android.text.TextWatcher; import android.text.Editable.Factory; import android.text.PrecomputedText.Params; import android.text.TextUtils.TruncateAt; import android.text.method.KeyListener; import android.text.method.MovementMethod; import android.text.method.TransformationMethod; import android.text.style.URLSpan; import android.util.AttributeSet; import android.view.ContextMenu; import android.view.DragEvent; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.View; import android.view.ActionMode.Callback; import android.view.View.BaseSavedState; import android.view.ViewDebug.CapturedViewProperty; import android.view.ViewDebug.ExportedProperty; import android.view.ViewTreeObserver.OnPreDrawListener; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.autofill.AutofillValue; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; import android.view.textclassifier.TextClassifier; import android.widget.RemoteViews.RemoteView; import androidx.annotation.RecentlyNonNull; import java.io.IOException; import java.util.ArrayList; import java.util.Locale; import org.xmlpull.v1.XmlPullParserException; @RemoteView public class TextView extends View implements OnPreDrawListener { public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; public TextView(Context context) { super((Context)null); throw new RuntimeException("Stub!"); } public TextView(Context context, @Nullable AttributeSet attrs) { super((Context)null); throw new RuntimeException("Stub!"); } public TextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super((Context)null); throw new RuntimeException("Stub!"); } public TextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super((Context)null); throw new RuntimeException("Stub!"); } public void setAutoSizeTextTypeWithDefaults(int autoSizeTextType) { throw new RuntimeException("Stub!"); } public void setAutoSizeTextTypeUniformWithConfiguration(int autoSizeMinTextSize, int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit) { throw new RuntimeException("Stub!"); } public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[] presetSizes, int unit) { throw new RuntimeException("Stub!"); } public int getAutoSizeTextType() { throw new RuntimeException("Stub!"); } public int getAutoSizeStepGranularity() { throw new RuntimeException("Stub!"); } public int getAutoSizeMinTextSize() { throw new RuntimeException("Stub!"); } public int getAutoSizeMaxTextSize() { throw new RuntimeException("Stub!"); } public int[] getAutoSizeTextAvailableSizes() { throw new RuntimeException("Stub!"); } public void setEnabled(boolean enabled) { throw new RuntimeException("Stub!"); } public void setTypeface(@Nullable Typeface tf, int style) { throw new RuntimeException("Stub!"); } protected boolean getDefaultEditable() { throw new RuntimeException("Stub!"); } protected MovementMethod getDefaultMovementMethod() { throw new RuntimeException("Stub!"); } @CapturedViewProperty public CharSequence getText() { throw new RuntimeException("Stub!"); } public int length() { throw new RuntimeException("Stub!"); } public Editable getEditableText() { throw new RuntimeException("Stub!"); } public int getLineHeight() { throw new RuntimeException("Stub!"); } public final Layout getLayout() { throw new RuntimeException("Stub!"); } public final KeyListener getKeyListener() { throw new RuntimeException("Stub!"); } public void setKeyListener(KeyListener input) { throw new RuntimeException("Stub!"); } public final MovementMethod getMovementMethod() { throw new RuntimeException("Stub!"); } public final void setMovementMethod(MovementMethod movement) { throw new RuntimeException("Stub!"); } public final TransformationMethod getTransformationMethod() { throw new RuntimeException("Stub!"); } public final void setTransformationMethod(TransformationMethod method) { throw new RuntimeException("Stub!"); } public int getCompoundPaddingTop() { throw new RuntimeException("Stub!"); } public int getCompoundPaddingBottom() { throw new RuntimeException("Stub!"); } public int getCompoundPaddingLeft() { throw new RuntimeException("Stub!"); } public int getCompoundPaddingRight() { throw new RuntimeException("Stub!"); } public int getCompoundPaddingStart() { throw new RuntimeException("Stub!"); } public int getCompoundPaddingEnd() { throw new RuntimeException("Stub!"); } public int getExtendedPaddingTop() { throw new RuntimeException("Stub!"); } public int getExtendedPaddingBottom() { throw new RuntimeException("Stub!"); } public int getTotalPaddingLeft() { throw new RuntimeException("Stub!"); } public int getTotalPaddingRight() { throw new RuntimeException("Stub!"); } public int getTotalPaddingStart() { throw new RuntimeException("Stub!"); } public int getTotalPaddingEnd() { throw new RuntimeException("Stub!"); } public int getTotalPaddingTop() { throw new RuntimeException("Stub!"); } public int getTotalPaddingBottom() { throw new RuntimeException("Stub!"); } public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top, @Nullable Drawable right, @Nullable Drawable bottom) { throw new RuntimeException("Stub!"); } public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) { throw new RuntimeException("Stub!"); } public void setCompoundDrawablesWithIntrinsicBounds(@Nullable Drawable left, @Nullable Drawable top, @Nullable Drawable right, @Nullable Drawable bottom) { throw new RuntimeException("Stub!"); } public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom) { throw new RuntimeException("Stub!"); } public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, int bottom) { throw new RuntimeException("Stub!"); } public void setCompoundDrawablesRelativeWithIntrinsicBounds(@Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom) { throw new RuntimeException("Stub!"); } @NonNull public Drawable[] getCompoundDrawables() { throw new RuntimeException("Stub!"); } @NonNull public Drawable[] getCompoundDrawablesRelative() { throw new RuntimeException("Stub!"); } public void setCompoundDrawablePadding(int pad) { throw new RuntimeException("Stub!"); } public int getCompoundDrawablePadding() { throw new RuntimeException("Stub!"); } public void setCompoundDrawableTintList(@Nullable ColorStateList tint) { throw new RuntimeException("Stub!"); } public ColorStateList getCompoundDrawableTintList() { throw new RuntimeException("Stub!"); } public void setCompoundDrawableTintMode(@Nullable Mode tintMode) { throw new RuntimeException("Stub!"); } public void setCompoundDrawableTintBlendMode(@Nullable BlendMode blendMode) { throw new RuntimeException("Stub!"); } public Mode getCompoundDrawableTintMode() { throw new RuntimeException("Stub!"); } @Nullable public BlendMode getCompoundDrawableTintBlendMode() { throw new RuntimeException("Stub!"); } public void setPadding(int left, int top, int right, int bottom) { throw new RuntimeException("Stub!"); } public void setPaddingRelative(int start, int top, int end, int bottom) { throw new RuntimeException("Stub!"); } public void setFirstBaselineToTopHeight(int firstBaselineToTopHeight) { throw new RuntimeException("Stub!"); } public void setLastBaselineToBottomHeight(int lastBaselineToBottomHeight) { throw new RuntimeException("Stub!"); } public int getFirstBaselineToTopHeight() { throw new RuntimeException("Stub!"); } public int getLastBaselineToBottomHeight() { throw new RuntimeException("Stub!"); } public final int getAutoLinkMask() { throw new RuntimeException("Stub!"); } public void setTextSelectHandle(@NonNull Drawable textSelectHandle) { throw new RuntimeException("Stub!"); } public void setTextSelectHandle(int textSelectHandle) { throw new RuntimeException("Stub!"); } @Nullable public Drawable getTextSelectHandle() { throw new RuntimeException("Stub!"); } public void setTextSelectHandleLeft(@NonNull Drawable textSelectHandleLeft) { throw new RuntimeException("Stub!"); } public void setTextSelectHandleLeft(int textSelectHandleLeft) { throw new RuntimeException("Stub!"); } @Nullable public Drawable getTextSelectHandleLeft() { throw new RuntimeException("Stub!"); } public void setTextSelectHandleRight(@NonNull Drawable textSelectHandleRight) { throw new RuntimeException("Stub!"); } public void setTextSelectHandleRight(int textSelectHandleRight) { throw new RuntimeException("Stub!"); } @Nullable public Drawable getTextSelectHandleRight() { throw new RuntimeException("Stub!"); } public void setTextCursorDrawable(@Nullable Drawable textCursorDrawable) { throw new RuntimeException("Stub!"); } public void setTextCursorDrawable(int textCursorDrawable) { throw new RuntimeException("Stub!"); } @Nullable public Drawable getTextCursorDrawable() { throw new RuntimeException("Stub!"); } public void setTextAppearance(int resId) { throw new RuntimeException("Stub!"); } /** @deprecated */ @Deprecated public void setTextAppearance(Context context, int resId) { throw new RuntimeException("Stub!"); } @NonNull public Locale getTextLocale() { throw new RuntimeException("Stub!"); } @NonNull public LocaleList getTextLocales() { throw new RuntimeException("Stub!"); } public void setTextLocale(@NonNull Locale locale) { throw new RuntimeException("Stub!"); } public void setTextLocales(@NonNull LocaleList locales) { throw new RuntimeException("Stub!"); } protected void onConfigurationChanged(Configuration newConfig) { throw new RuntimeException("Stub!"); } @ExportedProperty( category = "text" ) public float getTextSize() { throw new RuntimeException("Stub!"); } public void setTextSize(float size) { throw new RuntimeException("Stub!"); } public void setTextSize(int unit, float size) { throw new RuntimeException("Stub!"); } public float getTextScaleX() { throw new RuntimeException("Stub!"); } public void setTextScaleX(float size) { throw new RuntimeException("Stub!"); } public void setTypeface(@Nullable Typeface tf) { throw new RuntimeException("Stub!"); } public Typeface getTypeface() { throw new RuntimeException("Stub!"); } public void setElegantTextHeight(boolean elegant) { throw new RuntimeException("Stub!"); } public void setFallbackLineSpacing(boolean enabled) { throw new RuntimeException("Stub!"); } public boolean isFallbackLineSpacing() { throw new RuntimeException("Stub!"); } public boolean isElegantTextHeight() { throw new RuntimeException("Stub!"); } public float getLetterSpacing() { throw new RuntimeException("Stub!"); } public void setLetterSpacing(float letterSpacing) { throw new RuntimeException("Stub!"); } @Nullable public String getFontFeatureSettings() { throw new RuntimeException("Stub!"); } @Nullable public String getFontVariationSettings() { throw new RuntimeException("Stub!"); } public void setBreakStrategy(int breakStrategy) { throw new RuntimeException("Stub!"); } public int getBreakStrategy() { throw new RuntimeException("Stub!"); } public void setHyphenationFrequency(int hyphenationFrequency) { throw new RuntimeException("Stub!"); } public int getHyphenationFrequency() { throw new RuntimeException("Stub!"); } @NonNull public Params getTextMetricsParams() { throw new RuntimeException("Stub!"); } public void setTextMetricsParams(@NonNull Params params) { throw new RuntimeException("Stub!"); } public void setJustificationMode(int justificationMode) { throw new RuntimeException("Stub!"); } public int getJustificationMode() { throw new RuntimeException("Stub!"); } public void setFontFeatureSettings(@Nullable String fontFeatureSettings) { throw new RuntimeException("Stub!"); } public boolean setFontVariationSettings(@Nullable String fontVariationSettings) { throw new RuntimeException("Stub!"); } public void setTextColor(int color) { throw new RuntimeException("Stub!"); } public void setTextColor(ColorStateList colors) { throw new RuntimeException("Stub!"); } public final ColorStateList getTextColors() { throw new RuntimeException("Stub!"); } public final int getCurrentTextColor() { throw new RuntimeException("Stub!"); } public void setHighlightColor(int color) { throw new RuntimeException("Stub!"); } public int getHighlightColor() { throw new RuntimeException("Stub!"); } public final void setShowSoftInputOnFocus(boolean show) { throw new RuntimeException("Stub!"); } public final boolean getShowSoftInputOnFocus() { throw new RuntimeException("Stub!"); } public void setShadowLayer(float radius, float dx, float dy, int color) { throw new RuntimeException("Stub!"); } public float getShadowRadius() { throw new RuntimeException("Stub!"); } public float getShadowDx() { throw new RuntimeException("Stub!"); } public float getShadowDy() { throw new RuntimeException("Stub!"); } public int getShadowColor() { throw new RuntimeException("Stub!"); } public TextPaint getPaint() { throw new RuntimeException("Stub!"); } public final void setAutoLinkMask(int mask) { throw new RuntimeException("Stub!"); } public final void setLinksClickable(boolean whether) { throw new RuntimeException("Stub!"); } public final boolean getLinksClickable() { throw new RuntimeException("Stub!"); } public URLSpan[] getUrls() { throw new RuntimeException("Stub!"); } public final void setHintTextColor(int color) { throw new RuntimeException("Stub!"); } public final void setHintTextColor(ColorStateList colors) { throw new RuntimeException("Stub!"); } public final ColorStateList getHintTextColors() { throw new RuntimeException("Stub!"); } public final int getCurrentHintTextColor() { throw new RuntimeException("Stub!"); } public final void setLinkTextColor(int color) { throw new RuntimeException("Stub!"); } public final void setLinkTextColor(ColorStateList colors) { throw new RuntimeException("Stub!"); } public final ColorStateList getLinkTextColors() { throw new RuntimeException("Stub!"); } public void setGravity(int gravity) { throw new RuntimeException("Stub!"); } public int getGravity() { throw new RuntimeException("Stub!"); } public int getPaintFlags() { throw new RuntimeException("Stub!"); } public void setPaintFlags(int flags) { throw new RuntimeException("Stub!"); } public void setHorizontallyScrolling(boolean whether) { throw new RuntimeException("Stub!"); } public final boolean isHorizontallyScrollable() { throw new RuntimeException("Stub!"); } public void setMinLines(int minLines) { throw new RuntimeException("Stub!"); } public int getMinLines() { throw new RuntimeException("Stub!"); } public void setMinHeight(int minPixels) { throw new RuntimeException("Stub!"); } public int getMinHeight() { throw new RuntimeException("Stub!"); } public void setMaxLines(int maxLines) { throw new RuntimeException("Stub!"); } public int getMaxLines() { throw new RuntimeException("Stub!"); } public void setMaxHeight(int maxPixels) { throw new RuntimeException("Stub!"); } public int getMaxHeight() { throw new RuntimeException("Stub!"); } public void setLines(int lines) { throw new RuntimeException("Stub!"); } public void setHeight(int pixels) { throw new RuntimeException("Stub!"); } public void setMinEms(int minEms) { throw new RuntimeException("Stub!"); } public int getMinEms() { throw new RuntimeException("Stub!"); } public void setMinWidth(int minPixels) { throw new RuntimeException("Stub!"); } public int getMinWidth() { throw new RuntimeException("Stub!"); } public void setMaxEms(int maxEms) { throw new RuntimeException("Stub!"); } public int getMaxEms() { throw new RuntimeException("Stub!"); } public void setMaxWidth(int maxPixels) { throw new RuntimeException("Stub!"); } public int getMaxWidth() { throw new RuntimeException("Stub!"); } public void setEms(int ems) { throw new RuntimeException("Stub!"); } public void setWidth(int pixels) { throw new RuntimeException("Stub!"); } public void setLineSpacing(float add, float mult) { throw new RuntimeException("Stub!"); } public float getLineSpacingMultiplier() { throw new RuntimeException("Stub!"); } public float getLineSpacingExtra() { throw new RuntimeException("Stub!"); } public void setLineHeight(int lineHeight) { throw new RuntimeException("Stub!"); } public final void append(CharSequence text) { throw new RuntimeException("Stub!"); } public void append(CharSequence text, int start, int end) { throw new RuntimeException("Stub!"); } protected void drawableStateChanged() { throw new RuntimeException("Stub!"); } public void drawableHotspotChanged(float x, float y) { throw new RuntimeException("Stub!"); } public Parcelable onSaveInstanceState() { throw new RuntimeException("Stub!"); } public void onRestoreInstanceState(Parcelable state) { throw new RuntimeException("Stub!"); } public void setFreezesText(boolean freezesText) { throw new RuntimeException("Stub!"); } public boolean getFreezesText() { throw new RuntimeException("Stub!"); } public final void setEditableFactory(Factory factory) { throw new RuntimeException("Stub!"); } public final void setSpannableFactory(android.text.Spannable.Factory factory) { throw new RuntimeException("Stub!"); } public final void setText(CharSequence text) { throw new RuntimeException("Stub!"); } public final void setTextKeepState(CharSequence text) { throw new RuntimeException("Stub!"); } public void setText(CharSequence text, TextView.BufferType type) { throw new RuntimeException("Stub!"); } public final void setText(char[] text, int start, int len) { throw new RuntimeException("Stub!"); } public final void setTextKeepState(CharSequence text, TextView.BufferType type) { throw new RuntimeException("Stub!"); } public final void setText(int resid) { throw new RuntimeException("Stub!"); } public final void setText(int resid, TextView.BufferType type) { throw new RuntimeException("Stub!"); } public final void setHint(CharSequence hint) { throw new RuntimeException("Stub!"); } public final void setHint(int resid) { throw new RuntimeException("Stub!"); } @CapturedViewProperty public CharSequence getHint() { throw new RuntimeException("Stub!"); } public boolean isSingleLine() { throw new RuntimeException("Stub!"); } public void setInputType(int type) { throw new RuntimeException("Stub!"); } public void setRawInputType(int type) { throw new RuntimeException("Stub!"); } public int getInputType() { throw new RuntimeException("Stub!"); } public void setImeOptions(int imeOptions) { throw new RuntimeException("Stub!"); } public int getImeOptions() { throw new RuntimeException("Stub!"); } public void setImeActionLabel(CharSequence label, int actionId) { throw new RuntimeException("Stub!"); } public CharSequence getImeActionLabel() { throw new RuntimeException("Stub!"); } public int getImeActionId() { throw new RuntimeException("Stub!"); } public void setOnEditorActionListener(TextView.OnEditorActionListener l) { throw new RuntimeException("Stub!"); } public void onEditorAction(int actionCode) { throw new RuntimeException("Stub!"); } public void setPrivateImeOptions(String type) { throw new RuntimeException("Stub!"); } public String getPrivateImeOptions() { throw new RuntimeException("Stub!"); } public void setInputExtras(int xmlResId) throws IOException, XmlPullParserException { throw new RuntimeException("Stub!"); } public Bundle getInputExtras(boolean create) { throw new RuntimeException("Stub!"); } public void setImeHintLocales(@Nullable LocaleList hintLocales) { throw new RuntimeException("Stub!"); } @Nullable public LocaleList getImeHintLocales() { throw new RuntimeException("Stub!"); } public CharSequence getError() { throw new RuntimeException("Stub!"); } public void setError(CharSequence error) { throw new RuntimeException("Stub!"); } public void setError(CharSequence error, Drawable icon) { throw new RuntimeException("Stub!"); } protected boolean setFrame(int l, int t, int r, int b) { throw new RuntimeException("Stub!"); } public void setFilters(InputFilter[] filters) { throw new RuntimeException("Stub!"); } public InputFilter[] getFilters() { throw new RuntimeException("Stub!"); } public boolean onPreDraw() { throw new RuntimeException("Stub!"); } protected void onAttachedToWindow() { throw new RuntimeException("Stub!"); } public void onScreenStateChanged(int screenState) { throw new RuntimeException("Stub!"); } protected boolean isPaddingOffsetRequired() { throw new RuntimeException("Stub!"); } protected int getLeftPaddingOffset() { throw new RuntimeException("Stub!"); } protected int getTopPaddingOffset() { throw new RuntimeException("Stub!"); } protected int getBottomPaddingOffset() { throw new RuntimeException("Stub!"); } protected int getRightPaddingOffset() { throw new RuntimeException("Stub!"); } protected boolean verifyDrawable(@NonNull Drawable who) { throw new RuntimeException("Stub!"); } public void jumpDrawablesToCurrentState() { throw new RuntimeException("Stub!"); } public void invalidateDrawable(@NonNull Drawable drawable) { throw new RuntimeException("Stub!"); } public boolean hasOverlappingRendering() { throw new RuntimeException("Stub!"); } public boolean isTextSelectable() { throw new RuntimeException("Stub!"); } public void setTextIsSelectable(boolean selectable) { throw new RuntimeException("Stub!"); } protected int[] onCreateDrawableState(int extraSpace) { throw new RuntimeException("Stub!"); } protected void onDraw(Canvas canvas) { throw new RuntimeException("Stub!"); } public void getFocusedRect(Rect r) { throw new RuntimeException("Stub!"); } public int getLineCount() { throw new RuntimeException("Stub!"); } public int getLineBounds(int line, Rect bounds) { throw new RuntimeException("Stub!"); } public int getBaseline() { throw new RuntimeException("Stub!"); } public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) { throw new RuntimeException("Stub!"); } public boolean onKeyPreIme(int keyCode, KeyEvent event) { throw new RuntimeException("Stub!"); } public boolean onKeyDown(int keyCode, KeyEvent event) { throw new RuntimeException("Stub!"); } public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { throw new RuntimeException("Stub!"); } public boolean onKeyUp(int keyCode, KeyEvent event) { throw new RuntimeException("Stub!"); } public boolean onCheckIsTextEditor() { throw new RuntimeException("Stub!"); } public InputConnection onCreateInputConnection(EditorInfo outAttrs) { throw new RuntimeException("Stub!"); } public boolean extractText(ExtractedTextRequest request, ExtractedText outText) { throw new RuntimeException("Stub!"); } public void setExtractedText(ExtractedText text) { throw new RuntimeException("Stub!"); } public void onCommitCompletion(CompletionInfo text) { throw new RuntimeException("Stub!"); } public void onCommitCorrection(CorrectionInfo info) { throw new RuntimeException("Stub!"); } public void beginBatchEdit() { throw new RuntimeException("Stub!"); } public void endBatchEdit() { throw new RuntimeException("Stub!"); } public void onBeginBatchEdit() { throw new RuntimeException("Stub!"); } public void onEndBatchEdit() { throw new RuntimeException("Stub!"); } public boolean onPrivateIMECommand(String action, Bundle data) { throw new RuntimeException("Stub!"); } public void setIncludeFontPadding(boolean includepad) { throw new RuntimeException("Stub!"); } public boolean getIncludeFontPadding() { throw new RuntimeException("Stub!"); } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { throw new RuntimeException("Stub!"); } protected void onLayout(boolean changed, int left, int top, int right, int bottom) { throw new RuntimeException("Stub!"); } public boolean bringPointIntoView(int offset) { throw new RuntimeException("Stub!"); } public boolean moveCursorToVisibleOffset() { throw new RuntimeException("Stub!"); } public void computeScroll() { throw new RuntimeException("Stub!"); } public void debug(int depth) { throw new RuntimeException("Stub!"); } @ExportedProperty( category = "text" ) public int getSelectionStart() { throw new RuntimeException("Stub!"); } @ExportedProperty( category = "text" ) public int getSelectionEnd() { throw new RuntimeException("Stub!"); } public boolean hasSelection() { throw new RuntimeException("Stub!"); } public void setSingleLine() { throw new RuntimeException("Stub!"); } public void setAllCaps(boolean allCaps) { throw new RuntimeException("Stub!"); } public boolean isAllCaps() { throw new RuntimeException("Stub!"); } public void setSingleLine(boolean singleLine) { throw new RuntimeException("Stub!"); } public void setEllipsize(TruncateAt where) { throw new RuntimeException("Stub!"); } public void setMarqueeRepeatLimit(int marqueeLimit) { throw new RuntimeException("Stub!"); } public int getMarqueeRepeatLimit() { throw new RuntimeException("Stub!"); } @ExportedProperty public TruncateAt getEllipsize() { throw new RuntimeException("Stub!"); } public void setSelectAllOnFocus(boolean selectAllOnFocus) { throw new RuntimeException("Stub!"); } public void setCursorVisible(boolean visible) { throw new RuntimeException("Stub!"); } public boolean isCursorVisible() { throw new RuntimeException("Stub!"); } protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { throw new RuntimeException("Stub!"); } protected void onSelectionChanged(int selStart, int selEnd) { throw new RuntimeException("Stub!"); } public void addTextChangedListener(TextWatcher watcher) { throw new RuntimeException("Stub!"); } public void removeTextChangedListener(TextWatcher watcher) { throw new RuntimeException("Stub!"); } protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { throw new RuntimeException("Stub!"); } public void onWindowFocusChanged(boolean hasWindowFocus) { throw new RuntimeException("Stub!"); } protected void onVisibilityChanged(View changedView, int visibility) { throw new RuntimeException("Stub!"); } public void clearComposingText() { throw new RuntimeException("Stub!"); } public void setSelected(boolean selected) { throw new RuntimeException("Stub!"); } public boolean onTouchEvent(MotionEvent event) { throw new RuntimeException("Stub!"); } public boolean onGenericMotionEvent(MotionEvent event) { throw new RuntimeException("Stub!"); } protected void onCreateContextMenu(ContextMenu menu) { throw new RuntimeException("Stub!"); } public boolean showContextMenu() { throw new RuntimeException("Stub!"); } public boolean showContextMenu(float x, float y) { throw new RuntimeException("Stub!"); } public boolean didTouchFocusSelect() { throw new RuntimeException("Stub!"); } public void cancelLongPress() { throw new RuntimeException("Stub!"); } public boolean onTrackballEvent(MotionEvent event) { throw new RuntimeException("Stub!"); } public void setScroller(Scroller s) { throw new RuntimeException("Stub!"); } protected float getLeftFadingEdgeStrength() { throw new RuntimeException("Stub!"); } protected float getRightFadingEdgeStrength() { throw new RuntimeException("Stub!"); } protected int computeHorizontalScrollRange() { throw new RuntimeException("Stub!"); } protected int computeVerticalScrollRange() { throw new RuntimeException("Stub!"); } protected int computeVerticalScrollExtent() { throw new RuntimeException("Stub!"); } public void findViewsWithText(ArrayList<View> outViews, CharSequence searched, int flags) { throw new RuntimeException("Stub!"); } public boolean onKeyShortcut(int keyCode, KeyEvent event) { throw new RuntimeException("Stub!"); } public CharSequence getAccessibilityClassName() { throw new RuntimeException("Stub!"); } public void autofill(AutofillValue value) { throw new RuntimeException("Stub!"); } public int getAutofillType() { throw new RuntimeException("Stub!"); } @Nullable public AutofillValue getAutofillValue() { throw new RuntimeException("Stub!"); } public void addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo info, String extraDataKey, Bundle arguments) { throw new RuntimeException("Stub!"); } public void sendAccessibilityEventUnchecked(AccessibilityEvent event) { throw new RuntimeException("Stub!"); } public boolean isInputMethodTarget() { throw new RuntimeException("Stub!"); } public boolean onTextContextMenuItem(int id) { throw new RuntimeException("Stub!"); } public boolean performLongClick() { throw new RuntimeException("Stub!"); } protected void onScrollChanged(int horiz, int vert, int oldHoriz, int oldVert) { throw new RuntimeException("Stub!"); } public boolean isSuggestionsEnabled() { throw new RuntimeException("Stub!"); } public void setCustomSelectionActionModeCallback(Callback actionModeCallback) { throw new RuntimeException("Stub!"); } public Callback getCustomSelectionActionModeCallback() { throw new RuntimeException("Stub!"); } public void setCustomInsertionActionModeCallback(Callback actionModeCallback) { throw new RuntimeException("Stub!"); } public Callback getCustomInsertionActionModeCallback() { throw new RuntimeException("Stub!"); } public void setTextClassifier(@Nullable TextClassifier textClassifier) { throw new RuntimeException("Stub!"); } @NonNull public TextClassifier getTextClassifier() { throw new RuntimeException("Stub!"); } public int getOffsetForPosition(float x, float y) { throw new RuntimeException("Stub!"); } public boolean onDragEvent(DragEvent event) { throw new RuntimeException("Stub!"); } public void onRtlPropertiesChanged(int layoutDirection) { throw new RuntimeException("Stub!"); } @NonNull public TextDirectionHeuristic getTextDirectionHeuristic() { throw new RuntimeException("Stub!"); } public static class SavedState extends BaseSavedState { @RecentlyNonNull public static final Creator<TextView.SavedState> CREATOR = null; SavedState(Parcelable superState) { super((Parcel)null); throw new RuntimeException("Stub!"); } public void writeToParcel(Parcel out, int flags) { throw new RuntimeException("Stub!"); } public String toString() { throw new RuntimeException("Stub!"); } } public interface OnEditorActionListener { boolean onEditorAction(TextView var1, int var2, KeyEvent var3); } public static enum BufferType { NORMAL, SPANNABLE, EDITABLE; private BufferType() { } } }
原文:会打篮球的程序猿