Skip to content

Commit

Permalink
头条配置优化
Browse files Browse the repository at this point in the history
  • Loading branch information
maning0303 committed Sep 30, 2020
1 parent 21cd4f9 commit c7cba68
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,16 @@ public void onFail(int code, String message) {

@Override
public void getRandomDatas() {
//查看配置的干活类型:默认Android
//查看配置的干活类型:默认Android, //Android,iOS,Flutter,frontend,backend,app
String headLineType = SharePreUtil.getStringData(context, Constants.SPSwitcherDataType, "Android");
GankApi2.getRandomDatas("GanHuo", headLineType, 10, new CommonHttpCallback<Gank2CategoryTypeListBean>() {
if ("前端".equals(headLineType)) {
headLineType = "frontend";
} else if ("后端".equals(headLineType)) {
headLineType = "backend";
} else if ("APP".equals(headLineType)) {
headLineType = "app";
}
GankApi2.getRandomDatas("Article", headLineType, 10, new CommonHttpCallback<Gank2CategoryTypeListBean>() {
@Override
public void onSuccess(Gank2CategoryTypeListBean result) {
randomLists = result.getData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void configurationHeadLine() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
//保存选择的类型
SharePreUtil.saveStringData(context, Constants.SPSwitcherDataType, String.valueOf(text));
String result = String.valueOf(text);
SharePreUtil.saveStringData(context, Constants.SPSwitcherDataType, result);
mView.updateHeadLine(String.valueOf(text));
}
});
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@
<string name="setting">设置</string>
<string name="cancel">取消</string>

<!--数据类型:福利 | Android | iOS | 休息视频 | 拓展资源 | 前端-->
<!--数据类型-->
<string-array name="gankHeadLineTypes">
<item>Android</item>
<item>iOS</item>
<item>休息视频</item>
<item>拓展资源</item>
<item>Flutter</item>
<item>前端</item>
<item>后端</item>
<item>APP</item>
</string-array>

<!--性别:男女 -->
Expand Down

0 comments on commit c7cba68

Please sign in to comment.