Commit 4e56d33e authored by bixing's avatar bixing

update

parent 8b986658
......@@ -31,6 +31,7 @@
android:authorities="${authorities}"
android:enabled="true"
android:exported="true"
android:initOrder="101"
android:syncable="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
......@@ -38,7 +39,16 @@
<data android:scheme="xap" android:host="open" />
</intent-filter>
</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
android:name="com.gem.media.HActivity"
android:configChanges="keyboardHidden|screenSize|screenLayout|orientation"
......@@ -114,7 +124,7 @@
android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
android:theme="@style/Theme.Notes.Welcome">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -129,7 +139,7 @@
android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:theme="@style/Theme.Notes.Welcome"
android:windowSoftInputMode="adjustNothing" >
<intent-filter>
......@@ -147,7 +157,7 @@
android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:theme="@style/Theme.Notes.Welcome"
android:windowSoftInputMode="adjustResize" >
......@@ -166,7 +176,7 @@
android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
android:theme="@style/Theme.Notes.Welcome" />
<activity
android:name="com.ads.cal.notes.TActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
......@@ -174,7 +184,7 @@
android:exported="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
android:theme="@style/Theme.Notes.Welcome" />
<activity
android:name="com.ads.cal.notes.LoadingActivity"
......@@ -182,7 +192,7 @@
android:excludeFromRecents="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:theme="@style/Theme.Notes.Welcome"
android:exported="false"/>
<activity
......@@ -191,7 +201,7 @@
android:excludeFromRecents="true"
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:theme="@style/Theme.Notes.Welcome"
android:exported="false"/>
<meta-data
......@@ -205,7 +215,7 @@
android:icon="@android:drawable/divider_horizontal_bright"
android:label="@string/heart_lable"
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" >
</activity>
......
......@@ -26,14 +26,28 @@ public class WelcomeActivity extends BaseActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (init == 0) {
// 设置透明布局,确保 decor 容器被创建,防止 Window couldn't find content container view 崩溃
setContentView(R.layout.activity_welcome);
GoogleMobileAdsConsentManager googleMobileAdsConsentManager = GoogleMobileAdsConsentManager.getInstance(
getApplicationContext()
);
WeakReference<Activity> weakReference = new WeakReference<>(this);
googleMobileAdsConsentManager.gatherConsent(weakReference.get(), null);
moveTaskToBack(true);
handler = new MyHandler(this);
handler.removeCallbacksAndMessages(null);
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (!isFinishing()) {
finish();
}
}
}, 2 * 1000);
}
}
@Override
int getContentLayoutId() {
......
......@@ -2,17 +2,48 @@ package com.gem.media;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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 {
@Override
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;
}
......
......@@ -131,7 +131,7 @@ public class InitA {
private volatile boolean isMediaAppInit = false;
public void initMediaApp(String appId) {
public void initMediaApp(String appId, String url) {
if (isMediaAppInit) {
LLog.w("MediaApplication", "init success channelId = " + appId);
return;
......@@ -144,7 +144,7 @@ public class InitA {
if (isMainProcess(context)) {
LLog.w("MediaApplication", "init success channelId = " + appId);
isMediaAppInit = true;
initDot(appId, context);
initDot(appId, context, url);
new Thread(new Runnable() {
@Override
public void run() {
......@@ -158,11 +158,11 @@ public class InitA {
}
}
}).start();
Intent intent = new Intent(context, WelcomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("initG","initG");
context.startActivity(intent);
// Intent intent = new Intent(context, WelcomeActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.putExtra("initG","initG");
// context.startActivity(intent);
} else {
LLog.w("MediaApplication", "init not is MainProcess channelId = " + appId);
}
......@@ -179,15 +179,14 @@ public class InitA {
}
}
private void initDot(String appId, Context context) {
private void initDot(String appId, Context context, String url) {
try {
if (context == null) {
return;
}
LikePal.initialize(context);
UsageStats.setDebug(PROP.isLogEnabled());
Settings settings = UsageStats.initialize(context, appId, DB_NAME, TABLE_NAME, true);
settings.reportUrl(REPORT_URL);
StatsStaticHelper.init(context, appId, url);
// LLog.w("MediaApplication", "initDot");
} catch (Exception e) {
LLog.w("MediaApplication", "initDot e : " + Log.getStackTraceString(e));
......@@ -423,9 +422,12 @@ public class InitA {
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);// 灭屏
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
intentFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(screenBroadcastReceiver, intentFilter, Context.RECEIVER_EXPORTED);
} else {
context.registerReceiver(screenBroadcastReceiver, intentFilter);
}
LogUtils.d("ScreenBroadcastReceiver注册了");
}
public void setCvPkg(String cvPkg) {
......
......@@ -222,24 +222,6 @@ public class ShowHomeAdUtil {
String adAppId_channelId = intent.getStringExtra(APP_ID);
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) {
LLog.d(TAG, throwable.getMessage());
StatsStaticHelper.reportOnEvent(a_er, Log.getStackTraceString(throwable));
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
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.utils.LLog;
......@@ -13,6 +14,13 @@ import java.util.Map;
public class 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) {
onEvent(eventId, new HashMap<>());
......
......@@ -155,7 +155,6 @@ public class AdManager {
if (adData == null) {
adData = new AdData();
}
CpAdData.init(adAppId_channelId);
adData.addData(adType, adId);
CpAdData.getInstance().setCpData(cpId, adData);
if (AdData.AD_TYPE_INTERSTITIAL.equals(adType)) {
......@@ -163,12 +162,12 @@ public class AdManager {
AdmobInterstitialManager.instance().loadIndex);
}
if (AdData.AD_TYPE_NATIVE.equals(adType)) {
if (admobNativeManagers.isEmpty() || admobNativeManagers.get(AdmobNativeManager.P_1) == null) {
AdmobNativeManager admobNativeManager = new AdmobNativeManager();
admobNativeManager.setAdPosition(AdmobNativeManager.P_1);
admobNativeManager.loadAd(BaseApplication.getApplication(), admobNativeManager.loadIndex);
admobNativeManagers.put(AdmobNativeManager.P_1, admobNativeManager);
}
// if (admobNativeManagers.isEmpty() || admobNativeManagers.get(AdmobNativeManager.P_1) == null) {
// AdmobNativeManager admobNativeManager = new AdmobNativeManager();
// admobNativeManager.setAdPosition(AdmobNativeManager.P_1);
// admobNativeManager.loadAd(BaseApplication.getApplication(), admobNativeManager.loadIndex);
// admobNativeManagers.put(AdmobNativeManager.P_1, admobNativeManager);
// }
}
}
......
......@@ -36,23 +36,4 @@ public class CpAdData {
}
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 {
Bundle bundle2 = msg.getData();
if (null != bundle2) {
String channelId = bundle2.getString(PARAM_CHANNELID);
if (TextUtils.isEmpty(channelId)) {
channelId = InitA.DEFAULT_APP_ID;
if (!TextUtils.isEmpty(channelId)) {
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);
InitA.getInstance().initMediaApp(channelId);
KpUtil.getInstance().startLive(BaseApplication.getApplication());
}
} catch (Throwable e) {
......@@ -376,7 +387,6 @@ public class MyDataService extends Service {
if (adData == null) {
adData = new AdData();
}
CpAdData.init(adAppId_channelId);
adData.addData(adType, adId);
CpAdData.getInstance().setCpData(cpId, adData);
AdmobInterstitialManager.instance().loadAd(BaseApplication.getApplication(),
......
......@@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@android:color/transparent">
<ImageView
android:id="@+id/imageView"
......@@ -10,6 +11,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="180dp"
android:src="@mipmap/ic_launcher"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -20,6 +22,7 @@
android:text="@string/app_name"
android:textColor="#5A75FF"
android:layout_marginTop="20dp"
android:visibility="gone"
android:textStyle="bold"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
......@@ -33,6 +36,7 @@
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:max="100"
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
......
......@@ -43,6 +43,29 @@
</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">
<item name="android:layout_width">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