新增清除缓存,no data点击事件
This commit is contained in:
parent
afc4e207f8
commit
01074ed199
@ -18,10 +18,13 @@ import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.media3.common.C;
|
||||
|
||||
import com.shortdrama.jelly.zyreotv.topics.abslRwgt.AExtractionActivity;
|
||||
import com.shortdrama.jelly.zyreotv.unconfirmedPiecewise.GSTranslatesBean;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class AppUtils {
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
@ -104,5 +107,41 @@ public class AppUtils {
|
||||
return replace.replace("#2#",new2);
|
||||
}
|
||||
|
||||
public static long getFileSize(File file) {
|
||||
long size = 0;
|
||||
if (file.isDirectory()) {
|
||||
for (File child : file.listFiles()) {
|
||||
size += getFileSize(child);
|
||||
}
|
||||
} else {
|
||||
size = file.length();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public static void clearAppCache(Context context) {
|
||||
try {
|
||||
File dir = context.getCacheDir(); // 获取缓存目录
|
||||
deleteDir(dir);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 递归删除目录及其内容
|
||||
public static boolean deleteDir(File dir) {
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (String child : children) {
|
||||
boolean success = deleteDir(new File(dir, child));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除空目录或文件
|
||||
return dir != null && dir.delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -102,6 +102,12 @@ public class MyFirebaseMessageService extends FirebaseMessagingService {
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
setNotification(intent, finalTitle, finalMessageBody, null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setNotification(intent, title, messageBody, null);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.shortdrama.jelly.zyreotv.topics.abslRwgt.app;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.shortdrama.jelly.zyreotv.beginning.ITItem.CONSTANTS_UserWeb_Refresh_Event;
|
||||
import static com.shortdrama.jelly.zyreotv.beginning.ITItem.CONSTANTS_User_Refresh_Event;
|
||||
import static com.shortdrama.jelly.zyreotv.beginning.ITItem.Constants_AppEnter;
|
||||
@ -33,6 +34,8 @@ import com.shortdrama.jelly.zyreotv.unconfirmedPiecewise.GSTranslatesBean;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class ZYTSettingActivity extends IDDetailsRoundActivity<ActivitySettingZytBinding> {
|
||||
|
||||
ActivitySettingZytBinding binding;
|
||||
@ -51,12 +54,15 @@ public class ZYTSettingActivity extends IDDetailsRoundActivity<ActivitySettingZy
|
||||
@Override
|
||||
public void initView() {
|
||||
binding.loading.hide();
|
||||
binding.tvSettingLoginout.setVisibility(VISIBLE);
|
||||
binding.tvSettingDeleteaccount.setVisibility(VISIBLE);
|
||||
translates = AppUtils.getTranslates();
|
||||
if (translates != null) {
|
||||
binding.layoutSettingActionbar.tvToptitle.setText(translates.getGleestream_setting());
|
||||
binding.tvSettingNotify.setText(translates.getGleestream_setting_notify());
|
||||
binding.tvSettingDeleteaccount.setText(translates.getGleestream_setting_deleteaccount());
|
||||
binding.tvSettingLoginout.setText(translates.getGleestream_setting_logout());
|
||||
binding.tvSettingClean.setText(translates.getGleestream_clearcahe());
|
||||
} else {
|
||||
binding.layoutSettingActionbar.tvToptitle.setText(getString(R.string.setting_txt));
|
||||
}
|
||||
@ -66,6 +72,13 @@ public class ZYTSettingActivity extends IDDetailsRoundActivity<ActivitySettingZy
|
||||
binding.tvSettingDeleteaccount.setVisibility(GONE);
|
||||
}
|
||||
|
||||
long size = AppUtils.getFileSize(this.getCacheDir());
|
||||
String total = "0B";
|
||||
if (size > 0) {
|
||||
total = formatSize(size);
|
||||
}
|
||||
|
||||
binding.tvSettingCleanvalue.setText(total);
|
||||
binding.layoutSettingActionbar.ivTopback.setOnClickListener(v -> finish());
|
||||
binding.tvSettingLoginout.setOnClickListener(v -> {
|
||||
if (!TIndicator.isTourist()) {
|
||||
@ -83,7 +96,8 @@ public class ZYTSettingActivity extends IDDetailsRoundActivity<ActivitySettingZy
|
||||
}
|
||||
});
|
||||
binding.tvSettingClean.setOnClickListener(v -> {
|
||||
|
||||
AppUtils.clearAppCache(this);
|
||||
binding.tvSettingCleanvalue.setText("0");
|
||||
});
|
||||
binding.tvSettingNotify.setOnClickListener(v -> {
|
||||
boolean isOpen = NotifyUtils.isNotificationEnable(ZYTSettingActivity.this);
|
||||
@ -112,6 +126,14 @@ public class ZYTSettingActivity extends IDDetailsRoundActivity<ActivitySettingZy
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public String formatSize(long size) {
|
||||
if (size <= 0) return "0 B";
|
||||
final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
|
||||
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
|
||||
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
||||
}
|
||||
|
||||
public void firebaseToken() {
|
||||
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
|
||||
@Override
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.shortdrama.jelly.zyreotv.topics.abslRwgt.movepage;
|
||||
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
@ -82,6 +85,11 @@ public class VItemGradlewFragment extends Fragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
loadingdefaultRunning.loading.show();
|
||||
double click6 = 6325.0;
|
||||
loadingdefaultRunning.layoutSearch.setOnClickListener(v -> LRewards.startSearch(getActivity()));
|
||||
loadingdefaultRunning.tvNodata.setOnClickListener(v -> {
|
||||
loadingdefaultRunning.loading.show();
|
||||
setFrontParty();
|
||||
});
|
||||
setFrontParty();
|
||||
boolean currenth = true;
|
||||
if (currenth) {
|
||||
@ -98,7 +106,6 @@ public class VItemGradlewFragment extends Fragment {
|
||||
private List<KLAnnerBean> androidClose;
|
||||
|
||||
private void setFrontParty() {
|
||||
loadingdefaultRunning.layoutSearch.setOnClickListener(v -> LRewards.startSearch(getActivity()));
|
||||
VZBack.getInstance().homeTop()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -108,6 +115,7 @@ public class VItemGradlewFragment extends Fragment {
|
||||
public void onSuccess(IMACloseStroke<CFRewardsLoginBean> feedbackResp) {
|
||||
loadingdefaultRunning.loading.hide();
|
||||
if (feedbackResp.data != null) {
|
||||
loadingdefaultRunning.tvNodata.setVisibility(GONE);
|
||||
List<BMRagmentBean> KLAnnerBeans = feedbackResp.data.getCategory();
|
||||
int indicatorO = 1949;
|
||||
if (indicatorO >= 109) {
|
||||
@ -133,6 +141,8 @@ public class VItemGradlewFragment extends Fragment {
|
||||
myCountDownTimer.start();
|
||||
}
|
||||
|
||||
}else{
|
||||
loadingdefaultRunning.tvNodata.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
@ -140,6 +150,7 @@ public class VItemGradlewFragment extends Fragment {
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
loadingdefaultRunning.loading.hide();
|
||||
loadingdefaultRunning.tvNodata.setVisibility(VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -113,6 +113,11 @@ public class FLSFragmentOogleFragment extends Fragment implements ICEventDetails
|
||||
long drawy = 8042L;
|
||||
if (drawy == 123) {
|
||||
}
|
||||
tipsPageView.layoutEmpty.setOnClickListener(v -> {
|
||||
tipsPageView.avi.show();
|
||||
loadZyreotv = 1;
|
||||
seenMarkView.getExploreVideoList(loadZyreotv, 20);
|
||||
});
|
||||
tipsPageView.viewPagerExploreEpisode.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
@ -188,6 +193,7 @@ public class FLSFragmentOogleFragment extends Fragment implements ICEventDetails
|
||||
public void logic() {
|
||||
|
||||
seenMarkView.getExploreVideoLiveData().observe(getViewLifecycleOwner(), data -> {
|
||||
|
||||
if (data != null) {
|
||||
if (loadZyreotv == 1) {
|
||||
if (data.data.getList().isEmpty()) {
|
||||
@ -232,7 +238,11 @@ public class FLSFragmentOogleFragment extends Fragment implements ICEventDetails
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tipsPageView.layoutEmpty.setVisibility(View.VISIBLE);
|
||||
if(loadZyreotv==1){
|
||||
tipsPageView.layoutEmpty.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
tipsPageView.layoutEmpty.setVisibility(View.GONE);
|
||||
}
|
||||
float settingsD = 4846.0f;
|
||||
while (settingsD > 98) {
|
||||
break;
|
||||
|
@ -35,10 +35,10 @@ public class ZYTStoreSubVipAdapter extends BaseQuickAdapter<ZYTPaySettingBean.Vi
|
||||
AppCompatTextView tvDonateCoins = holder.getView(R.id.tv_membership_donatecoins);
|
||||
AppCompatTextView tvIntroduce = holder.getView(R.id.tv_membership_introduce);
|
||||
|
||||
tvTitle.setText(item.getTitle() + "");
|
||||
tvTitle.setText(item.getBrief() + "");
|
||||
tvCurrency.setText(item.getCurrency() + "");
|
||||
tvPrice.setText(item.getPrice() + "");
|
||||
tvVipType.setText("/" + item.getVip_type() + "");
|
||||
tvVipType.setText("/" + item.getShort_type() + "");
|
||||
tvDesc.setText(item.getDescription() + "");
|
||||
tvDonateCoins.setText("+Extra " + item.getSend_coins());
|
||||
GSTranslatesBean.Translates translates = AppUtils.getTranslates();
|
||||
|
@ -144,6 +144,15 @@ public class GSTranslatesBean {
|
||||
private String gleestream_today;
|
||||
private String gleestream_yesterday;
|
||||
private String gleestream_earlier;
|
||||
private String gleestream_clearcahe;
|
||||
|
||||
public String getGleestream_clearcahe() {
|
||||
return gleestream_clearcahe;
|
||||
}
|
||||
|
||||
public void setGleestream_clearcahe(String gleestream_clearcahe) {
|
||||
this.gleestream_clearcahe = gleestream_clearcahe;
|
||||
}
|
||||
|
||||
public String getGleestream_today() {
|
||||
return gleestream_today;
|
||||
|
@ -98,6 +98,18 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_nodata"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/strokeCornorBottom"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/itemItemVideohistory"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -56,7 +56,7 @@
|
||||
|
||||
|
||||
<string name="setting_notify_txt">Notification settings</string>
|
||||
<string name="setting_clean_txt">Clear Cahe</string>
|
||||
<string name="setting_clean_txt">Clear the cache</string>
|
||||
<string name="setting_delete_account">Delete Account</string>
|
||||
<string name="setting_logout">Log Out</string>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user