forked from racofix/architecture-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zjlong
committed
May 31, 2016
1 parent
2be4476
commit 99af799
Showing
65 changed files
with
1,346 additions
and
370 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/src/main/java/com/zhoujinlong/adapter/CustomViewPageAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.zhoujinlong.adapter; | ||
|
||
import android.content.Context; | ||
import android.support.v4.view.PagerAdapter; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
|
||
import com.zhoujinlong.R; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class CustomViewPageAdapter extends PagerAdapter { | ||
public List<Integer> comm_data_ls; | ||
private Context context; | ||
private View itemView; | ||
|
||
public CustomViewPageAdapter(Context context, List<Integer> comm_data_ls) { | ||
this.context = context; | ||
this.comm_data_ls = comm_data_ls; | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return comm_data_ls.size() > 0 ? comm_data_ls.size() == 1 ? 1 : Integer.MAX_VALUE : 0; | ||
} | ||
|
||
public Object instantiateItem(ViewGroup container, final int position) { | ||
itemView = View.inflate(context, R.layout.item_viewpage_content, null); | ||
ImageView imageView = ((ImageView) itemView.findViewById(R.id.image)); | ||
imageView.setBackgroundResource(comm_data_ls.get(position % comm_data_ls.size())); | ||
container.addView(itemView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); | ||
return itemView; | ||
} | ||
|
||
@Override | ||
public void destroyItem(ViewGroup container, int position, Object obj) { | ||
// container.removeView(itemView); | ||
} | ||
|
||
public boolean isViewFromObject(View arg0, Object arg1) { | ||
return arg0 == (arg1); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/zhoujinlong/adapter/HomeRecyclerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.zhoujinlong.adapter; | ||
|
||
import android.content.Context; | ||
import android.net.Uri; | ||
import android.support.design.widget.Snackbar; | ||
import android.view.View; | ||
import android.widget.ImageView; | ||
|
||
import com.android.core.adapter.RecyclerAdapter; | ||
import com.android.core.adapter.RecyclerViewHolder; | ||
import com.bumptech.glide.Glide; | ||
import com.zhoujinlong.R; | ||
import com.zhoujinlong.model.bean.Classify; | ||
import com.zhoujinlong.ui.activity.SwipBackActivity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class HomeRecyclerAdapter extends RecyclerAdapter<Classify.TngouEntity> { | ||
|
||
private String URL_Base = "http://tnfs.tngou.net/image"; | ||
|
||
public HomeRecyclerAdapter(Context context, int layoutId, List<Classify.TngouEntity> datas) { | ||
super(context, layoutId, datas); | ||
} | ||
|
||
@Override | ||
public void convert(final RecyclerViewHolder holder, final Classify.TngouEntity item) { | ||
Uri uri = Uri.parse(URL_Base + item.getImg()); | ||
Glide.with(mContext).load(uri).into((ImageView) holder.getView(R.id.sv_classitfy_img)); | ||
holder.setText(R.id.sv_classitfy_des, item.getTitle()); | ||
holder.setOnClickListener(R.id.sv_classitfy_img, new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Snackbar.make(holder.getView(R.id.sv_classitfy_img), item.getTitle(), Snackbar.LENGTH_LONG).show(); | ||
SwipBackActivity.start(mContext); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ | |
import java.util.List; | ||
|
||
/** | ||
* author meikoz on 2016/4/27. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class Classify { | ||
private boolean status; | ||
|
5 changes: 3 additions & 2 deletions
5
app/src/main/java/com/zhoujinlong/model/config/ApiConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.zhoujinlong.model.config; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public interface ApiConstant { | ||
|
||
|
5 changes: 3 additions & 2 deletions
5
app/src/main/java/com/zhoujinlong/model/config/LocalStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.zhoujinlong.model.config; | ||
|
||
/** | ||
* author meikoz on 2016/3/30. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class LocalStorage { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,12 @@ | |
import retrofit2.http.Query; | ||
|
||
/** | ||
* author miekoz on 2016/3/17. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public interface BaseHttpService { | ||
|
||
|
||
@Headers("Cache-Control: public, max-age=3600") | ||
@GET("tnfs/api/list") | ||
Call<Classify> getImageClassify(@Query("id") int id); | ||
|
||
|
5 changes: 3 additions & 2 deletions
5
app/src/main/java/com/zhoujinlong/model/http/BaseUserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.zhoujinlong.model.http; | ||
|
||
/** | ||
* author meikoz on 2016/4/26. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public interface BaseUserService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
|
||
|
||
/** | ||
* author miekoz on 2016/3/21. | ||
* email [email protected] | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:15 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class Factory { | ||
|
||
|
19 changes: 0 additions & 19 deletions
19
app/src/main/java/com/zhoujinlong/presenter/CompeteLogic.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,9 @@ | |
import com.android.core.model.annotation.Implement; | ||
import com.android.core.model.control.BaseLogic; | ||
import com.zhoujinlong.presenter.impl.LoginLogicImpl; | ||
import com.zhoujinlong.ui.view.LoginView; | ||
import com.zhoujinlong.presenter.view.LoginView; | ||
|
||
|
||
/** | ||
* author meikoz on 2016/4/13. | ||
* email [email protected] | ||
*/ | ||
|
||
@Implement(LoginLogicImpl.class) | ||
public interface LoginLogic extends BaseLogic<LoginView> { | ||
|
||
|
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/zhoujinlong/presenter/MainLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.zhoujinlong.presenter; | ||
|
||
import com.android.core.model.annotation.Implement; | ||
import com.zhoujinlong.presenter.impl.MainLogicImpl; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 12:03 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
@Implement(MainLogicImpl.class) | ||
public interface MainLogic { | ||
void onLoadRemoteData(boolean isMore, int page); | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/zhoujinlong/presenter/base/CommonView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.zhoujinlong.presenter.base; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 11:47 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public interface CommonView<T> { | ||
|
||
void onLoadComplete(); | ||
|
||
void onShowListData(T response, boolean isMore); | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/zhoujinlong/presenter/base/LoadSuccessLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.zhoujinlong.presenter.base; | ||
|
||
import com.android.core.model.control.BaseLogic; | ||
|
||
import retrofit2.Response; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 14:39 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public interface LoadSuccessLogic<T> extends BaseLogic<CommonView<T>> { | ||
|
||
void onLoadListSuccessHandle(Response<T> response, boolean isMore); | ||
|
||
void onLoadFail(String msg); | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/zhoujinlong/presenter/base/LoadSuccessLogicImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.zhoujinlong.presenter.base; | ||
|
||
import retrofit2.Response; | ||
|
||
/** | ||
* @author: 蜡笔小新 | ||
* @date: 2016-05-31 11:51 | ||
* @GitHub: https://github.com/meikoz | ||
*/ | ||
public class LoadSuccessLogicImpl<T> implements LoadSuccessLogic<T> { | ||
|
||
CommonView view; | ||
|
||
/** | ||
* 处理获取列表成功回调的公共函数 | ||
* | ||
* @param response | ||
* @param isMore | ||
*/ | ||
public void onLoadListSuccessHandle(Response<T> response, boolean isMore) { | ||
view.onLoadComplete(); | ||
T body = response.body(); | ||
if (body != null) { | ||
view.onShowListData(body, isMore); | ||
} | ||
// else { | ||
// if (isMore) { | ||
// //加载更多 Toast "没有更多数据" | ||
// } else { | ||
//// Toast "没有更多数据" | ||
// } | ||
// } | ||
} | ||
|
||
@Override | ||
public void onLoadFail(String msg) { | ||
//提示请求失败 | ||
} | ||
|
||
@Override | ||
public void attachView(CommonView<T> v) { | ||
view = v; | ||
} | ||
} |
61 changes: 0 additions & 61 deletions
61
app/src/main/java/com/zhoujinlong/presenter/impl/CompeteLogicImpl.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.