改了通知图标
This commit is contained in:
@@ -4,6 +4,7 @@ import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
@@ -16,9 +17,14 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
@@ -65,6 +71,9 @@ import okhttp3.RequestBody;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -159,13 +168,19 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
// }
|
||||
// super.onCreate(savedInstanceState);
|
||||
|
||||
getWindow().setNavigationBarColor(getColor(R.color.white));
|
||||
getWindow().setNavigationBarColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "style_color", "#FFFFFF")));
|
||||
getWindow().getDecorView().setBackgroundColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "windows_color", "#FFFFFF")));
|
||||
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
View decor = getWindow().getDecorView();
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
if (getInt(MainActivity2.this, "is_white", 0) == 1) {
|
||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
} else {
|
||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
@@ -314,6 +329,11 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
// }
|
||||
// webView.loadUrl(linkconfig);
|
||||
// });
|
||||
if (userId == 75) {
|
||||
toPlayers();
|
||||
timer.schedule(timerTask,0,3000);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -370,8 +390,8 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
intent.setData(Uri.parse(uri));
|
||||
startActivity(intent);
|
||||
}
|
||||
layoutOtherApp.setVisibility(View.GONE);
|
||||
ivotherApp.setImageResource(R.mipmap.ic_zhangkai);
|
||||
// layoutOtherApp.setVisibility(View.GONE);
|
||||
// ivotherApp.setImageResource(R.mipmap.ic_zhangkai);
|
||||
}
|
||||
|
||||
private boolean isLuncher = false;
|
||||
@@ -662,6 +682,15 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (userId == 75&&webView!=null&&!TextUtils.isEmpty(webView.getUrl())) {
|
||||
if (url.startsWith("https://mgiwallet.com")) {
|
||||
if(mp!=null){
|
||||
toPlayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {//不能返回了 关闭进程 退出程序
|
||||
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
|
||||
homeIntent.addCategory(Intent.CATEGORY_HOME);
|
||||
@@ -757,7 +786,7 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
webView.setFocusableInTouchMode(true);
|
||||
webView.getSettings().setSupportMultipleWindows(true);
|
||||
|
||||
settings.setSupportZoom(true);
|
||||
settings.setSupportZoom(false);
|
||||
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
|
||||
// webView.setHorizontalScrollbarOverlay(true);
|
||||
webView.setHorizontalScrollBarEnabled(true);
|
||||
@@ -779,7 +808,7 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
|
||||
// new Handler().postDelayed(() -> showTopLy.setVisibility(View.GONE), 3000);
|
||||
// verifyStoragePermissions(this);
|
||||
|
||||
showTopLy.setBackgroundColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "windows_color", "#FFFFFF")));
|
||||
webView.setDownloadListener(new DownloadListener() {
|
||||
@Override
|
||||
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimeType, long contentLength) {
|
||||
@@ -810,8 +839,12 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
public void onSuccess(Result<ResultDataInfo<MessageInfo>> o) {
|
||||
if (o.data != null && o.data.getTotal() > 0) {
|
||||
// notifyVisible = View.VISIBLE;
|
||||
otherApp.setVisibility(View.VISIBLE);
|
||||
otherApp.setVisibility(View.INVISIBLE);
|
||||
|
||||
ivNotify.setVisibility(View.VISIBLE);
|
||||
if(userId == 112){
|
||||
ivNotify.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
ivotherApp.setImageResource(R.mipmap.ic_shousuo);
|
||||
}
|
||||
}
|
||||
@@ -856,7 +889,7 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(dataInfo.getVersionCode())) {
|
||||
if (Integer.parseInt(dataInfo.getVersionCode()) > getInt(MainActivity2.this,"version_code",0)) {
|
||||
if (Integer.parseInt(dataInfo.getVersionCode()) > getInt(MainActivity2.this, "version_code", 0)) {
|
||||
ActionConfirmDialog actionDialog = new ActionConfirmDialog(MainActivity2.this,
|
||||
getString(R.string.banbengengxin_txt), getString(R.string.xiacigengxin_txt),
|
||||
getString(R.string.lijigengxin_txt));
|
||||
@@ -888,15 +921,15 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
telegramUrl = dataInfo.getTgUrl().trim();
|
||||
whatsappUrl = dataInfo.getWsUrl().trim();
|
||||
if (!TextUtils.isEmpty(facebookUrl)) {
|
||||
otherApp.setVisibility(View.VISIBLE);
|
||||
otherApp.setVisibility(View.INVISIBLE);
|
||||
ivFaceBook.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(telegramUrl)) {
|
||||
otherApp.setVisibility(View.VISIBLE);
|
||||
otherApp.setVisibility(View.INVISIBLE);
|
||||
ivTelG.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(whatsappUrl)) {
|
||||
otherApp.setVisibility(View.VISIBLE);
|
||||
otherApp.setVisibility(View.INVISIBLE);
|
||||
ivWhatsApp.setVisibility(View.VISIBLE);
|
||||
}
|
||||
// if (linkconfiglist != null && linkconfiglist.size() > 0) {
|
||||
@@ -1248,6 +1281,8 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
Handler handler = new Handler();
|
||||
|
||||
boolean hasSignIn = false;
|
||||
|
||||
WebViewClient webViewClient = new WebViewClient() {
|
||||
@@ -1260,14 +1295,20 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
if (webView.getUrl().contains("hasSignIn")) {
|
||||
hasSignIn = true;
|
||||
}
|
||||
|
||||
if (userId == 75) {
|
||||
if ((webView.getUrl().startsWith("https://mgiwallet.com"))) {
|
||||
toPlayers();
|
||||
}
|
||||
}
|
||||
int w = View.MeasureSpec.makeMeasureSpec(0,
|
||||
View.MeasureSpec.UNSPECIFIED);
|
||||
int h = View.MeasureSpec.makeMeasureSpec(0,
|
||||
View.MeasureSpec.UNSPECIFIED);
|
||||
// 重新测量
|
||||
webView.measure(w, h);
|
||||
showTopLy.setVisibility(View.GONE);
|
||||
if (showTopLy.getVisibility() == View.VISIBLE) {
|
||||
handler.postDelayed(() -> showTopLy.setVisibility(View.GONE), 1000);
|
||||
}
|
||||
// notifyCardView.setVisibility(notifyVisible);
|
||||
if (webView.getUrl().equals(url + "index") || webView.getUrl().equals(url + "/index")) {
|
||||
isAtGame = false;
|
||||
@@ -1323,13 +1364,22 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
public boolean shouldOverrideUrlLoading(WebView webView, String url1) {
|
||||
|
||||
LogUtils.i("URL是啥:" + url1);
|
||||
|
||||
if (userId == 75) {
|
||||
if ((url1.startsWith("https://mgiwallet.com"))) {
|
||||
toPlayers();
|
||||
} else {
|
||||
toStopPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
if (url1.equals(url + "index") || url1.equals(url + "/index")) {
|
||||
isAtGame = false;
|
||||
topVvvv.setVisibility(View.GONE);
|
||||
} else {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (url1.contains("facebook")||url1.contains("https://t.me")||url1.contains("instagram")||url1.contains("https://x.com")) {
|
||||
if (url1.contains("facebook") || url1.contains("https://t.me") || url1.contains("instagram") || url1.contains("https://x.com")) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
@@ -1374,8 +1424,15 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
uri = Uri.parse(request.toString());
|
||||
}
|
||||
String url1 = uri.toString();
|
||||
|
||||
if (url1.contains("facebook")||url1.contains("https://t.me")||url1.contains("instagram")||url1.contains("https://x.com")) {
|
||||
LogUtils.i("URL是啥1:" + url1);
|
||||
if (userId == 75) {
|
||||
if ((url1.startsWith("https://mgiwallet.com"))) {
|
||||
toPlayers();
|
||||
} else {
|
||||
toStopPlayers();
|
||||
}
|
||||
}
|
||||
if (url1.contains("facebook") || url1.contains("https://t.me") || url1.contains("instagram") || url1.contains("https://x.com")) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
@@ -1420,6 +1477,64 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private static MediaPlayer mp = null;
|
||||
|
||||
private void toStopPlayers() {
|
||||
if (mp != null) {
|
||||
mp.pause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void toPauseDimess() {
|
||||
if (mp != null) {
|
||||
mp.pause();
|
||||
}
|
||||
if (mp != null) {
|
||||
mp.stop();
|
||||
mp.release();
|
||||
mp = null;
|
||||
}
|
||||
if(userId == 75){
|
||||
if(timer!=null){
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
if (timerTask != null){
|
||||
timerTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private int rawRes = -1;
|
||||
|
||||
private void toPlayers() {
|
||||
AudioManager audioManager = (AudioManager) MainActivity2.this.getSystemService(Context.AUDIO_SERVICE);
|
||||
// stop(context);
|
||||
if (mp == null) {
|
||||
if (rawRes == -1) {
|
||||
int rands = new Random().nextInt(2);
|
||||
if (rands == 0) {
|
||||
rawRes = R.raw.title;
|
||||
} else {
|
||||
rawRes = R.raw.town;
|
||||
}
|
||||
}
|
||||
mp = MediaPlayer.create(MainActivity2.this, rawRes);
|
||||
// mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
mp.setAudioAttributes(new AudioAttributes
|
||||
.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.build());
|
||||
mp.setVolume(0.6f, 0.6f);
|
||||
mp.setLooping(true);
|
||||
mp.start();
|
||||
} else {
|
||||
mp.start();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNetError = false;
|
||||
|
||||
public void onShowErrorView(String errorMsg) { //网络不可用的情况
|
||||
@@ -1471,7 +1586,16 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
|
||||
if (url.contains("facebook")||url.contains("https://t.me")||url.contains("instagram")||url.contains("https://x.com")) {
|
||||
LogUtils.i("URL是啥新窗口:"+url);
|
||||
if (userId == 75) {
|
||||
if ((url.startsWith("https://mgiwallet.com"))) {
|
||||
toPlayers();
|
||||
} else {
|
||||
toStopPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
if (url.contains("facebook") || url.contains("https://t.me") || url.contains("instagram") || url.contains("https://x.com")) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
@@ -1514,6 +1638,15 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
@Override
|
||||
public void onCloseWindow(WebView window) {
|
||||
super.onCloseWindow(window);
|
||||
LogUtils.i("URL是啥新窗口结束:"+url);
|
||||
|
||||
if (userId == 75) {
|
||||
if ((window.getUrl().startsWith("https://mgiwallet.com"))) {
|
||||
toPlayers();
|
||||
} else {
|
||||
toStopPlayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1710,6 +1843,8 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
//销毁VebView
|
||||
webView.destroy();
|
||||
}
|
||||
|
||||
toPauseDimess();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -1720,13 +1855,23 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
checkNotify();
|
||||
}
|
||||
|
||||
|
||||
if (userId == 75&&webView!=null&&!TextUtils.isEmpty(webView.getUrl())) {
|
||||
if (webView.getUrl().startsWith("https://mgiwallet.com")) {
|
||||
if(mp!=null){
|
||||
toPlayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (userId == 75) {
|
||||
if (mp != null && mp.isPlaying()) {
|
||||
mp.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1746,18 +1891,44 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
}
|
||||
//wp-caption alignnone
|
||||
|
||||
public static void saveInt(Context context,String key, int value) {
|
||||
public static void saveInt(Context context, String key, int value) {
|
||||
SharedPreferences sp = context.getSharedPreferences("InitApp", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putInt(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int getInt(Context context,String key, int defValue) {
|
||||
public static int getInt(Context context, String key, int defValue) {
|
||||
SharedPreferences sp = context.getSharedPreferences("InitApp", Activity.MODE_PRIVATE);
|
||||
return sp.getInt(key, defValue);
|
||||
}
|
||||
Timer timer = new Timer();
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mainHandler.post(() -> {
|
||||
if(webView!=null&&!TextUtils.isEmpty(webView.getUrl())) {
|
||||
if (webView.getUrl().startsWith("https://mgiwallet.com")&&isApplicationBroughtToBackground(MainActivity2.this)) {
|
||||
if(mp!=null&&!mp.isPlaying()){
|
||||
mp.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
public boolean isApplicationBroughtToBackground(final Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
|
||||
if (!tasks.isEmpty()) {
|
||||
ComponentName topActivity = tasks.get(0).topActivity;
|
||||
if (!topActivity.getPackageName().equals(context.getPackageName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="120dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="@color/dialog_bg"
|
||||
|
||||
BIN
base/src/main/res/raw/title.mp3
Normal file
BIN
base/src/main/res/raw/title.mp3
Normal file
Binary file not shown.
BIN
base/src/main/res/raw/town.mp3
Normal file
BIN
base/src/main/res/raw/town.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user