20 | * LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(30, 30);
21 | * params.leftMargin = 10;
22 | * params.rightMargin = 10;
23 | * View view = new View(context);
24 | * view.setLayoutParams(params);
25 | * return view;
26 | *
27 | * @param context context
28 | * @param index index
29 | * @param item entity
30 | * @return indicator view at index
31 | */
32 | @Nullable
33 | View onCreateIndicatorView(Context context, int index, T item);
34 | }
35 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/bannerview/OnDataSetChangedListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.bannerview;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | interface OnDataSetChangedListener
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface OnPageAdapterItemClickListener
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public interface PageAdapterItemLifeCycle
false-destroy item by default way: {@code container.removeView((View) object);}
32 | */
33 | boolean onDestroyItem(ViewGroup container, Object object);
34 | }
35 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/bannerview/pageTransformer/AlphaPageTransformer.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.bannerview.pageTransformer;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v4.view.ViewPager;
5 | import android.view.View;
6 |
7 | /**
8 | *
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public class AlphaPageTransformer implements ViewPager.PageTransformer {
15 |
16 | @Override
17 | public void transformPage(@NonNull View page, float position) {
18 | float alpha = 0.0f;
19 | if (0.0f <= position && position <= 1.0f) {
20 | alpha = 1.0f - position;
21 | } else if (-1.0f <= position && position < 0.0f) {
22 | alpha = position + 1.0f;
23 | }
24 | if (alpha < 0.5f)
25 | alpha = 0.5f;
26 | page.setAlpha(alpha);
27 | }
28 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/bannerview/pageTransformer/DepthPageTransformer.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.bannerview.pageTransformer;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v4.view.ViewPager;
5 | import android.view.View;
6 |
7 | /**
8 | *
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public class DepthPageTransformer implements ViewPager.PageTransformer {
15 | private static float MIN_SCALE = 0.75f;
16 |
17 | @Override
18 | public void transformPage(@NonNull View view, float position) {
19 | int pageWidth = view.getWidth();
20 | if (position < -1) { // [-Infinity,-1)//This page is way off-screen to the left.
21 | view.setAlpha(0);
22 | } else if (position <= 0) { // [-1,0]Use //the default slide transition when moving to the left page
23 | view.setAlpha(1);
24 | view.setTranslationX(0);
25 | view.setScaleX(1);
26 | view.setScaleY(1);
27 | } else if (position <= 1) { // (0,1]// Fade the page out.
28 | view.setAlpha(1 - position);
29 | // Counteract the default slide transition
30 | view.setTranslationX(pageWidth * -position);
31 | // Scale the page down (between MIN_SCALE and 1)
32 | float scaleFactor = MIN_SCALE + (1 - MIN_SCALE)
33 | * (1 - Math.abs(position));
34 | view.setScaleX(scaleFactor);
35 | view.setScaleY(scaleFactor);
36 | } else { // (1,+Infinity]
37 | // This page is way off-screen to the right.
38 | view.setAlpha(0);
39 |
40 | }
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/bannerview/pageTransformer/ScaleTransformer.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.bannerview.pageTransformer;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v4.view.ViewPager;
5 | import android.view.View;
6 |
7 | /**
8 | *
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public class ScaleTransformer implements ViewPager.PageTransformer {
15 | private static final float MIN_SCALE = 0.70f;
16 | private static final float MIN_ALPHA = 0.5f;
17 |
18 | @Override
19 | public void transformPage(@NonNull View page, float position) {
20 | if (position < -1 || position > 1) {
21 | page.setAlpha(MIN_ALPHA);
22 | page.setScaleX(MIN_SCALE);
23 | page.setScaleY(MIN_SCALE);
24 | } else if (position <= 1) { // [-1,1]
25 | float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
26 | if (position < 0) {
27 | float scaleXY = 1 + 0.3f * position;
28 | page.setScaleX(scaleXY);
29 | page.setScaleY(scaleXY);
30 | } else {
31 | float scaleXY = 1 - 0.3f * position;
32 | page.setScaleX(scaleXY);
33 | page.setScaleY(scaleXY);
34 | }
35 | page.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/bannerview/pageTransformer/ZoomOutPageTransformer.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.bannerview.pageTransformer;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v4.view.ViewPager;
5 | import android.view.View;
6 |
7 | /**
8 | *
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public class ZoomOutPageTransformer implements ViewPager.PageTransformer {
15 |
16 | private final static float MIN_SCALE = 0.85f;
17 | private final static float MIN_ALPHA = 0.5f;
18 |
19 | @Override
20 | public void transformPage(@NonNull View view, float position) {
21 | int pageWidth = view.getWidth();
22 | int pageHeight = view.getHeight();
23 |
24 | if (position < -1) { // [-Infinity,-1)
25 | // This page is way off-screen to the left.
26 | view.setAlpha(0);
27 | } else if (position <= 1) { // [-1,1]
28 | // Modify the default slide transition to
29 | // shrink the page as well
30 | float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
31 | float vertMargin = pageHeight * (1 - scaleFactor) / 2;
32 | float horzMargin = pageWidth * (1 - scaleFactor) / 2;
33 | if (position < 0) {
34 | view.setTranslationX(horzMargin - vertMargin / 2);
35 | } else {
36 | view.setTranslationX(-horzMargin + vertMargin / 2);
37 | }
38 | // Scale the page down (between MIN_SCALE and 1)
39 | view.setScaleX(scaleFactor);
40 | view.setScaleY(scaleFactor);
41 | // Fade the page relative to its size.
42 | view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE)
43 | / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
44 | } else { // (1,+Infinity]
45 | // This page is way off-screen to the right.
46 | view.setAlpha(0);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui;
2 |
3 | import android.support.v4.app.Fragment;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public abstract class BaseFragment extends Fragment {
13 |
14 | protected boolean isVisible;
15 |
16 | @Override
17 | public void setUserVisibleHint(boolean isVisibleToUser) {
18 | super.setUserVisibleHint(isVisibleToUser);
19 | if (getUserVisibleHint()) {
20 | isVisible = true;
21 | onVisible();
22 | } else {
23 | isVisible = false;
24 | onInVisible();
25 | }
26 | }
27 |
28 | protected void onVisible() {
29 | lazyLoad();
30 | }
31 |
32 | protected void onInVisible() {
33 | }
34 |
35 | protected abstract void lazyLoad();
36 | }
37 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp/BaseMVPFragment.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import jsc.kit.component.baseui.BaseLazyLoadFragment;
9 |
10 | /**
11 | *
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | */
17 | public abstract class BaseMVPFragment extends BaseLazyLoadFragment {
18 |
19 | private List
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public abstract class BasePresenter
For example:
37 | *
38 | * if(isViewAttached()){
39 | * V view = getView();
40 | * //todo
41 | * }
42 | *
43 | *
44 | * @return view
45 | */
46 | public V getView() {
47 | return viewWeakReference.get();
48 | }
49 |
50 | public boolean isViewAttached(){
51 | return viewWeakReference.get() != null;
52 | }
53 |
54 | public void setView(@NonNull V view) {
55 | viewWeakReference = new WeakReference<>(view);
56 | }
57 |
58 | public void release() {
59 | if (viewWeakReference != null){
60 | V view = viewWeakReference.get();
61 | view = null;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp/IBaseModel.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface IBaseModel {
11 | }
12 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp/IBaseView.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface IBaseView {
11 | }
12 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp2/BasePresenterImpl.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp2;
2 |
3 | import java.lang.ref.WeakReference;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public abstract class BasePresenterImpl
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface IBaseModel {
11 | }
12 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp2/IBasePresenter.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp2;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface IBasePresenter
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface IBaseView {
11 | }
12 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp2/LifecycleContract.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp2;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface LifecycleContract {
11 | public interface Model extends IBaseModel {}
12 | public interface View extends IBaseView {
13 | public void onLifecycleStart();
14 | public void onLifecycleResume();
15 | public void onLifecyclePause();
16 | public void onLifecycleStop();
17 | public void onLifecycleDestroy();
18 | }
19 | public interface Presenter {
20 | public void start();
21 | public void resume();
22 | public void pause();
23 | public void stop();
24 | public void destroy();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/basemvp2/LifecyclePresenterImpl.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.basemvp2;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | import java.lang.ref.WeakReference;
6 |
7 | /**
8 | *
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | */
14 | public class LifecyclePresenterImpl extends BasePresenterImpl
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public interface TemplateContract {
11 | public interface Model extends IBaseModel {}
12 | public interface View extends IBaseView {}
13 | public interface Presenter extends IBasePresenter
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public class TemplatePresenterImpl implements TemplateContract.Presenter {
11 |
12 |
13 | @Override
14 | public void attachModel(TemplateContract.Model model) {
15 |
16 | }
17 |
18 | @Override
19 | public boolean isModelAttached() {
20 | return false;
21 | }
22 |
23 | @Override
24 | public TemplateContract.Model model() {
25 | return null;
26 | }
27 |
28 | @Override
29 | public void attachView(TemplateContract.View view) {
30 |
31 | }
32 |
33 | @Override
34 | public boolean isViewAttached() {
35 | return false;
36 | }
37 |
38 | @Override
39 | public TemplateContract.View view() {
40 | return null;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/baseview/BaseViewShowDelegate.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.baseview;
2 |
3 | import android.os.Bundle;
4 | import android.os.Message;
5 | import android.support.annotation.NonNull;
6 | import android.support.annotation.Nullable;
7 | import android.view.View;
8 |
9 | /**
10 | *
Email:1006368252@qq.com
11 | *
QQ:1006368252
12 | *
https://github.com/JustinRoom/JSCKit
13 | *
14 | * @author jiangshicheng
15 | */
16 | public interface BaseViewShowDelegate {
17 |
18 | void onShowContentPage(@NonNull View contentView, @Nullable Bundle bundle);
19 |
20 | void onShowEmptyPage(@NonNull View emptyView, @Nullable Bundle bundle);
21 |
22 | void onShowLoadingPage(@NonNull View loadingView, @Nullable Bundle bundle);
23 |
24 | void onShowErrorPage(@NonNull View errorView, @Nullable Bundle bundle);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/download/DownloadListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.download;
2 |
3 | import android.net.Uri;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface DownloadListener {
13 | /**
14 | * Observe downloading progress.
15 | *
16 | * @param downloadedBytes downloaded bytes
17 | * @param totalBytes total bytes
18 | * @param downStatus download status
19 | */
20 | public void onDownloadProgress(int downloadedBytes, int totalBytes, int downStatus);
21 |
22 | /**
23 | * Download successfully.
24 | *
25 | * @param uri file uri
26 | */
27 | public void onDownloadCompleted(Uri uri);
28 | }
29 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/handler/HandlerDelegate.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.handler;
2 |
3 | import android.os.Message;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface HandlerDelegate {
13 |
14 | /**
15 | * Do your ui operations here, in UI thread.
16 | *
17 | * @param msg message
18 | */
19 | public void handleUIMessage(Message msg);
20 |
21 | /**
22 | * Do your long-running operations here, in none UI thread.
23 | *
24 | * @param msg message
25 | */
26 | public void handleWorkMessage(Message msg);
27 | }
28 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/resizable/BaseResizableAdapter.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.resizable;
2 |
3 | import android.support.annotation.IdRes;
4 | import android.support.annotation.IntDef;
5 | import android.support.annotation.LayoutRes;
6 | import android.support.annotation.NonNull;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import java.lang.annotation.Retention;
13 | import java.lang.annotation.RetentionPolicy;
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import jsc.kit.component.swiperecyclerview.BaseRecyclerViewAdapter;
18 |
19 | /**
20 | * 大小屏切换基础适配器。
21 | *
Email:1006368252@qq.com
22 | *
QQ:1006368252
23 | *
https://github.com/JustinRoom/JSCKit
24 | *
25 | * @author jiangshicheng
26 | */
27 | public abstract class BaseResizableAdapter
Email:1006368252@qq.com
10 | *
QQ:1006368252
11 | *
https://github.com/JustinRoom/JSCKit
12 | *
13 | * @author jiangshicheng
14 | */
15 | public interface TransitionDelegate {
16 |
17 | /**
18 | * activity's entering transition
19 | *
This transition will be executed when jump to this activity.
20 | *
21 | * @return a transition for entering activity
22 | */
23 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
24 | public Transition createEnterTransition();
25 |
26 | /**
27 | * activity's exiting transition
28 | *
This transition will be executed when jump to next activity.
29 | *
30 | * @return a transition for exiting activity
31 | */
32 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
33 | public Transition createExitTransition();
34 |
35 | /**
36 | * activity's returning transition
37 | *
This transition will be executed when return to previous activity.
38 | *
39 | * @return a transition for returning activity
40 | */
41 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
42 | public Transition createReturnTransition();
43 |
44 | /**
45 | * activity's re-entering transition
46 | *
This transition will be executed when back to this activity.
47 | *
48 | * @return a transition for re-entering activity
49 | */
50 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
51 | public Transition createReenterTransition();
52 |
53 | /**
54 | * initialize shared_elements' transition name here.
55 | *
It should be called after calling {@link android.app.Activity#setContentView(View)} method on your own.
56 | */
57 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
58 | public void initSharedElement();
59 | }
60 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/baseui/transition/TransitionEnum.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.baseui.transition;
2 |
3 | import android.support.annotation.Nullable;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public enum TransitionEnum {
13 | SLIDE((byte) 0, "slide"),
14 | EXPLODE((byte) 1, "explode"),
15 | FADE((byte) 2, "fade");
16 |
17 | private byte value;
18 | private String label;
19 |
20 | TransitionEnum(byte value, String label) {
21 | this.value = value;
22 | this.label = label;
23 | }
24 |
25 | public byte getValue() {
26 | return value;
27 | }
28 |
29 | public String getLabel() {
30 | return label;
31 | }
32 |
33 | @Nullable
34 | public static TransitionEnum createTransitionByValue(byte value) {
35 | if (value == 0)
36 | return SLIDE;
37 | if (value == 1)
38 | return EXPLODE;
39 | if (value == 2)
40 | return FADE;
41 | return null;
42 | }
43 |
44 | @Nullable
45 | public static TransitionEnum createTransitionByLabel(String label) {
46 | if (SLIDE.getLabel().equalsIgnoreCase(label))
47 | return SLIDE;
48 | if (EXPLODE.getLabel().equalsIgnoreCase(label))
49 | return EXPLODE;
50 | if (FADE.getLabel().equalsIgnoreCase(label))
51 | return FADE;
52 | return null;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/graph/DataItem.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.graph;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public class DataItem {
11 | private float ratio;//比率, 柱形高度百分比
12 |
13 | public DataItem() {
14 | }
15 |
16 | public DataItem(float ratio) {
17 | this.ratio = ratio;
18 | }
19 |
20 | public float getRatio() {
21 | return ratio;
22 | }
23 |
24 | public void setRatio(float ratio) {
25 | this.ratio = ratio;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/graph/LabelItem.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.graph;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.ColorInt;
5 | import android.support.annotation.FloatRange;
6 | import android.support.annotation.NonNull;
7 | import android.util.DisplayMetrics;
8 | import android.util.TypedValue;
9 |
10 | /**
11 | *
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | */
17 | public class LabelItem {
18 | private int color;//标签颜色
19 | private float size;//标签大小
20 | private String label;//标签
21 |
22 | public LabelItem() {
23 | color = 0xFF04DB5B;
24 | }
25 |
26 | public LabelItem(@ColorInt int color, @FloatRange(from = 0) float size, String label) {
27 | this.color = color;
28 | this.size = size;
29 | this.label = label;
30 | }
31 |
32 | public int getColor() {
33 | return color;
34 | }
35 |
36 | public void setColor(@ColorInt int color) {
37 | this.color = color;
38 | }
39 |
40 | public float getSize() {
41 | return size;
42 | }
43 |
44 | public void setSize(@FloatRange(from = 0)float size) {
45 | this.size = size;
46 | }
47 |
48 | /**
49 | * @param context context
50 | * @param unit unit
51 | * @param value value
52 | * @see TypedValue#applyDimension(int, float, DisplayMetrics)
53 | */
54 | public void setSize(@NonNull Context context, int unit, @FloatRange(from = 0)float value) {
55 | this.size = TypedValue.applyDimension(unit, value, context.getResources().getDisplayMetrics());
56 | }
57 |
58 | public String getLabel() {
59 | return label;
60 | }
61 |
62 | public void setLabel(String label) {
63 | this.label = label;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/graph/LineItem.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.graph;
2 |
3 | import android.graphics.Color;
4 | import android.support.annotation.ColorInt;
5 |
6 | /**
7 | *
Email:1006368252@qq.com
8 | *
QQ:1006368252
9 | *
https://github.com/JustinRoom/JSCKit
10 | *
11 | * @author jiangshicheng
12 | */
13 | public class LineItem {
14 | private int lineColor = Color.BLUE;
15 | private DataItem[] data = null;
16 |
17 | public LineItem() {
18 | }
19 |
20 | public LineItem(@ColorInt int lineColor, DataItem[] data) {
21 | this.lineColor = lineColor;
22 | this.data = data;
23 | }
24 |
25 | public int getLineColor() {
26 | return lineColor;
27 | }
28 |
29 | public void setLineColor(@ColorInt int lineColor) {
30 | this.lineColor = lineColor;
31 | }
32 |
33 | public DataItem[] getData() {
34 | return data;
35 | }
36 |
37 | public void setData(DataItem[] data) {
38 | this.data = data;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/guide/OnCustomClickListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.guide;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.view.View;
5 |
6 | public interface OnCustomClickListener {
7 | public void onCustomClick(@NonNull View view);
8 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/guide/OnTargetClickListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.guide;
2 |
3 | import android.view.View;
4 |
5 | public interface OnTargetClickListener {
6 | public void onTargetClick(View target);
7 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/radarview/RadarPoint.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.radarview;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public class RadarPoint {
11 | private float x;
12 | private float y;
13 |
14 | public RadarPoint() {
15 | }
16 |
17 | public RadarPoint(float x, float y) {
18 | this.x = x;
19 | this.y = y;
20 | }
21 |
22 | public float getX() {
23 | return x;
24 | }
25 |
26 | public void setX(float x) {
27 | this.x = x;
28 | }
29 |
30 | public float getY() {
31 | return y;
32 | }
33 |
34 | public void setY(float y) {
35 | this.y = y;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/stepview/DrawDelegate.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.stepview;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.support.annotation.NonNull;
6 |
7 | /**
8 | * This delegate is for {@link VerticalStepLinearLayout} drawing steps.
9 | *
Email:1006368252@qq.com
10 | *
QQ:1006368252
11 | *
https://github.com/JustinRoom/JSCKit
12 | *
13 | * @author jiangshicheng
14 | */
15 | public interface DrawDelegate {
16 | /**
17 | * Draw the vertical line.
18 | *
Override this method to draw the vertical line on your own style.
19 | *
20 | * @param canvas canvas
21 | * @param centerX center x axis
22 | */
23 | public void drawLine(@NonNull Canvas canvas, float centerX);
24 |
25 | /**
26 | * Draw index.
27 | *
Override this method to draw index info on your own style.
28 | *
29 | * @param canvas canvas
30 | * @param index index
31 | * @param centerX center x axis
32 | * @param fontMetrics fontMetrics
33 | */
34 | public void drawIndex(@NonNull Canvas canvas, int index, float centerX, @NonNull Paint.FontMetrics fontMetrics);
35 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/swiperecyclerview/OnItemClickListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.swiperecyclerview;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface OnItemClickListener
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface OnItemLongClickListener
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public interface ViewAdapter
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | */
17 | public class AntiShakeUtils {
18 |
19 | private final static long INTERNAL_TIME = 1000;
20 |
21 | /**
22 | * Whether this click event is invalid.
23 | *
24 | * @param target target view
25 | * @return true, invalid click event.
26 | * @see #isInvalidClick(View, long)
27 | */
28 | public static boolean isInvalidClick(@NonNull View target) {
29 | return isInvalidClick(target, INTERNAL_TIME);
30 | }
31 |
32 | /**
33 | * Whether this click event is invalid.
34 | *
35 | * @param target target view
36 | * @param internalTime the internal time. The unit is millisecond.
37 | * @return true, invalid click event.
38 | */
39 | public static boolean isInvalidClick(@NonNull View target, @IntRange(from = 0) long internalTime) {
40 | long curTimeStamp = System.currentTimeMillis();
41 | long lastClickTimeStamp = 0;
42 | Object o = target.getTag(R.id.last_click_time);
43 | if (o == null){
44 | target.setTag(R.id.last_click_time, curTimeStamp);
45 | return false;
46 | }
47 | lastClickTimeStamp = (Long) o;
48 | boolean isInvalid = curTimeStamp - lastClickTimeStamp < internalTime;
49 | if (!isInvalid)
50 | target.setTag(R.id.last_click_time, curTimeStamp);
51 | return isInvalid;
52 | }
53 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/utils/BaseAnimationListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.utils;
2 |
3 | import android.view.animation.Animation;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | */
12 | public class BaseAnimationListener implements Animation.AnimationListener {
13 |
14 | @Override
15 | public void onAnimationStart(Animation animation) {
16 |
17 | }
18 |
19 | @Override
20 | public void onAnimationEnd(Animation animation) {
21 |
22 | }
23 |
24 | @Override
25 | public void onAnimationRepeat(Animation animation) {
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/utils/FileProviderCompat.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Build;
7 |
8 | import java.io.File;
9 |
10 | /**
11 | *
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | */
17 | public class FileProviderCompat {
18 |
19 | /**
20 | * Get uri for file.
21 | *
System provides {@link android.support.v4.content.FileProvider} to find uri of file for security since android {@link Build.VERSION_CODES#N}.
22 | *
23 | * @param context context
24 | * @param file file
25 | * @return uri
26 | */
27 | public static Uri getUriForFile(Context context, File file) {
28 | Uri fileUri = null;
29 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
30 | fileUri = getUriForFile24(context, file);
31 | } else {
32 | fileUri = Uri.fromFile(file);
33 | }
34 | return fileUri;
35 | }
36 |
37 | public static Uri getUriForFile24(Context context, File file) {
38 | return android.support.v4.content.FileProvider.getUriForFile(context,
39 | context.getPackageName() + ".fileProvider",
40 | file);
41 | }
42 |
43 |
44 | public static void setDataAndType(Intent intent, Uri uri, String type, boolean writeAble) {
45 | intent.setDataAndType(uri, type);
46 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
47 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
48 | if (writeAble) {
49 | intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
50 | }
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/widget/NoScrollViewPager.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.widget;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.view.ViewPager;
7 | import android.util.AttributeSet;
8 | import android.view.MotionEvent;
9 |
10 | /**
11 | *
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | */
17 | public class NoScrollViewPager extends ViewPager {
18 |
19 | private boolean mNoScroll = true;
20 |
21 | public NoScrollViewPager(@NonNull Context context) {
22 | super(context);
23 | }
24 |
25 | public NoScrollViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
26 | super(context, attrs);
27 | }
28 |
29 | public void setNoScroll(boolean noScroll) {
30 | this.mNoScroll = noScroll;
31 | }
32 |
33 | @Override
34 | public boolean onTouchEvent(MotionEvent event) {
35 | if (mNoScroll)
36 | return false;
37 | else
38 | return super.onTouchEvent(event);
39 | }
40 |
41 | @Override
42 | public boolean onInterceptTouchEvent(MotionEvent event) {
43 | if (mNoScroll)
44 | return false;
45 | else
46 | return super.onInterceptTouchEvent(event);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/widget/aspectlayout/AspectRatioHelper.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.widget.aspectlayout;
2 |
3 | import android.support.annotation.IntDef;
4 | import android.view.View;
5 |
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | *
Email:1006368252@qq.com
11 | *
QQ:1006368252
12 | *
https://github.com/JustinRoom/JSCKit
13 | *
14 | * @author jiangshicheng
15 | */
16 | public class AspectRatioHelper {
17 |
18 | public static final int BASE_HORIZONTAL = 0;
19 | public static final int BASE_VERTICAL = 1;
20 | @IntDef({BASE_HORIZONTAL, BASE_VERTICAL})
21 | @Retention(RetentionPolicy.SOURCE)
22 | public @interface BaseWhat {
23 | }
24 |
25 | private int baseWhat;
26 | private int aspectX;
27 | private int aspectY;
28 |
29 | public AspectRatioHelper() {
30 | }
31 |
32 | public AspectRatioHelper(int baseWhat, int aspectX, int aspectY) {
33 | this.baseWhat = baseWhat;
34 | this.aspectX = aspectX;
35 | this.aspectY = aspectY;
36 | if (this.aspectX <= 0)
37 | this.aspectX = 1;
38 | if (this.aspectY <= 0)
39 | this.aspectY = 1;
40 | }
41 |
42 | public int getBaseWhat() {
43 | return baseWhat;
44 | }
45 |
46 | public void setBaseWhat(@AspectRatioHelper.BaseWhat int baseWhat) {
47 | this.baseWhat = baseWhat;
48 | }
49 |
50 | public int getAspectX() {
51 | return aspectX;
52 | }
53 |
54 | public void setAspectX(int aspectX) {
55 | this.aspectX = aspectX;
56 | }
57 |
58 | public int getAspectY() {
59 | return aspectY;
60 | }
61 |
62 | public void setAspectY(int aspectY) {
63 | this.aspectY = aspectY;
64 | }
65 |
66 | public int calHeightMeasureSpec(int width){
67 | int height = width * aspectY / aspectX;
68 | return View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);
69 | }
70 |
71 | public int calWidthMeasureSpec(int height){
72 | int width = height * aspectX / aspectY;
73 | return View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/widget/aspectlayout/IAspect.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.widget.aspectlayout;
2 |
3 | /**
4 | *
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | interface IAspect {
11 |
12 | int getBaseWhat();
13 |
14 | void setBaseWhat(int baseWhat);
15 |
16 | int getAspectX();
17 |
18 | void setAspectX(int aspectX);
19 |
20 | int getAspectY();
21 |
22 | void setAspectY(int aspectY);
23 | }
24 |
--------------------------------------------------------------------------------
/BaseComponentLibrary/src/main/java/jsc/kit/component/widget/spacelickable/OnSpaceClickListener.java:
--------------------------------------------------------------------------------
1 | package jsc.kit.component.widget.spacelickable;
2 |
3 | import android.view.ViewGroup;
4 |
5 | public interface OnSpaceClickListener
Email:1006368252@qq.com
14 | *
QQ:1006368252
15 | *
https://github.com/JustinRoom/JSCKit
16 | *
17 | * @author jiangshicheng
18 | */
19 | public class SpaceClickableFrameLayout extends FrameLayout implements IViewAttrDelegate {
20 |
21 | private SpaceClickHelper
Email:1006368252@qq.com
15 | *
QQ:1006368252
16 | *
https://github.com/JustinRoom/JSCKit
17 | *
18 | * @author jiangshicheng
19 | */
20 | public class SpaceClickableLinearLayout extends LinearLayout implements IViewAttrDelegate {
21 |
22 | private SpaceClickHelper
Email:1006368252@qq.com
15 | *
QQ:1006368252
16 | *
https://github.com/JustinRoom/JSCKit
17 | *
18 | * @author jiangshicheng
19 | */
20 | public class SpaceClickableRelativeLayout extends RelativeLayout implements IViewAttrDelegate {
21 |
22 | private SpaceClickHelper
Email:1006368252@qq.com
5 | *
QQ:1006368252
6 | *
https://github.com/JustinRoom/JSCKit
7 | *
8 | * @author jiangshicheng
9 | */
10 | public class BaseResponse
Email:1006368252@qq.com
19 | *
QQ:1006368252
20 | *
https://github.com/JustinRoom/JSCKit
21 | *
22 | * @author jiangshicheng
23 | */
24 | public class ReboundLinearLayoutFragment extends Fragment {
25 |
26 | @Nullable
27 | @Override
28 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
29 | LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fragment_rebound_linear_layout, container, false);
30 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
31 | params.gravity = Gravity.CENTER_HORIZONTAL;
32 | Button button = new Button(layout.getContext());
33 | button.setText("Hello");
34 | button.setOnClickListener(new View.OnClickListener() {
35 | @Override
36 | public void onClick(View v) {
37 | Toast.makeText(v.getContext(), "Hello", Toast.LENGTH_SHORT).show();
38 | }
39 | });
40 | layout.addView(button, 0, params);
41 | return layout;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/jsc/exam/jsckit/ui/mvp/model/ITestModel.java:
--------------------------------------------------------------------------------
1 | package jsc.exam.jsckit.ui.mvp.model;
2 |
3 | import io.reactivex.Observable;
4 | import jsc.kit.component.baseui.basemvp.IBaseModel;
5 |
6 | /**
7 | *
Email:1006368252@qq.com
8 | *
QQ:1006368252
9 | *
https://github.com/JustinRoom/JSCKit
10 | *
11 | * @author jiangshicheng
12 | * @createTime 2018-06-06 2:29 PM Wednesday
13 | */
14 | public interface ITestModel extends IBaseModel {
15 |
16 | Observable
Email:1006368252@qq.com
12 | *
QQ:1006368252
13 | *
https://github.com/JustinRoom/JSCKit
14 | *
15 | * @author jiangshicheng
16 | * @createTime 2018-06-06 2:31 PM Wednesday
17 | */
18 | public class TestModel implements ITestModel {
19 |
20 | @Override
21 | public Observable
Email:1006368252@qq.com
9 | *
QQ:1006368252
10 | *
https://github.com/JustinRoom/JSCKit
11 | *
12 | * @author jiangshicheng
13 | * @createTime 2018-06-06 2:22 PM Wednesday
14 | */
15 | public interface CommonView extends IBaseView{
16 |
17 | /**
18 | * Show log of network requesting or not.
19 | * @return show if {@code true}, else not.
20 | */
21 | boolean isShowNetLog();
22 |
23 | /**
24 | * Get the base url of network requesting.
25 | * @return base url
26 | */
27 | String getBaseUrl();
28 |
29 | /**
30 | * Get network requesting token
31 | * @return token
32 | */
33 | String getToken();
34 |
35 | /**
36 | * Get the current user id
37 | * @return the current user id
38 | */
39 | String getCurrentUserId();
40 |
41 | /**
42 | * Create loading dialog.
43 | * @return loading dialog instance
44 | */
45 | Dialog getLoadingDialog();
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/jsc/exam/jsckit/ui/mvp/view/ITestView.java:
--------------------------------------------------------------------------------
1 | package jsc.exam.jsckit.ui.mvp.view;
2 |
3 | import jsc.kit.component.baseui.basemvp.IBaseView;
4 |
5 | /**
6 | *
Email:1006368252@qq.com
7 | *
QQ:1006368252
8 | *
https://github.com/JustinRoom/JSCKit
9 | *
10 | * @author jiangshicheng
11 | * @createTime 2018-06-06 2:22 PM Wednesday
12 | */
13 | public interface ITestView extends IBaseView{
14 |
15 | void onLoadVersionInfo(String result);
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/jsc/exam/jsckit/ui/zxing/ZXingScannerActivity.java:
--------------------------------------------------------------------------------
1 | package jsc.exam.jsckit.ui.zxing;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.View;
6 |
7 | import jsc.exam.jsckit.R;
8 | import jsc.exam.jsckit.ui.BaseActivity;
9 | import jsc.kit.zxing.zxing.ui.ZXingFragment;
10 |
11 | public class ZXingScannerActivity extends BaseActivity {
12 |
13 | @Override
14 | protected void onCreate(@Nullable Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_z_xing_scanner);
17 | setTitleBarTitle(getClass().getSimpleName().replace("Activity", ""));
18 |
19 | getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new ZXingFragment()).commit();
20 | }
21 |
22 | public void widgetClick(View v) {
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ripple_round_corner_white_r4.xml:
--------------------------------------------------------------------------------
1 |
2 |