update:2020.10.19

fix:兼容Android10,获取sn失败
add:
This commit is contained in:
2020-10-19 18:42:52 +08:00
parent 9e1f50f381
commit 08d8c0bef4
24 changed files with 351 additions and 103 deletions

File diff suppressed because one or more lines are too long

View File

@@ -17,8 +17,8 @@ android {
applicationId "com.appstore.uiui" applicationId "com.appstore.uiui"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 29
versionCode 20 versionCode 22
versionName "1.2.0" versionName "1.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//极光 //极光
ndk { ndk {

View File

@@ -3,6 +3,7 @@ package com.appstore.uiui.activity;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -33,6 +34,7 @@ public class KindDetailActivity extends BaseActivity implements RefreshManager.R
private RecyclerView detail_rv; private RecyclerView detail_rv;
private AppAdapter adapter; private AppAdapter adapter;
private List<AppInfo> AppInfoList = new ArrayList<>(); private List<AppInfo> AppInfoList = new ArrayList<>();
private ImageView mImageView;
@Override @Override
@@ -45,7 +47,7 @@ public class KindDetailActivity extends BaseActivity implements RefreshManager.R
title = findViewById(R.id.detail_tv_title); title = findViewById(R.id.detail_tv_title);
detail_rv = findViewById(R.id.detail_rv); detail_rv = findViewById(R.id.detail_rv);
mRefreshLayout = findViewById(R.id.detail_refresh_layout); mRefreshLayout = findViewById(R.id.detail_refresh_layout);
mImageView = findViewById(R.id.imageView);
} }
@Override @Override
@@ -91,12 +93,19 @@ public class KindDetailActivity extends BaseActivity implements RefreshManager.R
AppInfoList = (List<AppInfo>) msg.obj; AppInfoList = (List<AppInfo>) msg.obj;
adapter.setData(checkUpdateOrInstalled(AppInfoList)); adapter.setData(checkUpdateOrInstalled(AppInfoList));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
mImageView.setVisibility(View.GONE);
detail_rv.setVisibility(View.VISIBLE);
break;
case 0:
mImageView.setVisibility(View.VISIBLE);
detail_rv.setVisibility(View.GONE);
break; break;
} }
mRefreshLayout.finishRefresh(); mRefreshLayout.finishRefresh();
} }
}; };
public List<AppInfo> checkUpdateOrInstalled(List<AppInfo> list) { public List<AppInfo> checkUpdateOrInstalled(List<AppInfo> list) {
for (AppInfo appInfo : list) { for (AppInfo appInfo : list) {
appInfo.setInstall(ApkUtils.isAvailable(getApplicationContext(), appInfo.getApp_package())); appInfo.setInstall(ApkUtils.isAvailable(getApplicationContext(), appInfo.getApp_package()));
@@ -104,6 +113,7 @@ public class KindDetailActivity extends BaseActivity implements RefreshManager.R
} }
return list; return list;
} }
@Override @Override
public void onRefresh() { public void onRefresh() {
mRefreshLayout.autoRefresh(); mRefreshLayout.autoRefresh();

View File

@@ -131,7 +131,7 @@ public class MainActivity extends BaseActivity {
private void initTabLayout() { private void initTabLayout() {
final List<Fragment> fragmentList = new ArrayList<>(); final List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(new FeaturedFragment(this)); fragmentList.add(new FeaturedFragment(this));
fragmentList.add(new RankFragment()); // fragmentList.add(new RankFragment());
fragmentList.add(new KindFragment()); fragmentList.add(new KindFragment());
fragmentList.add(new ManageFragment()); fragmentList.add(new ManageFragment());
mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@@ -142,11 +142,11 @@ public class MainActivity extends BaseActivity {
@Override @Override
public int getCount() { public int getCount() {
return 4; return fragmentList.size();
} }
}); });
mViewPager.setOffscreenPageLimit(3); mViewPager.setOffscreenPageLimit(3);
String titles[] = new String[]{"推荐", "排行", "分类", "管理"}; String titles[] = new String[]{"专属应用", "我的分类", "下载管理"};
mSlidingTabLayout.setViewPager(mViewPager, titles); mSlidingTabLayout.setViewPager(mViewPager, titles);
} }
@@ -234,6 +234,7 @@ public class MainActivity extends BaseActivity {
case 7: case 7:
// alias = getInPutAlias(); // alias = getInPutAlias();
alias = Utils.getSerial(); alias = Utils.getSerial();
Log.e("jiguang", "sn:" + alias);
if (TextUtils.isEmpty(alias)) { if (TextUtils.isEmpty(alias)) {
return; return;
} }

View File

@@ -119,8 +119,8 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
} }
} else { } else {
holder.btnDownLoad.setText("安装"); holder.btnDownLoad.setText("安装");
holder.btnDownLoad.setTextColor(mContext.getColor(R.color.install)); holder.btnDownLoad.setTextColor(mContext.getColor(R.color.white));
holder.btnDownLoad.setBackground(mContext.getDrawable(R.drawable.btn_style_none)); holder.btnDownLoad.setBackground(mContext.getDrawable(R.drawable.btn_style_open));
if (downloadTask != null) { if (downloadTask != null) {
holder.refresh(downloadTask.progress); holder.refresh(downloadTask.progress);
} }

View File

@@ -7,6 +7,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@@ -41,6 +43,11 @@ public class KindAdapter extends RecyclerView.Adapter<KindAdapter.KindViewHolder
@Override @Override
public void onBindViewHolder(KindViewHolder holder, int position) { public void onBindViewHolder(KindViewHolder holder, int position) {
final Kind kind = mKindList.get(position); final Kind kind = mKindList.get(position);
if (kind.getHide() == 1) {
setVisibility( false,holder.root);
}else {
setVisibility( true,holder.root);
}
holder.tvName.setText(kind.getName()); holder.tvName.setText(kind.getName());
Glide.with(mContext).load(kind.getIcon()) Glide.with(mContext).load(kind.getIcon())
// .transform(new GlideCircleWithBorder(mContext)) // .transform(new GlideCircleWithBorder(mContext))
@@ -58,6 +65,20 @@ public class KindAdapter extends RecyclerView.Adapter<KindAdapter.KindViewHolder
}); });
} }
// 防止隐藏item出现空白
public void setVisibility(boolean isVisible, View itemView) {
RecyclerView.LayoutParams param = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
if (isVisible) {
param.height = LinearLayout.LayoutParams.WRAP_CONTENT;
param.width = LinearLayout.LayoutParams.MATCH_PARENT;
itemView.setVisibility(View.VISIBLE);
} else {
param.height = 0;
param.width = 0;
itemView.setVisibility(View.GONE);
}
itemView.setLayoutParams(param);
}
@Override @Override
public int getItemCount() { public int getItemCount() {
@@ -67,12 +88,14 @@ public class KindAdapter extends RecyclerView.Adapter<KindAdapter.KindViewHolder
public static class KindViewHolder extends RecyclerView.ViewHolder { public static class KindViewHolder extends RecyclerView.ViewHolder {
ImageView ivIcon, ivDetail; ImageView ivIcon, ivDetail;
TextView tvName; TextView tvName;
LinearLayout root;
public KindViewHolder(View itemView) { public KindViewHolder(View itemView) {
super(itemView); super(itemView);
ivIcon = itemView.findViewById(R.id.kind_iv_icon); ivIcon = itemView.findViewById(R.id.kind_iv_icon);
ivDetail = itemView.findViewById(R.id.kind_iv_detail); ivDetail = itemView.findViewById(R.id.kind_iv_detail);
tvName = itemView.findViewById(R.id.kind_tv_name); tvName = itemView.findViewById(R.id.kind_tv_name);
root = itemView.findViewById(R.id.root);
} }
} }

View File

@@ -0,0 +1,9 @@
package com.appstore.uiui.bean;
import java.io.Serializable;
public class BaseResponse implements Serializable {
public int code;
public String data;
public String msg;
}

View File

@@ -8,11 +8,13 @@ public class Kind {
String name;//每个种类的名字 String name;//每个种类的名字
int category;//种类的代号 int category;//种类的代号
int icon;//图片的id int icon;//图片的id
int hide;//隐藏显示 1是0否
public Kind(String name, int category, int icon) { public Kind(String name, int category, int icon, int hide) {
this.name = name; this.name = name;
this.category = category; this.category = category;
this.icon = icon; this.icon = icon;
this.hide = hide;
} }
public int getIcon() { public int getIcon() {
@@ -38,4 +40,12 @@ public class Kind {
public void setCategory(int category) { public void setCategory(int category) {
this.category = category; this.category = category;
} }
public int getHide() {
return hide;
}
public void setHide(int hide) {
this.hide = hide;
}
} }

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@@ -45,7 +46,7 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
private RecyclerView mRvResult; private RecyclerView mRvResult;
private SmartRefreshLayout mRefreshLayout; private SmartRefreshLayout mRefreshLayout;
private BannerViewPager<String, BannerViewHolder> mViewPager; private BannerViewPager<String, BannerViewHolder> mViewPager;
private ImageView imageView;
private List<AppInfos> appInfoList;// private List<AppInfos> appInfoList;//
private List<AppInfo> newAppInfoList = new ArrayList<>(); private List<AppInfo> newAppInfoList = new ArrayList<>();
private AppAdapter adapter; private AppAdapter adapter;
@@ -103,6 +104,7 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
@Override @Override
public void initViews(View view) { public void initViews(View view) {
mRvResult = view.findViewById(R.id.featured_rv_result); mRvResult = view.findViewById(R.id.featured_rv_result);
imageView = view.findViewById(R.id.imageView);
mRefreshLayout = view.findViewById(R.id.featured_refresh_layout); mRefreshLayout = view.findViewById(R.id.featured_refresh_layout);
RefreshManager.getInstance().register(this); RefreshManager.getInstance().register(this);
mViewPager = view.findViewById(R.id.banner_view); mViewPager = view.findViewById(R.id.banner_view);
@@ -169,7 +171,13 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
super.handleMessage(msg); super.handleMessage(msg);
switch (msg.what) { switch (msg.what) {
case 0:
mRvResult.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE);
break;
case 1: case 1:
mRvResult.setVisibility(View.VISIBLE);
imageView.setVisibility(View.GONE);
newAppInfoList = (List<AppInfo>) msg.obj; newAppInfoList = (List<AppInfo>) msg.obj;
adapter.setData(checkUpdateOrInstalled(newAppInfoList)); adapter.setData(checkUpdateOrInstalled(newAppInfoList));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@@ -198,7 +206,6 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
break; break;
} }
mRefreshLayout.finishRefresh(); mRefreshLayout.finishRefresh();
} }
}; };

View File

@@ -2,11 +2,14 @@ package com.appstore.uiui.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@@ -14,7 +17,13 @@ import androidx.recyclerview.widget.RecyclerView;
import com.appstore.uiui.R; import com.appstore.uiui.R;
import com.appstore.uiui.adapter.KindAdapter; import com.appstore.uiui.adapter.KindAdapter;
import com.appstore.uiui.base.BaseFragment; import com.appstore.uiui.base.BaseFragment;
import com.appstore.uiui.base.RefreshManager;
import com.appstore.uiui.bean.Kind; import com.appstore.uiui.bean.Kind;
import com.appstore.uiui.network.OKGO;
import com.lzy.okgo.OkGo;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -25,40 +34,100 @@ import java.util.List;
* 分类的页面 * 分类的页面
*/ */
public class KindFragment extends BaseFragment { public class KindFragment extends BaseFragment implements RefreshManager.RefreshInterface {
private RecyclerView mRvKind; private RecyclerView mRvKind;
private KindAdapter adapter; private KindAdapter adapter;
private List<Kind> kindList; private List<Kind> kindList;
private SmartRefreshLayout mRefreshLayout;
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_kind, container, false); View view = inflater.inflate(R.layout.fragment_kind, container, false);
mRvKind = view.findViewById(R.id.kind_rv_kind); mRvKind = view.findViewById(R.id.kind_rv_kind);
mRefreshLayout = view.findViewById(R.id.featured_refresh_layout);
mRefreshLayout.setEnableLoadMore(false);
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
initData();
}
});
initView(); initView();
initData();
return view; return view;
} }
private void initView() { private void initView() {
kindList = new ArrayList<>(); kindList = new ArrayList<>();
kindList.add(new Kind("语文", 1, R.drawable.icon_language1)); kindList.add(new Kind("语文", 1, R.drawable.icon_language1, 1));
kindList.add(new Kind("数学", 2, R.drawable.icon_math1)); kindList.add(new Kind("数学", 2, R.drawable.icon_math1, 1));
kindList.add(new Kind("英语", 3, R.drawable.icon_english1)); kindList.add(new Kind("英语", 3, R.drawable.icon_english1, 1));
kindList.add(new Kind("物理", 4, R.drawable.icon_physics1)); kindList.add(new Kind("物理", 4, R.drawable.icon_physics1, 1));
kindList.add(new Kind("化学", 5, R.drawable.icon_chemistry1)); kindList.add(new Kind("化学", 5, R.drawable.icon_chemistry1, 1));
kindList.add(new Kind("生物", 6, R.drawable.icon_biology1)); kindList.add(new Kind("生物", 6, R.drawable.icon_biology1, 1));
kindList.add(new Kind("政治", 7, R.drawable.icon_politics1)); kindList.add(new Kind("政治", 7, R.drawable.icon_politics1, 1));
kindList.add(new Kind("历史", 8, R.drawable.icon_history1)); kindList.add(new Kind("历史", 8, R.drawable.icon_history1, 1));
kindList.add(new Kind("地理", 9, R.drawable.icon_geography1)); kindList.add(new Kind("地理", 9, R.drawable.icon_geography1, 1));
kindList.add(new Kind("娱乐", 0, R.drawable.icon_game1)); kindList.add(new Kind("娱乐", 0, R.drawable.icon_game1, 0));
adapter = new KindAdapter(kindList, getContext()); adapter = new KindAdapter(kindList, getContext());
mRvKind.setAdapter(adapter); mRvKind.setAdapter(adapter);
mRvKind.setLayoutManager(new LinearLayoutManager(getActivity())); mRvKind.setLayoutManager(new LinearLayoutManager(getActivity()));
} }
private void initData() {
OKGO.getSubClassfy(mHandler);
}
private Handler mHandler = new Handler() {
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 200:
List<String> list = (List<String>) msg.obj;
showAdapter(list);
break;
case -200:
hideAdapter();
break;
}
mRefreshLayout.finishRefresh();
}
};
private void showAdapter(List<String> list) {
if (null != list && list.size() != 0) {
for (int i = 0; i < kindList.size() - 1; i++) {
if (list.contains(kindList.get(i).getName())) {
kindList.get(i).setHide(0);
} else {
kindList.get(i).setHide(1);
}
}
}
adapter.notifyDataSetChanged();
}
private void hideAdapter() {
for (int i = 0; i < kindList.size() - 1; i++) {
kindList.get(i).setHide(1);
}
adapter.notifyDataSetChanged();
}
@Override
public void onRefresh() {
mRefreshLayout.autoRefresh();
}
@Override
public void onLoadBitMap(boolean isLoad) {
}
} }

