ADD week 5
This commit is contained in:
202
02-Easy5/E5/sources/androidx/viewpager/R.java
Normal file
202
02-Easy5/E5/sources/androidx/viewpager/R.java
Normal file
@ -0,0 +1,202 @@
|
||||
package androidx.viewpager;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R {
|
||||
|
||||
public static final class attr {
|
||||
public static final int alpha = 0x7f03002e;
|
||||
public static final int font = 0x7f0301fb;
|
||||
public static final int fontProviderAuthority = 0x7f0301fd;
|
||||
public static final int fontProviderCerts = 0x7f0301fe;
|
||||
public static final int fontProviderFetchStrategy = 0x7f0301ff;
|
||||
public static final int fontProviderFetchTimeout = 0x7f030200;
|
||||
public static final int fontProviderPackage = 0x7f030201;
|
||||
public static final int fontProviderQuery = 0x7f030202;
|
||||
public static final int fontStyle = 0x7f030204;
|
||||
public static final int fontVariationSettings = 0x7f030205;
|
||||
public static final int fontWeight = 0x7f030206;
|
||||
public static final int ttcIndex = 0x7f0304b6;
|
||||
|
||||
private attr() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class color {
|
||||
public static final int notification_action_color_filter = 0x7f0502e9;
|
||||
public static final int notification_icon_bg_color = 0x7f0502ea;
|
||||
public static final int ripple_material_light = 0x7f0502f7;
|
||||
public static final int secondary_text_default_material_light = 0x7f0502f9;
|
||||
|
||||
private color() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class dimen {
|
||||
public static final int compat_button_inset_horizontal_material = 0x7f060058;
|
||||
public static final int compat_button_inset_vertical_material = 0x7f060059;
|
||||
public static final int compat_button_padding_horizontal_material = 0x7f06005a;
|
||||
public static final int compat_button_padding_vertical_material = 0x7f06005b;
|
||||
public static final int compat_control_corner_material = 0x7f06005c;
|
||||
public static final int compat_notification_large_icon_max_height = 0x7f06005d;
|
||||
public static final int compat_notification_large_icon_max_width = 0x7f06005e;
|
||||
public static final int notification_action_icon_size = 0x7f060307;
|
||||
public static final int notification_action_text_size = 0x7f060308;
|
||||
public static final int notification_big_circle_margin = 0x7f060309;
|
||||
public static final int notification_content_margin_start = 0x7f06030a;
|
||||
public static final int notification_large_icon_height = 0x7f06030b;
|
||||
public static final int notification_large_icon_width = 0x7f06030c;
|
||||
public static final int notification_main_column_padding_top = 0x7f06030d;
|
||||
public static final int notification_media_narrow_margin = 0x7f06030e;
|
||||
public static final int notification_right_icon_size = 0x7f06030f;
|
||||
public static final int notification_right_side_padding_top = 0x7f060310;
|
||||
public static final int notification_small_icon_background_padding = 0x7f060311;
|
||||
public static final int notification_small_icon_size_as_large = 0x7f060312;
|
||||
public static final int notification_subtext_size = 0x7f060313;
|
||||
public static final int notification_top_pad = 0x7f060314;
|
||||
public static final int notification_top_pad_large_text = 0x7f060315;
|
||||
|
||||
private dimen() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class drawable {
|
||||
public static final int notification_action_background = 0x7f0700d0;
|
||||
public static final int notification_bg = 0x7f0700d1;
|
||||
public static final int notification_bg_low = 0x7f0700d2;
|
||||
public static final int notification_bg_low_normal = 0x7f0700d3;
|
||||
public static final int notification_bg_low_pressed = 0x7f0700d4;
|
||||
public static final int notification_bg_normal = 0x7f0700d5;
|
||||
public static final int notification_bg_normal_pressed = 0x7f0700d6;
|
||||
public static final int notification_icon_background = 0x7f0700d7;
|
||||
public static final int notification_template_icon_bg = 0x7f0700d8;
|
||||
public static final int notification_template_icon_low_bg = 0x7f0700d9;
|
||||
public static final int notification_tile_bg = 0x7f0700da;
|
||||
public static final int notify_panel_notification_icon_bg = 0x7f0700db;
|
||||
|
||||
private drawable() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class id {
|
||||
public static final int action_container = 0x7f08003a;
|
||||
public static final int action_divider = 0x7f08003c;
|
||||
public static final int action_image = 0x7f08003d;
|
||||
public static final int action_text = 0x7f080043;
|
||||
public static final int actions = 0x7f080044;
|
||||
public static final int async = 0x7f080052;
|
||||
public static final int blocking = 0x7f08005c;
|
||||
public static final int chronometer = 0x7f080071;
|
||||
public static final int forever = 0x7f0800c2;
|
||||
public static final int icon = 0x7f0800d4;
|
||||
public static final int icon_group = 0x7f0800d5;
|
||||
public static final int info = 0x7f0800dd;
|
||||
public static final int italic = 0x7f0800e0;
|
||||
public static final int line1 = 0x7f0800e9;
|
||||
public static final int line3 = 0x7f0800ea;
|
||||
public static final int normal = 0x7f080139;
|
||||
public static final int notification_background = 0x7f08013b;
|
||||
public static final int notification_main_column = 0x7f08013c;
|
||||
public static final int notification_main_column_container = 0x7f08013d;
|
||||
public static final int right_icon = 0x7f08016b;
|
||||
public static final int right_side = 0x7f08016c;
|
||||
public static final int tag_transition_group = 0x7f0801b6;
|
||||
public static final int tag_unhandled_key_event_manager = 0x7f0801b7;
|
||||
public static final int tag_unhandled_key_listeners = 0x7f0801b8;
|
||||
public static final int text = 0x7f0801ba;
|
||||
public static final int text2 = 0x7f0801bb;
|
||||
public static final int time = 0x7f0801ca;
|
||||
public static final int title = 0x7f0801cb;
|
||||
|
||||
private id() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class integer {
|
||||
public static final int status_bar_notification_info_maxnum = 0x7f090043;
|
||||
|
||||
private integer() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class layout {
|
||||
public static final int notification_action = 0x7f0b0060;
|
||||
public static final int notification_action_tombstone = 0x7f0b0061;
|
||||
public static final int notification_template_custom_big = 0x7f0b0062;
|
||||
public static final int notification_template_icon_group = 0x7f0b0063;
|
||||
public static final int notification_template_part_chronometer = 0x7f0b0064;
|
||||
public static final int notification_template_part_time = 0x7f0b0065;
|
||||
|
||||
private layout() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class string {
|
||||
public static final int status_bar_notification_info_overflow = 0x7f0f00a8;
|
||||
|
||||
private string() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class style {
|
||||
public static final int TextAppearance_Compat_Notification = 0x7f1001c3;
|
||||
public static final int TextAppearance_Compat_Notification_Info = 0x7f1001c4;
|
||||
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1001c5;
|
||||
public static final int TextAppearance_Compat_Notification_Time = 0x7f1001c6;
|
||||
public static final int TextAppearance_Compat_Notification_Title = 0x7f1001c7;
|
||||
public static final int Widget_Compat_NotificationActionContainer = 0x7f10032d;
|
||||
public static final int Widget_Compat_NotificationActionText = 0x7f10032e;
|
||||
|
||||
private style() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class styleable {
|
||||
public static final int ColorStateListItem_alpha = 0x00000003;
|
||||
public static final int ColorStateListItem_android_alpha = 0x00000001;
|
||||
public static final int ColorStateListItem_android_color = 0x00000000;
|
||||
public static final int ColorStateListItem_android_lStar = 0x00000002;
|
||||
public static final int ColorStateListItem_lStar = 0x00000004;
|
||||
public static final int FontFamilyFont_android_font = 0x00000000;
|
||||
public static final int FontFamilyFont_android_fontStyle = 0x00000002;
|
||||
public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004;
|
||||
public static final int FontFamilyFont_android_fontWeight = 0x00000001;
|
||||
public static final int FontFamilyFont_android_ttcIndex = 0x00000003;
|
||||
public static final int FontFamilyFont_font = 0x00000005;
|
||||
public static final int FontFamilyFont_fontStyle = 0x00000006;
|
||||
public static final int FontFamilyFont_fontVariationSettings = 0x00000007;
|
||||
public static final int FontFamilyFont_fontWeight = 0x00000008;
|
||||
public static final int FontFamilyFont_ttcIndex = 0x00000009;
|
||||
public static final int FontFamily_fontProviderAuthority = 0x00000000;
|
||||
public static final int FontFamily_fontProviderCerts = 0x00000001;
|
||||
public static final int FontFamily_fontProviderFetchStrategy = 0x00000002;
|
||||
public static final int FontFamily_fontProviderFetchTimeout = 0x00000003;
|
||||
public static final int FontFamily_fontProviderPackage = 0x00000004;
|
||||
public static final int FontFamily_fontProviderQuery = 0x00000005;
|
||||
public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006;
|
||||
public static final int GradientColorItem_android_color = 0x00000000;
|
||||
public static final int GradientColorItem_android_offset = 0x00000001;
|
||||
public static final int GradientColor_android_centerColor = 0x00000007;
|
||||
public static final int GradientColor_android_centerX = 0x00000003;
|
||||
public static final int GradientColor_android_centerY = 0x00000004;
|
||||
public static final int GradientColor_android_endColor = 0x00000001;
|
||||
public static final int GradientColor_android_endX = 0x0000000a;
|
||||
public static final int GradientColor_android_endY = 0x0000000b;
|
||||
public static final int GradientColor_android_gradientRadius = 0x00000005;
|
||||
public static final int GradientColor_android_startColor = 0x00000000;
|
||||
public static final int GradientColor_android_startX = 0x00000008;
|
||||
public static final int GradientColor_android_startY = 0x00000009;
|
||||
public static final int GradientColor_android_tileMode = 0x00000006;
|
||||
public static final int GradientColor_android_type = 0x00000002;
|
||||
public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, ch.mod_p.sre24.e5.R.attr.alpha, ch.mod_p.sre24.e5.R.attr.lStar};
|
||||
public static final int[] FontFamily = {ch.mod_p.sre24.e5.R.attr.fontProviderAuthority, ch.mod_p.sre24.e5.R.attr.fontProviderCerts, ch.mod_p.sre24.e5.R.attr.fontProviderFetchStrategy, ch.mod_p.sre24.e5.R.attr.fontProviderFetchTimeout, ch.mod_p.sre24.e5.R.attr.fontProviderPackage, ch.mod_p.sre24.e5.R.attr.fontProviderQuery, ch.mod_p.sre24.e5.R.attr.fontProviderSystemFontFamily};
|
||||
public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.font, ch.mod_p.sre24.e5.R.attr.fontStyle, ch.mod_p.sre24.e5.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.fontWeight, ch.mod_p.sre24.e5.R.attr.ttcIndex};
|
||||
public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
|
||||
public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
|
||||
|
||||
private styleable() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
104
02-Easy5/E5/sources/androidx/viewpager/widget/PagerAdapter.java
Normal file
104
02-Easy5/E5/sources/androidx/viewpager/widget/PagerAdapter.java
Normal file
@ -0,0 +1,104 @@
|
||||
package androidx.viewpager.widget;
|
||||
|
||||
import android.database.DataSetObservable;
|
||||
import android.database.DataSetObserver;
|
||||
import android.os.Parcelable;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class PagerAdapter {
|
||||
public static final int POSITION_NONE = -2;
|
||||
public static final int POSITION_UNCHANGED = -1;
|
||||
private final DataSetObservable mObservable = new DataSetObservable();
|
||||
private DataSetObserver mViewPagerObserver;
|
||||
|
||||
@Deprecated
|
||||
public void finishUpdate(View view) {
|
||||
}
|
||||
|
||||
public abstract int getCount();
|
||||
|
||||
public int getItemPosition(Object obj) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public CharSequence getPageTitle(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getPageWidth(int i) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public abstract boolean isViewFromObject(View view, Object obj);
|
||||
|
||||
public void restoreState(Parcelable parcelable, ClassLoader classLoader) {
|
||||
}
|
||||
|
||||
public Parcelable saveState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setPrimaryItem(View view, int i, Object obj) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void startUpdate(View view) {
|
||||
}
|
||||
|
||||
public void startUpdate(ViewGroup viewGroup) {
|
||||
startUpdate((View) viewGroup);
|
||||
}
|
||||
|
||||
public Object instantiateItem(ViewGroup viewGroup, int i) {
|
||||
return instantiateItem((View) viewGroup, i);
|
||||
}
|
||||
|
||||
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
destroyItem((View) viewGroup, i, obj);
|
||||
}
|
||||
|
||||
public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
setPrimaryItem((View) viewGroup, i, obj);
|
||||
}
|
||||
|
||||
public void finishUpdate(ViewGroup viewGroup) {
|
||||
finishUpdate((View) viewGroup);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Object instantiateItem(View view, int i) {
|
||||
throw new UnsupportedOperationException("Required method instantiateItem was not overridden");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void destroyItem(View view, int i, Object obj) {
|
||||
throw new UnsupportedOperationException("Required method destroyItem was not overridden");
|
||||
}
|
||||
|
||||
public void notifyDataSetChanged() {
|
||||
synchronized (this) {
|
||||
DataSetObserver dataSetObserver = this.mViewPagerObserver;
|
||||
if (dataSetObserver != null) {
|
||||
dataSetObserver.onChanged();
|
||||
}
|
||||
}
|
||||
this.mObservable.notifyChanged();
|
||||
}
|
||||
|
||||
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
this.mObservable.registerObserver(dataSetObserver);
|
||||
}
|
||||
|
||||
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
this.mObservable.unregisterObserver(dataSetObserver);
|
||||
}
|
||||
|
||||
void setViewPagerObserver(DataSetObserver dataSetObserver) {
|
||||
synchronized (this) {
|
||||
this.mViewPagerObserver = dataSetObserver;
|
||||
}
|
||||
}
|
||||
}
|
214
02-Easy5/E5/sources/androidx/viewpager/widget/PagerTabStrip.java
Normal file
214
02-Easy5/E5/sources/androidx/viewpager/widget/PagerTabStrip.java
Normal file
@ -0,0 +1,214 @@
|
||||
package androidx.viewpager.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PagerTabStrip extends PagerTitleStrip {
|
||||
private static final int FULL_UNDERLINE_HEIGHT = 1;
|
||||
private static final int INDICATOR_HEIGHT = 3;
|
||||
private static final int MIN_PADDING_BOTTOM = 6;
|
||||
private static final int MIN_STRIP_HEIGHT = 32;
|
||||
private static final int MIN_TEXT_SPACING = 64;
|
||||
private static final int TAB_PADDING = 16;
|
||||
private static final int TAB_SPACING = 32;
|
||||
private static final String TAG = "PagerTabStrip";
|
||||
private boolean mDrawFullUnderline;
|
||||
private boolean mDrawFullUnderlineSet;
|
||||
private int mFullUnderlineHeight;
|
||||
private boolean mIgnoreTap;
|
||||
private int mIndicatorColor;
|
||||
private int mIndicatorHeight;
|
||||
private float mInitialMotionX;
|
||||
private float mInitialMotionY;
|
||||
private int mMinPaddingBottom;
|
||||
private int mMinStripHeight;
|
||||
private int mMinTextSpacing;
|
||||
private int mTabAlpha;
|
||||
private int mTabPadding;
|
||||
private final Paint mTabPaint;
|
||||
private final Rect mTempRect;
|
||||
private int mTouchSlop;
|
||||
|
||||
public boolean getDrawFullUnderline() {
|
||||
return this.mDrawFullUnderline;
|
||||
}
|
||||
|
||||
public int getTabIndicatorColor() {
|
||||
return this.mIndicatorColor;
|
||||
}
|
||||
|
||||
public PagerTabStrip(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public PagerTabStrip(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
Paint paint = new Paint();
|
||||
this.mTabPaint = paint;
|
||||
this.mTempRect = new Rect();
|
||||
this.mTabAlpha = 255;
|
||||
this.mDrawFullUnderline = false;
|
||||
this.mDrawFullUnderlineSet = false;
|
||||
int i = this.mTextColor;
|
||||
this.mIndicatorColor = i;
|
||||
paint.setColor(i);
|
||||
float f = context.getResources().getDisplayMetrics().density;
|
||||
this.mIndicatorHeight = (int) ((3.0f * f) + 0.5f);
|
||||
this.mMinPaddingBottom = (int) ((6.0f * f) + 0.5f);
|
||||
this.mMinTextSpacing = (int) (64.0f * f);
|
||||
this.mTabPadding = (int) ((16.0f * f) + 0.5f);
|
||||
this.mFullUnderlineHeight = (int) ((1.0f * f) + 0.5f);
|
||||
this.mMinStripHeight = (int) ((f * 32.0f) + 0.5f);
|
||||
this.mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
|
||||
setTextSpacing(getTextSpacing());
|
||||
setWillNotDraw(false);
|
||||
this.mPrevText.setFocusable(true);
|
||||
this.mPrevText.setOnClickListener(new View.OnClickListener() { // from class: androidx.viewpager.widget.PagerTabStrip.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
PagerTabStrip.this.mPager.setCurrentItem(PagerTabStrip.this.mPager.getCurrentItem() - 1);
|
||||
}
|
||||
});
|
||||
this.mNextText.setFocusable(true);
|
||||
this.mNextText.setOnClickListener(new View.OnClickListener() { // from class: androidx.viewpager.widget.PagerTabStrip.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
PagerTabStrip.this.mPager.setCurrentItem(PagerTabStrip.this.mPager.getCurrentItem() + 1);
|
||||
}
|
||||
});
|
||||
if (getBackground() == null) {
|
||||
this.mDrawFullUnderline = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTabIndicatorColor(int i) {
|
||||
this.mIndicatorColor = i;
|
||||
this.mTabPaint.setColor(i);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setTabIndicatorColorResource(int i) {
|
||||
setTabIndicatorColor(ContextCompat.getColor(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setPadding(int i, int i2, int i3, int i4) {
|
||||
int i5 = this.mMinPaddingBottom;
|
||||
if (i4 < i5) {
|
||||
i4 = i5;
|
||||
}
|
||||
super.setPadding(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerTitleStrip
|
||||
public void setTextSpacing(int i) {
|
||||
int i2 = this.mMinTextSpacing;
|
||||
if (i < i2) {
|
||||
i = i2;
|
||||
}
|
||||
super.setTextSpacing(i);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
if (this.mDrawFullUnderlineSet) {
|
||||
return;
|
||||
}
|
||||
this.mDrawFullUnderline = drawable == null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundColor(int i) {
|
||||
super.setBackgroundColor(i);
|
||||
if (this.mDrawFullUnderlineSet) {
|
||||
return;
|
||||
}
|
||||
this.mDrawFullUnderline = (i & ViewCompat.MEASURED_STATE_MASK) == 0;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
if (this.mDrawFullUnderlineSet) {
|
||||
return;
|
||||
}
|
||||
this.mDrawFullUnderline = i == 0;
|
||||
}
|
||||
|
||||
public void setDrawFullUnderline(boolean z) {
|
||||
this.mDrawFullUnderline = z;
|
||||
this.mDrawFullUnderlineSet = true;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerTitleStrip
|
||||
int getMinHeight() {
|
||||
return Math.max(super.getMinHeight(), this.mMinStripHeight);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
int action = motionEvent.getAction();
|
||||
if (action != 0 && this.mIgnoreTap) {
|
||||
return false;
|
||||
}
|
||||
float x = motionEvent.getX();
|
||||
float y = motionEvent.getY();
|
||||
if (action == 0) {
|
||||
this.mInitialMotionX = x;
|
||||
this.mInitialMotionY = y;
|
||||
this.mIgnoreTap = false;
|
||||
} else if (action != 1) {
|
||||
if (action == 2 && (Math.abs(x - this.mInitialMotionX) > this.mTouchSlop || Math.abs(y - this.mInitialMotionY) > this.mTouchSlop)) {
|
||||
this.mIgnoreTap = true;
|
||||
}
|
||||
} else if (x < this.mCurrText.getLeft() - this.mTabPadding) {
|
||||
this.mPager.setCurrentItem(this.mPager.getCurrentItem() - 1);
|
||||
} else if (x > this.mCurrText.getRight() + this.mTabPadding) {
|
||||
this.mPager.setCurrentItem(this.mPager.getCurrentItem() + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
int height = getHeight();
|
||||
int left = this.mCurrText.getLeft() - this.mTabPadding;
|
||||
int right = this.mCurrText.getRight() + this.mTabPadding;
|
||||
int i = height - this.mIndicatorHeight;
|
||||
this.mTabPaint.setColor((this.mTabAlpha << 24) | (this.mIndicatorColor & ViewCompat.MEASURED_SIZE_MASK));
|
||||
float f = height;
|
||||
canvas.drawRect(left, i, right, f, this.mTabPaint);
|
||||
if (this.mDrawFullUnderline) {
|
||||
this.mTabPaint.setColor((this.mIndicatorColor & ViewCompat.MEASURED_SIZE_MASK) | ViewCompat.MEASURED_STATE_MASK);
|
||||
canvas.drawRect(getPaddingLeft(), height - this.mFullUnderlineHeight, getWidth() - getPaddingRight(), f, this.mTabPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerTitleStrip
|
||||
void updateTextPositions(int i, float f, boolean z) {
|
||||
Rect rect = this.mTempRect;
|
||||
int height = getHeight();
|
||||
int left = this.mCurrText.getLeft() - this.mTabPadding;
|
||||
int right = this.mCurrText.getRight() + this.mTabPadding;
|
||||
int i2 = height - this.mIndicatorHeight;
|
||||
rect.set(left, i2, right, height);
|
||||
super.updateTextPositions(i, f, z);
|
||||
this.mTabAlpha = (int) (Math.abs(f - 0.5f) * 2.0f * 255.0f);
|
||||
rect.union(this.mCurrText.getLeft() - this.mTabPadding, i2, this.mCurrText.getRight() + this.mTabPadding, height);
|
||||
invalidate(rect);
|
||||
}
|
||||
}
|
@ -0,0 +1,393 @@
|
||||
package androidx.viewpager.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.SingleLineTransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
|
||||
@ViewPager.DecorView
|
||||
/* loaded from: classes.dex */
|
||||
public class PagerTitleStrip extends ViewGroup {
|
||||
private static final float SIDE_ALPHA = 0.6f;
|
||||
private static final int TEXT_SPACING = 16;
|
||||
TextView mCurrText;
|
||||
private int mGravity;
|
||||
private int mLastKnownCurrentPage;
|
||||
float mLastKnownPositionOffset;
|
||||
TextView mNextText;
|
||||
private int mNonPrimaryAlpha;
|
||||
private final PageListener mPageListener;
|
||||
ViewPager mPager;
|
||||
TextView mPrevText;
|
||||
private int mScaledTextSpacing;
|
||||
int mTextColor;
|
||||
private boolean mUpdatingPositions;
|
||||
private boolean mUpdatingText;
|
||||
private WeakReference<PagerAdapter> mWatchingAdapter;
|
||||
private static final int[] ATTRS = {R.attr.textAppearance, R.attr.textSize, R.attr.textColor, R.attr.gravity};
|
||||
private static final int[] TEXT_ATTRS = {R.attr.textAllCaps};
|
||||
|
||||
public int getTextSpacing() {
|
||||
return this.mScaledTextSpacing;
|
||||
}
|
||||
|
||||
private static class SingleLineAllCapsTransform extends SingleLineTransformationMethod {
|
||||
private Locale mLocale;
|
||||
|
||||
SingleLineAllCapsTransform(Context context) {
|
||||
this.mLocale = context.getResources().getConfiguration().locale;
|
||||
}
|
||||
|
||||
@Override // android.text.method.ReplacementTransformationMethod, android.text.method.TransformationMethod
|
||||
public CharSequence getTransformation(CharSequence charSequence, View view) {
|
||||
CharSequence transformation = super.getTransformation(charSequence, view);
|
||||
if (transformation != null) {
|
||||
return transformation.toString().toUpperCase(this.mLocale);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void setSingleLineAllCaps(TextView textView) {
|
||||
textView.setTransformationMethod(new SingleLineAllCapsTransform(textView.getContext()));
|
||||
}
|
||||
|
||||
public PagerTitleStrip(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public PagerTitleStrip(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.mLastKnownCurrentPage = -1;
|
||||
this.mLastKnownPositionOffset = -1.0f;
|
||||
this.mPageListener = new PageListener();
|
||||
TextView textView = new TextView(context);
|
||||
this.mPrevText = textView;
|
||||
addView(textView);
|
||||
TextView textView2 = new TextView(context);
|
||||
this.mCurrText = textView2;
|
||||
addView(textView2);
|
||||
TextView textView3 = new TextView(context);
|
||||
this.mNextText = textView3;
|
||||
addView(textView3);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ATTRS);
|
||||
int resourceId = obtainStyledAttributes.getResourceId(0, 0);
|
||||
if (resourceId != 0) {
|
||||
TextViewCompat.setTextAppearance(this.mPrevText, resourceId);
|
||||
TextViewCompat.setTextAppearance(this.mCurrText, resourceId);
|
||||
TextViewCompat.setTextAppearance(this.mNextText, resourceId);
|
||||
}
|
||||
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(1, 0);
|
||||
if (dimensionPixelSize != 0) {
|
||||
setTextSize(0, dimensionPixelSize);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(2)) {
|
||||
int color = obtainStyledAttributes.getColor(2, 0);
|
||||
this.mPrevText.setTextColor(color);
|
||||
this.mCurrText.setTextColor(color);
|
||||
this.mNextText.setTextColor(color);
|
||||
}
|
||||
this.mGravity = obtainStyledAttributes.getInteger(3, 80);
|
||||
obtainStyledAttributes.recycle();
|
||||
this.mTextColor = this.mCurrText.getTextColors().getDefaultColor();
|
||||
setNonPrimaryAlpha(SIDE_ALPHA);
|
||||
this.mPrevText.setEllipsize(TextUtils.TruncateAt.END);
|
||||
this.mCurrText.setEllipsize(TextUtils.TruncateAt.END);
|
||||
this.mNextText.setEllipsize(TextUtils.TruncateAt.END);
|
||||
if (resourceId != 0) {
|
||||
TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(resourceId, TEXT_ATTRS);
|
||||
boolean z = obtainStyledAttributes2.getBoolean(0, false);
|
||||
obtainStyledAttributes2.recycle();
|
||||
if (z) {
|
||||
setSingleLineAllCaps(this.mPrevText);
|
||||
setSingleLineAllCaps(this.mCurrText);
|
||||
setSingleLineAllCaps(this.mNextText);
|
||||
this.mScaledTextSpacing = (int) (context.getResources().getDisplayMetrics().density * 16.0f);
|
||||
}
|
||||
}
|
||||
this.mPrevText.setSingleLine();
|
||||
this.mCurrText.setSingleLine();
|
||||
this.mNextText.setSingleLine();
|
||||
this.mScaledTextSpacing = (int) (context.getResources().getDisplayMetrics().density * 16.0f);
|
||||
}
|
||||
|
||||
public void setTextSpacing(int i) {
|
||||
this.mScaledTextSpacing = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setNonPrimaryAlpha(float f) {
|
||||
int i = ((int) (f * 255.0f)) & 255;
|
||||
this.mNonPrimaryAlpha = i;
|
||||
int i2 = (i << 24) | (this.mTextColor & ViewCompat.MEASURED_SIZE_MASK);
|
||||
this.mPrevText.setTextColor(i2);
|
||||
this.mNextText.setTextColor(i2);
|
||||
}
|
||||
|
||||
public void setTextColor(int i) {
|
||||
this.mTextColor = i;
|
||||
this.mCurrText.setTextColor(i);
|
||||
int i2 = (this.mNonPrimaryAlpha << 24) | (this.mTextColor & ViewCompat.MEASURED_SIZE_MASK);
|
||||
this.mPrevText.setTextColor(i2);
|
||||
this.mNextText.setTextColor(i2);
|
||||
}
|
||||
|
||||
public void setTextSize(int i, float f) {
|
||||
this.mPrevText.setTextSize(i, f);
|
||||
this.mCurrText.setTextSize(i, f);
|
||||
this.mNextText.setTextSize(i, f);
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
this.mGravity = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
ViewParent parent = getParent();
|
||||
if (!(parent instanceof ViewPager)) {
|
||||
throw new IllegalStateException("PagerTitleStrip must be a direct child of a ViewPager.");
|
||||
}
|
||||
ViewPager viewPager = (ViewPager) parent;
|
||||
PagerAdapter adapter = viewPager.getAdapter();
|
||||
viewPager.setInternalPageChangeListener(this.mPageListener);
|
||||
viewPager.addOnAdapterChangeListener(this.mPageListener);
|
||||
this.mPager = viewPager;
|
||||
WeakReference<PagerAdapter> weakReference = this.mWatchingAdapter;
|
||||
updateAdapter(weakReference != null ? weakReference.get() : null, adapter);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
ViewPager viewPager = this.mPager;
|
||||
if (viewPager != null) {
|
||||
updateAdapter(viewPager.getAdapter(), null);
|
||||
this.mPager.setInternalPageChangeListener(null);
|
||||
this.mPager.removeOnAdapterChangeListener(this.mPageListener);
|
||||
this.mPager = null;
|
||||
}
|
||||
}
|
||||
|
||||
void updateText(int i, PagerAdapter pagerAdapter) {
|
||||
int count = pagerAdapter != null ? pagerAdapter.getCount() : 0;
|
||||
this.mUpdatingText = true;
|
||||
CharSequence charSequence = null;
|
||||
this.mPrevText.setText((i < 1 || pagerAdapter == null) ? null : pagerAdapter.getPageTitle(i - 1));
|
||||
this.mCurrText.setText((pagerAdapter == null || i >= count) ? null : pagerAdapter.getPageTitle(i));
|
||||
int i2 = i + 1;
|
||||
if (i2 < count && pagerAdapter != null) {
|
||||
charSequence = pagerAdapter.getPageTitle(i2);
|
||||
}
|
||||
this.mNextText.setText(charSequence);
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(Math.max(0, (int) (((getWidth() - getPaddingLeft()) - getPaddingRight()) * 0.8f)), Integer.MIN_VALUE);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(Math.max(0, (getHeight() - getPaddingTop()) - getPaddingBottom()), Integer.MIN_VALUE);
|
||||
this.mPrevText.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
this.mCurrText.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
this.mNextText.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
this.mLastKnownCurrentPage = i;
|
||||
if (!this.mUpdatingPositions) {
|
||||
updateTextPositions(i, this.mLastKnownPositionOffset, false);
|
||||
}
|
||||
this.mUpdatingText = false;
|
||||
}
|
||||
|
||||
@Override // android.view.View, android.view.ViewParent
|
||||
public void requestLayout() {
|
||||
if (this.mUpdatingText) {
|
||||
return;
|
||||
}
|
||||
super.requestLayout();
|
||||
}
|
||||
|
||||
void updateAdapter(PagerAdapter pagerAdapter, PagerAdapter pagerAdapter2) {
|
||||
if (pagerAdapter != null) {
|
||||
pagerAdapter.unregisterDataSetObserver(this.mPageListener);
|
||||
this.mWatchingAdapter = null;
|
||||
}
|
||||
if (pagerAdapter2 != null) {
|
||||
pagerAdapter2.registerDataSetObserver(this.mPageListener);
|
||||
this.mWatchingAdapter = new WeakReference<>(pagerAdapter2);
|
||||
}
|
||||
ViewPager viewPager = this.mPager;
|
||||
if (viewPager != null) {
|
||||
this.mLastKnownCurrentPage = -1;
|
||||
this.mLastKnownPositionOffset = -1.0f;
|
||||
updateText(viewPager.getCurrentItem(), pagerAdapter2);
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
void updateTextPositions(int i, float f, boolean z) {
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
int i5;
|
||||
if (i != this.mLastKnownCurrentPage) {
|
||||
updateText(i, this.mPager.getAdapter());
|
||||
} else if (!z && f == this.mLastKnownPositionOffset) {
|
||||
return;
|
||||
}
|
||||
this.mUpdatingPositions = true;
|
||||
int measuredWidth = this.mPrevText.getMeasuredWidth();
|
||||
int measuredWidth2 = this.mCurrText.getMeasuredWidth();
|
||||
int measuredWidth3 = this.mNextText.getMeasuredWidth();
|
||||
int i6 = measuredWidth2 / 2;
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
int paddingLeft = getPaddingLeft();
|
||||
int paddingRight = getPaddingRight();
|
||||
int paddingTop = getPaddingTop();
|
||||
int paddingBottom = getPaddingBottom();
|
||||
int i7 = paddingRight + i6;
|
||||
int i8 = (width - (paddingLeft + i6)) - i7;
|
||||
float f2 = 0.5f + f;
|
||||
if (f2 > 1.0f) {
|
||||
f2 -= 1.0f;
|
||||
}
|
||||
int i9 = ((width - i7) - ((int) (i8 * f2))) - i6;
|
||||
int i10 = measuredWidth2 + i9;
|
||||
int baseline = this.mPrevText.getBaseline();
|
||||
int baseline2 = this.mCurrText.getBaseline();
|
||||
int baseline3 = this.mNextText.getBaseline();
|
||||
int max = Math.max(Math.max(baseline, baseline2), baseline3);
|
||||
int i11 = max - baseline;
|
||||
int i12 = max - baseline2;
|
||||
int i13 = max - baseline3;
|
||||
int max2 = Math.max(Math.max(this.mPrevText.getMeasuredHeight() + i11, this.mCurrText.getMeasuredHeight() + i12), this.mNextText.getMeasuredHeight() + i13);
|
||||
int i14 = this.mGravity & 112;
|
||||
if (i14 == 16) {
|
||||
i2 = (((height - paddingTop) - paddingBottom) - max2) / 2;
|
||||
} else {
|
||||
if (i14 != 80) {
|
||||
i3 = i11 + paddingTop;
|
||||
i4 = i12 + paddingTop;
|
||||
i5 = paddingTop + i13;
|
||||
TextView textView = this.mCurrText;
|
||||
textView.layout(i9, i4, i10, textView.getMeasuredHeight() + i4);
|
||||
int min = Math.min(paddingLeft, (i9 - this.mScaledTextSpacing) - measuredWidth);
|
||||
TextView textView2 = this.mPrevText;
|
||||
textView2.layout(min, i3, measuredWidth + min, textView2.getMeasuredHeight() + i3);
|
||||
int max3 = Math.max((width - paddingRight) - measuredWidth3, i10 + this.mScaledTextSpacing);
|
||||
TextView textView3 = this.mNextText;
|
||||
textView3.layout(max3, i5, max3 + measuredWidth3, textView3.getMeasuredHeight() + i5);
|
||||
this.mLastKnownPositionOffset = f;
|
||||
this.mUpdatingPositions = false;
|
||||
}
|
||||
i2 = (height - paddingBottom) - max2;
|
||||
}
|
||||
i3 = i11 + i2;
|
||||
i4 = i12 + i2;
|
||||
i5 = i2 + i13;
|
||||
TextView textView4 = this.mCurrText;
|
||||
textView4.layout(i9, i4, i10, textView4.getMeasuredHeight() + i4);
|
||||
int min2 = Math.min(paddingLeft, (i9 - this.mScaledTextSpacing) - measuredWidth);
|
||||
TextView textView22 = this.mPrevText;
|
||||
textView22.layout(min2, i3, measuredWidth + min2, textView22.getMeasuredHeight() + i3);
|
||||
int max32 = Math.max((width - paddingRight) - measuredWidth3, i10 + this.mScaledTextSpacing);
|
||||
TextView textView32 = this.mNextText;
|
||||
textView32.layout(max32, i5, max32 + measuredWidth3, textView32.getMeasuredHeight() + i5);
|
||||
this.mLastKnownPositionOffset = f;
|
||||
this.mUpdatingPositions = false;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int max;
|
||||
if (View.MeasureSpec.getMode(i) != 1073741824) {
|
||||
throw new IllegalStateException("Must measure with an exact width");
|
||||
}
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int childMeasureSpec = getChildMeasureSpec(i2, paddingTop, -2);
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int childMeasureSpec2 = getChildMeasureSpec(i, (int) (size * 0.2f), -2);
|
||||
this.mPrevText.measure(childMeasureSpec2, childMeasureSpec);
|
||||
this.mCurrText.measure(childMeasureSpec2, childMeasureSpec);
|
||||
this.mNextText.measure(childMeasureSpec2, childMeasureSpec);
|
||||
if (View.MeasureSpec.getMode(i2) == 1073741824) {
|
||||
max = View.MeasureSpec.getSize(i2);
|
||||
} else {
|
||||
max = Math.max(getMinHeight(), this.mCurrText.getMeasuredHeight() + paddingTop);
|
||||
}
|
||||
setMeasuredDimension(size, View.resolveSizeAndState(max, i2, this.mCurrText.getMeasuredState() << 16));
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (this.mPager != null) {
|
||||
float f = this.mLastKnownPositionOffset;
|
||||
if (f < 0.0f) {
|
||||
f = 0.0f;
|
||||
}
|
||||
updateTextPositions(this.mLastKnownCurrentPage, f, true);
|
||||
}
|
||||
}
|
||||
|
||||
int getMinHeight() {
|
||||
Drawable background = getBackground();
|
||||
if (background != null) {
|
||||
return background.getIntrinsicHeight();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class PageListener extends DataSetObserver implements ViewPager.OnPageChangeListener, ViewPager.OnAdapterChangeListener {
|
||||
private int mScrollState;
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
this.mScrollState = i;
|
||||
}
|
||||
|
||||
PageListener() {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrolled(int i, float f, int i2) {
|
||||
if (f > 0.5f) {
|
||||
i++;
|
||||
}
|
||||
PagerTitleStrip.this.updateTextPositions(i, f, false);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageSelected(int i) {
|
||||
if (this.mScrollState == 0) {
|
||||
PagerTitleStrip pagerTitleStrip = PagerTitleStrip.this;
|
||||
pagerTitleStrip.updateText(pagerTitleStrip.mPager.getCurrentItem(), PagerTitleStrip.this.mPager.getAdapter());
|
||||
float f = PagerTitleStrip.this.mLastKnownPositionOffset >= 0.0f ? PagerTitleStrip.this.mLastKnownPositionOffset : 0.0f;
|
||||
PagerTitleStrip pagerTitleStrip2 = PagerTitleStrip.this;
|
||||
pagerTitleStrip2.updateTextPositions(pagerTitleStrip2.mPager.getCurrentItem(), f, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnAdapterChangeListener
|
||||
public void onAdapterChanged(ViewPager viewPager, PagerAdapter pagerAdapter, PagerAdapter pagerAdapter2) {
|
||||
PagerTitleStrip.this.updateAdapter(pagerAdapter, pagerAdapter2);
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
PagerTitleStrip pagerTitleStrip = PagerTitleStrip.this;
|
||||
pagerTitleStrip.updateText(pagerTitleStrip.mPager.getCurrentItem(), PagerTitleStrip.this.mPager.getAdapter());
|
||||
float f = PagerTitleStrip.this.mLastKnownPositionOffset >= 0.0f ? PagerTitleStrip.this.mLastKnownPositionOffset : 0.0f;
|
||||
PagerTitleStrip pagerTitleStrip2 = PagerTitleStrip.this;
|
||||
pagerTitleStrip2.updateTextPositions(pagerTitleStrip2.mPager.getCurrentItem(), f, true);
|
||||
}
|
||||
}
|
||||
}
|
2102
02-Easy5/E5/sources/androidx/viewpager/widget/ViewPager.java
Normal file
2102
02-Easy5/E5/sources/androidx/viewpager/widget/ViewPager.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user