├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── hankkin │ │ └── hbase │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── province.json │ ├── java │ │ └── com │ │ │ └── hankkin │ │ │ └── hbase │ │ │ ├── Constant.java │ │ │ ├── HApplication.java │ │ │ ├── adapter │ │ │ ├── HomeAdapter.java │ │ │ └── RVAdapter.java │ │ │ ├── popwindow │ │ │ └── SmsRightPopwindow.java │ │ │ └── ui │ │ │ ├── CommonDialogActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── PickerViewActivity.java │ │ │ ├── RVActivity.java │ │ │ └── SmsActivity.java │ └── res │ │ ├── anim │ │ ├── push_in.xml │ │ └── push_out.xml │ │ ├── layout │ │ ├── activity_common_dialog.xml │ │ ├── activity_main.xml │ │ ├── activity_mvp.xml │ │ ├── activity_mvp_demo.xml │ │ ├── activity_picker_view.xml │ │ ├── activity_rv.xml │ │ ├── activity_sms.xml │ │ ├── adapter_home_item.xml │ │ ├── adapter_rv_item.xml │ │ └── popwindow_sms_right.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── bg_sms_right.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── icon_sms_jiahao.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── hankkin │ └── hbase │ └── ExampleUnitTest.java ├── build.gradle ├── config.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── hlibrary ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── hankkin │ │ └── xlibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── province.json │ ├── java │ │ └── com │ │ │ └── hankkin │ │ │ └── xlibrary │ │ │ ├── base │ │ │ ├── BaseAcitvity.java │ │ │ ├── BaseFragment.java │ │ │ ├── BasePresent.java │ │ │ ├── BaseView.java │ │ │ ├── MvpActivity.java │ │ │ └── MvpFragment.java │ │ │ ├── bean │ │ │ ├── BaseBean.java │ │ │ ├── JsonBean.java │ │ │ └── ProvinceBean.java │ │ │ ├── constant │ │ │ ├── MemoryConstants.java │ │ │ ├── RegexConstants.java │ │ │ └── TimeConstants.java │ │ │ ├── event │ │ │ └── EventMap.java │ │ │ ├── http │ │ │ ├── ErrorResponse.java │ │ │ ├── GsonResponseConverter.java │ │ │ ├── HttpResult.java │ │ │ ├── HttpResultSubscriber.java │ │ │ ├── HttpUtils.java │ │ │ └── ResponseConverterFactory.java │ │ │ ├── other │ │ │ ├── GetJsonDataUtil.java │ │ │ └── PickerManager.java │ │ │ ├── utils │ │ │ ├── ActivityUtils.java │ │ │ ├── CleanUtils.java │ │ │ ├── CloseUtils.java │ │ │ ├── ConvertUtils.java │ │ │ ├── EmptyUtils.java │ │ │ ├── EncodeUtils.java │ │ │ ├── EncryptUtils.java │ │ │ ├── FileUtils.java │ │ │ ├── IntentUtils.java │ │ │ ├── KeyboardUtils.java │ │ │ ├── LogUtils.java │ │ │ ├── NetworkUtils.java │ │ │ ├── PinyinUtils.java │ │ │ ├── RegexUtils.java │ │ │ ├── SDCardUtils.java │ │ │ ├── SPUtils.java │ │ │ ├── ScreenUtils.java │ │ │ ├── ShellUtils.java │ │ │ ├── SizeUtils.java │ │ │ ├── SnackbarUtils.java │ │ │ ├── SpannableStringUtils.java │ │ │ ├── TimeUtils.java │ │ │ ├── ToastUtils.java │ │ │ └── Utils.java │ │ │ └── widget │ │ │ ├── ClickImageView.java │ │ │ ├── CustomLoadMoreView.java │ │ │ ├── CustomView.java │ │ │ ├── ProgressBar.java │ │ │ ├── ProgressDialog.java │ │ │ ├── divider │ │ │ ├── GridDivider.java │ │ │ └── RecycleViewDivider.java │ │ │ └── view │ │ │ ├── AVLoadingIndicatorView.java │ │ │ ├── HLoading.java │ │ │ ├── Indicator.java │ │ │ └── indicators │ │ │ ├── BallBeatIndicator.java │ │ │ ├── BallClipRotateIndicator.java │ │ │ ├── BallClipRotateMultipleIndicator.java │ │ │ ├── BallClipRotatePulseIndicator.java │ │ │ ├── BallGridBeatIndicator.java │ │ │ ├── BallGridPulseIndicator.java │ │ │ ├── BallPulseIndicator.java │ │ │ ├── BallPulseRiseIndicator.java │ │ │ ├── BallPulseSyncIndicator.java │ │ │ ├── BallRotateIndicator.java │ │ │ ├── BallScaleIndicator.java │ │ │ ├── BallScaleMultipleIndicator.java │ │ │ ├── BallScaleRippleIndicator.java │ │ │ ├── BallScaleRippleMultipleIndicator.java │ │ │ ├── BallSpinFadeLoaderIndicator.java │ │ │ ├── BallTrianglePathIndicator.java │ │ │ ├── BallZigZagDeflectIndicator.java │ │ │ ├── BallZigZagIndicator.java │ │ │ ├── CubeTransitionIndicator.java │ │ │ ├── LineScaleIndicator.java │ │ │ ├── LineScalePartyIndicator.java │ │ │ ├── LineScalePulseOutIndicator.java │ │ │ ├── LineScalePulseOutRapidIndicator.java │ │ │ ├── LineSpinFadeLoaderIndicator.java │ │ │ ├── PacmanIndicator.java │ │ │ ├── SemiCircleSpinIndicator.java │ │ │ ├── SquareSpinIndicator.java │ │ │ └── TriangleSkewSpinIndicator.java │ └── res │ │ ├── anim │ │ ├── pickerview_dialog_scale_in.xml │ │ ├── pickerview_dialog_scale_out.xml │ │ ├── pickerview_slide_in_bottom.xml │ │ ├── pickerview_slide_out_bottom.xml │ │ ├── push_in.xml │ │ └── push_out.xml │ │ ├── layout │ │ ├── dialog_hloading.xml │ │ ├── dialog_progress.xml │ │ ├── layout_title_bar.xml │ │ ├── layout_title_bar_right_img.xml │ │ ├── layout_title_bar_right_txt.xml │ │ └── view_load_more.xml │ │ ├── mipmap-xxhdpi │ │ └── back.png │ │ └── values │ │ ├── attrs.xml │ │ ├── color.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── integers.xml │ │ ├── strings.xml │ │ ├── styleconfigs.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── hankkin │ └── xlibrary │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | app/libs/ 57 | app/src/main/res/drawable/ 58 | hlibrary/libs/ 59 | hlibrary/src/main/res/drawable/ 60 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HBase 2 | library库 3 | 4 | ###1. Picker组件 5 | ###2. Loading组件 6 | ###3. 统一Dialog 7 | ###4. 选择图片 8 | ###5. 消息Popwindow 9 | ###6. Rv+SwipeRefresh 10 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.neenbedankt.android-apt' 3 | 4 | android { 5 | compileSdkVersion rootProject.ext.android.compileSdkVersion 6 | buildToolsVersion rootProject.ext.android.buildToolsVersion 7 | 8 | defaultConfig { 9 | applicationId "cn.droidlover.xdroidbase.demo" 10 | minSdkVersion rootProject.ext.android.minSdkVersion 11 | targetSdkVersion rootProject.ext.android.targetSdkVersion 12 | versionCode rootProject.ext.android.versionCode 13 | versionName rootProject.ext.android.versionName 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 26 | exclude group: 'com.android.support', module: 'support-annotations' 27 | }) 28 | compile rootProject.ext.dependencies["appcompat-v7"] 29 | apt rootProject.ext.dependencies["butterknife-apt"] 30 | compile project(':hlibrary') 31 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 32 | testCompile 'junit:junit:4.12' 33 | } 34 | -------------------------------------------------------------------------------- /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/hankkin/Documents/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/hankkin/hbase/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.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.hankkin.hbase", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/Constant.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase; 2 | 3 | /** 4 | * Created by hankkin on 2017/6/9. 5 | */ 6 | 7 | public class Constant { 8 | public static final int PAGE_SIZE = 19;//分页加载数量 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/HApplication.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase; 2 | 3 | import android.app.Application; 4 | 5 | import com.hankkin.xlibrary.utils.Utils; 6 | import com.luck.picture.lib.compress.Luban; 7 | import com.luck.picture.lib.model.FunctionConfig; 8 | import com.luck.picture.lib.model.FunctionOptions; 9 | import com.luck.picture.lib.model.PictureConfig; 10 | 11 | /** 12 | * Created by hankkin on 2017/4/5. 13 | */ 14 | 15 | public class HApplication extends Application { 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | Utils.init(this); 21 | initPickerImg(); 22 | } 23 | 24 | private void initPickerImg() { 25 | FunctionOptions options = new FunctionOptions.Builder() 26 | .setType(FunctionConfig.TYPE_IMAGE) 27 | .setCompress(true) 28 | .setGrade(Luban.CUSTOM_GEAR) 29 | .setSelectMode(FunctionConfig.MODE_MULTIPLE) 30 | .create(); 31 | PictureConfig.getInstance().init(options); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/adapter/HomeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.adapter; 2 | 3 | import com.chad.library.adapter.base.BaseQuickAdapter; 4 | import com.chad.library.adapter.base.BaseViewHolder; 5 | import com.hankkin.hbase.R; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by hankkin on 2017/3/28. 11 | */ 12 | 13 | public class HomeAdapter extends BaseQuickAdapter { 14 | 15 | 16 | public HomeAdapter(int layoutResId, List data) { 17 | super(layoutResId, data); 18 | } 19 | 20 | @Override 21 | protected void convert(BaseViewHolder helper, String item) { 22 | helper.setText(R.id.tv_home_item,item); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/adapter/RVAdapter.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.adapter; 2 | 3 | import com.chad.library.adapter.base.BaseQuickAdapter; 4 | import com.chad.library.adapter.base.BaseViewHolder; 5 | import com.hankkin.hbase.R; 6 | 7 | /** 8 | * Created by hankkin on 2017/6/9. 9 | */ 10 | 11 | public class RVAdapter extends BaseQuickAdapter { 12 | public RVAdapter() { 13 | super(R.layout.adapter_rv_item); 14 | } 15 | 16 | @Override 17 | protected void convert(BaseViewHolder helper, String item) { 18 | helper.setText(R.id.tv_adapter_rv,item); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/popwindow/SmsRightPopwindow.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.popwindow; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.WindowManager; 9 | import android.widget.PopupWindow; 10 | import android.widget.TextView; 11 | 12 | import com.hankkin.hbase.R; 13 | 14 | import butterknife.BindView; 15 | import butterknife.ButterKnife; 16 | 17 | /** 18 | * @author yangyu 19 | * 功能描述:标题按钮上的弹窗(继承自PopupWindow) 20 | */ 21 | public class SmsRightPopwindow extends PopupWindow { 22 | 23 | 24 | private View mainView; 25 | private int width; 26 | private int height; 27 | 28 | @BindView(R.id.tv_sms_pop_group_chat) TextView tvGroupChat; 29 | @BindView(R.id.tv_sms_pop_add_friend) TextView tvAddFriend; 30 | @BindView(R.id.tv_sms_pop_scan) TextView tvScan; 31 | @BindView(R.id.tv_sms_pop_share) TextView tvShare; 32 | 33 | public SmsRightPopwindow(Activity paramActivity, View.OnClickListener paramOnClickListener) { 34 | 35 | WindowManager wm = (WindowManager) paramActivity.getSystemService(Context.WINDOW_SERVICE); 36 | width = wm.getDefaultDisplay().getWidth(); 37 | height = wm.getDefaultDisplay().getHeight(); 38 | 39 | //窗口布局 40 | mainView = LayoutInflater.from(paramActivity).inflate(R.layout.popwindow_sms_right, null); 41 | ButterKnife.bind(this,mainView); 42 | //设置每个子布局的事件监听器 43 | if (paramOnClickListener != null) { 44 | tvGroupChat.setOnClickListener(paramOnClickListener); 45 | tvAddFriend.setOnClickListener(paramOnClickListener); 46 | tvScan.setOnClickListener(paramOnClickListener); 47 | tvShare.setOnClickListener(paramOnClickListener); 48 | } 49 | setContentView(mainView); 50 | //设置宽度 51 | setWidth(width); 52 | //设置高度 53 | setHeight(height); 54 | //设置背景透明 55 | setBackgroundDrawable(new ColorDrawable(-00000)); 56 | //设置显示隐藏动画 57 | setAnimationStyle(R.style.AnimTools); 58 | //设置背景透明 59 | setBackgroundDrawable(new ColorDrawable(0)); 60 | mainView.setOnClickListener(new View.OnClickListener() { 61 | @Override 62 | public void onClick(View view) { 63 | dismiss(); 64 | } 65 | }); 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/ui/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.View; 7 | 8 | import com.chad.library.adapter.base.BaseQuickAdapter; 9 | import com.chad.library.adapter.base.listener.OnItemClickListener; 10 | import com.hankkin.hbase.R; 11 | import com.hankkin.hbase.adapter.HomeAdapter; 12 | import com.hankkin.xlibrary.base.BaseAcitvity; 13 | import com.hankkin.xlibrary.utils.ToastUtils; 14 | import com.hankkin.xlibrary.widget.view.HLoading; 15 | import com.luck.picture.lib.model.PictureConfig; 16 | import com.yalantis.ucrop.entity.LocalMedia; 17 | 18 | import java.util.Arrays; 19 | import java.util.List; 20 | 21 | import butterknife.BindView; 22 | 23 | public class MainActivity extends BaseAcitvity { 24 | 25 | @BindView(R.id.rv_main) RecyclerView rv; 26 | 27 | @Override 28 | protected int getLayoutId() { 29 | return R.layout.activity_main; 30 | } 31 | 32 | @Override 33 | protected void initViews(Bundle savedInstanceState) { 34 | } 35 | 36 | @Override 37 | protected void initData() { 38 | String[] data = getResources().getStringArray(R.array.mainArrays); 39 | HomeAdapter homeAdapter = new HomeAdapter(R.layout.adapter_home_item, Arrays.asList(data)); 40 | rv.setLayoutManager(new LinearLayoutManager(this)); 41 | homeAdapter.openLoadAnimation(); 42 | rv.setAdapter(homeAdapter); 43 | 44 | rv.addOnItemTouchListener(new OnItemClickListener() { 45 | @Override 46 | public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) { 47 | switch (position){ 48 | case 0: 49 | gotoActivity(PickerViewActivity.class); 50 | break; 51 | case 1: 52 | // showProgress(); 53 | HLoading loading = new HLoading(activity,R.color.green_70); 54 | loading.show(); 55 | break; 56 | case 2: 57 | gotoActivity(CommonDialogActivity.class); 58 | break; 59 | case 3: 60 | selectImg(); 61 | break; 62 | case 4: 63 | gotoActivity(SmsActivity.class); 64 | break; 65 | case 5: 66 | gotoActivity(RVActivity.class); 67 | break; 68 | default: 69 | break; 70 | } 71 | } 72 | }); 73 | } 74 | 75 | private void selectImg(){ 76 | PictureConfig.getInstance() 77 | .openPhoto(this, new PictureConfig.OnSelectResultCallback() { 78 | @Override 79 | public void onSelectSuccess(List list) { 80 | if (list != null){ 81 | } 82 | } 83 | 84 | @Override 85 | public void onSelectSuccess(LocalMedia localMedia) { 86 | if (localMedia != null){ 87 | ToastUtils.showShortToast(localMedia.getPath()); 88 | } 89 | } 90 | }); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/ui/PickerViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.ui; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Button; 7 | 8 | import com.bigkoo.pickerview.OptionsPickerView; 9 | import com.bigkoo.pickerview.TimePickerView; 10 | import com.hankkin.hbase.R; 11 | import com.hankkin.xlibrary.base.BaseAcitvity; 12 | import com.hankkin.xlibrary.bean.JsonBean; 13 | import com.hankkin.xlibrary.other.PickerManager; 14 | 15 | import java.text.SimpleDateFormat; 16 | import java.util.ArrayList; 17 | import java.util.Calendar; 18 | import java.util.Date; 19 | 20 | import butterknife.BindView; 21 | import butterknife.OnClick; 22 | 23 | public class PickerViewActivity extends BaseAcitvity { 24 | 25 | 26 | @BindView(R.id.btn_picker_time) 27 | Button btnTime; 28 | @BindView(R.id.btn_picker_province) 29 | Button btnProvince; 30 | 31 | private TimePickerView pvTime; 32 | private ArrayList options1Items = new ArrayList<>(); 33 | private ArrayList> options2Items = new ArrayList<>(); 34 | private ArrayList>> options3Items = new ArrayList<>(); 35 | 36 | 37 | @Override 38 | protected int getLayoutId() { 39 | return R.layout.activity_picker_view; 40 | } 41 | 42 | @Override 43 | protected void initViews(Bundle savedInstanceState) { 44 | initToolBar("PICKER组件"); 45 | initTimePicker(); 46 | } 47 | 48 | @Override 49 | protected void initData() { 50 | PickerManager.getInstance().initProvince(activity); 51 | options1Items = PickerManager.getInstance().getOptions1Items(); 52 | options2Items = PickerManager.getInstance().getOptions2Items(); 53 | options3Items = PickerManager.getInstance().getOptions3Items(); 54 | } 55 | 56 | private void initTimePicker() { 57 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) 58 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 59 | Calendar selectedDate = Calendar.getInstance(); 60 | 61 | Calendar startDate = Calendar.getInstance(); 62 | startDate.set(1970,0,23); 63 | 64 | Calendar endDate = Calendar.getInstance(); 65 | endDate.set(2100,11,28); 66 | //时间选择器 67 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { 68 | @Override 69 | public void onTimeSelect(Date date, View v) {//选中事件回调 70 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null 71 | 72 | /*btn_Time.setText(getTime(date));*/ 73 | btnTime.setText(getTime(date)); 74 | } 75 | }) 76 | .setType(TimePickerView.Type.YEAR_MONTH_DAY) 77 | .setLabel("", "", "", "", "", "") //设置空字符串以隐藏单位提示 hide label 78 | .setDividerColor(Color.DKGRAY) 79 | .setContentSize(20) 80 | .setDate(selectedDate) 81 | .setRangDate(startDate,endDate) 82 | .build(); 83 | } 84 | 85 | private String getTime(Date date) {//可根据需要自行截取数据显示 86 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 87 | return format.format(date); 88 | } 89 | 90 | @OnClick(R.id.btn_picker_time) 91 | void showTime(){ 92 | pvTime.show(); 93 | } 94 | 95 | @OnClick(R.id.btn_picker_province) 96 | void showOptions(){ 97 | OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() { 98 | @Override 99 | public void onOptionsSelect(int options1, int options2, int options3, View v) { 100 | //返回的分别是三个级别的选中位置 101 | String tx = options1Items.get(options1).getPickerViewText()+ 102 | options2Items.get(options1).get(options2)+ 103 | options3Items.get(options1).get(options2).get(options3); 104 | 105 | btnProvince.setText(tx); 106 | } 107 | }) 108 | 109 | .setTitleText("城市选择") 110 | .setDividerColor(Color.BLACK) 111 | .setTextColorCenter(Color.BLACK) //设置选中项文字颜色 112 | .setContentTextSize(20) 113 | .setOutSideCancelable(false)// default is true 114 | .build(); 115 | 116 | /*pvOptions.setPicker(options1Items);//一级选择器 117 | pvOptions.setPicker(options1Items, options2Items);//二级选择器*/ 118 | pvOptions.setPicker(options1Items, options2Items,options3Items);//三级选择器 119 | pvOptions.show(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/ui/RVActivity.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.ui; 2 | 3 | import android.os.Bundle; 4 | import android.os.Handler; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | import android.support.v7.widget.DividerItemDecoration; 7 | import android.support.v7.widget.LinearLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | 10 | import com.chad.library.adapter.base.BaseQuickAdapter; 11 | import com.hankkin.hbase.Constant; 12 | import com.hankkin.hbase.R; 13 | import com.hankkin.hbase.adapter.RVAdapter; 14 | import com.hankkin.xlibrary.base.BaseAcitvity; 15 | import com.hankkin.xlibrary.widget.CustomLoadMoreView; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | import butterknife.BindView; 21 | 22 | public class RVActivity extends BaseAcitvity implements BaseQuickAdapter.RequestLoadMoreListener,SwipeRefreshLayout.OnRefreshListener{ 23 | 24 | @BindView(R.id.refreshlayout) SwipeRefreshLayout refreshLayout; 25 | @BindView(R.id.rv) RecyclerView rv; 26 | private int dataCount = 0;//数据源个数 27 | private int page = 1;//分页数 28 | private RVAdapter adapter; 29 | 30 | @Override 31 | protected int getLayoutId() { 32 | return R.layout.activity_rv; 33 | } 34 | 35 | @Override 36 | protected void initViews(Bundle savedInstanceState) { 37 | initToolBar("Rv+SwipeRefresh"); 38 | initSwipe(refreshLayout,this); 39 | rv.setLayoutManager(new LinearLayoutManager(activity)); 40 | rv.addItemDecoration( 41 | new DividerItemDecoration(activity, DividerItemDecoration.VERTICAL)); 42 | adapter = new RVAdapter(); 43 | adapter.setOnLoadMoreListener(this,rv); 44 | adapter.setLoadMoreView(new CustomLoadMoreView()); 45 | rv.setAdapter(adapter); 46 | } 47 | 48 | @Override 49 | protected void initData() { 50 | page = 1; 51 | refreshLayout.setRefreshing(true); 52 | new Handler().postDelayed(new Runnable() { 53 | @Override 54 | public void run() { 55 | List data = new ArrayList<>(); 56 | for (int i=0;i<20;i++){ 57 | data.add("item"+i); 58 | } 59 | adapter.setNewData(data); 60 | dataCount = adapter.getItemCount(); 61 | adapter.notifyDataSetChanged(); 62 | refreshLayout.setRefreshing(false); 63 | adapter.setEnableLoadMore(true); 64 | } 65 | },1000); 66 | 67 | } 68 | 69 | @Override 70 | public void onRefresh() { 71 | initData(); 72 | } 73 | 74 | @Override 75 | public void onLoadMoreRequested() { 76 | refreshLayout.setEnabled(false); 77 | if (dataCount < Constant.PAGE_SIZE){ 78 | adapter.loadMoreEnd(true); 79 | } 80 | else { 81 | page ++; 82 | new Handler().postDelayed(new Runnable() { 83 | @Override 84 | public void run() { 85 | List data = new ArrayList<>(); 86 | for (int i=0;i<20;i++){ 87 | data.add("item"+i); 88 | } 89 | adapter.addData(data); 90 | dataCount = adapter.getData().size(); 91 | adapter.notifyDataSetChanged(); 92 | adapter.loadMoreComplete(); 93 | } 94 | },1000); 95 | } 96 | refreshLayout.setEnabled(true); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/hankkin/hbase/ui/SmsActivity.java: -------------------------------------------------------------------------------- 1 | package com.hankkin.hbase.ui; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.ImageView; 6 | 7 | import com.hankkin.hbase.R; 8 | import com.hankkin.hbase.popwindow.SmsRightPopwindow; 9 | import com.hankkin.xlibrary.base.BaseAcitvity; 10 | 11 | import butterknife.BindView; 12 | 13 | public class SmsActivity extends BaseAcitvity { 14 | 15 | @BindView(R.id.iv_tool_bar_right) ImageView ivJiaHao; 16 | 17 | @Override 18 | protected int getLayoutId() { 19 | return R.layout.activity_sms; 20 | } 21 | 22 | @Override 23 | protected void initViews(Bundle savedInstanceState) { 24 | initToolBarRightImg("消息POP", R.mipmap.icon_sms_jiahao, new OnRightClickListener() { 25 | @Override 26 | public void rightClick() { 27 | final SmsRightPopwindow popwindow = new SmsRightPopwindow(activity,new OnClickLintener()); 28 | popwindow.getContentView().setOnFocusChangeListener(new View.OnFocusChangeListener() { 29 | 30 | @Override 31 | public void onFocusChange(View v, boolean hasFocus) { 32 | if (!hasFocus) { 33 | popwindow.dismiss(); 34 | } 35 | } 36 | }); 37 | //设置默认获取焦点 38 | popwindow.setFocusable(true); 39 | //以某个控件的x和y的偏移量位置开始显示窗口 40 | popwindow.showAsDropDown(ivJiaHao); 41 | //如果窗口存在,则更新 42 | popwindow.update(); 43 | } 44 | }); 45 | } 46 | 47 | @Override 48 | protected void initData() { 49 | 50 | } 51 | 52 | class OnClickLintener implements View.OnClickListener { 53 | 54 | @Override 55 | public void onClick(View view) { 56 | switch (view.getId()) { 57 | 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_in.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_common_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 18 | 23 | 24 |