All Projects → jenly1314 → Base

jenly1314 / Base

Licence: apache-2.0
🍁 Base是针对于Android开发封装好一些常用的基类,主要包括通用的Adapter、Activity、Fragment、Dialog等、和一些常用的Util类,只为更简单。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Base

Tieguanyin
Activity Builder.
Stars: ✭ 113 (-54.62%)
Mutual labels:  activity, fragments, fragment
Simpledialogfragments
A collection of easy to use and extendable DialogFragment's for Android
Stars: ✭ 94 (-62.25%)
Mutual labels:  fragments, dialog
Rxbus
Android reactive event bus that simplifies communication between Presenters, Activities, Fragments, Threads, Services, etc.
Stars: ✭ 79 (-68.27%)
Mutual labels:  activity, fragment
Flowr
FlowR is a wrapper class around the Fragment Manager.
Stars: ✭ 123 (-50.6%)
Mutual labels:  fragments, fragment
Activity
A PHP API to log anything anywhere
Stars: ✭ 44 (-82.33%)
Mutual labels:  log, activity
Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+313.25%)
Mutual labels:  activity, fragment
Fragnav
An Android library for managing multiple stacks of fragments
Stars: ✭ 1,379 (+453.82%)
Mutual labels:  fragments, fragment
Androidnavigation
A library managing navigation, nested Fragment, StatusBar, Toolbar for Android
Stars: ✭ 636 (+155.42%)
Mutual labels:  fragment, dialog
Navigator
Android Multi-module navigator, trying to find a way to navigate into a modularized android project
Stars: ✭ 131 (-47.39%)
Mutual labels:  activity, fragment
Rxlifecycle
Rx binding of stock Android Activities & Fragment Lifecycle, avoiding memory leak
Stars: ✭ 131 (-47.39%)
Mutual labels:  activity, fragment
Wordpress Simple History
🔍🕵️‍♀️ WordPress audit log that track user changes in WordPress admin using a nice activity feed.
Stars: ✭ 232 (-6.83%)
Mutual labels:  log, activity
Dialogutil
common used dialog with material style ( in support v7),ios style,get top activity automatically, invoke everywhere (any thread , any window)
Stars: ✭ 948 (+280.72%)
Mutual labels:  util, dialog
Androidutilcode
AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥
Stars: ✭ 30,239 (+12044.18%)
Mutual labels:  log, fragment
Thirtyinch
a MVP library for Android favoring a stateful Presenter
Stars: ✭ 1,052 (+322.49%)
Mutual labels:  activity, fragment
Devutils
🔥 ( 持续更新,目前含 160+ 工具类 ) DevUtils 是一个 Android 工具库,主要根据不同功能模块,封装快捷使用的工具类及 API 方法调用。该项目尽可能的便于开发人员,快捷、高效开发安全可靠的项目。
Stars: ✭ 680 (+173.09%)
Mutual labels:  log, activity
Bundler
🎁 Android Intent & Bundle extensions that insert and retrieve values elegantly.
Stars: ✭ 195 (-21.69%)
Mutual labels:  activity, fragment
Android Switchdatetimepicker
Android library for Date and Time Picker in same dialog
Stars: ✭ 360 (+44.58%)
Mutual labels:  fragment, dialog
Lazyfragment
类似微信,网易新闻 延迟加载Fragment基类 , 支持与ViewPager组合刷新全部Fragment
Stars: ✭ 391 (+57.03%)
Mutual labels:  fragments, fragment
Scene
Android Single Activity Applications framework without Fragment.
Stars: ✭ 1,793 (+620.08%)
Mutual labels:  activity, fragments
Binding
Simple API implement DataBinding and ViewBinding. 简单的 API 实现 DataBinding 和 ViewBinding,欢迎 star
Stars: ✭ 169 (-32.13%)
Mutual labels:  activity, fragment

Base

Image

Download JitPack CI CircleCI API License Blog

Base是针对于Android开发封装好一些常用的基类,主要包括通用的Adapter、Activity、Fragment、Dialog等、和一些常用的Util类,只为更简单。

Base 3.x 在Base 2.x 的基础上进行了重构,最大的变化是将base-adapter和base-util提取了出来。

单独提取library主要是为了模块化,使其更加独立。在使用时需要用哪个库就引入库,这样就能尽可能的减少引入库的体积。

  • base 主要是封装了常用的Activity、Fragment、DialogFragment、Dialog等作为基类,方便使用。
  • base-adapter 主要是封装了各种Adapter、简化自定义Adapter步骤,让写自定义适配器从此更简单。
  • base-util 主要是封装了一些常用的工具类。

AndroidX version

Gif展示(示例App)

Image

引入

Maven:

//base
<dependency>
  <groupId>com.king.base</groupId>
  <artifactId>base</artifactId>
  <version>3.2.1</version>
  <type>pom</type>
</dependency>

//base-adapter
<dependency>
  <groupId>com.king.base</groupId>
  <artifactId>adapter</artifactId>
  <version>3.2.1</version>
  <type>pom</type>
</dependency>

//base-util
<dependency>
  <groupId>com.king.base</groupId>
  <artifactId>util</artifactId>
  <version>3.2.1</version>
  <type>pom</type>
</dependency>

Gradle:

//---------- AndroidX 版本
//base
implementation 'com.king.base:base:3.2.1-androidx'

//base-adapter
implementation 'com.king.base:adapter:3.2.1-androidx'

//base-util
implementation 'com.king.base:util:3.2.1-androidx'


