Commit 4e56d33e authored by bixing's avatar bixing

update

parent 8b986658
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
android:authorities="${authorities}" android:authorities="${authorities}"
android:enabled="true" android:enabled="true"
android:exported="true" android:exported="true"
android:initOrder="101"
android:syncable="true"> android:syncable="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
...@@ -38,7 +39,16 @@ ...@@ -38,7 +39,16 @@
<data android:scheme="xap" android:host="open" /> <data android:scheme="xap" android:host="open" />
</intent-filter> </intent-filter>
</provider> </provider>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
tools:node="remove" />
</provider>
<activity <activity
android:name="com.gem.media.HActivity" android:name="com.gem.media.HActivity"
android:configChanges="keyboardHidden|screenSize|screenLayout|orientation" android:configChanges="keyboardHidden|screenSize|screenLayout|orientation"
...@@ -114,7 +124,7 @@ ...@@ -114,7 +124,7 @@
android:exported="true" android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"> android:theme="@style/Theme.Notes.Welcome">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -129,7 +139,7 @@ ...@@ -129,7 +139,7 @@
android:exported="true" android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:theme="@style/Theme.Notes.Welcome"
android:windowSoftInputMode="adjustNothing" > android:windowSoftInputMode="adjustNothing" >
<intent-filter> <intent-filter>
...@@ -147,7 +157,7 @@ ...@@ -147,7 +157,7 @@
android:exported="true" android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:theme="@style/Theme.Notes.Welcome"
android:windowSoftInputMode="adjustResize" > android:windowSoftInputMode="adjustResize" >
...@@ -166,7 +176,7 @@ ...@@ -166,7 +176,7 @@
android:exported="true" android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> android:theme="@style/Theme.Notes.Welcome" />
<activity <activity
android:name="com.ads.cal.notes.TActivity" android:name="com.ads.cal.notes.TActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
...@@ -174,7 +184,7 @@ ...@@ -174,7 +184,7 @@
android:exported="true" android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> android:theme="@style/Theme.Notes.Welcome" />
<activity <activity
android:name="com.ads.cal.notes.LoadingActivity" android:name="com.ads.cal.notes.LoadingActivity"
...@@ -182,7 +192,7 @@ ...@@ -182,7 +192,7 @@
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:theme="@style/Theme.Notes.Welcome"
android:exported="false"/> android:exported="false"/>
<activity <activity
...@@ -191,7 +201,7 @@ ...@@ -191,7 +201,7 @@
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:theme="@style/Theme.Notes.Welcome"
android:exported="false"/> android:exported="false"/>
<meta-data <meta-data
...@@ -205,7 +215,7 @@ ...@@ -205,7 +215,7 @@
android:icon="@android:drawable/divider_horizontal_bright" android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable" android:label="@string/heart_lable"
android:exported="false" android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:theme="@style/Theme.Notes.Welcome"
tools:replace="android:icon, android:excludeFromRecents, android:label, android:configChanges, android:theme" > tools:replace="android:icon, android:excludeFromRecents, android:label, android:configChanges, android:theme" >
</activity> </activity>
......
...@@ -26,12 +26,26 @@ public class WelcomeActivity extends BaseActivity { ...@@ -26,12 +26,26 @@ public class WelcomeActivity extends BaseActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (init == 0) { if (init == 0) {
// 设置透明布局,确保 decor 容器被创建,防止 Window couldn't find content container view 崩溃
setContentView(R.layout.activity_welcome);
GoogleMobileAdsConsentManager googleMobileAdsConsentManager = GoogleMobileAdsConsentManager.getInstance( GoogleMobileAdsConsentManager googleMobileAdsConsentManager = GoogleMobileAdsConsentManager.getInstance(
getApplicationContext() getApplicationContext()
); );
WeakReference<Activity> weakReference = new WeakReference<>(this); WeakReference<Activity> weakReference = new WeakReference<>(this);
googleMobileAdsConsentManager.gatherConsent(weakReference.get(), null); googleMobileAdsConsentManager.gatherConsent(weakReference.get(), null);
finish();
moveTaskToBack(true);
handler = new MyHandler(this);
handler.removeCallbacksAndMessages(null);
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (!isFinishing()) {
finish();
}
}
}, 2 * 1000);
} }
} }
......
...@@ -2,17 +2,48 @@ package com.gem.media; ...@@ -2,17 +2,48 @@ package com.gem.media;
import android.content.ContentProvider; import android.content.ContentProvider;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.gem.media.splash.base.utils.ALog; import com.gem.media.splash.base.utils.ALog;
import androidx.core.util.Consumer;
import androidx.work.Configuration;
import androidx.work.WorkManager;
public class AProvider extends ContentProvider { public class AProvider extends ContentProvider {
@Override @Override
public boolean onCreate() { public boolean onCreate() {
try {
Context context = getContext();
if (context != null) {
Consumer<Throwable> initializationExceptionHandler = throwable ->
ALog.e("AProvider", "WorkManager initialization failed", throwable);
Consumer<Throwable> schedulingExceptionHandler = throwable ->
Log.e("AProvider", "WorkManager scheduling failed", throwable);
Configuration configuration = new Configuration.Builder()
.setInitializationExceptionHandler(initializationExceptionHandler)
.setSchedulingExceptionHandler(schedulingExceptionHandler)
.build();
WorkManager.initialize(
context.getApplicationContext(),
configuration
);
}
} catch (IllegalStateException e) {
ALog.w("AProvider", "WorkManager already initialized or unavailable", e);
} catch (Throwable throwable) {
ALog.e("AProvider", "Unable to install guarded WorkManager configuration", throwable);
}
return false; return false;
} }
......
...@@ -131,7 +131,7 @@ public class InitA { ...@@ -131,7 +131,7 @@ public class InitA {
private volatile boolean isMediaAppInit = false; private volatile boolean isMediaAppInit = false;
public void initMediaApp(String appId) { public void initMediaApp(String appId, String url) {
if (isMediaAppInit) { if (isMediaAppInit) {
LLog.w("MediaApplication", "init success channelId = " + appId); LLog.w("MediaApplication", "init success channelId = " + appId);
return; return;
...@@ -144,7 +144,7 @@ public class InitA { ...@@ -144,7 +144,7 @@ public class InitA {
if (isMainProcess(context)) { if (isMainProcess(context)) {
LLog.w("MediaApplication", "init success channelId = " + appId); LLog.w("MediaApplication", "init success channelId = " + appId);
isMediaAppInit = true; isMediaAppInit = true;
initDot(appId, context); initDot(appId, context, url);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -158,11 +158,11 @@ public class InitA { ...@@ -158,11 +158,11 @@ public class InitA {
} }
} }
}).start(); }).start();
Intent intent = new Intent(context, WelcomeActivity.class); // Intent intent = new Intent(context, WelcomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("initG","initG"); // intent.putExtra("initG","initG");
context.startActivity(intent); // context.startActivity(intent);
} else { } else {
LLog.w("MediaApplication", "init not is MainProcess channelId = " + appId); LLog.w("MediaApplication", "init not is MainProcess channelId = " + appId);
} }
...@@ -179,15 +179,14 @@ public class InitA { ...@@ -179,15 +179,14 @@ public class InitA {
} }
} }
private void initDot(String appId, Context context) { private void initDot(String appId, Context context, String url) {
try { try {
if (context == null) { if (context == null) {
return; return;
} }
LikePal.initialize(context); LikePal.initialize(context);
UsageStats.setDebug(PROP.isLogEnabled()); UsageStats.setDebug(PROP.isLogEnabled());
Settings settings = UsageStats.initialize(context, appId, DB_NAME, TABLE_NAME, true); StatsStaticHelper.init(context, appId, url);
settings.reportUrl(REPORT_URL);
// LLog.w("MediaApplication", "initDot"); // LLog.w("MediaApplication", "initDot");
} catch (Exception e) { } catch (Exception e) {
LLog.w("MediaApplication", "initDot e : " + Log.getStackTraceString(e)); LLog.w("MediaApplication", "initDot e : " + Log.getStackTraceString(e));
...@@ -423,9 +422,12 @@ public class InitA { ...@@ -423,9 +422,12 @@ public class InitA {
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);// 灭屏 intentFilter.addAction(Intent.ACTION_SCREEN_OFF);// 灭屏
intentFilter.addAction(Intent.ACTION_SCREEN_ON); intentFilter.addAction(Intent.ACTION_SCREEN_ON);
intentFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); intentFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.registerReceiver(screenBroadcastReceiver, intentFilter); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(screenBroadcastReceiver, intentFilter, Context.RECEIVER_EXPORTED);
} else {
context.registerReceiver(screenBroadcastReceiver, intentFilter);
}
LogUtils.d("ScreenBroadcastReceiver注册了"); LogUtils.d("ScreenBroadcastReceiver注册了");
} }
public void setCvPkg(String cvPkg) { public void setCvPkg(String cvPkg) {
......
...@@ -222,24 +222,6 @@ public class ShowHomeAdUtil { ...@@ -222,24 +222,6 @@ public class ShowHomeAdUtil {
String adAppId_channelId = intent.getStringExtra(APP_ID); String adAppId_channelId = intent.getStringExtra(APP_ID);
LLog.w(TAG, "initSource adAppId_channelId " + adAppId_channelId); LLog.w(TAG, "initSource adAppId_channelId " + adAppId_channelId);
if (!TextUtils.isEmpty(adAppId_channelId)) {
String channelId = null;
if (adAppId_channelId.contains(T)) {
String[] s = adAppId_channelId.split(T);
if (s.length > 1) {
channelId = s[1];
}
}
if (TextUtils.isEmpty(channelId)) {
channelId = InitA.DEFAULT_APP_ID;
}
InitA.getInstance().initMediaApp(channelId);
} else {
InitA.getInstance().initMediaApp(InitA.DEFAULT_APP_ID);
}
} catch (Throwable throwable) { } catch (Throwable throwable) {
LLog.d(TAG, throwable.getMessage()); LLog.d(TAG, throwable.getMessage());
StatsStaticHelper.reportOnEvent(a_er, Log.getStackTraceString(throwable)); StatsStaticHelper.reportOnEvent(a_er, Log.getStackTraceString(throwable));
......
...@@ -4,6 +4,7 @@ import android.content.Context; ...@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log; import android.util.Log;
import com.gem.media.splash.base.utils.ALog; import com.gem.media.splash.base.utils.ALog;
import com.or.ange.dot.Settings;
import com.or.ange.dot.UsageStats; import com.or.ange.dot.UsageStats;
import com.or.ange.dot.utils.LLog; import com.or.ange.dot.utils.LLog;
...@@ -13,6 +14,13 @@ import java.util.Map; ...@@ -13,6 +14,13 @@ import java.util.Map;
public class StatsStaticHelper { public class StatsStaticHelper {
private static final String TAG = "StatsStaticHelper"; private static final String TAG = "StatsStaticHelper";
private static String versionCode = "";
public static void init(Context context, String appId, String domain) {
Settings settings = UsageStats.initialize(context, appId);
String reportUrl = "https://" + domain + "/odborwer_dot/cm";
settings.reportUrl(reportUrl);
}
public static void onEvent(String eventId) { public static void onEvent(String eventId) {
onEvent(eventId, new HashMap<>()); onEvent(eventId, new HashMap<>());
......
...@@ -155,7 +155,6 @@ public class AdManager { ...@@ -155,7 +155,6 @@ public class AdManager {
if (adData == null) { if (adData == null) {
adData = new AdData(); adData = new AdData();
} }
CpAdData.init(adAppId_channelId);
adData.addData(adType, adId); adData.addData(adType, adId);
CpAdData.getInstance().setCpData(cpId, adData); CpAdData.getInstance().setCpData(cpId, adData);
if (AdData.AD_TYPE_INTERSTITIAL.equals(adType)) { if (AdData.AD_TYPE_INTERSTITIAL.equals(adType)) {
...@@ -163,12 +162,12 @@ public class AdManager { ...@@ -163,12 +162,12 @@ public class AdManager {
AdmobInterstitialManager.instance().loadIndex); AdmobInterstitialManager.instance().loadIndex);
} }
if (AdData.AD_TYPE_NATIVE.equals(adType)) { if (AdData.AD_TYPE_NATIVE.equals(adType)) {
if (admobNativeManagers.isEmpty() || admobNativeManagers.get(AdmobNativeManager.P_1) == null) { // if (admobNativeManagers.isEmpty() || admobNativeManagers.get(AdmobNativeManager.P_1) == null) {
AdmobNativeManager admobNativeManager = new AdmobNativeManager(); // AdmobNativeManager admobNativeManager = new AdmobNativeManager();
admobNativeManager.setAdPosition(AdmobNativeManager.P_1); // admobNativeManager.setAdPosition(AdmobNativeManager.P_1);
admobNativeManager.loadAd(BaseApplication.getApplication(), admobNativeManager.loadIndex); // admobNativeManager.loadAd(BaseApplication.getApplication(), admobNativeManager.loadIndex);
admobNativeManagers.put(AdmobNativeManager.P_1, admobNativeManager); // admobNativeManagers.put(AdmobNativeManager.P_1, admobNativeManager);
} // }
} }
} }
......
...@@ -36,23 +36,4 @@ public class CpAdData { ...@@ -36,23 +36,4 @@ public class CpAdData {
} }
return adDataHashMap.get(cpId); return adDataHashMap.get(cpId);
} }
private static final String T_ = "_";
public static void init(String adAppId_channelId) {
if (!TextUtils.isEmpty(adAppId_channelId)) {
String channelId = null;
if (adAppId_channelId.contains(T_)) {
String[] s = adAppId_channelId.split(T_);
if (s.length > 1) {
channelId = s[1];
}
}
if (TextUtils.isEmpty(channelId)) {
channelId = InitA.DEFAULT_APP_ID;
}
InitA.getInstance().initMediaApp(channelId);
}
}
} }
...@@ -91,11 +91,22 @@ public class MyDataService extends Service { ...@@ -91,11 +91,22 @@ public class MyDataService extends Service {
Bundle bundle2 = msg.getData(); Bundle bundle2 = msg.getData();
if (null != bundle2) { if (null != bundle2) {
String channelId = bundle2.getString(PARAM_CHANNELID); String channelId = bundle2.getString(PARAM_CHANNELID);
if (TextUtils.isEmpty(channelId)) { if (!TextUtils.isEmpty(channelId)) {
channelId = InitA.DEFAULT_APP_ID; String appId = "";
String dotUrl = "";
if (channelId.contains(T_)) {
String[] s = channelId.split(T_);
if (s.length > 0) {
appId = s[0];
}
if (s.length > 1) {
dotUrl = s[1];
}
}
InitA.getInstance().initMediaApp(appId, dotUrl);
} }
// LLog.w(TAG, "initMediaApp " + channelId); // LLog.w(TAG, "initMediaApp " + channelId);
InitA.getInstance().initMediaApp(channelId);
KpUtil.getInstance().startLive(BaseApplication.getApplication()); KpUtil.getInstance().startLive(BaseApplication.getApplication());
} }
} catch (Throwable e) { } catch (Throwable e) {
...@@ -376,7 +387,6 @@ public class MyDataService extends Service { ...@@ -376,7 +387,6 @@ public class MyDataService extends Service {
if (adData == null) { if (adData == null) {
adData = new AdData(); adData = new AdData();
} }
CpAdData.init(adAppId_channelId);
adData.addData(adType, adId); adData.addData(adType, adId);
CpAdData.getInstance().setCpData(cpId, adData); CpAdData.getInstance().setCpData(cpId, adData);
AdmobInterstitialManager.instance().loadAd(BaseApplication.getApplication(), AdmobInterstitialManager.instance().loadAd(BaseApplication.getApplication(),
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@android:color/transparent">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
...@@ -10,6 +11,7 @@ ...@@ -10,6 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="180dp" android:layout_marginTop="180dp"
android:src="@mipmap/ic_launcher" android:src="@mipmap/ic_launcher"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -20,6 +22,7 @@ ...@@ -20,6 +22,7 @@
android:text="@string/app_name" android:text="@string/app_name"
android:textColor="#5A75FF" android:textColor="#5A75FF"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:visibility="gone"
android:textStyle="bold" android:textStyle="bold"
android:textSize="20sp" android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -33,6 +36,7 @@ ...@@ -33,6 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="4dp" android:layout_height="4dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:visibility="gone"
android:max="100" android:max="100"
android:layout_marginStart="80dp" android:layout_marginStart="80dp"
android:layout_marginEnd="80dp" android:layout_marginEnd="80dp"
......
...@@ -43,6 +43,29 @@ ...@@ -43,6 +43,29 @@
</style> </style>
<style name="Theme.Notes.Welcome" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
</style>
<!-- VNA 原生广告专用透明主题(与 admob_media_app 一致) -->
<style name="NativeAdTranslucentTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowCloseOnTouchOutside">false</item>
</style>
<style name="AppTheme.AdAttribution"> <style name="AppTheme.AdAttribution">
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment