version:1.2
fix:修复首页不显示应用 add:
This commit is contained in:
@@ -154,6 +154,11 @@ dependencies {
|
|||||||
implementation "androidx.core:core-ktx:1.6.0"
|
implementation "androidx.core:core-ktx:1.6.0"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
|
||||||
|
//butterknife
|
||||||
|
implementation 'com.jakewharton:butterknife:10.2.1'
|
||||||
|
// If you are using Kotlin, replace annotationProcessor with kapt.
|
||||||
|
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
|
||||||
|
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
|
||||||
//github第三方控件
|
//github第三方控件
|
||||||
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
|
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
|
||||||
//下拉刷新控件
|
//下拉刷新控件
|
||||||
|
|||||||
@@ -36,14 +36,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
||||||
|
|
||||||
private List<AppInfo> mAppInfoList;
|
private List<AppInfo> mAppInfoList;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private DownloadTask mDownloadTask;
|
private DownloadTask mDownloadTask;
|
||||||
|
|
||||||
//order代表是否显示所在的位置,1.2.3.
|
|
||||||
|
|
||||||
|
|
||||||
public AppAdapter(List<AppInfo> appInfoList, Context context) {
|
public AppAdapter(List<AppInfo> appInfoList, Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mAppInfoList = appInfoList;
|
this.mAppInfoList = appInfoList;
|
||||||
@@ -208,6 +204,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
|||||||
break;
|
break;
|
||||||
case IEntity.STATE_CANCEL:
|
case IEntity.STATE_CANCEL:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +234,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
|||||||
break;
|
break;
|
||||||
case IEntity.STATE_CANCEL:
|
case IEntity.STATE_CANCEL:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,51 +244,6 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
|||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private class ListDownloadListener extends DownloadListener {
|
|
||||||
//
|
|
||||||
// private Holder holder;
|
|
||||||
//
|
|
||||||
// ListDownloadListener(Object tag, Holder holder) {
|
|
||||||
// super(tag);
|
|
||||||
// this.holder = holder;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onStart(Progress progress) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onProgress(Progress progress) {
|
|
||||||
// if (tag == holder.getTag()) {
|
|
||||||
// holder.refresh(progress);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onError(Progress progress) {
|
|
||||||
// Throwable throwable = progress.exception;
|
|
||||||
// if (throwable != null) throwable.printStackTrace();
|
|
||||||
// ToastUtil.show(((AppInfo) progress.extra1).getApp_name() + "\t下载失败,请重试");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFinish(final File file, Progress progress) {
|
|
||||||
// ToastUtil.show(((AppInfo) progress.extra1).getApp_name() + "\t下载完成");
|
|
||||||
// new Thread(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// ApkUtils.installApp(mContext, file.getAbsolutePath());
|
|
||||||
// }
|
|
||||||
// }).start();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onRemove(Progress progress) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void ItemChanged(DownloadTask task) {
|
private void ItemChanged(DownloadTask task) {
|
||||||
mDownloadTask = task;
|
mDownloadTask = task;
|
||||||
// notifyDataSetChanged();
|
// notifyDataSetChanged();
|
||||||
@@ -345,6 +298,4 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
|||||||
void onTaskFail(DownloadTask task, Exception e) {
|
void onTaskFail(DownloadTask task, Exception e) {
|
||||||
ItemChanged(task);
|
ItemChanged(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,12 @@ import android.content.res.Resources;
|
|||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
@@ -28,7 +25,6 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
|
|||||||
|
|
||||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.uiui.appstore.BuildConfig;
|
import com.uiui.appstore.BuildConfig;
|
||||||
import com.uiui.appstore.R;
|
import com.uiui.appstore.R;
|
||||||
@@ -48,8 +44,6 @@ import com.uiui.appstore.utils.Utils;
|
|||||||
import com.blankj.utilcode.util.ScreenUtils;
|
import com.blankj.utilcode.util.ScreenUtils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
||||||
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
|
||||||
import com.zhpan.bannerview.BannerViewPager;
|
import com.zhpan.bannerview.BannerViewPager;
|
||||||
import com.zhpan.bannerview.constants.IndicatorSlideMode;
|
import com.zhpan.bannerview.constants.IndicatorSlideMode;
|
||||||
import com.zhpan.bannerview.constants.PageStyle;
|
import com.zhpan.bannerview.constants.PageStyle;
|
||||||
@@ -59,6 +53,8 @@ import com.zhpan.bannerview.utils.BannerUtils;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.annotations.NonNull;
|
import io.reactivex.annotations.NonNull;
|
||||||
@@ -73,132 +69,47 @@ import io.reactivex.schedulers.Schedulers;
|
|||||||
|
|
||||||
public class FeaturedFragment extends LazyLoadFragment implements RefreshManager.RefreshInterface {
|
public class FeaturedFragment extends LazyLoadFragment implements RefreshManager.RefreshInterface {
|
||||||
private String TAG = FeaturedFragment.class.getSimpleName();
|
private String TAG = FeaturedFragment.class.getSimpleName();
|
||||||
|
@BindView(R.id.featured_rv_result)
|
||||||
|
RecyclerView mRvResult;
|
||||||
|
@BindView(R.id.cl)
|
||||||
|
ConstraintLayout cl;
|
||||||
|
@BindView(R.id.featured_refresh_layout)
|
||||||
|
SmartRefreshLayout mRefreshLayout;
|
||||||
|
@BindView(R.id.iv_banner)
|
||||||
|
ImageView iv_banner;
|
||||||
|
@BindView(R.id.banner_view)
|
||||||
|
BannerViewPager<String, BannerViewHolder> mViewPager;
|
||||||
|
|
||||||
private RecyclerView mRvResult;
|
|
||||||
private SmartRefreshLayout mRefreshLayout;
|
|
||||||
private BannerViewPager<String, BannerViewHolder> mViewPager;
|
|
||||||
private ImageView imageView, iv_banner;
|
|
||||||
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;
|
||||||
private ConstraintLayout cl;
|
|
||||||
|
|
||||||
private boolean isNotLoadBitmap;
|
private boolean isNotLoadBitmap;
|
||||||
|
|
||||||
private installReceiver myReceiver;
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public FeaturedFragment() {
|
public FeaturedFragment() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
mRefreshLayout.autoRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadBitMap(boolean isLoad) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutId() {
|
public int getLayoutId() {
|
||||||
return R.layout.fragment_featured;
|
return R.layout.fragment_featured;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (myReceiver != null) {
|
|
||||||
try {
|
|
||||||
getActivity().unregisterReceiver(myReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtils.e("onStop", e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initDatas() {
|
|
||||||
mContext = this.getActivity();
|
|
||||||
adapter = new AppAdapter(newAppInfoList, getActivity());
|
|
||||||
adapter.setHasStableIds(true);
|
|
||||||
int orientation = 0;
|
|
||||||
orientation = mContext.getResources().getConfiguration().orientation;
|
|
||||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 3);
|
|
||||||
mRvResult.setLayoutManager(gridLayoutManager);
|
|
||||||
} else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2);
|
|
||||||
mRvResult.setLayoutManager(gridLayoutManager);
|
|
||||||
} else {
|
|
||||||
mRvResult.setLayoutManager(new LinearLayoutManager(getActivity()));
|
|
||||||
}
|
|
||||||
mRvResult.setAdapter(adapter);
|
|
||||||
mRefreshLayout.setEnableLoadMore(false);
|
|
||||||
mRefreshLayout.setEnableRefresh(true);
|
|
||||||
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
|
||||||
@Override
|
|
||||||
public void onRefresh(RefreshLayout refreshlayout) {
|
|
||||||
// initData();
|
|
||||||
initAPPData(handler);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mRefreshLayout.autoRefresh();
|
|
||||||
|
|
||||||
adapter.setData(newAppInfoList);
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged(@androidx.annotation.NonNull Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 3);
|
|
||||||
mRvResult.setLayoutManager(gridLayoutManager);
|
|
||||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2);
|
|
||||||
mRvResult.setLayoutManager(gridLayoutManager);
|
|
||||||
} else {
|
|
||||||
mRvResult.setLayoutManager(new LinearLayoutManager(getActivity()));
|
|
||||||
}
|
|
||||||
initAPPData(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
if (myReceiver == null) {
|
|
||||||
myReceiver = new installReceiver();
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
|
||||||
filter.addDataScheme("package");
|
|
||||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
|
||||||
getActivity().registerReceiver(myReceiver, filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initViews(View view) {
|
public void initViews(View view) {
|
||||||
mRvResult = view.findViewById(R.id.featured_rv_result);
|
ButterKnife.bind(this, view);
|
||||||
((SimpleItemAnimator) mRvResult.getItemAnimator()).setSupportsChangeAnimations(false);
|
((SimpleItemAnimator) mRvResult.getItemAnimator()).setSupportsChangeAnimations(false);
|
||||||
// mRvResult.setItemAnimator(null);
|
|
||||||
imageView = view.findViewById(R.id.imageView);
|
|
||||||
iv_banner = view.findViewById(R.id.iv_banner);
|
|
||||||
cl = view.findViewById(R.id.ll);
|
|
||||||
setImageViewSize();
|
setImageViewSize();
|
||||||
mRefreshLayout = view.findViewById(R.id.featured_refresh_layout);
|
|
||||||
RefreshManager.getInstance().register(this);
|
RefreshManager.getInstance().register(this);
|
||||||
mViewPager = view.findViewById(R.id.banner_view);
|
mViewPager.setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
|
||||||
mViewPager
|
|
||||||
.setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
|
|
||||||
.setHolderCreator(new HolderCreator<BannerViewHolder>() {
|
.setHolderCreator(new HolderCreator<BannerViewHolder>() {
|
||||||
@Override
|
@Override
|
||||||
public BannerViewHolder createViewHolder() {
|
public BannerViewHolder createViewHolder() {
|
||||||
@@ -216,18 +127,104 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
|||||||
isNotLoadBitmap = false;
|
isNotLoadBitmap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initDatas() {
|
||||||
|
adapter = new AppAdapter(newAppInfoList, getActivity());
|
||||||
|
adapter.setHasStableIds(true);
|
||||||
|
int orientation = 0;
|
||||||
|
orientation = getActivity().getResources().getConfiguration().orientation;
|
||||||
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 3);
|
||||||
|
mRvResult.setLayoutManager(gridLayoutManager);
|
||||||
|
} else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2);
|
||||||
|
mRvResult.setLayoutManager(gridLayoutManager);
|
||||||
|
} else {
|
||||||
|
mRvResult.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
}
|
||||||
|
mRvResult.setAdapter(adapter);
|
||||||
|
mRefreshLayout.setEnableLoadMore(false);
|
||||||
|
mRefreshLayout.setEnableRefresh(true);
|
||||||
|
mRefreshLayout.setOnRefreshListener(refreshlayout -> {
|
||||||
|
initAPPData();
|
||||||
|
});
|
||||||
|
adapter.setData(newAppInfoList);
|
||||||
|
mRefreshLayout.autoRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadData(Bundle savedInstanceState) {
|
public void loadData(Bundle savedInstanceState) {
|
||||||
// initData();
|
|
||||||
// initAPPData(handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void initAPPData(final Handler handler) {
|
@Override
|
||||||
// OKGO.getAllAppInfo(handler);
|
public void onConfigurationChanged(@androidx.annotation.NonNull Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 3);
|
||||||
|
mRvResult.setLayoutManager(gridLayoutManager);
|
||||||
|
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2);
|
||||||
|
mRvResult.setLayoutManager(gridLayoutManager);
|
||||||
|
} else {
|
||||||
|
mRvResult.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
}
|
||||||
|
initAPPData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
registerReceiver();
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (myReceiver != null) {
|
||||||
|
try {
|
||||||
|
getActivity().unregisterReceiver(myReceiver);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("onDestroy", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerReceiver() {
|
||||||
|
if (myReceiver == null) {
|
||||||
|
myReceiver = new installReceiver();
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
|
filter.addDataScheme("package");
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
getActivity().registerReceiver(myReceiver, filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private installReceiver myReceiver;
|
||||||
|
|
||||||
|
public class installReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
//接收安装广播
|
||||||
|
if (action.equals(Intent.ACTION_PACKAGE_ADDED)
|
||||||
|
|| action.equals(Intent.ACTION_PACKAGE_REPLACED)
|
||||||
|
|| action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
|
||||||
|
// adapter.setData(checkUpdateOrInstalled(newAppInfoList));
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
Log.e("installReceiver", action);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private void initAPPData() {
|
||||||
getAllAppInfo();
|
getAllAppInfo();
|
||||||
// OKGO.getBannerImg(handler);
|
|
||||||
// getBannerImg();
|
|
||||||
getBanner();
|
getBanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,16 +357,6 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
|||||||
Log.e(TAG, "setImageViewSize: imageViewheight :" + iv_banner.getHeight());
|
Log.e(TAG, "setImageViewSize: imageViewheight :" + iv_banner.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRefresh() {
|
|
||||||
mRefreshLayout.autoRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadBitMap(boolean isLoad) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void getAllAppInfo() {
|
private void getAllAppInfo() {
|
||||||
NetInterfaceManager.getInstance().getQueryAllAppControl().getAllApp(Utils.getSerial())
|
NetInterfaceManager.getInstance().getQueryAllAppControl().getAllApp(Utils.getSerial())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@@ -387,13 +374,13 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
List<AppInfo> infos = listBaseResponse.data;
|
List<AppInfo> infos = listBaseResponse.data;
|
||||||
newAppInfoList = infos;
|
newAppInfoList = infos;
|
||||||
mRvResult.setVisibility(View.VISIBLE);
|
// mRvResult.setVisibility(View.VISIBLE);
|
||||||
imageView.setVisibility(View.GONE);
|
// imageView.setVisibility(View.GONE);
|
||||||
adapter.setData(newAppInfoList);
|
adapter.setData(newAppInfoList);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
} else {
|
} else {
|
||||||
mRvResult.setVisibility(View.GONE);
|
// mRvResult.setVisibility(View.GONE);
|
||||||
imageView.setVisibility(View.VISIBLE);
|
// imageView.setVisibility(View.VISIBLE);
|
||||||
if (!BuildConfig.DEBUG) {
|
if (!BuildConfig.DEBUG) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
// intent.putExtra("text", getResources().getString(R.string.no_app));
|
// intent.putExtra("text", getResources().getString(R.string.no_app));
|
||||||
@@ -488,72 +475,4 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler handler = new Handler() {
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
super.handleMessage(msg);
|
|
||||||
switch (msg.what) {
|
|
||||||
// case 0:
|
|
||||||
// mRvResult.setVisibility(View.GONE);
|
|
||||||
// imageView.setVisibility(View.VISIBLE);
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// mRvResult.setVisibility(View.VISIBLE);
|
|
||||||
// imageView.setVisibility(View.GONE);
|
|
||||||
// newAppInfoList = (List<AppInfo>) msg.obj;
|
|
||||||
// adapter.setData(checkUpdateOrInstalled(newAppInfoList));
|
|
||||||
// adapter.notifyDataSetChanged();
|
|
||||||
// break;
|
|
||||||
case 200:
|
|
||||||
List<String> list = (List<String>) msg.obj;
|
|
||||||
mViewPager
|
|
||||||
.setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_5))
|
|
||||||
.setRevealWidth(BannerUtils.dp2px(0))
|
|
||||||
.setPageStyle(PageStyle.MULTI_PAGE)
|
|
||||||
.setHolderCreator(new HolderCreator<BannerViewHolder>() {
|
|
||||||
@Override
|
|
||||||
public BannerViewHolder createViewHolder() {
|
|
||||||
return new BannerViewHolder();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setIndicatorColor(getResources().getColor(R.color.white), getResources().getColor(R.color.colorAccent))
|
|
||||||
.setOnPageClickListener(new BannerViewPager.OnPageClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onPageClick(int position) {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setInterval(5000)
|
|
||||||
.create(list);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mRefreshLayout.finishRefresh();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// public List<AppInfo> checkUpdateOrInstalled(List<AppInfo> list) {
|
|
||||||
// for (AppInfo appInfo : list) {
|
|
||||||
// appInfo.setInstall(ApkUtils.isAvailable(mContext, appInfo.getApp_package()));
|
|
||||||
// appInfo.setUpdate(ApkUtils.checkIsUpdate(mContext, appInfo.getApp_package(), Integer.parseInt(appInfo.getApp_version_code())));
|
|
||||||
// }
|
|
||||||
// return list;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public class installReceiver extends BroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
//接收安装广播
|
|
||||||
if (action.equals(Intent.ACTION_PACKAGE_ADDED)
|
|
||||||
|| action.equals(Intent.ACTION_PACKAGE_REPLACED)
|
|
||||||
|| action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
|
|
||||||
// adapter.setData(checkUpdateOrInstalled(newAppInfoList));
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
Log.e("installReceiver", action);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +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"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/ll"
|
android:id="@+id/cl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/constraintLayout"
|
android:id="@+id/constraintLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
||||||
|
|
||||||
@@ -56,20 +55,19 @@
|
|||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:overScrollMode="never" />
|
android:overScrollMode="never" />
|
||||||
|
|
||||||
<ImageView
|
<!-- <ImageView-->
|
||||||
android:id="@+id/imageView"
|
<!-- android:id="@+id/imageView"-->
|
||||||
android:layout_width="300dp"
|
<!-- android:layout_width="300dp"-->
|
||||||
android:layout_height="300dp"
|
<!-- android:layout_height="300dp"-->
|
||||||
android:layout_centerInParent="true"
|
<!-- android:layout_centerInParent="true"-->
|
||||||
android:adjustViewBounds="true"
|
<!-- android:adjustViewBounds="true"-->
|
||||||
android:scaleType="centerInside"
|
<!-- android:scaleType="centerInside"-->
|
||||||
android:src="@drawable/icon_nodata"
|
<!-- android:src="@drawable/icon_nodata"-->
|
||||||
android:visibility="gone"
|
<!-- android:visibility="gone"-->
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -1,7 +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"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/ll"
|
android:id="@+id/cl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@@ -45,39 +44,34 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/constraintLayout"
|
android:id="@+id/constraintLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="sdasdasd"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/featured_rv_result" />
|
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/featured_rv_result"
|
android:id="@+id/featured_rv_result"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:overScrollMode="never" />
|
android:overScrollMode="never"
|
||||||
|
|
||||||
<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_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="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" />-->
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
Reference in New Issue
Block a user