├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── simple │ │ └── view │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── simple │ │ │ └── view │ │ │ ├── CardActivity.java │ │ │ ├── CheckViewActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── RefreshActivity.java │ │ │ ├── RefreshSmtFragment.java │ │ │ ├── TabSmartActivity.java │ │ │ └── ViewApplication.java │ └── res │ │ ├── layout │ │ ├── ac_card.xml │ │ ├── ac_checkview.xml │ │ ├── ac_hfadapter.xml │ │ ├── ac_message.xml │ │ ├── ac_permission.xml │ │ ├── ac_refresh.xml │ │ ├── ac_tab.xml │ │ ├── ac_upload.xml │ │ ├── activity_main.xml │ │ ├── empty.xml │ │ ├── fr_tab.xml │ │ ├── header.xml │ │ └── layout_smart_refresh.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── shadow_134239.9.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── simple │ └── view │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── xcheng │ │ └── view │ │ ├── EasyView.java │ │ ├── adapter │ │ ├── EasyAdapter.java │ │ ├── EasyFragmentAdapter.java │ │ ├── EasyHolder.java │ │ ├── IAdapterDelegate.java │ │ ├── SpaceDecoration.java │ │ └── TabInfo.java │ │ ├── autosize │ │ ├── AutoSize.java │ │ └── ResourcesWrapper.java │ │ ├── controller │ │ ├── ActionBarSupportActivity.java │ │ ├── EasyActivity.java │ │ ├── EasyFragment.java │ │ ├── EasyPagerActivity.java │ │ ├── EasyPagerFragment.java │ │ ├── GlobalLifecycleCallbacks.java │ │ ├── IEasyView.java │ │ ├── ILoadingView.java │ │ ├── IPullRefreshView.java │ │ ├── SmartRefreshFragment.java │ │ └── dialog │ │ │ ├── BottomDialog.java │ │ │ ├── BottomOptionDialog.java │ │ │ ├── EasyDialog.java │ │ │ └── LoadingDialog.java │ │ ├── divider │ │ ├── DividerContainer.java │ │ ├── DividerHelper.java │ │ ├── DividerLayout.java │ │ ├── DividerTextView.java │ │ └── IDividerView.java │ │ ├── enums │ │ └── SmartState.java │ │ ├── round │ │ ├── RoundButton.java │ │ ├── RoundDrawableHelper.java │ │ ├── RoundEditText.java │ │ ├── RoundFrameLayout.java │ │ ├── RoundLinearLayout.java │ │ ├── RoundRelativeLayout.java │ │ └── RoundTextView.java │ │ ├── util │ │ ├── ColorUtil.java │ │ ├── KeyboardUtil.java │ │ ├── LocalDisplay.java │ │ ├── NumberTextWatcher.java │ │ ├── Router.java │ │ └── ViewUtil.java │ │ └── widget │ │ ├── CheckView.java │ │ ├── CommonView.java │ │ ├── FragmentTabHost.java │ │ ├── GalleryLayoutManager.java │ │ ├── LoadingView.java │ │ ├── ProgressView.java │ │ ├── ScaleTransformer.java │ │ ├── TopBarLayout.java │ │ └── smarttab │ │ ├── SmartTabIndicationInterpolator.java │ │ ├── SmartTabLayout.java │ │ ├── SmartTabStrip.java │ │ └── Utils.java │ └── res │ ├── anim │ ├── ev_dialog_bottom_enter.xml │ └── ev_dialog_bottom_exit.xml │ ├── drawable-xhdpi │ ├── ev_ic_empty_data.png │ ├── ev_ic_network_error.png │ └── ic_check_white_18dp.png │ ├── drawable-xxhdpi │ ├── ev_enter_arrow.png │ ├── ev_nav_back_arrow.png │ └── ic_check_white_18dp.png │ ├── drawable │ └── ev_shape_bg_dialog_loading.xml │ ├── layout │ ├── ev_commom_view.xml │ ├── ev_dialog_loading.xml │ ├── ev_dialog_option_bottom.xml │ ├── ev_item_module.xml │ ├── ev_item_text.xml │ ├── ev_pager.xml │ ├── ev_smart_refresh.xml │ └── ev_toolbar.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ ├── styles.xml │ └── themes.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /.idea 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | //noinspection GradleDependency 2 | apply plugin: 'com.android.application' 3 | 4 | android { 5 | compileSdkVersion 28 6 | buildToolsVersion "28.0.3" 7 | lintOptions { 8 | abortOnError false 9 | } 10 | defaultConfig { 11 | applicationId "com.simple.view" 12 | minSdkVersion 14 13 | targetSdkVersion 28 14 | versionCode 1 15 | versionName "1.0" 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | dependencies { 26 | implementation fileTree(include: ['*.jar'], dir: 'libs') 27 | testImplementation 'junit:junit:4.12' 28 | androidTestImplementation 'androidx.test:runner:1.2.0' 29 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 32 | implementation project(':library') 33 | implementation "com.squareup.picasso:picasso:2.71828" 34 | implementation "com.github.bumptech.glide:glide:3.7.0" 35 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 36 | //implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' 37 | implementation 'com.github.zcweng:switch-button:0.0.3@aar' 38 | // compileOnly 'com.github.Jay-Goo:RangeSeekBar:v3.0.0' 39 | // SmartRefreshLayout需要 40 | implementation 'androidx.legacy:legacy-support-core-ui:1.0.0' 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/chengxin/Documents/Android/android-sdk-macosx/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/simple/view/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.simple.view", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 34 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/CardActivity.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import android.view.View; 6 | 7 | import com.xcheng.view.controller.EasyActivity; 8 | import com.xcheng.view.widget.CheckView; 9 | import com.xcheng.view.widget.CommonView; 10 | import com.xcheng.view.widget.ProgressView; 11 | 12 | public class CardActivity extends EasyActivity { 13 | 14 | public CommonView commonView; 15 | public ProgressView progressView; 16 | 17 | @Override 18 | public int getLayoutId() { 19 | return R.layout.ac_card; 20 | } 21 | 22 | @Override 23 | public void initView(@Nullable Bundle savedInstanceState) { 24 | super.initView(savedInstanceState); 25 | commonView = findViewById(R.id.cv); 26 | commonView.setOnClickListener(new View.OnClickListener() { 27 | @Override 28 | public void onClick(View v) { 29 | int mode = commonView.getMode(); 30 | if (mode == CommonView.INPUT) { 31 | commonView.setMode(CommonView.DISPLAY); 32 | } else { 33 | commonView.setMode(CommonView.INPUT); 34 | } 35 | } 36 | }); 37 | progressView = findViewById(R.id.progressView); 38 | progressView.setProgressViewTextGenerator(new ProgressView.ProgressViewTextGenerator() { 39 | @Override 40 | public String generateText(ProgressView progressBar, int value, int maxValue) { 41 | return "测试text"; 42 | } 43 | }); 44 | final CheckView checkView = findViewById(R.id.tv_uncheck); 45 | checkView.setOnClickListener(new View.OnClickListener() { 46 | @Override 47 | public void onClick(View v) { 48 | checkView.toggle(); 49 | } 50 | }); 51 | final CheckView checkView1 = findViewById(R.id.tv_uncheck1); 52 | checkView1.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View v) { 55 | checkView1.toggle(); 56 | } 57 | }); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/CheckViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | 6 | import androidx.annotation.Nullable; 7 | 8 | import com.xcheng.view.controller.EasyActivity; 9 | import com.xcheng.view.widget.CheckView; 10 | import com.xcheng.view.widget.ProgressView; 11 | 12 | public class CheckViewActivity extends EasyActivity { 13 | 14 | public ProgressView progressView; 15 | CheckView cvCheckView; 16 | 17 | @Override 18 | public int getLayoutId() { 19 | return R.layout.ac_checkview; 20 | } 21 | 22 | @Override 23 | public void initView(@Nullable Bundle savedInstanceState) { 24 | super.initView(savedInstanceState); 25 | //cvCheckView=findViewById(R.id.cv_checkView); 26 | Log.e("print", "1\n2\n\n\n3"); 27 | Log.e("print", "\n\n\n13"); 28 | System.out.println(1); 29 | System.out.println(2); 30 | System.out.println(3); 31 | System.out.println(); 32 | System.out.println(); 33 | System.out.print(5); 34 | // System.out.println(4); 35 | 36 | System.out.print(6); 37 | 38 | } 39 | 40 | public static void main(String[] args) { 41 | System.out.println(1); 42 | System.out.println(2); 43 | System.out.println(3); 44 | System.out.println(); 45 | System.out.println(); 46 | System.out.println(); 47 | System.out.println(); 48 | System.out.println(); 49 | System.out.println(); 50 | System.out.println(); 51 | 52 | System.out.print(5); 53 | // System.out.println(4); 54 | 55 | System.out.print(6); 56 | } 57 | 58 | @Override 59 | protected void onStop() { 60 | super.onStop(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.app.ListActivity; 4 | import android.content.Context; 5 | import android.graphics.Color; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.widget.ArrayAdapter; 10 | import android.widget.ListView; 11 | 12 | import androidx.annotation.NonNull; 13 | 14 | import com.scwang.smartrefresh.layout.SmartRefreshLayout; 15 | import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; 16 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 17 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 18 | import com.scwang.smartrefresh.layout.constant.SpinnerStyle; 19 | import com.scwang.smartrefresh.layout.header.ClassicsHeader; 20 | import com.xcheng.view.EasyView; 21 | import com.xcheng.view.autosize.AutoSize; 22 | import com.xcheng.view.controller.dialog.BottomOptionDialog; 23 | import com.xcheng.view.util.Router; 24 | 25 | import java.util.Arrays; 26 | import java.util.HashMap; 27 | import java.util.Map; 28 | 29 | import es.dmoral.toasty.Toasty; 30 | 31 | public class MainActivity extends ListActivity { 32 | static { 33 | //设置全局的Header构建器o 34 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 35 | @NonNull 36 | @Override 37 | public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) { 38 | ClassicsHeader header = new ClassicsHeader(context).setSpinnerStyle(SpinnerStyle.Translate); 39 | header.setPrimaryColorId(R.color.ev_holo_red_light); 40 | header.setTextSizeTitle(14); 41 | header.setFinishDuration(200); 42 | //header.setAccentColorId(android.R.color.white); 43 | return header;//指定为经典Header,默认是 贝塞尔雷达Header 44 | } 45 | }); 46 | 47 | EasyView.AUTOSIZE = new AutoSize(740, true); 48 | } 49 | 50 | @Override 51 | protected void onCreate(Bundle savedInstanceState) { 52 | super.onCreate(savedInstanceState); 53 | String[] items = getResources().getStringArray(R.array.sample_list); 54 | 55 | ArrayAdapter adapter = 56 | new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items); 57 | setListAdapter(adapter); 58 | 59 | } 60 | 61 | private Map values = new HashMap<>(); 62 | 63 | @Override 64 | protected void onListItemClick(ListView l, View v, int position, long id) { 65 | Toasty.info(this, "点击操作").show(); 66 | 67 | switch (position) { 68 | case 0: 69 | // startSignInActivity(); 70 | EasyView.success("123"); 71 | EasyView.error("456"); 72 | EasyView.info("789"); 73 | EasyView.warning("123"); 74 | break; 75 | case 1: 76 | Router.build(CheckViewActivity.class).navigation(this); 77 | break; 78 | case 3: 79 | break; 80 | case 4: 81 | BottomOptionDialog dialog = new BottomOptionDialog.Builder(this) 82 | // .bottomText(null) 83 | .tipText("请先登录或注册") 84 | .tipTextColor(Color.RED) 85 | .dividerColor(Color.GREEN) 86 | // .bottomTextColor(Color.YELLOW) 87 | // .optionTextColor(Color.RED) 88 | // .dividerColor(Color.GREEN) 89 | // .solidColor(Color.MAGENTA) 90 | // .textSize(30) 91 | // .optionHeight(200) 92 | // .radius(LocalDisplay.dp2px(10)) 93 | // .bottomText("底部测试") 94 | .optionTexts("登录", "注册", "忘记密码") 95 | .onSelectListener(new BottomOptionDialog.OnSelectListener() { 96 | @Override 97 | public void onBottomSelect(View view) { 98 | Log.e("print", "底部点击"); 99 | } 100 | 101 | @Override 102 | public void onOptionSelect(View view, int position) { 103 | Log.e("print", "列表点击:" + position); 104 | } 105 | }) 106 | .create(); 107 | dialog.show(); 108 | break; 109 | case 5: 110 | startTabActivity(); 111 | break; 112 | case 6: 113 | Router.build(RefreshActivity.class).navigation(this); 114 | break; 115 | case 7: 116 | Router.build(CardActivity.class).navigation(this); 117 | 118 | break; 119 | case 8: 120 | 121 | break; 122 | } 123 | } 124 | 125 | private void startTabActivity() { 126 | Router.build(TabSmartActivity.class).navigation(this); 127 | } 128 | 129 | public void testAndroidR() { 130 | try { 131 | Class c = Class.forName("android.R$styleable"); 132 | int[] value = (int[]) c.getField("ProgressBar").get(null); 133 | 134 | Log.e("print", "value" + Arrays.toString(value)); 135 | Log.e("print", "maxHeight:" + android.R.attr.maxHeight); 136 | 137 | Class c2 = Class.forName("com.android.internal.R$styleable"); 138 | int[] value2 = (int[]) c.getField("ProgressBar").get(null); 139 | Object value3 = Class.forName("com.android.internal.R$attr").getField("maxHeight").get(null); 140 | 141 | Log.e("print", "value2" + Arrays.toString(value2)); 142 | Log.e("print", "maxHeight2:" + value3); 143 | 144 | } catch (ClassNotFoundException e) { 145 | Log.e("print", "", e); 146 | e.printStackTrace(); 147 | } catch (IllegalAccessException e) { 148 | e.printStackTrace(); 149 | } catch (NoSuchFieldException e) { 150 | e.printStackTrace(); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/RefreshActivity.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import com.xcheng.view.controller.EasyActivity; 4 | 5 | 6 | public class RefreshActivity extends EasyActivity { 7 | 8 | @Override 9 | public int getLayoutId() { 10 | return R.layout.ac_refresh; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/RefreshSmtFragment.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.os.Bundle; 4 | import android.os.Handler; 5 | import android.util.Log; 6 | import android.widget.TextView; 7 | 8 | import androidx.annotation.NonNull; 9 | 10 | import com.xcheng.view.adapter.EasyAdapter; 11 | import com.xcheng.view.adapter.EasyHolder; 12 | import com.xcheng.view.adapter.SpaceDecoration; 13 | import com.xcheng.view.controller.SmartRefreshFragment; 14 | import com.xcheng.view.util.LocalDisplay; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by chengxin on 2017/9/3. 21 | */ 22 | public class RefreshSmtFragment extends SmartRefreshFragment { 23 | @Override 24 | public int getLayoutId() { 25 | return R.layout.layout_smart_refresh; 26 | } 27 | 28 | @Override 29 | public void initView(Bundle savedInstanceState) { 30 | super.initView(savedInstanceState); 31 | mAdapter.setOnItemClickListener(new EasyAdapter.OnItemClickListener() { 32 | @Override 33 | public void onItemClick(EasyHolder holder, int position) { 34 | // ToastLess.showToast(position + "==position:"); 35 | // mAdapter.notifyFooter(); 36 | int beforeAp = holder.getAdapterPosition(); 37 | Log.e("print", "beforeAp:" + beforeAp); 38 | int beforeLp = holder.getLayoutPosition(); 39 | Log.e("print", "beforeLp:" + beforeLp); 40 | 41 | 42 | int afterAp = holder.getAdapterPosition(); 43 | Log.e("print", "afterAp:" + afterAp); 44 | 45 | int afterLp = holder.getLayoutPosition(); 46 | Log.e("print", "afterLp:" + afterLp); 47 | } 48 | }); 49 | mRecyclerView.addItemDecoration(new SpaceDecoration(LocalDisplay.dp2px(10))); 50 | } 51 | 52 | @NonNull 53 | @Override 54 | protected Config getConfig() { 55 | return new Config(200, 8); 56 | } 57 | 58 | @Override 59 | public void requestData(final boolean isRefresh) { 60 | new Handler().postDelayed(new Runnable() { 61 | @Override 62 | public void run() { 63 | if (isRefresh) { 64 | List data = new ArrayList<>(); 65 | for (int index = 0; index < 8; index++) { 66 | data.add("数据:" + index); 67 | } 68 | refreshView(true, data); 69 | } else { 70 | List data = new ArrayList<>(); 71 | if (mAdapter.getDataCount() < 40) { 72 | for (int index = 0; index < 8; index++) { 73 | data.add("数据:" + index); 74 | } 75 | } else { 76 | for (int index = 0; index < 2; index++) { 77 | data.add("数据:" + index); 78 | } 79 | } 80 | refreshView(false, data); 81 | } 82 | } 83 | }, 500); 84 | } 85 | 86 | @NonNull 87 | @Override 88 | public EasyAdapter createAdapter() { 89 | return new EasyAdapter(getContext(), R.layout.ev_item_text) { 90 | @Override 91 | public void convert(EasyHolder holder, String s, int position) { 92 | // Log.e("print", "adapterPosition:" + holder.getAdapterPosition()); 93 | TextView textView = (TextView) holder.itemView; 94 | textView.setText(s); 95 | } 96 | }; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/TabSmartActivity.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | 6 | import com.xcheng.view.adapter.TabInfo; 7 | import com.xcheng.view.controller.EasyPagerActivity; 8 | 9 | import java.util.List; 10 | 11 | 12 | public class TabSmartActivity extends EasyPagerActivity { 13 | 14 | 15 | @Override 16 | public int getLayoutId() { 17 | return R.layout.ac_tab; 18 | } 19 | 20 | @Override 21 | public void initView(@Nullable Bundle savedInstanceState) { 22 | super.initView(savedInstanceState); 23 | // mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { 24 | // @Override 25 | // public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 26 | // 27 | // } 28 | // 29 | // @Override 30 | // public void onPageSelected(int position) { 31 | // if (position == 0) { 32 | // mIndicator.setIndicatorColor(Color.YELLOW); 33 | // mIndicator.setIndicatorHeight(20); 34 | // mIndicator.setDividerColor(Color.BLUE); 35 | // } else if (position == 1) { 36 | // mIndicator.setIndicatorColor(Color.GREEN); 37 | // mIndicator.setIndicatorHeight(15); 38 | // mIndicator.setDividerColor(Color.CYAN); 39 | // 40 | // 41 | // } else if (position == 2) { 42 | // mIndicator.setIndicatorColor(Color.RED); 43 | // mIndicator.setIndicatorHeight(10); 44 | // mIndicator.setDividerColor(Color.LTGRAY); 45 | // } 46 | // } 47 | // 48 | // @Override 49 | // public void onPageScrollStateChanged(int state) { 50 | // 51 | // } 52 | // }); 53 | } 54 | 55 | @Override 56 | protected void getTabInfos(List tabInfos) { 57 | tabInfos.add(new TabInfo("0", "新闻", RefreshSmtFragment.class)); 58 | tabInfos.add(new TabInfo("1", "咨询", RefreshSmtFragment.class)); 59 | tabInfos.add(new TabInfo("2", "视频", RefreshSmtFragment.class)); 60 | tabInfos.add(new TabInfo("3", "本地", RefreshSmtFragment.class)); 61 | tabInfos.add(new TabInfo("4", "小说", RefreshSmtFragment.class)); 62 | tabInfos.add(new TabInfo("5", "阅读", RefreshSmtFragment.class)); 63 | tabInfos.add(new TabInfo("6", "本地", RefreshSmtFragment.class)); 64 | tabInfos.add(new TabInfo("7", "贴吧", RefreshSmtFragment.class)); 65 | tabInfos.add(new TabInfo("8", "评论", RefreshSmtFragment.class)); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/simple/view/ViewApplication.java: -------------------------------------------------------------------------------- 1 | package com.simple.view; 2 | 3 | import android.app.Application; 4 | 5 | import com.xcheng.view.util.LocalDisplay; 6 | 7 | /** 8 | * 创建时间:2020-05-07 9 | * 编写人: chengxin 10 | * 功能描述: 11 | */ 12 | public class ViewApplication extends Application { 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | LocalDisplay.init(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/ac_card.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 16 | 17 | 25 | 26 | 33 | 34 | 40 | 41 | 47 | 48 | 53 | 59 | 60 | 66 | 67 | 73 | 74 | 75 | 80 | 81 |