version:1.1.1
bugfixes:修复主页不用密码就可以进入的问题 update:
This commit is contained in:
@@ -18,8 +18,8 @@ android {
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 10
|
||||
versionName "1.0.9"
|
||||
versionCode 12
|
||||
versionName "1.1.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.hainaos.vc.activity.category.local;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
@@ -10,14 +11,19 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.hainaos.vc.R;
|
||||
import com.hainaos.vc.adapter.VideoAdapter;
|
||||
import com.hainaos.vc.base.mvvm.BaseMvvmActivity;
|
||||
import com.hainaos.vc.bean.BaseResponse;
|
||||
import com.hainaos.vc.bean.CategoryInfo;
|
||||
import com.hainaos.vc.bean.LocalVideoInfo;
|
||||
import com.hainaos.vc.bean.VideoListData;
|
||||
import com.hainaos.vc.databinding.ActivityCategoryLocalBinding;
|
||||
import com.hainaos.vc.fragment.passwd.PasswdDialogFragment;
|
||||
import com.hainaos.vc.utils.FileUtils;
|
||||
import com.hainaos.vc.utils.ScreenUtils;
|
||||
import com.hainaos.vc.utils.ToastUtil;
|
||||
import com.hainaos.vc.view.CustomDialog;
|
||||
import com.hainaos.vc.view.EquallyDividedItemDecoration;
|
||||
import com.hainaos.vc.view.RecycleGridLayoutManager;
|
||||
import com.hjq.toast.Toaster;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -25,10 +31,12 @@ import java.util.ArrayList;
|
||||
public class LocalCategoryActivity extends BaseMvvmActivity<LocalCategoryViewModel, ActivityCategoryLocalBinding> {
|
||||
private static final String TAG = "LocalCategoryActivity";
|
||||
|
||||
private String mTitle;
|
||||
private String mDirName;
|
||||
private CategoryInfo mCategoryInfo;
|
||||
private String mPasswd;
|
||||
|
||||
private VideoAdapter mVideoAdapter;
|
||||
private PasswdDialogFragment mPasswdDialogFragment;
|
||||
|
||||
|
||||
private static final int SPAN_COUNT = 3;
|
||||
|
||||
@@ -68,7 +76,7 @@ public class LocalCategoryActivity extends BaseMvvmActivity<LocalCategoryViewMod
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
mViewDataBinding.swipeRefreshLayout.setRefreshing(true);
|
||||
mViewModel.getViedoList(mDirName);
|
||||
mViewModel.getVideoList(mCategoryInfo.getFolder());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -76,9 +84,13 @@ public class LocalCategoryActivity extends BaseMvvmActivity<LocalCategoryViewMod
|
||||
@Override
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
mTitle = intent.getStringExtra("title");
|
||||
mDirName = intent.getStringExtra("dir");
|
||||
mViewDataBinding.setTitle(mTitle);
|
||||
mCategoryInfo = (CategoryInfo) intent.getSerializableExtra("CategoryInfo");
|
||||
mPasswd = intent.getStringExtra("passwd");
|
||||
if (mCategoryInfo == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mViewDataBinding.setTitle(mCategoryInfo.getCategory_name());
|
||||
|
||||
|
||||
mViewModel.mLocalVideoInfosData.observe(this, new Observer<ArrayList<LocalVideoInfo>>() {
|
||||
@@ -95,10 +107,34 @@ public class LocalCategoryActivity extends BaseMvvmActivity<LocalCategoryViewMod
|
||||
mViewDataBinding.swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
mViewModel.getViedoList(mDirName);
|
||||
mViewModel.mCategoryVideoInfoListData.observe(this, new Observer<BaseResponse<VideoListData>>() {
|
||||
@Override
|
||||
public void onChanged(BaseResponse<VideoListData> baseResponse) {
|
||||
if (baseResponse.code == 200) {
|
||||
mViewModel.getVideoList(mCategoryInfo.getFolder());
|
||||
} else {
|
||||
Toaster.show("密码错误,请重新输入");
|
||||
mPasswdDialogFragment = new PasswdDialogFragment(mCategoryInfo);
|
||||
mPasswdDialogFragment.setConfimCallback(new PasswdDialogFragment.ConfimCallback() {
|
||||
@Override
|
||||
public void onConfig(String passwd) {
|
||||
mPasswd = passwd;
|
||||
mViewModel.getVideoList(mCategoryInfo.getUuid(), passwd);
|
||||
}
|
||||
});
|
||||
mPasswdDialogFragment.show(getSupportFragmentManager(), "PasswdDialogFragment");
|
||||
}
|
||||
}
|
||||
});
|
||||
if (TextUtils.isEmpty(mPasswd)) {
|
||||
mViewModel.getVideoList(mCategoryInfo.getFolder());
|
||||
} else {
|
||||
mViewModel.getVideoList(mCategoryInfo.getUuid(), mPasswd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void showDialog(String path, int position) {
|
||||
CustomDialog dialog = new CustomDialog(LocalCategoryActivity.this);
|
||||
dialog.setTitle("删除文件")
|
||||
|
||||
@@ -5,10 +5,14 @@ import android.util.Log;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hainaos.vc.base.mvvm.BaseViewModel;
|
||||
import com.hainaos.vc.bean.BaseResponse;
|
||||
import com.hainaos.vc.bean.LocalVideoInfo;
|
||||
import com.hainaos.vc.bean.VideoListData;
|
||||
import com.hainaos.vc.databinding.ActivityCategoryLocalBinding;
|
||||
import com.hainaos.vc.network.NetInterfaceManager;
|
||||
import com.hainaos.vc.utils.FileUtils;
|
||||
import com.hainaos.vc.utils.VideoUtils;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
|
||||
import java.io.File;
|
||||
@@ -42,16 +46,46 @@ public class LocalCategoryViewModel extends BaseViewModel<ActivityCategoryLocalB
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<BaseResponse<VideoListData>> mCategoryVideoInfoListData = new MutableLiveData<>();
|
||||
|
||||
public void getVideoList(String uuid, String password) {
|
||||
NetInterfaceManager.getInstance().getVideoListObservable(uuid, password)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<VideoListData>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getVideoList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<VideoListData> listBaseResponse) {
|
||||
Log.e("getVideoList", "onNext: ");
|
||||
mCategoryVideoInfoListData.setValue(listBaseResponse);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getVideoList", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getVideoList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<ArrayList<LocalVideoInfo>> mLocalVideoInfosData = new MutableLiveData<>();
|
||||
|
||||
public void getViedoList(String dir) {
|
||||
public void getVideoList(String dir) {
|
||||
File file = new File(FileUtils.getHainaVideoPath(getCtx()) + dir);
|
||||
Observable
|
||||
.fromCallable(new Callable<List<String>>() {
|
||||
@Override
|
||||
public List<String> call() throws Exception {
|
||||
String[] strings = file.list();
|
||||
Log.e(TAG, "getViedoList: " + Arrays.toString(strings));
|
||||
Log.e(TAG, "getVideoList: " + Arrays.toString(strings));
|
||||
if (strings != null) {
|
||||
return new ArrayList<>(Arrays.asList(strings));
|
||||
} else {
|
||||
@@ -103,25 +137,25 @@ public class LocalCategoryViewModel extends BaseViewModel<ActivityCategoryLocalB
|
||||
.subscribe(new Observer<ArrayList<LocalVideoInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getViedoList", "onSubscribe: ");
|
||||
Log.e("getVideoList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ArrayList<LocalVideoInfo> localVideoInfos) {
|
||||
Log.e("getViedoList", "onNext: ");
|
||||
Log.e("getVideoList", "onNext: ");
|
||||
mLocalVideoInfosData.setValue(localVideoInfos);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getViedoList", "onError: " + e.getMessage());
|
||||
Log.e("getVideoList", "onError: " + e.getMessage());
|
||||
mLocalVideoInfosData.setValue(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getViedoList", "onComplete: ");
|
||||
Log.e("getVideoList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import androidx.lifecycle.Observer;
|
||||
|
||||
import com.hainaos.vc.BuildConfig;
|
||||
import com.hainaos.vc.R;
|
||||
import com.hainaos.vc.activity.category.local.LocalCategoryActivity;
|
||||
import com.hainaos.vc.activity.login.LoginActivity;
|
||||
import com.hainaos.vc.base.BaseFragmentPagerAdapter;
|
||||
import com.hainaos.vc.base.mvvm.BaseMvvmActivity;
|
||||
@@ -356,12 +355,13 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
}
|
||||
}
|
||||
|
||||
private void openCategory(String title, String dir) {
|
||||
Intent intent = new Intent(MainActivity.this, LocalCategoryActivity.class);
|
||||
intent.putExtra("title", title);
|
||||
intent.putExtra("dir", dir);
|
||||
startActivity(intent);
|
||||
}
|
||||
// @Deprecated
|
||||
// private void openCategory(String title, String dir) {
|
||||
// Intent intent = new Intent(MainActivity.this, LocalCategoryActivity.class);
|
||||
// intent.putExtra("title", title);
|
||||
// intent.putExtra("dir", dir);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View view) {
|
||||
@@ -372,53 +372,53 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
startActivity(new Intent(MainActivity.this, LoginActivity.class));
|
||||
}
|
||||
|
||||
public void open1(View view) {
|
||||
openCategory("发型设计", "1");
|
||||
}
|
||||
|
||||
public void open2(View view) {
|
||||
openCategory("化妆基础", "2");
|
||||
}
|
||||
|
||||
public void open3(View view) {
|
||||
openCategory("美甲技巧", "3");
|
||||
}
|
||||
|
||||
public void open4(View view) {
|
||||
openCategory("皮肤管理", "4");
|
||||
}
|
||||
|
||||
public void open5(View view) {
|
||||
openCategory("纹绣入门", "5");
|
||||
}
|
||||
|
||||
public void open6(View view) {
|
||||
openCategory("美睫教程", "6");
|
||||
}
|
||||
|
||||
public void open7(View view) {
|
||||
openCategory("形象穿搭", "7");
|
||||
}
|
||||
|
||||
public void open8(View view) {
|
||||
openCategory("门店营销", "8");
|
||||
}
|
||||
|
||||
public void open9(View view) {
|
||||
openCategory("色彩搭配", "9");
|
||||
}
|
||||
|
||||
public void open10(View view) {
|
||||
openCategory("工具消毒", "10");
|
||||
}
|
||||
|
||||
public void open11(View view) {
|
||||
|
||||
}
|
||||
|
||||
public void open12(View view) {
|
||||
|
||||
}
|
||||
// public void open1(View view) {
|
||||
// openCategory("发型设计", "1");
|
||||
// }
|
||||
//
|
||||
// public void open2(View view) {
|
||||
// openCategory("化妆基础", "2");
|
||||
// }
|
||||
//
|
||||
// public void open3(View view) {
|
||||
// openCategory("美甲技巧", "3");
|
||||
// }
|
||||
//
|
||||
// public void open4(View view) {
|
||||
// openCategory("皮肤管理", "4");
|
||||
// }
|
||||
//
|
||||
// public void open5(View view) {
|
||||
// openCategory("纹绣入门", "5");
|
||||
// }
|
||||
//
|
||||
// public void open6(View view) {
|
||||
// openCategory("美睫教程", "6");
|
||||
// }
|
||||
//
|
||||
// public void open7(View view) {
|
||||
// openCategory("形象穿搭", "7");
|
||||
// }
|
||||
//
|
||||
// public void open8(View view) {
|
||||
// openCategory("门店营销", "8");
|
||||
// }
|
||||
//
|
||||
// public void open9(View view) {
|
||||
// openCategory("色彩搭配", "9");
|
||||
// }
|
||||
//
|
||||
// public void open10(View view) {
|
||||
// openCategory("工具消毒", "10");
|
||||
// }
|
||||
//
|
||||
// public void open11(View view) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void open12(View view) {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hainaos.vc.R;
|
||||
import com.hainaos.vc.activity.category.list.CategoryListActivity;
|
||||
import com.hainaos.vc.activity.category.local.LocalCategoryActivity;
|
||||
import com.hainaos.vc.activity.user.UserActivity;
|
||||
import com.hainaos.vc.bean.HomeAppInfo;
|
||||
import com.hainaos.vc.utils.ApkUtils;
|
||||
@@ -95,10 +94,10 @@ public class HomeAppAdapter extends RecyclerView.Adapter<HomeAppAdapter.Holder>
|
||||
mContext.startActivity(new Intent(mContext, CategoryListActivity.class));
|
||||
break;
|
||||
default:
|
||||
Intent intent = new Intent(mContext, LocalCategoryActivity.class);
|
||||
intent.putExtra("title", name);
|
||||
intent.putExtra("dir", dirName);
|
||||
mContext.startActivity(intent);
|
||||
// Intent intent = new Intent(mContext, LocalCategoryActivity.class);
|
||||
// intent.putExtra("title", name);
|
||||
// intent.putExtra("dir", dirName);
|
||||
// mContext.startActivity(intent);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class HomeCategoryAdapter extends RecyclerView.Adapter<HomeCategoryAdapte
|
||||
mPasswdDialogFragment.setConfimCallback(new PasswdDialogFragment.ConfimCallback() {
|
||||
@Override
|
||||
public void onConfig(String passwd) {
|
||||
openCategory(categoryInfo);
|
||||
openCategory(categoryInfo, passwd);
|
||||
}
|
||||
});
|
||||
mPasswdDialogFragment.show(mFragmentManager, "PasswdDialogFragment");
|
||||
@@ -112,8 +112,14 @@ public class HomeCategoryAdapter extends RecyclerView.Adapter<HomeCategoryAdapte
|
||||
|
||||
private void openCategory(CategoryInfo categoryInfo) {
|
||||
Intent intent = new Intent(mContext, LocalCategoryActivity.class);
|
||||
intent.putExtra("title", categoryInfo.getCategory_name());
|
||||
intent.putExtra("dir", categoryInfo.getFolder());
|
||||
intent.putExtra("CategoryInfo", categoryInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
private void openCategory(CategoryInfo categoryInfo, String passwd) {
|
||||
Intent intent = new Intent(mContext, LocalCategoryActivity.class);
|
||||
intent.putExtra("CategoryInfo", categoryInfo);
|
||||
intent.putExtra("passwd", passwd);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user