82个文件已修改
21个文件已添加
5个文件已删除
| | |
| | | applicationId "com.application.zhangshi_app_android" |
| | | minSdk 24 |
| | | targetSdk 33 |
| | | versionCode 3 |
| | | versionName "1.0.2" |
| | | versionCode 5 |
| | | versionName "1.0.31" |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | ndk { |
| | | //APP的build.gradle设置支持的SO库架构 |
| | |
| | | android:exported="false" /> |
| | | <activity android:name=".ui.home.GenealogyActivity" |
| | | android:exported="false"/> |
| | | <activity android:name=".ui.TestActivity" |
| | | /> |
| | | <activity android:name=".ui.personal_center.LoginBgChangeActivity" |
| | | android:exported="false"/> |
| | | <activity android:name=".ui.home.HomeMindMapActivity" |
| | |
| | | android:screenOrientation="landscape" |
| | | android:theme="@style/FullScreenTheme" /> |
| | | |
| | | <activity |
| | | android:name=".ui.PlayActivity" |
| | | android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" |
| | | android:screenOrientation="portrait" |
| | | android:theme="@style/FullScreenTheme" |
| | | /> |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
| | |
| | | }); |
| | | } |
| | | if (isCheckable){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | holder.getBinding().checkbox.setChecked(viewModel.getCheckListLiveData().getValue().contains(mDataList.get(position))); |
| | | }else{ |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | |
| | | package com.application.zhangshi_app_android.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.view.View; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ItemElectronicFileBinding; |
| | | import com.application.zhangshi_app_android.ui.ImagePreviewActivity; |
| | | import com.application.zhangshi_app_android.ui.VideoPlayActivity; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | |
| | | @Override |
| | | protected void onBind(BaseViewHolder<ItemElectronicFileBinding> holder, int position) { |
| | | holder.getBinding().setUrl(mDataList.get(position)); |
| | | String item = mDataList.get(position); |
| | | if (item != null) { |
| | | if (item.endsWith(".pdf")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_pdf); |
| | | } else if (item.endsWith(".zip") || item.endsWith(".aar") || item.endsWith(".7z")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_zip); |
| | | } else if (item.endsWith(".doc") || item.endsWith(".docx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_word); |
| | | } else if (item.endsWith(".xls") || item.endsWith(".xlsx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_excel); |
| | | } else if (item.endsWith(".ppt") || item.endsWith(".pptx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_ppt); |
| | | } else if (item.endsWith(".txt")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_txt); |
| | | } else if (item.endsWith(".jpg") || item.endsWith(".jpeg") || item.endsWith(".png") || item.endsWith(".gif")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_img); |
| | | } else if (item.endsWith(".mp4")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_video); |
| | | } else if (item.endsWith(".mp3") || item.endsWith(".m4a")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_audio); |
| | | } else { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.application.zhangshi_app_android.adapter; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.view.View; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.app.ActivityOptionsCompat; |
| | | import androidx.core.util.Pair; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ItemElectronicFileAddBinding; |
| | | import com.application.zhangshi_app_android.ui.ImagePreviewActivity; |
| | | import com.application.zhangshi_app_android.ui.PlayActivity; |
| | | import com.application.zhangshi_app_android.ui.VideoPlayActivity; |
| | | |
| | | import java.util.HashSet; |
| | |
| | | String item = mDataList.get(position); |
| | | if (item != null) { |
| | | if (item.endsWith(".pdf")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_pdf); |
| | | } else if (item.endsWith(".zip") || item.endsWith(".aar") || item.endsWith(".7z")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_zip); |
| | | } else if (item.endsWith(".doc") || item.endsWith(".docx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_word); |
| | | } else if (item.endsWith(".xls") || item.endsWith(".xlsx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_excel); |
| | | } else if (item.endsWith(".ppt") || item.endsWith(".pptx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_ppt); |
| | | } else if (item.endsWith(".txt")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_txt); |
| | | } else if (item.endsWith(".jpg") || item.endsWith(".jpeg") || item.endsWith(".png") || item.endsWith(".gif")) { |
| | |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | new VideoPlayActivity.Builder() |
| | | .setVideoSource(item) |
| | | .setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) |
| | | .start(mContext); |
| | | // new VideoPlayActivity.Builder() |
| | | // .setVideoSource(item) |
| | | // .setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) |
| | | // .start(mContext); |
| | | PlayActivity.start((Activity) mContext, item,holder.itemView,true); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } else if (item.endsWith(".mp3") || item.endsWith(".m4a")) { |
| | | // holder.getBinding().flPlay.setVisibility(View.VISIBLE); |
| | | |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_audio); |
| | | } else { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | |
| | | } |
| | | |
| | | if (isShowSelectIcon) { |
| | | holder.getBinding().ivSelect.setVisibility(View.VISIBLE); |
| | | if (selectedItems.contains(item)){ |
| | | holder.getBinding().ivSelect.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivSelect.setBackgroundResource(R.drawable.ic_checked); |
| | | } else { |
| | | holder.getBinding().ivSelect.setVisibility(View.GONE); |
| | | holder.getBinding().ivSelect.setBackgroundResource(R.drawable.ic_unchecked); |
| | | } |
| | | } else { |
| | | holder.getBinding().ivSelect.setVisibility(View.GONE); |
| | |
| | | holder.getBinding().cardView.requestLayout(); |
| | | }); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | |
| | | }); |
| | | } |
| | | if (isCheckable){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | holder.getBinding().checkbox.setChecked(viewModel.getCheckListLiveData().getValue().contains(mDataList.get(position))); |
| | | }else{ |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | }); |
| | | } |
| | | if (isCheckable){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | holder.getBinding().checkbox.setChecked(viewModel.getCheckListLiveData().getValue().contains(mDataList.get(position))); |
| | | }else{ |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | |
| | | holder.getBinding().cardView.requestLayout(); |
| | | }); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | |
| | | }); |
| | | } |
| | | if (isCheckable){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | holder.getBinding().checkbox.setChecked(viewModel.getCheckListLiveData().getValue().contains(mDataList.get(position))); |
| | | }else{ |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | |
| | | }); |
| | | } |
| | | if (isCheckable){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().checkbox.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | holder.getBinding().checkbox.setChecked(viewModel.getCheckListLiveData().getValue().contains(mDataList.get(position))); |
| | | }else{ |
| | | holder.getBinding().checkbox.setVisibility(View.GONE); |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.view.View; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.manager.AppManager; |
| | |
| | | }else { |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_pink)); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity( |
| | | new Intent(mContext, PetDetailActivity.class) |
| | |
| | | package com.application.zhangshi_app_android.bean; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | public void setChoose(int choose) { |
| | | this.choose = choose; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) return true; |
| | | if (o == null || getClass() != o.getClass()) return false; |
| | | BannerBean that = (BannerBean) o; |
| | | return id == that.id && uid == that.uid && flag == that.flag && choose == that.choose && url.equals(that.url); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | return Objects.hash(id, uid, url, flag, choose); |
| | | } |
| | | } |
| | |
| | | private String remark; |
| | | private String url; |
| | | //家庭id |
| | | private String familyId; |
| | | private transient String familyId; |
| | | //创建时间 |
| | | private String createTime; |
| | | //发生时间 |
| | | private String happenTime; |
| | | |
| | | private int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | |
| | | public int getId() { |
| | | return id; |
| | |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public void setKind(int kind) { |
| | | this.kind = kind; |
| | | } |
| | | |
| | | public int getOwnData() { |
| | | return ownData; |
| | | } |
| | | |
| | | public void setOwnData(int ownData) { |
| | | this.ownData = ownData; |
| | | } |
| | | |
| | | public String getHappenTime() { |
| | | return happenTime; |
| | | } |
| | |
| | | //发生时间 |
| | | private String happenTime; |
| | | |
| | | private transient int familyId;//所属家庭 id |
| | | private transient int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | |
| | | public String getAddress() { return address; } |
| | | public void setAddress(String value) { this.address = value; } |
| | | |
| | |
| | | this.happenTime = happenTime; |
| | | } |
| | | |
| | | public int getFamilyId() { |
| | | return familyId; |
| | | } |
| | | |
| | | public void setFamilyId(int familyId) { |
| | | this.familyId = familyId; |
| | | } |
| | | |
| | | public int getOwnData() { |
| | | return ownData; |
| | | } |
| | | |
| | | public void setOwnData(int ownData) { |
| | | this.ownData = ownData; |
| | | } |
| | | } |
| | |
| | | private String remark; |
| | | private String url; |
| | | private String happenTime; |
| | | |
| | | private transient int familyId;//所属家庭 id |
| | | private int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | private List<String> urlList; |
| | | |
| | | public String getAddress() { return address; } |
| | |
| | | this.happenTime = happenTime; |
| | | } |
| | | |
| | | public int getFamilyId() { return familyId; } |
| | | public void setFamilyId(int value) { this.familyId = value; } |
| | | public int getOwnData() { return ownData; } |
| | | public void setOwnData(int value) { this.ownData = value; } |
| | | |
| | | public String getOwnDataStr(){ |
| | | if (ownData == 1){ |
| | | return "(本家庭)"; |
| | | }else { |
| | | return "(非本家)"; |
| | | } |
| | | } |
| | | @Override |
| | | public String toString() { |
| | | return "FamilyMemorabiliaBean{" + |
| | |
| | | private String location;//存放位置 |
| | | private String remark; |
| | | private String url; |
| | | private String familyId; |
| | | private transient String familyId; |
| | | private int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | |
| | | private String happenTime;//发生时间 |
| | | |
| | | private int status;//状态 0:未过期 1:已过期 |
| | |
| | | this.happenTime = happenTime; |
| | | } |
| | | |
| | | public int getOwnData() { |
| | | return ownData; |
| | | } |
| | | |
| | | public void setOwnData(int ownData) { |
| | | this.ownData = ownData; |
| | | } |
| | | |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | |
| | | private String img; |
| | | //是否是我的家族 1是 0否 (用于判断是否显示身份代数) |
| | | private int isMyFamily; |
| | | //配偶信息 |
| | | private HomeMemberBean spouse; |
| | | public int getUserId() { |
| | | return userId; |
| | | } |
| | |
| | | public void setIsMyFamily(int isMyFamily) { |
| | | this.isMyFamily = isMyFamily; |
| | | } |
| | | |
| | | public HomeMemberBean getSpouse() { |
| | | return spouse; |
| | | } |
| | | |
| | | public void setSpouse(HomeMemberBean spouse) { |
| | | this.spouse = spouse; |
| | | } |
| | | } |
| | |
| | | private String location;//存放地点 |
| | | private String remark;//备注 |
| | | private String url;//电子文件 |
| | | private String familyId;//家庭id |
| | | private transient String familyId;//家庭id |
| | | private String createTime;//创建时间 |
| | | private int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | |
| | | public String getName() { |
| | | return name; |
| | |
| | | this.familyId = familyId; |
| | | } |
| | | |
| | | public int getOwnData() { |
| | | return ownData; |
| | | } |
| | | |
| | | public void setOwnData(int ownData) { |
| | | this.ownData = ownData; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | |
| | | private String balance;//余额 |
| | | private String remark;//备注 |
| | | private String url;//电子文件 |
| | | private String familyId;//家庭id |
| | | private int ownData;//是否是本家庭的数据 0=否,1=是 |
| | | private transient String familyId;//家庭id |
| | | private int ownData = 1;//是否是本家庭的数据 0=否,1=是 |
| | | private String happenTime;//发生时间 |
| | | |
| | | public int getId() { |
| | |
| | | private String suitable;//适用人群 |
| | | private String remark;//备注 |
| | | private String url;//电子文件地址 |
| | | private transient int familyId;//所属家庭 id |
| | | private int ownData = 1;//是否是自己家庭的数据 1 是 0 不是 |
| | | |
| | | public LittleDoctorBean(int id, String symptoms, String usingPeople, String duration, String type, String tcmPrescription, String westernMedicinePrescription, String efficacy, String remark, String url) { |
| | | this.id = id; |
| | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public int getFamilyId() { |
| | | return familyId; |
| | | } |
| | | |
| | | public void setFamilyId(int familyId) { |
| | | this.familyId = familyId; |
| | | } |
| | | |
| | | public int getOwnData() { |
| | | return ownData; |
| | | } |
| | | |
| | | public void setOwnData(int ownData) { |
| | | this.ownData = ownData; |
| | | } |
| | | } |
| | |
| | | //能听懂的方言 |
| | | private String dialect; |
| | | |
| | | private int familyId; |
| | | private int ownData; |
| | | private transient int familyId; |
| | | private int ownData = 1; |
| | | private String createTime; |
| | | private String headPicture; |
| | | //全身照 |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui; |
| | | |
| | | import android.annotation.TargetApi; |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Build; |
| | | import android.os.Handler; |
| | | import android.transition.Transition; |
| | | import android.transition.TransitionListenerAdapter; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.app.ActivityOptionsCompat; |
| | | import androidx.core.util.Pair; |
| | | import androidx.core.view.ViewCompat; |
| | | |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPlayBinding; |
| | | import com.shuyu.gsyvideoplayer.GSYVideoManager; |
| | | import com.shuyu.gsyvideoplayer.utils.OrientationUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.09.04. 15:59 |
| | | * @desc |
| | | */ |
| | | public class PlayActivity extends BaseActivity<ActivityPlayBinding,SimpleViewModel> { |
| | | public final static String IMG_TRANSITION = "IMG_TRANSITION"; |
| | | public final static String TRANSITION = "TRANSITION"; |
| | | public final static String VIDEO_URL = "VIDEO_URL"; |
| | | OrientationUtils orientationUtils; |
| | | |
| | | private boolean isTransition; |
| | | private String videoUrl; |
| | | |
| | | private Transition transition; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_play; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | isTransition = getIntent().getBooleanExtra(TRANSITION, false); |
| | | videoUrl = getIntent().getStringExtra(VIDEO_URL); |
| | | init(); |
| | | } |
| | | |
| | | private void init() { |
| | | if (videoUrl == null) { |
| | | return; |
| | | } |
| | | |
| | | binding.videoPlayer.setUp(videoUrl, true, ""); |
| | | |
| | | //增加封面 |
| | | ImageView imageView = new ImageView(this); |
| | | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); |
| | | GlideUtil.loadVideoCover(videoUrl,imageView,-1,0); |
| | | binding.videoPlayer.setThumbImageView(imageView); |
| | | |
| | | //增加title |
| | | binding.videoPlayer.getTitleTextView().setVisibility(View.VISIBLE); |
| | | //videoPlayer.setShowPauseCover(false); |
| | | |
| | | //videoPlayer.setSpeed(2f); |
| | | |
| | | //设置返回键 |
| | | binding.videoPlayer.getBackButton().setVisibility(View.VISIBLE); |
| | | |
| | | //设置旋转 |
| | | orientationUtils = new OrientationUtils(this, binding.videoPlayer); |
| | | |
| | | //设置全屏按键功能,这是使用的是选择屏幕,而不是全屏 |
| | | binding.videoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | // ------- !!!如果不需要旋转屏幕,可以不调用!!!------- |
| | | // 不需要屏幕旋转,还需要设置 setNeedOrientationUtils(false) |
| | | orientationUtils.resolveByClick(); |
| | | } |
| | | }); |
| | | |
| | | // binding.videoPlayer.setBottomProgressBarDrawable(getResources().getDrawable(R.drawable.video_new_progress)); |
| | | // binding.videoPlayer.setDialogVolumeProgressBar(getResources().getDrawable(R.drawable.video_new_volume_progress_bg)); |
| | | // binding.videoPlayer.setDialogProgressBar(getResources().getDrawable(R.drawable.video_new_progress)); |
| | | // binding.videoPlayer.setBottomShowProgressBarDrawable(getResources().getDrawable(R.drawable.video_new_seekbar_progress), |
| | | // binding.getResources().getDrawable(R.drawable.video_new_seekbar_thumb)); |
| | | // binding.videoPlayer.setDialogProgressColor(getResources().getColor(R.color.colorAccent), -11); |
| | | |
| | | //是否可以滑动调整 |
| | | binding.videoPlayer.setIsTouchWiget(true); |
| | | |
| | | //设置返回按键功能 |
| | | binding.videoPlayer.getBackButton().setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | onBackPressed(); |
| | | } |
| | | }); |
| | | |
| | | //过渡动画 |
| | | initTransition(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | binding.videoPlayer.onVideoPause(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | binding.videoPlayer.onVideoResume(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | if (orientationUtils != null) |
| | | orientationUtils.releaseListener(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBackPressed() { |
| | | //先返回正常状态 |
| | | if (orientationUtils.getScreenType() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { |
| | | binding.videoPlayer.getFullscreenButton().performClick(); |
| | | return; |
| | | } |
| | | //释放所有 |
| | | binding.videoPlayer.setVideoAllCallBack(null); |
| | | GSYVideoManager.releaseAllVideos(); |
| | | if (isTransition && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | super.onBackPressed(); |
| | | } else { |
| | | new Handler().postDelayed(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | finish(); |
| | | overridePendingTransition(androidx.appcompat.R.anim.abc_fade_in, androidx.appcompat.R.anim.abc_fade_out); |
| | | } |
| | | }, 500); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void initTransition() { |
| | | if (isTransition && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | postponeEnterTransition(); |
| | | ViewCompat.setTransitionName(binding.videoPlayer, IMG_TRANSITION); |
| | | addTransitionListener(); |
| | | startPostponedEnterTransition(); |
| | | } else { |
| | | binding.videoPlayer.startPlayLogic(); |
| | | } |
| | | } |
| | | |
| | | @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| | | private boolean addTransitionListener() { |
| | | transition = getWindow().getSharedElementEnterTransition(); |
| | | if (transition != null) { |
| | | transition.addListener(new Transition.TransitionListener() { |
| | | @Override |
| | | public void onTransitionStart(Transition transition) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTransitionEnd(Transition transition) { |
| | | binding.videoPlayer.startPlayLogic(); |
| | | transition.removeListener(this); |
| | | } |
| | | |
| | | @Override |
| | | public void onTransitionCancel(Transition transition) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTransitionPause(Transition transition) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTransitionResume(Transition transition) { |
| | | |
| | | } |
| | | }); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | @Override |
| | | public void initData() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 启动播放界面 |
| | | * @param activity 启动的activity |
| | | * @param url 视频地址 |
| | | * @param view 过渡动画的起点view |
| | | * @param isTransition 是否有过渡动画 |
| | | */ |
| | | public static void start(Activity activity, String url, View view, boolean isTransition){ |
| | | Intent intent = new Intent(activity, PlayActivity.class); |
| | | intent.putExtra(PlayActivity.TRANSITION, isTransition); |
| | | intent.putExtra(PlayActivity.VIDEO_URL, url); |
| | | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { |
| | | Pair pair = new Pair<>(view, PlayActivity.IMG_TRANSITION); |
| | | ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation( |
| | | activity, pair); |
| | | ActivityCompat.startActivity(activity, intent, activityOptions.toBundle()); |
| | | } else { |
| | | activity.startActivity(intent); |
| | | activity.overridePendingTransition(androidx.appcompat.R.anim.abc_fade_in, androidx.appcompat.R.anim.abc_fade_out); |
| | | } |
| | | } |
| | | } |
| | |
| | | //右上角操作弹窗 |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_add).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_select).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old).setOnClickListener(v -> { |
| | | viewModel.sortDataList(0); |
| | |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.view_select_underline).setVisibility(View.GONE); |
| | | setOnClickListener( |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select) |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top) |
| | | ); |
| | | //点击放大镜按钮显示出搜索框 |
| | | binding.ivSearchDefault.setOnClickListener(v -> { |
| | |
| | | }else if (id == R.id.tv_select){ |
| | | viewModel.getOperateTypeLiveData().postValue(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }else if (id == R.id.tv_own_top) { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | } |
| | | } |
| | | @Override |
| | |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.CleanStorageBean; |
| | | import com.application.zhangshi_app_android.bean.CleanStorageRequestBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | |
| | | this.finishDeleteListLiveData = finishDeleteListLiveData; |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<CleanStorageBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | if (beanLiveData.getValue() == null){ |
| | | return; |
| | | } |
| | | model.deleteLittleDoctors(String.valueOf(beanLiveData.getValue().getId())) |
| | | model.deleteCleanStorages(String.valueOf(beanLiveData.getValue().getId())) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | |
| | | viewModel.sortDataList(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top).setOnClickListener(v -> { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | //点击弹出操作弹窗 |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | mOperatePopupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsRequestBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | |
| | | dataListLiveData.postValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<FamilyAssetsBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_old_to_new) |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_old_to_new), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top) |
| | | ); |
| | | //点击放大镜按钮显示出搜索框 |
| | | binding.ivSearchDefault.setOnClickListener(v -> { |
| | |
| | | } else if (id == R.id.tv_from_old_to_new) { |
| | | viewModel.changeOrder(false); |
| | | mOperatePopupWindow.dismiss(); |
| | | } else if (id == R.id.tv_own_top) { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | } |
| | | } |
| | | |
| | |
| | | * 删除单个数据 |
| | | */ |
| | | public void deleteItem(FamilyMemorabiliaBean bean) { |
| | | model.deleteLittleDoctors(String.valueOf(bean.getId())) |
| | | model.deleteFamilyMemorabilia(String.valueOf(bean.getId())) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | |
| | | } |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<FamilyMemorabiliaBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | |
| | | import androidx.lifecycle.Observer; |
| | | |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentFunctionBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseFragment; |
| | | import com.application.zhangshi_app_android.ui.TestActivity; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | | import com.application.zhangshi_app_android.ui.main.MainActivity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.functions.Consumer; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | |
| | | private PopupWindow mOperatePopupWindow; |
| | | private ImageCarouselFragment imageCarouselFragment; |
| | | private VideoFragment videoFragment; |
| | | private VideoCarouselFragment videoCarouselFragment; |
| | | |
| | | private FunctionFragment() { |
| | | } |
| | |
| | | binding.layoutContacts.setOnClickListener(v->{ |
| | | AppManager.getAppManager().startActivity(ContactsActivity.class); |
| | | }); |
| | | binding.ivOperate.setOnClickListener(v->{ |
| | | AppManager.getAppManager().startActivity(TestActivity.class); |
| | | }); |
| | | |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | videoFragment = VideoFragment.newInstance(); |
| | | replaceFragment(imageCarouselFragment); |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(getSelfActivity(),R.layout.pop_switch_video_or_image,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_image).setOnClickListener(v -> { |
| | | mOperatePopupWindow.dismiss(); |
| | | if (imageCarouselFragment == null){ |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | } |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | replaceFragment(imageCarouselFragment); |
| | | imageCarouselFragment.setImageList(viewModel.getImageListLiveData().getValue()); |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_video).setOnClickListener(v -> { |
| | | mOperatePopupWindow.dismiss(); |
| | | if (videoFragment == null){ |
| | | videoFragment = VideoFragment.newInstance(); |
| | | } |
| | | replaceFragment(videoFragment); |
| | | videoCarouselFragment = VideoCarouselFragment.newInstance(); |
| | | replaceFragment(videoCarouselFragment); |
| | | videoCarouselFragment.setVideoList(viewModel.getVideoListLiveData().getValue()); |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(),ImageSelectActivity.class).putExtra("flag",1).putExtra("list", (Serializable) videoFragment.getVideoList())); |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(),ImageSelectActivity.class).putExtra("flag",1).putExtra("list", (Serializable) videoCarouselFragment.getVideoList())); |
| | | } |
| | | |
| | | }); |
| | |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | mOperatePopupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(getSelfActivity(),85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | replaceFragment(imageCarouselFragment); |
| | | } |
| | | public void replaceFragment(Fragment fragment){ |
| | | FragmentTransaction transaction = getSelfActivity().getSupportFragmentManager().beginTransaction(); |
| | |
| | | |
| | | @Override |
| | | protected void initLiveDataObserve() { |
| | | viewModel.getBannerListLiveData().observe(this, new Observer<List<BannerBean>>() { |
| | | viewModel.getImageListLiveData().observe(this, new Observer<List<BannerBean>>() { |
| | | @Override |
| | | public void onChanged(List<BannerBean> bannerBeans) { |
| | | List<BannerBean> imageList = new ArrayList<>(); |
| | | List<BannerBean> videoList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : bannerBeans) { |
| | | if (bannerBean.getFlag() == 0){ |
| | | //图片 |
| | | imageList.add(bannerBean); |
| | | }else if (bannerBean.getFlag() == 1){ |
| | | //视频 |
| | | videoList.add(bannerBean); |
| | | } |
| | | if (imageCarouselFragment != null){ |
| | | imageCarouselFragment.setImageList(bannerBeans); |
| | | } |
| | | imageCarouselFragment.setImageList(imageList); |
| | | videoFragment.setVideoList(videoList); |
| | | } |
| | | }); |
| | | |
| | | viewModel.getVideoListLiveData().observe(this, new Observer<List<BannerBean>>() { |
| | | @Override |
| | | public void onChanged(List<BannerBean> bannerBeans) { |
| | | if (videoCarouselFragment != null){ |
| | | videoCarouselFragment.setVideoList(bannerBeans); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observer; |
| | |
| | | public class FunctionFragmentViewModel extends BaseViewModel<DataRepository> { |
| | | |
| | | private final MutableLiveData<List<BannerBean>> bannerListLiveData = new MutableLiveData<>(); |
| | | private final MutableLiveData<List<BannerBean>> videoListLiveData = new MutableLiveData<>(); |
| | | private final MutableLiveData<List<BannerBean>> imageListLiveData = new MutableLiveData<>(); |
| | | public FunctionFragmentViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | |
| | | }else { |
| | | changeStateView(StateViewEnum.HIDE); |
| | | bannerListLiveData.postValue(data.getData()); |
| | | List<BannerBean> imageList = new ArrayList<>(); |
| | | List<BannerBean> videoList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : data.getData()) { |
| | | if (bannerBean.getFlag() == 0){ |
| | | //图片 |
| | | imageList.add(bannerBean); |
| | | }else if (bannerBean.getFlag() == 1){ |
| | | //视频 |
| | | videoList.add(bannerBean); |
| | | } |
| | | } |
| | | imageListLiveData.postValue(imageList); |
| | | videoListLiveData.postValue(videoList); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | |
| | | public void setBannerListLiveData(List<BannerBean> bannerListLiveData) { |
| | | this.bannerListLiveData.postValue(bannerListLiveData); |
| | | } |
| | | |
| | | public MutableLiveData<List<BannerBean>> getVideoListLiveData() { |
| | | return videoListLiveData; |
| | | } |
| | | |
| | | public void setVideoListLiveData(List<BannerBean> videoListLiveData) { |
| | | this.videoListLiveData.postValue(videoListLiveData); |
| | | } |
| | | |
| | | public MutableLiveData<List<BannerBean>> getImageListLiveData() { |
| | | return imageListLiveData; |
| | | } |
| | | |
| | | public void setImageListLiveData(List<BannerBean> imageListLiveData) { |
| | | this.imageListLiveData.postValue(imageListLiveData); |
| | | } |
| | | } |
| | |
| | | setOnClickListener( |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_old_to_new) |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top) |
| | | ); |
| | | //点击放大镜按钮显示出搜索框 |
| | | binding.ivSearchDefault.setOnClickListener(v -> { |
| | |
| | | }else if (id == R.id.tv_select){ |
| | | viewModel.getOperateTypeLiveData().postValue(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }else if (id == R.id.tv_from_new_to_old) { |
| | | viewModel.changeOrder(true); |
| | | mOperatePopupWindow.dismiss(); |
| | | } else if (id == R.id.tv_from_old_to_new) { |
| | | viewModel.changeOrder(false); |
| | | }else if (id == R.id.tv_own_top) { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | } |
| | | } |
| | |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesRequestBean; |
| | | import com.application.zhangshi_app_android.bean.IncomeAndExpensesBean; |
| | |
| | | } |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<HomeDevicesBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | viewModel.sortDataList(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top).setOnClickListener(v -> { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | //点击弹出操作弹窗 |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | mOperatePopupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.HonorCollectionBean; |
| | | import com.application.zhangshi_app_android.bean.HonorCollectionRequestBean; |
| | | import com.application.zhangshi_app_android.bean.HonorCollectionResponseBean; |
| | |
| | | } |
| | | dataListLiveData.setValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<HonorCollectionBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_add).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_select).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old).setOnClickListener(v -> { |
| | | viewModel.sortDataList(0); |
| | | mOperatePopupWindow.dismiss(); |
| | |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentImageCarouselBinding; |
| | | import com.youth.banner.Banner; |
| | | import com.youth.banner.adapter.BannerImageAdapter; |
| | | import com.youth.banner.config.IndicatorConfig; |
| | | import com.youth.banner.holder.BannerImageHolder; |
| | | import com.youth.banner.indicator.CircleIndicator; |
| | | |
| | |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("imgList", (Serializable) imageList); |
| | | setArguments(args); |
| | | chooseList = new ArrayList<>(); |
| | | //选出被选中的图片 |
| | | for (BannerBean bean : imageList) { |
| | | if (bean.getChoose() == 1) { |
| | | chooseList.add(bean); |
| | | |
| | | if (isAdded()){ |
| | | if (imageList == null) { |
| | | return; |
| | | } |
| | | } |
| | | if (chooseList == null || chooseList.size() == 0) { |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.banner.setVisibility(View.GONE); |
| | | } else { |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | binding.banner.setVisibility(View.VISIBLE); |
| | | if (adapter != null) { |
| | | adapter.setDatas(chooseList); |
| | | chooseList = new ArrayList<>(); |
| | | //选出被选中的图片 |
| | | for (BannerBean bean : imageList) { |
| | | if (bean.getChoose() == 1) { |
| | | chooseList.add(bean); |
| | | } |
| | | } |
| | | if (chooseList == null || chooseList.size() == 0) { |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.banner.setVisibility(View.GONE); |
| | | } else { |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | binding.banner.setVisibility(View.VISIBLE); |
| | | if (adapter != null) { |
| | | adapter.setDatas(chooseList); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | protected void initParam() { |
| | | if (getArguments() != null) { |
| | | imageList = (List<BannerBean>) getArguments().getSerializable("imgList"); |
| | | if (imageList != null){ |
| | | chooseList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : imageList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | chooseList.add(bannerBean); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | protected void initView() { |
| | | if (imageList != null) { |
| | | chooseList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : imageList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | chooseList.add(bannerBean); |
| | | //选出被选中的图片 |
| | | for (BannerBean bean : imageList) { |
| | | if (bean.getChoose() == 1) { |
| | | chooseList.add(bean); |
| | | } |
| | | } |
| | | if (chooseList == null || chooseList.size() == 0) { |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.banner.setVisibility(View.GONE); |
| | | } else { |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | binding.banner.setVisibility(View.VISIBLE); |
| | | if (adapter != null) { |
| | | adapter.setDatas(chooseList); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (updateBean != null) { |
| | | updateBean.setChoose(updateBean.getChoose()==0?1:0); |
| | | viewModel.update(updateBean); |
| | | |
| | | if (updateBean.getChoose() == 1) { |
| | | if (viewModel.getFlag() == 1) {//如果是视频,只能有一个选中,需要把其他的选中的取消 |
| | | for (BannerBean bean : beans) { |
| | | if (bean != updateBean && bean.getChoose() == 1) { |
| | | bean.setChoose(0); |
| | | viewModel.update(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }); |
| | | binding.rvImage.setAdapter(adapter); |
| | | |
| | | viewModel.setType(true); |
| | | binding.ivOperate.setVisibility(View.GONE); |
| | | binding.ivOperate.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_old_to_new) |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_old_to_new), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top) |
| | | ); |
| | | //点击放大镜按钮显示出搜索框 |
| | | binding.ivSearchDefault.setOnClickListener(v -> { |
| | |
| | | } else if (id == R.id.tv_from_old_to_new) { |
| | | viewModel.changeOrder(false); |
| | | mOperatePopupWindow.dismiss(); |
| | | }else if (id == R.id.tv_own_top) { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<IncomeAndExpensesBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | }else if (id == R.id.tv_select){ |
| | | viewModel.getOperateTypeLiveData().postValue(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }else if (id == R.id.tv_own_top) { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorRequestBean; |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | |
| | | this.finishDeleteListLiveData = finishDeleteListLiveData; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<LittleDoctorBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | viewModel.sortDataList(1); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_own_top).setOnClickListener(v -> { |
| | | viewModel.ownTop(); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | //点击弹出操作弹窗 |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | mOperatePopupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | | import com.application.zhangshi_app_android.bean.PetBean; |
| | | import com.application.zhangshi_app_android.bean.PetMemoBean; |
| | |
| | | dataListLiveData.setValue(list); |
| | | } |
| | | |
| | | /** |
| | | * 本家数据 置顶 |
| | | */ |
| | | public void ownTop(){ |
| | | List<PetBean> list = getDataListLiveData().getValue(); |
| | | if (list == null || list.isEmpty()){ |
| | | return; |
| | | } |
| | | //根据ownData值为1的 放到前面 |
| | | list.sort((o1, o2) -> { |
| | | if (o1.getOwnData() == 1 && o2.getOwnData() == 0) { |
| | | return -1; |
| | | } else if (o1.getOwnData() == 0 && o2.getOwnData() == 1) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | }); |
| | | getDataListLiveData().setValue(list); |
| | | } |
| | | } |
| | |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_add).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_select).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old).setOnClickListener(v -> { |
| | | viewModel.sortDataList(0); |
| | | mOperatePopupWindow.dismiss(); |
| | |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_add).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_select).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_from_new_to_old).setOnClickListener(v -> { |
| | | viewModel.sortDataList(0); |
| | | mOperatePopupWindow.dismiss(); |
| | |
| | | binding.recyclerView.setAdapter(adapter); |
| | | //右上角操作弹窗 |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | setOnClickListener( |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
| | |
| | | binding.recyclerView.setAdapter(adapter); |
| | | //右上角操作弹窗 |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_operate,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_own_top).setVisibility(View.GONE); |
| | | setOnClickListener( |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_add), |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_select), |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | import androidx.viewpager2.widget.ViewPager2; |
| | | |
| | | import com.android.app_base.base.adapter.BaseVp2FragmentAdapter; |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentVideoCarouselBinding; |
| | | import com.application.zhangshi_app_android.ui.SimpleViewModel; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | | import com.application.zhangshi_app_android.ui.personal_center.PersonalCenterFragment; |
| | | import com.youth.banner.indicator.CircleIndicator; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.09.05. 19:35 |
| | | * @desc 功能主页的视频轮播 Fragment |
| | | */ |
| | | public class VideoCarouselFragment extends BaseFragment<FragmentVideoCarouselBinding, SimpleViewModel> { |
| | | |
| | | private List<BannerBean> videoList; |
| | | private List<BannerBean> chooseList; |
| | | |
| | | private BaseVp2FragmentAdapter<VideoFragment> adapter; |
| | | public VideoCarouselFragment() { |
| | | } |
| | | |
| | | public static VideoCarouselFragment newInstance() { |
| | | VideoCarouselFragment fragment = new VideoCarouselFragment(); |
| | | Bundle args = new Bundle(); |
| | | fragment.setArguments(args); |
| | | return fragment; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected int getLayoutId() { |
| | | return R.layout.fragment_video_carousel; |
| | | } |
| | | |
| | | @Override |
| | | protected int getVariableId() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | protected void initParam() { |
| | | if (getArguments() != null) { |
| | | videoList = (List<BannerBean>) getArguments().getSerializable("videoList"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void initView() { |
| | | adapter = new BaseVp2FragmentAdapter<>(this); |
| | | binding.viewPager.setAdapter(adapter); |
| | | binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { |
| | | @Override |
| | | public void onPageSelected(int position) { |
| | | super.onPageSelected(position); |
| | | if (adapter.getFragment(position) != null){ |
| | | System.out.println("onPageSelected:"+position); |
| | | adapter.getFragment(position).startPlay(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void initData() { |
| | | if (videoList == null || videoList.size() == 0){ |
| | | binding.viewPager.setVisibility(View.GONE); |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | }else { |
| | | binding.viewPager.setVisibility(View.VISIBLE); |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | |
| | | chooseList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : videoList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | chooseList.add(bannerBean); |
| | | } |
| | | } |
| | | if (chooseList.size() == 0){ |
| | | chooseList = videoList; |
| | | } |
| | | adapter.removeFragmentAll(); |
| | | for (BannerBean bannerBean : chooseList) { |
| | | VideoFragment videoFragment = VideoFragment.newInstance(bannerBean.getUrl()); |
| | | videoFragment.setOnPlayListener(new VideoFragment.onPlayListener() { |
| | | @Override |
| | | public void onComplete() { |
| | | if (binding.viewPager.getCurrentItem() == adapter.getItemCount()-1) { |
| | | binding.viewPager.setCurrentItem(0, false); |
| | | } |
| | | binding.viewPager.setCurrentItem(binding.viewPager.getCurrentItem()+1,true); |
| | | } |
| | | }); |
| | | adapter.addFragment(videoFragment); |
| | | } |
| | | binding.viewPager.setCurrentItem(0); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void initLiveDataObserve() { |
| | | |
| | | } |
| | | |
| | | public void setVideoList(List<BannerBean> videoList) { |
| | | //如果内容相同,不刷新 |
| | | boolean isSame = true; |
| | | if (this.videoList != null && videoList != null && this.videoList.size() == videoList.size()) { |
| | | for (int i = 0; i < this.videoList.size(); i++) { |
| | | if (!this.videoList.get(i).equals(videoList.get(i))) { |
| | | isSame = false; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | isSame = false; |
| | | } |
| | | if (isSame){ |
| | | return; |
| | | } |
| | | this.videoList = videoList; |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("videoList", (Serializable) videoList); |
| | | setArguments(args); |
| | | |
| | | if (isAdded()){ |
| | | initData(); |
| | | } |
| | | } |
| | | |
| | | public List<BannerBean> getVideoList() { |
| | | return videoList; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class VideoFragment extends BaseFragment<FragmentVideoBinding, VideoFragmentViewModel> { |
| | | OrientationUtils orientationUtils; |
| | | private List<BannerBean> videoList; |
| | | private boolean isPlay; |
| | | private boolean isPause; |
| | | |
| | | private boolean isNeedStart = true;//是否需要开始播放 |
| | | private String playUrl; |
| | | private onPlayListener onPlayListener; |
| | | public VideoFragment() { |
| | | } |
| | | |
| | | public static VideoFragment newInstance() { |
| | | public static VideoFragment newInstance(String playUrl) { |
| | | VideoFragment fragment = new VideoFragment(); |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("playUrl", playUrl); |
| | | fragment.setArguments(args); |
| | | return fragment; |
| | | } |
| | |
| | | @Override |
| | | protected void initParam() { |
| | | if (getArguments() != null) { |
| | | videoList = (List<BannerBean>) getArguments().getSerializable("videoList"); |
| | | playUrl = (String) getArguments().getSerializable("playUrl"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void initView() { |
| | | String playUrl = null; |
| | | for (BannerBean bannerBean : videoList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | playUrl = bannerBean.getUrl(); |
| | | break; |
| | | } |
| | | } |
| | | if (playUrl != null){ |
| | | binding.videoPlayer.setVisibility(View.VISIBLE); |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | |
| | | |
| | | //外部辅助的旋转,帮助全屏 |
| | | //orientationUtils = new OrientationUtils(this, binding.videoPlayer); |
| | | //初始化不打开外部的旋转 |
| | |
| | | .setShowFullAnimation(false) |
| | | .setUrl(playUrl) |
| | | .setNeedLockFull(true) |
| | | .setCacheWithPlay(false) |
| | | .setCacheWithPlay(true) |
| | | .setVideoTitle("") |
| | | .setLooping(false) |
| | | ///不需要旋转 |
| | |
| | | // if (orientationUtils != null) { |
| | | // orientationUtils.backToProtVideo(); |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | | public void onAutoComplete(String url, Object... objects) { |
| | | super.onAutoComplete(url, objects); |
| | | if (onPlayListener != null){ |
| | | onPlayListener.onComplete(); |
| | | } |
| | | isNeedStart = true; |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete(String url, Object... objects) { |
| | | super.onComplete(url, objects); |
| | | // isNeedStart = true; |
| | | } |
| | | }) |
| | | .setLockClickListener(new LockClickListener() { |
| | |
| | | binding.videoPlayer.startWindowFullscreen(getSelfActivity(), true, true); |
| | | } |
| | | }); |
| | | }else { |
| | | binding.videoPlayer.setVisibility(View.GONE); |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public void setVideoList(List<BannerBean> videoList) { |
| | | this.videoList = videoList; |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("videoList", (Serializable) videoList); |
| | | setArguments(args); |
| | | if (isAdded()){ |
| | | initView(); |
| | | } |
| | | } |
| | | |
| | | public List<BannerBean> getVideoList() { |
| | | return videoList; |
| | | } |
| | | |
| | | @Override |
| | | protected void initLiveDataObserve() { |
| | |
| | | binding.videoPlayer.getCurrentPlayer().onVideoPause(); |
| | | super.onPause(); |
| | | isPause = true; |
| | | System.out.println("onPause"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | binding.videoPlayer.getCurrentPlayer().onVideoResume(false); |
| | | if (isNeedStart){ |
| | | binding.videoPlayer.getCurrentPlayer().startPlayLogic(); |
| | | isNeedStart = false; |
| | | }else { |
| | | binding.videoPlayer.getCurrentPlayer().onVideoResume(false); |
| | | } |
| | | super.onResume(); |
| | | isPause = false; |
| | | } |
| | |
| | | // binding.videoPlayer.onConfigurationChanged(this, newConfig, orientationUtils, true, true); |
| | | // } |
| | | } |
| | | |
| | | public void setOnPlayListener(onPlayListener listener){ |
| | | this.onPlayListener = listener; |
| | | } |
| | | public void startPlay(){ |
| | | isNeedStart = true; |
| | | } |
| | | |
| | | public interface onPlayListener{ |
| | | void onComplete(); |
| | | } |
| | | } |
| | |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.HomeMemberAdapter; |
| | | import com.application.zhangshi_app_android.bean.HomeMemberBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityGenealogyBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | |
| | | picker.show(); |
| | | }); |
| | | binding.etIdentity.setOnClickListener(v -> { |
| | | List<String> list = Arrays.asList("1","2","3","4"); |
| | | List<String> list = new ArrayList<>(); |
| | | for (int i = 1; i < 100; i++) { |
| | | list.add(i+""); |
| | | } |
| | | OptionPicker picker = getOptionPicker(list); |
| | | picker.setTitle("身份代数"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | viewModel.getDataListLiveData().observe(this, list -> { |
| | | adapter.setData(list); |
| | | List<HomeMemberBean> realList = new ArrayList<>(); |
| | | for (HomeMemberBean homeMemberBean : list) { |
| | | realList.add(homeMemberBean); |
| | | if (homeMemberBean.getSpouse() != null){ |
| | | realList.add(homeMemberBean.getSpouse()); |
| | | } |
| | | } |
| | | adapter.setData(realList); |
| | | }); |
| | | viewModel.getMoreListLiveData().observe(this, list -> { |
| | | adapter.addData(list); |
| | | List<HomeMemberBean> realList = new ArrayList<>(); |
| | | for (HomeMemberBean homeMemberBean : list) { |
| | | realList.add(homeMemberBean); |
| | | if (homeMemberBean.getSpouse() != null){ |
| | | realList.add(homeMemberBean.getSpouse()); |
| | | } |
| | | } |
| | | adapter.addData(realList); |
| | | }); |
| | | } |
| | | @Override |
| | |
| | | AppManager.getAppManager().startActivity(HomeMindMapActivity.class); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | final GestureDetector gestureDetector = new GestureDetector(getSelfActivity(), new GestureDetector.SimpleOnGestureListener() { |
| | | @Override |
| | | public boolean onDoubleTap(MotionEvent e) { |
| | | AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f); |
| | | alphaAnimation.setDuration(1000); |
| | | alphaAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | @Override |
| | | public void onAnimationStart(Animation animation) { |
| | | binding.scrollView.setVisibility(View.VISIBLE); |
| | | binding.scrollView.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | binding.scrollView.scrollTo(binding.scrollView.getChildAt(0).getMeasuredWidth()/2 - ScreenSizeUtils.getScreenWidth(getSelfActivity())/2,0); |
| | | } |
| | | }); |
| | | } |
| | | // final GestureDetector gestureDetector = new GestureDetector(getSelfActivity(), new GestureDetector.SimpleOnGestureListener() { |
| | | // @Override |
| | | // public boolean onDoubleTap(MotionEvent e) { |
| | | // AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f); |
| | | // alphaAnimation.setDuration(1000); |
| | | // alphaAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // binding.scrollView.setVisibility(View.VISIBLE); |
| | | // binding.scrollView.post(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // binding.scrollView.scrollTo(binding.scrollView.getChildAt(0).getMeasuredWidth()/2 - ScreenSizeUtils.getScreenWidth(getSelfActivity())/2,0); |
| | | // } |
| | | // }); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // |
| | | // AlphaAnimation alphaAnimation1 = new AlphaAnimation(1f, 0f); |
| | | // alphaAnimation1.setDuration(1000); |
| | | // alphaAnimation1.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // binding.layoutHomeRootNet.setVisibility(View.VISIBLE); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // binding.layoutHomeRootNet.setVisibility(View.GONE); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // |
| | | // float scale = binding.layoutHomeRootNet.getWidth()/ (binding.ivTreeView.getWidth() * 2f / 3f); |
| | | // //缩放动画 |
| | | // ScaleAnimation scaleAnimation = new ScaleAnimation(1f, scale, 1f, scale, binding.layoutHomeRootNet.getWidth()/2f, binding.layoutHomeRootNet.getHeight()/2f); |
| | | // scaleAnimation.setDuration(1000); |
| | | // scaleAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | // @Override |
| | | // public void onAnimationStart(Animation animation) { |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationEnd(Animation animation) { |
| | | // binding.scrollView.startAnimation(alphaAnimation); |
| | | // binding.layoutHomeRootNet.startAnimation(alphaAnimation1); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onAnimationRepeat(Animation animation) { |
| | | // |
| | | // } |
| | | // }); |
| | | // binding.layoutHomeRootNet.startAnimation(scaleAnimation); |
| | | // |
| | | // return true; |
| | | // } |
| | | // }); |
| | | // binding.layoutHomeRootNet.setOnTouchListener(new View.OnTouchListener() { |
| | | // @Override |
| | | // public boolean onTouch(View v, MotionEvent event) { |
| | | // gestureDetector.onTouchEvent(event); |
| | | // return true; |
| | | // } |
| | | // }); |
| | | binding.layoutHomeRootNet.setVisibility(View.GONE); |
| | | binding.scrollView.setVisibility(View.VISIBLE); |
| | | |
| | | @Override |
| | | public void onAnimationEnd(Animation animation) { |
| | | } |
| | | |
| | | @Override |
| | | public void onAnimationRepeat(Animation animation) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | AlphaAnimation alphaAnimation1 = new AlphaAnimation(1f, 0f); |
| | | alphaAnimation1.setDuration(1000); |
| | | alphaAnimation1.setAnimationListener(new Animation.AnimationListener() { |
| | | @Override |
| | | public void onAnimationStart(Animation animation) { |
| | | binding.layoutHomeRootNet.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Override |
| | | public void onAnimationEnd(Animation animation) { |
| | | binding.layoutHomeRootNet.setVisibility(View.GONE); |
| | | } |
| | | |
| | | @Override |
| | | public void onAnimationRepeat(Animation animation) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | float scale = binding.layoutHomeRootNet.getWidth()/ (binding.ivTreeView.getWidth() * 2f / 3f); |
| | | //缩放动画 |
| | | ScaleAnimation scaleAnimation = new ScaleAnimation(1f, scale, 1f, scale, binding.layoutHomeRootNet.getWidth()/2f, binding.layoutHomeRootNet.getHeight()/2f); |
| | | scaleAnimation.setDuration(1000); |
| | | scaleAnimation.setAnimationListener(new Animation.AnimationListener() { |
| | | @Override |
| | | public void onAnimationStart(Animation animation) { |
| | | } |
| | | |
| | | @Override |
| | | public void onAnimationEnd(Animation animation) { |
| | | binding.scrollView.startAnimation(alphaAnimation); |
| | | binding.layoutHomeRootNet.startAnimation(alphaAnimation1); |
| | | } |
| | | |
| | | @Override |
| | | public void onAnimationRepeat(Animation animation) { |
| | | |
| | | } |
| | | }); |
| | | binding.layoutHomeRootNet.startAnimation(scaleAnimation); |
| | | |
| | | return true; |
| | | } |
| | | }); |
| | | binding.layoutHomeRootNet.setOnTouchListener(new View.OnTouchListener() { |
| | | @Override |
| | | public boolean onTouch(View v, MotionEvent event) { |
| | | gestureDetector.onTouchEvent(event); |
| | | return true; |
| | | } |
| | | }); |
| | | |
| | | firstViewOperator1 = new ViewOperator(binding.tvFirst1,binding.ivFirst1); |
| | | firstViewOperator2 = new ViewOperator(binding.tvFirst2,binding.ivFirst2); |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Path; |
| | | import android.graphics.RectF; |
| | | import android.view.View; |
| | |
| | | private ImageView expandIconView;//展开按钮 |
| | | private View spouseView;//配偶view |
| | | |
| | | public DoubleNode(HomeRootBean member) { |
| | | super(member); |
| | | |
| | | public DoubleNode(Context context,HomeRootBean member) { |
| | | super(context,member); |
| | | member.getSpouse().setSpouse(member); |
| | | //双亲节点 前后路径长度 有两倍的 pathLength |
| | | if (member.getIdentity() > 1 && member.getChildList() != null && member.getChildList().size() > 0){ |
| | | //非 第一代 且 有子代, 节点宽度 = view宽度 + 前后路径长度 + 展开按钮宽度 |
| | |
| | | viewMap.clear(); |
| | | if (rootMember != null) { // 绘制根节点,在竖直方向上居中 |
| | | if (rootMember.getSpouse() == null){ |
| | | rootNode = new SimpleNode(rootMember); |
| | | rootNode = new SimpleNode(getContext(),rootMember); |
| | | }else { |
| | | rootNode = new DoubleNode(rootMember); |
| | | rootNode = new DoubleNode(getContext(),rootMember); |
| | | } |
| | | rootNode.setPosition(padding,padding); |
| | | //把所有节点的view添加到viewGroup中 |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Path; |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.PopupWindow; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.constraintlayout.utils.widget.ImageFilterView; |
| | | import androidx.databinding.DataBindingUtil; |
| | | |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | import com.application.zhangshi_app_android.databinding.PopBasicInformationBinding; |
| | | import com.otaliastudios.zoom.ZoomLayout; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedList; |
| | |
| | | * @desc |
| | | */ |
| | | public abstract class Node{ |
| | | protected Context context; |
| | | protected HomeRootBean member;//成员 |
| | | protected Node parent;//父节点 |
| | | protected final List<Node> children = new ArrayList<>(); //子节点 |
| | |
| | | protected final List<Path> forkPathList = new ArrayList<>();//分叉连线 |
| | | protected final List<View> viewList = new ArrayList<>(); |
| | | |
| | | public Node(HomeRootBean member){ |
| | | public Node(Context context,HomeRootBean member){ |
| | | this.context = context; |
| | | this.member = member; |
| | | if (member != null) { |
| | | // 递归创建子节点 |
| | |
| | | if (child != null) { |
| | | Node node; |
| | | if (child.getSpouse() != null) { |
| | | node = new DoubleNode(child); |
| | | node = new DoubleNode(context,child); |
| | | } else { |
| | | node = new SimpleNode(child); |
| | | node = new SimpleNode(context,child); |
| | | } |
| | | node.parent = this; |
| | | children.add(node); |
| | |
| | | |
| | | protected View createItemView(HomeRootBean bean) { |
| | | // 使用布局填充器加载节点布局 |
| | | LayoutInflater inflater = LayoutInflater.from(AppManager.getAppManager().currentActivity()); |
| | | LayoutInflater inflater = LayoutInflater.from(context); |
| | | View familyMemberView = inflater.inflate(R.layout.item_family_member, null, false); |
| | | familyMemberView.measure(View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST), |
| | | View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST)); |
| | |
| | | } |
| | | tv_name.setText(bean.getNickName()); |
| | | tv_name.setSelected(true); |
| | | familyMemberView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | PopBasicInformationBinding mBinding= DataBindingUtil.inflate(inflater,R.layout.pop_basic_information,null,false); |
| | | PopupWindow popupWindow = new PopupWindow(); |
| | | // 设置布局文件 |
| | | popupWindow.setContentView(mBinding.getRoot()); |
| | | // 为了避免部分机型不显示,需要重新设置一下宽高 |
| | | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | // 设置pop透明效果 |
| | | popupWindow.setBackgroundDrawable(new ColorDrawable(0x0000)); |
| | | // 设置pop出入动画 |
| | | popupWindow.setAnimationStyle(com.android.app_base.R.style.pop_operate); |
| | | // 设置pop获取焦点,如果为false点击返回按钮会退出当前Activity,如果pop中有Editor的话,focusable必须要为true |
| | | popupWindow.setFocusable(true); |
| | | // 设置pop可点击,为false点击事件无效,默认为true |
| | | popupWindow.setTouchable(true); |
| | | // 设置点击pop外侧消失,默认为false;在focusable为true时点击外侧始终消失 |
| | | popupWindow.setOutsideTouchable(false); |
| | | |
| | | mBinding.setSelfBean(bean); |
| | | mBinding.setSpouseBean(bean.getSpouse()); |
| | | ZoomLayout zoomLayout = (ZoomLayout) familyMemberView.getParent().getParent(); |
| | | popupWindow.setHeight(zoomLayout.getHeight()); |
| | | popupWindow.setWidth(zoomLayout.getWidth()); |
| | | popupWindow.showAtLocation((View) familyMemberView.getParent().getParent(), Gravity.BOTTOM,0,0); |
| | | } |
| | | }); |
| | | return familyMemberView; |
| | | } |
| | | |
| | | protected ImageView createExpandIconView() { |
| | | ImageView expandView = new ImageView(AppManager.getAppManager().currentActivity()); |
| | | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(pathLength,pathLength); |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Path; |
| | | import android.graphics.RectF; |
| | | import android.view.View; |
| | |
| | | private ImageView expandIconView;//展开按钮 |
| | | |
| | | |
| | | public SimpleNode(HomeRootBean member) { |
| | | super(member); |
| | | public SimpleNode(Context context,HomeRootBean member) { |
| | | super(context,member); |
| | | if (member.getIdentity() > 1 && member.getChildList() != null && member.getChildList().size() > 0){ |
| | | //非 第一代 且 有子代, 节点宽度 = view宽度 + 前后路径长度 + 展开按钮宽度 |
| | | width = pathLength + getItemViewWidth() + pathLength + getExpandIconWidth(); |
| | |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | android:visibility="@{viewModel.beanLiveData.ownData==1}" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | android:visibility="@{viewModel.beanLiveData.ownData==1}" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="持有出入境证件情况" |
| | | android:text="持有境证件情况" |
| | | android:textColor="#ff000000" |
| | | android:textSize="20sp" |
| | | android:textStyle="bold" |
| | |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | android:visibility="@{viewModel.beanLiveData.ownData==1}" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | android:visibility="@{viewModel.beanLiveData.ownData==1}" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | android:visibility="@{viewModel.beanLiveData.ownData==1}" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <data> |
| | | |
| | | </data> |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/activity_play" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#000000"> |
| | | |
| | | |
| | | <com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer |
| | | android:id="@+id/video_player" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_centerInParent="true" /> |
| | | |
| | | </RelativeLayout> |
| | | </layout> |
| | |
| | | </FrameLayout> |
| | | </com.android.app_base.widget.ExtendTitleBar> |
| | | |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="200dp" |
| | | /> |
| | | <RelativeLayout |
| | | android:id="@+id/layout_data_null" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | > |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:src="@drawable/img_data_null" |
| | | android:scaleType="center" |
| | | /> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="还没指定视频 ~" |
| | | android:textColor="#73000000" |
| | | android:layout_gravity="center" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_alignParentBottom="true" |
| | | android:layout_marginBottom="10dp" |
| | | /> |
| | | </RelativeLayout> |
| | | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </layout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| | | |
| | | <data> |
| | | |
| | | </data> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="200dp" |
| | | > |
| | | |
| | | <androidx.viewpager2.widget.ViewPager2 |
| | | android:id="@+id/view_pager" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="200dp" |
| | | /> |
| | | <com.youth.banner.indicator.CircleIndicator |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | /> |
| | | <RelativeLayout |
| | | android:id="@+id/layout_data_null" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | > |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:src="@drawable/img_data_null" |
| | | android:scaleType="center" |
| | | /> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="还没指定视频 ~" |
| | | android:textColor="#73000000" |
| | | android:layout_gravity="center" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_alignParentBottom="true" |
| | | android:layout_marginBottom="10dp" |
| | | /> |
| | | </RelativeLayout> |
| | | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </layout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | android:textColorHint="#6b000000" |
| | | android:textColor="#DE000000" |
| | | android:text="@={bean.content}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入内容`:``}" |
| | | android:textSize="16sp" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | /> |
| | |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ps_ic_shadow_bg" |
| | | app:round="10dp" |
| | | /> |
| | | app:round="10dp" /> |
| | | <ImageView |
| | | android:id="@+id/iv_play" |
| | | android:layout_width="30dp" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center_vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | app:imageUrl="@{bean.img}" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:round="20dp" /> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | |
| | | android:layout_height="40dp" |
| | | android:gravity="center_vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center_vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_flower" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="3dp" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/ic_flower" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/textView1" |
| | | android:layout_width="0dp" |
| | |
| | | android:id="@+id/tv_detail" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="查看详情" |
| | | android:text="每日游记" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" |
| | | android:layout_marginStart="20dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginBottom="@dimen/dp_12" |
| | | android:visibility="gone" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_modify" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer |
| | | android:id="@+id/player" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" /> |
| | | |
| | | </FrameLayout> |
| | |
| | | app:drawableStartCompat="@drawable/ic_operate_order" |
| | | android:drawablePadding="3dp" |
| | | /> |
| | | <LinearLayout |
| | | android:id="@+id/layout_own_top" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:gravity="center_horizontal" |
| | | > |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" |
| | | /> |
| | | <TextView |
| | | android:id="@+id/tv_own_top" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="32dp" |
| | | android:text="本家置顶" |
| | | android:gravity="center" |
| | | android:textColor="#FF333333" |
| | | android:textSize="12sp" |
| | | app:drawableStartCompat="@drawable/ic_operate_order" |
| | | android:drawablePadding="3dp" |
| | | /> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | |
| | | import androidx.lifecycle.Lifecycle; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import androidx.viewpager2.adapter.FragmentStateAdapter; |
| | | import androidx.viewpager2.widget.ViewPager2; |
| | | |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | |
| | |
| | | /** |
| | | * 当前 ViewPager |
| | | */ |
| | | private ViewPager mViewPager; |
| | | private ViewPager2 mViewPager; |
| | | |
| | | |
| | | public BaseVp2FragmentAdapter(@NonNull FragmentActivity fragmentActivity) { |
| | |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 根据 索引 获取某个 Fragment |
| | | */ |
| | | public F getFragment(int index) { |
| | | if (index >= 0 && index < mFragmentList.size()) { |
| | | return (F) mFragmentList.get(index); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static void dropExpand(View view,int initialHeight , int targetHeight) { |
| | | ValueAnimator animator = ValueAnimator.ofInt(initialHeight,targetHeight); |
| | | animator.setDuration(500); |
| | | animator.setDuration(400); |
| | | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | @Override |
| | | public void onAnimationUpdate(ValueAnimator animation) { |
| | |
| | | */ |
| | | public static void pullCollapse(View view,int initialHeight, int targetHeight) { |
| | | ValueAnimator animator = ValueAnimator.ofInt(initialHeight, targetHeight); |
| | | animator.setDuration(500); |
| | | animator.setDuration(400); |
| | | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | @Override |
| | | public void onAnimationUpdate(ValueAnimator animation) { |