Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.DS_Store
/build
/captures
.idea/
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/encodings.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

62 changes: 0 additions & 62 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
// retrolambda
apply plugin: 'me.tatarka.retrolambda'

android {
compileSdkVersion 23
Expand All @@ -17,32 +19,30 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.+'

compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'

compile 'com.jude:easyrecyclerview:4.0.2'

/*compile 'com.github.bumptech.glide:glide:3.7.0'*/
compile 'jp.wasabeef:glide-transformations:2.0.1'

compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'

compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'

compile project(':mylibrary')
}
1 change: 1 addition & 0 deletions app/src/main/java/coder/prettygirls/BaseView.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@

public interface BaseView<T> {

void setPresenter(T presenter);

}
7 changes: 1 addition & 6 deletions app/src/main/java/coder/prettygirls/about/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ private void initView() {
mAboutToolbar.setTitle("关于我");
setSupportActionBar(mAboutToolbar);
mAboutToolbar.setNavigationIcon(R.drawable.ic_back);
mAboutToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishActivity();
}
});
mAboutToolbar.setNavigationOnClickListener(v -> finishActivity());

//毛玻璃效果
Glide.with(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
/**
* Created by oracleen on 2016/6/29.
*/
public class GirlsResponsitory implements GirlsDataSource {
public class GirlsRepository implements GirlsDataSource {

private LocalGirlsDataSource mLocalGirlsDataSource;
private RemoteGirlsDataSource mRemoteGirlsDataSource;

public GirlsResponsitory() {
public GirlsRepository() {
mLocalGirlsDataSource = new LocalGirlsDataSource();
mRemoteGirlsDataSource = new RemoteGirlsDataSource();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package coder.prettygirls.data.source.remote;

import coder.prettygirls.data.bean.GirlsBean;
import coder.prettygirls.data.source.GirlsDataSource;
import coder.prettygirls.http.GirlsRetrofit;
import coder.prettygirls.http.RetrofitUtil;
import coder.prettygirls.http.GirlsService;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

Expand All @@ -15,27 +13,15 @@ public class RemoteGirlsDataSource implements GirlsDataSource {

@Override
public void getGirls(int page, int size, final LoadGirlsCallback callback) {
GirlsRetrofit.getRetrofit()
RetrofitUtil.getInstance()
.create(GirlsService.class)
.getGirls("福利", size, page)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GirlsBean>() {
@Override
public void onCompleted() {

}

@Override
public void onError(Throwable e) {
callback.onDataNotAvailable();
}

@Override
public void onNext(GirlsBean girlsBean) {
callback.onGirlsLoaded(girlsBean);
}
});
.subscribe(
callback::onGirlsLoaded,
throwable -> callback.onDataNotAvailable()
);
}

@Override
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/java/coder/prettygirls/girl/GirlActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ private void initView() {
mToolbar.setTitle(R.string.meizhi);
setSupportActionBar(mToolbar);
mToolbar.setNavigationIcon(R.drawable.ic_back);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishActivity();
}
});
mToolbar.setNavigationOnClickListener(v -> finishActivity());
}

@Override
Expand Down
52 changes: 21 additions & 31 deletions app/src/main/java/coder/prettygirls/girl/GirlFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import coder.prettygirls.widget.PinchImageView;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;

/**
Expand Down Expand Up @@ -126,15 +125,12 @@ private void getColor() {
PinchImageView imageView = getCurrentImageView();
Bitmap bitmap = BitmapUtil.drawableToBitmap(imageView.getDrawable());
Palette.Builder builder = Palette.from(bitmap);
builder.generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
builder.generate(palette -> {
// Palette.Swatch vir = palette.getLightMutedSwatch();
Palette.Swatch vir = palette.getVibrantSwatch();
if (vir == null)
return;
mListener.change(vir.getRgb());
}
Palette.Swatch vir = palette.getVibrantSwatch();
if (vir == null)
return;
mListener.change(vir.getRgb());
});
}

Expand All @@ -146,14 +142,11 @@ public void saveGirl() {
Observable.just(BitmapUtil.saveBitmap(bitmap, Constants.dir, imgUrl.substring(imgUrl.lastIndexOf("/") + 1, imgUrl.length()), true))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Boolean>() {
@Override
public void call(Boolean isSuccess) {
if (isSuccess) {
Snackbar.make(mRootView, "大爷,下载好了呢~", Snackbar.LENGTH_LONG).show();
} else {
Snackbar.make(mRootView, "大爷,下载出错了哦~", Snackbar.LENGTH_LONG).show();
}
.subscribe(isSuccess -> {
if (isSuccess) {
Snackbar.make(mRootView, "大爷,下载好了呢~", Snackbar.LENGTH_LONG).show();
} else {
Snackbar.make(mRootView, "大爷,下载出错了哦~", Snackbar.LENGTH_LONG).show();
}
});

Expand All @@ -174,20 +167,17 @@ public void shareGirl() {
Observable.just(BitmapUtil.saveBitmap(bitmap, Constants.dir, "share.jpg", false))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Boolean>() {
@Override
public void call(Boolean isSuccess) {
if (isSuccess) {
//由文件得到uri
Uri imageUri = Uri.fromFile(new File(Constants.dir + "/share.jpg"));
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "分享MeiZhi到"));
} else {
Snackbar.make(mRootView, "大爷,分享出错了哦~", Snackbar.LENGTH_LONG).show();
}
.subscribe(isSuccess -> {
if (isSuccess) {
//由文件得到uri
Uri imageUri = Uri.fromFile(new File(Constants.dir + "/share.jpg"));
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "分享MeiZhi到"));
} else {
Snackbar.make(mRootView, "大爷,分享出错了哦~", Snackbar.LENGTH_LONG).show();
}
});

Expand Down
Loading