diff --git a/powerbell/build.properties b/powerbell/build.properties index ed62d0b0..700cc01f 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun Nov 16 01:52:06 GMT 2025 +#Sun Nov 16 05:02:05 GMT 2025 stageCount=0 libraryProject= baseVersion=15.11 publishVersion=15.11.0 -buildCount=28 +buildCount=50 baseBetaVersion=15.11.1 diff --git a/powerbell/src/beta/res/values-zh/string.xml b/powerbell/src/beta/res/values-zh/string.xml index 210946f0..e52345f7 100644 --- a/powerbell/src/beta/res/values-zh/string.xml +++ b/powerbell/src/beta/res/values-zh/string.xml @@ -1,6 +1,6 @@ - 能源钟☆ + PowerBell☆ diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/MainActivity.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/MainActivity.java index bf6a3514..609be047 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/MainActivity.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/MainActivity.java @@ -10,7 +10,6 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; -import android.os.PersistableBundle; import android.provider.MediaStore; import android.text.TextUtils; import android.util.Log; @@ -26,7 +25,7 @@ import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.Toast; import androidx.appcompat.app.AlertDialog; -import cc.winboll.studio.libaes.views.ASupportToolbar; +import androidx.appcompat.widget.Toolbar; import cc.winboll.studio.libappbase.LogActivity; import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.powerbell.MainActivity; @@ -46,8 +45,7 @@ import com.miui.zeus.mimo.sdk.MimoLocation; import com.miui.zeus.mimo.sdk.MimoSdk; import java.util.ArrayList; import java.util.List; -import androidx.appcompat.widget.Toolbar; -import android.view.View; +import java.util.Map; public class MainActivity extends WinBoLLActivity { @@ -59,6 +57,7 @@ public class MainActivity extends WinBoLLActivity { private SharedPreferences mSharedPreferences; private String BANNER_POS_ID = "802e356f1726f9ff39c69308bfd6f06a"; + private String BANNER_POS_ID_WINBOLL = "d129ee5a263911f981a6dc7a9802e3e7"; private BannerAd mBannerAd; private List mAllBanners = new ArrayList<>(); @@ -127,28 +126,12 @@ public class MainActivity extends WinBoLLActivity { // NotificationHelper notificationUtils = new NotificationHelper(this); // notificationUtils.createNotificationChannels(); - LogUtils.d(TAG, "ads start"); - new Thread(new Runnable(){ - @Override - public void run() { - LogUtils.d(TAG, "run() 1"); - runOnUiThread(new Runnable(){ - @Override - public void run() { - LogUtils.d(TAG, "run() 2"); - try { - Thread.sleep(1000); - fetchAd(); - } catch (InterruptedException e) {} - } - }); - } - }).start(); + } - - - + + + // public void onADs(View view) { // LogUtils.d(TAG, "onPostCreate"); // fetchAd(); @@ -328,6 +311,24 @@ public class MainActivity extends WinBoLLActivity { //NotificationHelper.cancelRemindNotification(this); reloadBackground(); setBackgroundColor(); + + //LogUtils.d(TAG, "ads start"); + new Thread(new Runnable(){ + @Override + public void run() { + //LogUtils.d(TAG, "run() 1"); + runOnUiThread(new Runnable(){ + @Override + public void run() { + //LogUtils.d(TAG, "run() 2"); + //try { + //Thread.sleep(1000); + fetchAd(); + //} catch (InterruptedException e) {} + } + }); + } + }).start(); } // Menu icons are inflated just as they were with actionbar @@ -421,7 +422,7 @@ public class MainActivity extends WinBoLLActivity { if (mIsBiddingWin) { //如果竞价成功,传⼊本次实际结算价 - //mBannerAd.setPrice(getPrice()); + mBannerAd.setPrice(getPrice()); } mBannerAd.showAd(this, container, new BannerAd.BannerInteractionListener() { @Override @@ -503,7 +504,10 @@ public class MainActivity extends WinBoLLActivity { LogUtils.d(TAG, "onDownloadCancel"); } }); - ADParams params = new ADParams.Builder().setUpId(BANNER_POS_ID).build(); + + String currentAD_ID = isEvenSecond()?BANNER_POS_ID_WINBOLL: BANNER_POS_ID; + LogUtils.d(TAG, String.format("currentAD_ID = %s", currentAD_ID)); + ADParams params = new ADParams.Builder().setUpId(currentAD_ID).build(); mBannerAd.loadAd(params, new BannerAd.BannerLoadListener() { @Override public void onBannerAdLoadSuccess() { @@ -535,18 +539,41 @@ public class MainActivity extends WinBoLLActivity { }); } -// private long getPrice() { -// if (mBannerAd == null) { -// return 0; -// } -// Map map = mBannerAd.getMediaExtraInfo(); -// if (map == null || map.isEmpty()) { -// return 0; -// } -// return (long) map.get("price"); + /** + * 判断当前时间是单数秒还是双数秒 + * @return true:双数秒(0、2、4...),false:单数秒(1、3、5...) + */ + private boolean isEvenSecond() { + // 1. 获取当前毫秒级时间戳 + long currentTimeMillis = System.currentTimeMillis(); + // 2. 转换为秒数(毫秒 ÷ 1000,向下取整) + long currentSecond = currentTimeMillis / 1000; + // 3. 对 2 取余:余数为 0 是双数秒,余数为 1 是单数秒 + return currentSecond % 2 == 0; + } + + /** + * 扩展:获取当前秒数的奇偶描述(直接返回文字说明) + * @return 字符串:"单数秒" 或 "双数秒" + */ +// private String getSecondParityDesc() { +// long currentSecond = System.currentTimeMillis() / 1000; +// return (currentSecond % 2 == 0) ? "双数秒" : "单数秒"; // } + private long getPrice() { + if (mBannerAd == null) { + return 0; + } + Map map = mBannerAd.getMediaExtraInfo(); + if (map == null || map.isEmpty()) { + return 0; + } + return (long) map.get("price"); + } + + private void showPrivacy() { String privacyAgreeValue = getSharedPreferences().getString(PRIVACY_VALUE, null); if (TextUtils.equals(privacyAgreeValue, String.valueOf(0))) { diff --git a/powerbell/src/main/res/layout/activity_main.xml b/powerbell/src/main/res/layout/activity_main.xml index ae87b81e..85d45a49 100644 --- a/powerbell/src/main/res/layout/activity_main.xml +++ b/powerbell/src/main/res/layout/activity_main.xml @@ -22,19 +22,21 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/activitymainRelativeLayout1" - android:background="#FFEE2121"/> + android:background="#FFB7B7B7"/> + + android:layout_height="wrap_content" + android:id="@+id/activitymainLinearLayout1"> - diff --git a/powerbell/src/main/res/values-zh/strings.xml b/powerbell/src/main/res/values-zh/strings.xml index 91a6587f..59f9420a 100644 --- a/powerbell/src/main/res/values-zh/strings.xml +++ b/powerbell/src/main/res/values-zh/strings.xml @@ -1,6 +1,6 @@ - 能源钟 + PowerBell 一个接收手机电量信息的应用,当电量值达到设定范围时会提醒用户。 本应用崩溃了,作者水平有限,敬请谅解! Main View diff --git a/powerbell/src/main/res/values/colors.xml b/powerbell/src/main/res/values/colors.xml index 800b26bd..a81deb77 100644 --- a/powerbell/src/main/res/values/colors.xml +++ b/powerbell/src/main/res/values/colors.xml @@ -25,16 +25,15 @@ #FF0072A4 #FF33C1FF #FFFCC500 - @color/colorShuiDark + + #FFBEBE48 + #FFC85C5C + #FF2677C7 #FF000000 - @color/colorHuo - @color/colorShui - @color/colorXinling + @color/colorBlack - + + @color/colorShui + @color/colorShuiDark + @color/colorShuiAccent @color/colorRed @color/colorBlue @color/colorYellow - --> + #FFFFFFFF