我有一个用ngFor显示的对象列表,并且所有对象都有到期日。我要做的是每30秒检查一次到期日期是否到期以及是否到期,以在其上添加红色标记。有什么建议吗?
答案 0 :(得分:1)
TS 代码
在RewardedVideoAdListener rewardAdListener = new RewardedVideoAdListener() {
@Override
public void onRewardedVideoAdLoaded() {
Toast.makeText(getActivity(),"ad is loaded",Toast.LENGTH_SHORT).show();
Log.d("ADS_SHOW","loaded");
}
@Override
public void onRewardedVideoAdOpened() {
}
@Override
public void onRewardedVideoStarted() {
}
@Override
public void onRewardedVideoAdClosed() {
loadRewardedAdVideo();
}
@Override
public void onRewarded(RewardItem rewardItem) {
int rewardPoints = rewardItem.getAmount();
int userPoints = getActivity().getSharedPreferences(PREFERENCE,0).getInt(POINTS,0) - rewardPoints;
userRef.child(POINTS).setValue(userPoints);
getActivity().getSharedPreferences(PREFERENCE,0).edit().putInt(POINTS,userPoints).commit();
}
@Override
public void onRewardedVideoAdLeftApplication() {
}
@Override
public void onRewardedVideoAdFailedToLoad(int i) {
Toast.makeText(getActivity(),"No ads to show "+i,Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoCompleted() {
}
};
private void loadRewardedAdVideo(){
if(! mRewardedVideoAd.isLoaded()){
mRewardedVideoAd.loadAd("ca-app-pub-xxxxxxxxx", new AdRequest.Builder().build());
}
}
中遍历数组项并更新已过期项中的某个属性()。
HTML
然后将add_filter('woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways($gateways)
{
global $woocommerce
$current_user = wp_get_current_user();
$users_product = false;
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ){
$post_obj = get_post( $cart_item['product_id'] );
$post_author = $post_obj->post_author;
if ( is_user_logged_in() && $current_user->ID === $post_author ) $users_product = true;
}
if ( $users_product ! = true ) {
unset($gateways['cod']);
}
return $gateways;
}
绑定到该setInterval
属性。