//---------- Android 版本
//base
implementation 'com.king.base:base:3.2.1'

//base-adapter
implementation 'com.king.base:adapter:3.2.1'

//base-util
implementation 'com.king.base:util:3.2.1'


Lvy:

//base
<dependency org='com.king.base' name='base' rev='3.2.1'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

//base-adapter
<dependency org='com.king.base' name='adapter' rev='3.2.1'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

//base-util
<dependency org='com.king.base' name='util' rev='3.2.1'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>
如果Gradle出现compile失败的情况,可以在Project的build.gradle里面添加如下:(也可以使用上面的GitPack来complie)
allprojects {
    repositories {
        //...
        maven { url 'https://dl.bintray.com/jenly/maven' }
    }
}

引入的库:

//---------- AndroidX 版本
//base
compileOnly 'androidx.appcompat:appcompat:1.0.0+'
compileOnly 'com.king.base:util:3.2.1-androidx'

//base-adapter
compileOnly 'androidx.appcompat:appcompat:1.0.0+'
compileOnly 'androidx.recyclerview:recyclerview:1.0.0+'

//base-util
compileOnly 'androidx.appcompat:appcompat:1.0.0+'

//---------- Android 版本
//base
compileOnly 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'com.king.base:util:3.2.1'

//base-adapter
compileOnly 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'com.android.support:recyclerview-v7:28.0.0'

//base-util
compileOnly 'com.android.support:appcompat-v7:28.0.0'

简要说明:

Base主要实用地方体现在:出统一的代码风格,实用的各种基类,BaseActivity和BaseFragment里面还有许多实用的代码封装,只要用了Base,使用Fragment就感觉跟使用Activtiy基本是一样的。

代码示例:

通用的Adapter

/**
  *
  * 只需继承通用的适配器(ViewHolderAdapter或ViewHolderRecyclerAdapter),简单的几句代码,妈妈再也不同担心我写自定义适配器了。
  */
public class TestAdapter extends ViewHolderAdapter<String> {


    public TestAdapter(Context context, List<String> listData) {
        super(context, listData);
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater,T t,int position, ViewGroup parent) {
        return inflate(R.layout.list_item,parent,false);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, String s, int position) {
        holder.setText(R.id.tv,s);
    }
}

基类BaseActivity

public class TestActivity extends BaseActivity {

    private TextView tv;
    private Button btn;

    @Override
    public void initUI() {
        //TODO:初始化UI
        setContentView(R.layout.activity_test);
        tv = findView(R.id.tv);
        btn = findView(R.id.btn);
    }

    @Override
    public void initData() {
        //TODO:初始化数据(绑定数据)
        tv.setText("text");
    }

}

GestureActivity

public class TestGestureActivity extends GestureActivity {

    private TextView tv;
    private Button btn;

    @Override
    public void initUI() {
        //TODO:初始化UI
        setContentView(R.layout.activity_test);
        tv = findView(R.id.tv);
        btn = findView(R.id.btn);
    }

    @Override
    public void initData() {
        //TODO:初始化数据(绑定数据)
        tv.setText("text");
    }

    @Override
    public void onLeftFling() {
        //TODO:向左滑动
    }

    @Override
    public boolean onRightFling() {
        //TODO:向右滑动,默认执行finish,返回为true表示拦截事件。
        return false;
    }
}

SplashActivity

public class TestSplashActivity extends SplashActivity {
    @Override
    public int getContentViewId() {
        return R.layout.activity_splash;
    }

    @Override
    public Animation.AnimationListener getAnimationListener() {
        return new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                //TODO: 启动动画结束,可执行跳转逻辑
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        };
    }
}

BaseFragment

public class TestFragment extends BaseFragment {
    @Override
    public int inflaterRootView() {
        return R.layout.fragment_test;
    }

    @Override
    public void initUI() {
        //TODO:初始化UI
    }

    @Override
    public void initData() {
         //TODO:初始化数据(绑定数据)
    }

}

BaseDialogFragment

public class TestDialogFragment extends BaseDialogFragment {
    @Override
    public int inflaterRootView() {
        return R.layout.fragment_test_dialog;
    }

    @Override
    public void initUI() {
        //TODO:初始化UI
    }

    @Override
    public void initData() {
        //TODO:初始化数据(绑定数据)
    }


}

WebFragment

    WebFragment实现基本webView功能

其他小功能

使用Log: 统一控制管理Log

 LogUtils.v();

 LogUtils.d();

 LogUtils.i();

 LogUtils.w();

 LogUtils.e();

 LogUtils.twf();

 LogUtils.println();

使用Toast

 showToast(CharSequence text);

 showToast(@StringRes  int resId);

使用Dialog

 showDialog(View v);
 showProgressDialog();

 showProgressDialog(@LayoutRes int resId);

 showProgressDialog(View v);

App中的源码使用示例或直接查看API帮助文档。更多实用黑科技,请速速使用Base体会吧。

版本记录

v3.2.1:2019-7-1

  • 优化部分细节,为迁移AndroidX版本做准备
  • 支持AndroidX对应版本

v3.2.0:2019-5-28

  • 统一版本,方便维护

v3.1.2: 很久以前…

  • 未记录版本日志

赞赏

如果您喜欢Base,或感觉Base帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢 😃

您也可以扫描下面的二维码,请作者喝杯咖啡 ☕️

关于我

Name: Jenly

Email: jenly1314#gmail.com / jenly1314#vip.qq.com

CSDN: jenly121

Github: jenly1314

加入QQ群: 20867961

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].