View File

@@ -77,6 +77,7 @@ public class ManageFragment extends LazyLoadFragment {
mRvLocal = view.findViewById(R.id.manage_rv_local); mRvLocal = view.findViewById(R.id.manage_rv_local);
updateAppInfoList = new ArrayList<>(); updateAppInfoList = new ArrayList<>();
adapter = new UpdateAppAdapter(updateAppInfoList, getContext()); adapter = new UpdateAppAdapter(updateAppInfoList, getContext());
mRvLocal.setAdapter(adapter); mRvLocal.setAdapter(adapter);
mRvLocal.setLayoutManager(new LinearLayoutManager(getActivity())); mRvLocal.setLayoutManager(new LinearLayoutManager(getActivity()));
@@ -159,6 +160,10 @@ public class ManageFragment extends LazyLoadFragment {
} else { } else {
ToastUtil.show("没有可以下载的在线应用"); ToastUtil.show("没有可以下载的在线应用");
} }
if (null == updateAppInfoList || updateAppInfoList.size() == 0) {
iv_nodata.setVisibility(View.VISIBLE);
mRvLocal.setVisibility(View.GONE);
}
} }
int updateNum = 0; int updateNum = 0;
@@ -168,6 +173,10 @@ public class ManageFragment extends LazyLoadFragment {
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
super.handleMessage(msg); super.handleMessage(msg);
switch (msg.what) { switch (msg.what) {
case 0:
iv_nodata.setVisibility(View.VISIBLE);
mRvLocal.setVisibility(View.GONE);
break;
case 1: case 1:
applist = (List<AppInfo>) msg.obj; applist = (List<AppInfo>) msg.obj;
updateDta(applist); updateDta(applist);

View File

@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import com.appstore.uiui.TextCode.MessageWhat; import com.appstore.uiui.TextCode.MessageWhat;
import com.appstore.uiui.base.UserInfo; import com.appstore.uiui.base.UserInfo;
import com.appstore.uiui.bean.AppInfo; import com.appstore.uiui.bean.AppInfo;
import com.appstore.uiui.bean.BaseResponse;
import com.appstore.uiui.bean.bannerImage; import com.appstore.uiui.bean.bannerImage;
import com.appstore.uiui.network.URLs.Url; import com.appstore.uiui.network.URLs.Url;
import com.appstore.uiui.utils.LogUtils; import com.appstore.uiui.utils.LogUtils;
@@ -23,6 +24,7 @@ import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response; import com.lzy.okgo.model.Response;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -49,41 +51,43 @@ public class OKGO {
}; };
synchronized public static void getAllAppInfo(final Handler handler) { synchronized public static void getAllAppInfo(final Handler handler) {
OkGo.<String>post(Url.GET_ALL_APPINFO).execute(new StringCallback() { OkGo.<String>post(Url.GET_ALL_APPINFO)
@Override .params("sn", Utils.getSerial())
public void onSuccess(Response<String> response) { .execute(new StringCallback() {
try { @Override
JSONObject body = JSON.parseObject(response.body()); public void onSuccess(Response<String> response) {
try {
JSONObject body = JSON.parseObject(response.body());
// LogUtils.e("onSuccess", body.toString()); // LogUtils.e("onSuccess", body.toString());
LogUtils.e("fht", "getAllAppInfo onSuccess"); LogUtils.e("fht", "getAllAppInfo onSuccess");
int code = body.getInteger("code"); int code = body.getInteger("code");
String msg = body.getString("msg"); String msg = body.getString("msg");
String data = body.getString("data"); String data = body.getString("data");
List<AppInfo> applist = JSON.parseArray(data, AppInfo.class); List<AppInfo> applist = JSON.parseArray(data, AppInfo.class);
if (code == MessageWhat.CODE_SUCCESSFUL) { if (code == MessageWhat.CODE_SUCCESSFUL) {
Message message = new Message(); Message message = new Message();
message.what = 1; message.what = 1;
message.obj = applist; message.obj = applist;
handler.sendMessage(message); handler.sendMessage(message);
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);
handler.sendEmptyMessage(0);
}
} catch (Exception e) {
LogUtils.e("Exception", e.getMessage());
ToastUtil.show("服务器错误,请稍后重试");
handler.sendEmptyMessage(0);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
LogUtils.e("getAllAppInfo", response.getException().toString());
ToastUtil.show("网络连接失败,检查网络连接");
handler.sendEmptyMessage(0); handler.sendEmptyMessage(0);
} }
} catch (Exception e) { });
LogUtils.e("Exception", e.getMessage());
ToastUtil.show("服务器错误,请稍后重试");
handler.sendEmptyMessage(0);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
LogUtils.e("getAllAppInfo", response.getException().toString());
ToastUtil.show("网络连接失败,检查网络连接");
handler.sendEmptyMessage(0);
}
});
} }
synchronized public static void getAllAppPackageName(final Handler handler) { synchronized public static void getAllAppPackageName(final Handler handler) {
@@ -164,6 +168,7 @@ public class OKGO {
synchronized public static void searchAppbyName(final Handler handler, String app_name) { synchronized public static void searchAppbyName(final Handler handler, String app_name) {
OkGo.<String>post(Url.GET_APPSEARCHE) OkGo.<String>post(Url.GET_APPSEARCHE)
.params("sn", Utils.getSerial())
.params("app_name", app_name) .params("app_name", app_name)
.execute(new StringCallback() { .execute(new StringCallback() {
@Override @Override
@@ -268,6 +273,7 @@ public class OKGO {
synchronized public static void getSortApp(final Handler handler, int type, int grade, int subject) { synchronized public static void getSortApp(final Handler handler, int type, int grade, int subject) {
OkGo.<String>post(Url.GET_SORT_APP) OkGo.<String>post(Url.GET_SORT_APP)
.params("sn", Utils.getSerial())
.params("app_type", type)//应用分类 0学习 1娱乐 .params("app_type", type)//应用分类 0学习 1娱乐
.params("grade", grade)//年级 以数字代表 .params("grade", grade)//年级 以数字代表
.params("subject", subject) //科目 以数字代表 .params("subject", subject) //科目 以数字代表
@@ -431,5 +437,37 @@ public class OKGO {
} }
public static void getSubClassfy(final Handler handler) {
OkGo.<String>post(Url.GET_SUBClASSFY)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
JSONObject jsonObject = JSONObject.parseObject(response.body());
int code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
if (code == 200) {
String data = jsonObject.getString("data");
if (!data.equals("")) {
List<String> list = Arrays.asList(data.split(","));
Message message = new Message();
message.what = 200;
message.obj = list;
handler.sendMessage(message);
}
} else {
ToastUtil.debugShow(msg);
handler.sendEmptyMessage(-200);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
}
});
}
} }

View File

@@ -1,26 +1,29 @@
package com.appstore.uiui.network.URLs; package com.appstore.uiui.network.URLs;
public class Url { public class Url {
public final static String NETWORK_HOME_ADDRESS = "http://homework.tuiinfo.com/api"; public final static String NETWORK_HOME_ADDRESS = "http://homework.tuiinfo.com/api/";
public final static String GET_ALL_APPINFO = NETWORK_HOME_ADDRESS + "/App/allInfo"; public final static String GET_ALL_APPINFO = NETWORK_HOME_ADDRESS + "App/allInfo";
//获取所有应用 //获取所有应用
public final static String GET_ALL_RANK = NETWORK_HOME_ADDRESS + "/App/rankings"; public final static String GET_ALL_RANK = NETWORK_HOME_ADDRESS + "App/rankings";
//获取所有应用排行 //获取所有应用排行
public final static String GET_APPSEARCHE = NETWORK_HOME_ADDRESS + "/App/appSearch"; public final static String GET_APPSEARCHE = NETWORK_HOME_ADDRESS + "App/appSearch";
//搜索应用 //搜索应用
public final static String GET_INFO_FROMESN = NETWORK_HOME_ADDRESS + "/Member/snInfo"; public final static String GET_INFO_FROMESN = NETWORK_HOME_ADDRESS + "Member/snInfo";
//通过SN获取绑定信息 //通过SN获取绑定信息
public final static String GET_SORT_APP = NETWORK_HOME_ADDRESS + "/App/sortApp"; public final static String GET_SORT_APP = NETWORK_HOME_ADDRESS + "App/sortApp";
//app分类查询 //app分类查询
public final static String SET_APP_INSTALL_INFO = NETWORK_HOME_ADDRESS + "/App/appInstall"; public final static String SET_APP_INSTALL_INFO = NETWORK_HOME_ADDRESS + "App/appInstall";
//发送app安装信息 //发送app安装信息
public final static String SET_APP_UNINSTALL_INFO = NETWORK_HOME_ADDRESS + "/App/appUnload"; public final static String SET_APP_UNINSTALL_INFO = NETWORK_HOME_ADDRESS + "App/appUnload";
//发送app卸载信息 //发送app卸载信息
public final static String GET_APP_UPDATE = NETWORK_HOME_ADDRESS + "/Update/update"; public final static String GET_APP_UPDATE = NETWORK_HOME_ADDRESS + "Update/update";
//根据包名获取更新 //根据包名获取更新
public final static String GET_BANNER_IMG = NETWORK_HOME_ADDRESS + "/Slideshow/getImg"; public final static String GET_BANNER_IMG = NETWORK_HOME_ADDRESS + "Slideshow/getImg";
//获取banner图 //获取banner图
public final static String GET_ALL_PACKAGENAME = NETWORK_HOME_ADDRESS + "/App/allPackage"; public final static String GET_ALL_PACKAGENAME = NETWORK_HOME_ADDRESS + "App/allPackage";
//获取所有应用包名 //获取所有应用包名
public final static String GET_SUBClASSFY = NETWORK_HOME_ADDRESS + "Application/getSubClassfy";
//获取应用分类
} }

View File

@@ -26,6 +26,7 @@ import android.os.Build;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
@@ -38,6 +39,7 @@ import java.io.FileReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.io.Reader; import java.io.Reader;
import java.lang.reflect.Method;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
@@ -673,11 +675,24 @@ public class Utils {
* *
* @return * @return
*/ */
@SuppressLint({"MissingPermission", "NewApi"})
public static String getSerial() { public static String getSerial() {
return Build.SERIAL; String serial = "unknow";
// return "QNS3AI000111"; try {
// return "QNW8WJ900002"; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
serial = Build.getSerial();
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
serial = Build.SERIAL;
} else {//8.0-
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial = (String) get.invoke(c, "ro.serialno");
}
} catch (Exception e) {
e.printStackTrace();
Log.e("e", "读取设备序列号异常:" + e.toString());
}
return serial;
} }
public static final long A_GB = 1073741824; public static final long A_GB = 1073741824;

View File

@@ -73,7 +73,7 @@
android:shape="rectangle" android:shape="rectangle"
android:useLevel="false"> android:useLevel="false">
<!--实心 --> <!--实心 -->
<solid android:color="@color/red" /> <solid android:color="@color/blue" />
<corners android:radius="25dp" /> <corners android:radius="25dp" />
<size android:width="32dp" <size android:width="32dp"
android:height="32dp"/> android:height="32dp"/>

View File

@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
@@ -15,8 +16,8 @@
android:id="@+id/search_iv_back" android:id="@+id/search_iv_back"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_marginStart="20dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:onClick="finish" android:onClick="finish"
android:scaleType="centerInside" android:scaleType="centerInside"
@@ -40,13 +41,14 @@
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@color/white" android:layout_weight="1"
android:layout_weight="1"> android:background="@color/white">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@@ -104,15 +106,22 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<HorizontalScrollView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/detail_rv_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@color/white" android:layout_gravity="center_horizontal"
android:overScrollMode="never"
android:scrollbars="none">
android:layout_marginTop="15dp" <androidx.recyclerview.widget.RecyclerView
android:layout_marginBottom="15dp" /> android:id="@+id/detail_rv_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@color/white"
android:overScrollMode="never" />
</HorizontalScrollView>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -43,11 +43,32 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/detail_rv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
tools:listitem="@layout/item_app" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/detail_rv"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/item_app" />
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@drawable/icon_nodata"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>

View File

@@ -104,6 +104,7 @@
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/main_view_pager" android:id="@+id/main_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:overScrollMode="never"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1" />

View File

@@ -40,21 +40,16 @@
</LinearLayout> </LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/featured_refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3"
tools:listitem="@layout/item_app" /> tools:listitem="@layout/item_app" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
@@ -32,7 +33,22 @@
android:id="@+id/featured_rv_result" android:id="@+id/featured_rv_result"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
android:layout_width="match_parent" android:layout_width="match_parent"
android:overScrollMode="never"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@drawable/icon_nodata"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -5,8 +5,15 @@
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/kind_rv_kind" android:id="@+id/featured_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/kind_rv_kind"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>

View File

@@ -158,6 +158,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/manage_rv_local" android:id="@+id/manage_rv_local"
android:overScrollMode="never"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/white" android:background="@color/white"
android:layout_height="match_parent" /> android:layout_height="match_parent" />

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:background="@drawable/ll_selector" android:background="@drawable/ll_selector"
@@ -10,6 +11,8 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="horizontal"> android:orientation="horizontal">

View File

@@ -12,4 +12,5 @@
<color name="download">#ffffff</color> <color name="download">#ffffff</color>
<color name="backgroundcolor">#ffffff</color> <color name="backgroundcolor">#ffffff</color>
<color name="red">#d64743</color> <color name="red">#d64743</color>
<color name="blue">#00a0e9</color>
</resources> </resources>