Skip to content

Commit

Permalink
Upgrade base
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongnv219 committed Aug 6, 2018
1 parent 6711c8b commit e3dee20
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 268 deletions.
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
Expand All @@ -8,8 +6,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Expand Down
23 changes: 7 additions & 16 deletions mvvm-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,35 @@ android {
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}

dependencies {
api 'com.android.support:support-v4:27.1.1'
api 'com.android.support:design:27.1.1'
api 'com.android.support:appcompat-v7:27.1.1'
// api 'com.github.bumptech.glide:glide:4.7.1'
// api 'com.google.code.gson:gson:2.8.2'
// api 'com.karumi:dexter:4.2.0'
api 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

// network
// api "com.amitshekhar.android:rx2-android-networking:1.0.1"

// database
// api "android.arch.persistence.room:rxjava2:1.1.1"
// annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
//font
api "uk.co.chrisjenx:calligraphy:2.3.0"

// dependency injection
api "com.google.dagger:dagger:2.14.1"
annotationProcessor "com.google.dagger:dagger-compiler:2.14.1"
annotationProcessor "com.google.dagger:dagger-android-processor:2.14.1"
api "com.google.dagger:dagger-android-support:2.14.1"

// reactive
api "io.reactivex.rxjava2:rxjava:2.1.15"
api "io.reactivex.rxjava2:rxandroid:2.0.2"

//View model
api "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
api 'com.intuit.sdp:sdp-android:1.0.5'
api 'com.intuit.ssp:ssp-android:1.0.5'
api 'com.muddzdev:styleabletoast:2.1.2'

//Event bus
// api 'org.greenrobot:eventbus:3.1.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int
} else {
bindItemViewHolder(holder, position);
if (onClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onClickListener.onClick(mListItem.get(holder.getAdapterPosition()));
}
});
holder.itemView.setOnClickListener(v -> onClickListener.onClick(mListItem.get(holder.getAdapterPosition())));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.base.ui.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;

import com.base.R;

public class MaxHeightScrollView extends NestedScrollView {

private int maxHeight;

public MaxHeightScrollView(Context context) {
super(context);
}

public MaxHeightScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}

public MaxHeightScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}

private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.MaxHeightScrollView);
maxHeight = styledAttrs.getDimensionPixelSize(R.styleable.MaxHeightScrollView_maxHeight, 200); //200 is a defualt value
styledAttrs.recycle();
}
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.base.ui.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;

public class RoundRectCornerImageView extends android.support.v7.widget.AppCompatImageView {

private float radius = 5.0f;
private Path path;
private RectF rect;

public RoundRectCornerImageView(Context context) {
super(context);
init();
}

public RoundRectCornerImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}

public RoundRectCornerImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}

private void init() {
path = new Path();

}

@Override
protected void onDraw(Canvas canvas) {
rect = new RectF(0, 0, this.getWidth(), this.getHeight());
path.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(path);
super.onDraw(canvas);
}
}
26 changes: 26 additions & 0 deletions mvvm-base/src/main/java/com/base/ui/widget/SquareImageView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.base.ui.widget;

import android.content.Context;
import android.util.AttributeSet;

/**
* Created by Ka on 04/07/2016.
*/
public class SquareImageView extends android.support.v7.widget.AppCompatImageView {

public SquareImageView(Context context) {
super(context);
}

public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
}
}
36 changes: 0 additions & 36 deletions mvvm-base/src/main/java/com/base/utils/ImageLoaderUtils.java

This file was deleted.

Loading

0 comments on commit e3dee20

Please sign in to comment.