优化项目结构
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,10 +4,10 @@ package com.web.FreeAUD;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import com.web.base.MainActivity2;
|
||||||
import com.google.firebase.messaging.FirebaseMessaging;
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
public class MainActivity extends com.web.base.MainActivity2 {
|
public class MainActivity extends MainActivity2 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -28,11 +28,6 @@ public class MainActivity extends com.web.base.MainActivity2 {
|
|||||||
//订阅主题
|
//订阅主题
|
||||||
FirebaseMessaging.getInstance().subscribeToTopic("demo")
|
FirebaseMessaging.getInstance().subscribeToTopic("demo")
|
||||||
.addOnCompleteListener(task -> {
|
.addOnCompleteListener(task -> {
|
||||||
String msg = "Subscribed";
|
|
||||||
if (!task.isSuccessful()) {
|
|
||||||
msg = "Subscribe failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +40,5 @@ public class MainActivity extends com.web.base.MainActivity2 {
|
|||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,13 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||||
import com.google.firebase.messaging.RemoteMessage;
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.web.base.GsonUtils;
|
import com.web.base.GsonUtils;
|
||||||
import com.web.base.MessageInfo;
|
import com.web.base.MessageInfo;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -34,17 +31,12 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
MessageInfo messageInfo = gson.fromJson(value, MessageInfo.class);
|
MessageInfo messageInfo = gson.fromJson(value, MessageInfo.class);
|
||||||
showNotification(messageInfo);
|
showNotification(messageInfo);
|
||||||
// if (remoteMessage.getNotification() != null) {
|
|
||||||
// showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
//收到通知 创建notify
|
//收到通知 创建notify
|
||||||
if (remoteMessage.getNotification() != null) {
|
if (remoteMessage.getNotification() != null) {
|
||||||
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNotification(MessageInfo messageInfo) {
|
private void showNotification(MessageInfo messageInfo) {
|
||||||
@@ -57,23 +49,11 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
|||||||
.getComponent();
|
.getComponent();
|
||||||
notifyIntent.setComponent(launchComponent);
|
notifyIntent.setComponent(launchComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
notifyIntent.setAction(Intent.ACTION_VIEW);
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
notifyIntent.putExtra("message", messageInfo);
|
notifyIntent.putExtra("message", messageInfo);
|
||||||
|
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
|
||||||
// Intent notifyIntent = new Intent(this, MainActivity2.class);
|
|
||||||
// notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
// // notifyIntent.putExtra("message", messageInfo);
|
|
||||||
// notifyIntent.setAction(Intent.ACTION_VIEW);
|
|
||||||
// notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
|
||||||
// PendingIntent pendingIntent;
|
|
||||||
// pendingIntent = PendingIntent.getActivity
|
|
||||||
// (this, 0, notifyIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
|
|
||||||
|
|
||||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
NotificationChannel channelwinway = null;
|
NotificationChannel channelwinway = null;
|
||||||
NotificationCompat.Builder notificationBuilder = null;
|
NotificationCompat.Builder notificationBuilder = null;
|
||||||
@@ -113,8 +93,6 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
|||||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
notifyIntent.setAction(Intent.ACTION_VIEW);
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
|
|
||||||
|
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
NotificationChannel channelwinway = null;
|
NotificationChannel channelwinway = null;
|
||||||
@@ -143,29 +121,5 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
|||||||
.setContentIntent(pendingIntent);
|
.setContentIntent(pendingIntent);
|
||||||
}
|
}
|
||||||
notificationManager.notify(0, notificationBuilder.build());
|
notificationManager.notify(0, notificationBuilder.build());
|
||||||
//存储数据
|
|
||||||
// saveNotifyMessage(body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public void saveNotifyMessage(String body) {
|
|
||||||
// MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
|
||||||
// String savenotify = Utils.get(getApplication(),ApiService.savenotify,"");
|
|
||||||
// if(messageInfo!=null){
|
|
||||||
// if(TextUtils.isEmpty(savenotify)){
|
|
||||||
// GsonUtils.getListFromJSON(savenotify,)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// String jsonString = GsonUtils.beanToJSONString(chatMessageBeans);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @param key 要设置的key
|
|
||||||
// */
|
|
||||||
// public static void set(Context activity, String key, String is) {
|
|
||||||
// SharedPreferences nameSetting = getConfigShared(activity);
|
|
||||||
// SharedPreferences.Editor namePref = nameSetting.edit();
|
|
||||||
// namePref.putString(key, is);
|
|
||||||
// namePref.commit();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package com.web.FreeAUD;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.tencent.smtt.export.external.TbsCoreSettings;
|
import com.tencent.smtt.export.external.TbsCoreSettings;
|
||||||
import com.tencent.smtt.sdk.QbSdk;
|
import com.tencent.smtt.sdk.QbSdk;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class WebApplication extends Application {
|
public class WebApplication extends Application {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,8 +7,6 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
|
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,13 +77,10 @@ public class ActionBankInfoDialog extends Dialog {
|
|||||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||||
adapter = new MyBankListAdapter(listdata);
|
adapter = new MyBankListAdapter(listdata);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
adapter.setOnItemClick(new MyBankListAdapter.onItemClickPostionListener() {
|
adapter.setOnItemClick(position -> {
|
||||||
@Override
|
itemSelector = listdata.get(position);
|
||||||
public void item(int position) {
|
tvbankName.setText(itemSelector.getBankName());
|
||||||
itemSelector = listdata.get(position);
|
recyclerView.setVisibility(View.GONE);
|
||||||
tvbankName.setText(itemSelector.getBankName());
|
|
||||||
recyclerView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tvbankName.setText(MainActivity.getString(context, "bankname", ""));
|
tvbankName.setText(MainActivity.getString(context, "bankname", ""));
|
||||||
@@ -157,12 +154,6 @@ public class ActionBankInfoDialog extends Dialog {
|
|||||||
adapter.setListdata(listdata);
|
adapter.setListdata(listdata);
|
||||||
listCountryAdapter.setListdata(listcountry);
|
listCountryAdapter.setListdata(listcountry);
|
||||||
}
|
}
|
||||||
// if (o.data != null && o.data.size() > 0) {
|
|
||||||
// listdata.clear();
|
|
||||||
// listdata.addAll(o.data);
|
|
||||||
// adapter.setListdata(listdata);
|
|
||||||
// recyclerView.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,13 +50,10 @@ public class ActionSelectDialog extends Dialog {
|
|||||||
shareTv = (TextView) findViewById(R.id.share);
|
shareTv = (TextView) findViewById(R.id.share);
|
||||||
checkTv = (TextView) findViewById(R.id.check);
|
checkTv = (TextView) findViewById(R.id.check);
|
||||||
|
|
||||||
shareTv.setOnClickListener(new View.OnClickListener() {
|
shareTv.setOnClickListener(view -> {
|
||||||
@Override
|
dismiss();
|
||||||
public void onClick(View view) {
|
if (onToLoginListener != null) {
|
||||||
dismiss();
|
onToLoginListener.toShare();
|
||||||
if (onToLoginListener != null) {
|
|
||||||
onToLoginListener.toShare();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
checkTv.setOnClickListener(view -> {
|
checkTv.setOnClickListener(view -> {
|
||||||
@@ -94,25 +91,5 @@ public class ActionSelectDialog extends Dialog {
|
|||||||
window.setAttributes(wlp);
|
window.setAttributes(wlp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void fullScreenImmersive(View view) {
|
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
// int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
||||||
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
||||||
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
|
||||||
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
||||||
// | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
|
||||||
// view.setSystemUiVisibility(uiOptions);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void show() {
|
|
||||||
// this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
|
||||||
// super.show();
|
|
||||||
// fullScreenImmersive(getWindow().getDecorView());
|
|
||||||
// this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import android.widget.Toast;
|
|||||||
public class ActionWithDrawApplyDialog extends Dialog {
|
public class ActionWithDrawApplyDialog extends Dialog {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private View lineV;
|
private View lineV;
|
||||||
|
|
||||||
|
|
||||||
private EditText inputTxt;
|
private EditText inputTxt;
|
||||||
private TextView cancelTv;
|
private TextView cancelTv;
|
||||||
private TextView sumbitTv;
|
private TextView sumbitTv;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface ApiService {
|
|||||||
String URL = "https://api.liulao.top/";
|
String URL = "https://api.liulao.top/";
|
||||||
// String URL = "http://192.168.8.184:8000/";
|
// String URL = "http://192.168.8.184:8000/";
|
||||||
|
|
||||||
public static final String savenotify ="notify";
|
String savenotify ="notify";
|
||||||
|
|
||||||
|
|
||||||
@GET("api/system/applicationConf")
|
@GET("api/system/applicationConf")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.view.View;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class DialogUtil {
|
public class DialogUtil {
|
||||||
/**
|
/**
|
||||||
* 隐藏虚拟栏 ,显示的时候再隐藏掉
|
* 隐藏虚拟栏 ,显示的时候再隐藏掉
|
||||||
|
|||||||
@@ -58,12 +58,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(getIntent().getBooleanExtra("isChange",false)){
|
|
||||||
// toNextActivity();
|
|
||||||
// }else{
|
|
||||||
// findViewById(R.id.big_v).setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
setListener();
|
setListener();
|
||||||
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(inputTextView, 10, 50, 2, TypedValue.COMPLEX_UNIT_SP);
|
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(inputTextView, 10, 50, 2, TypedValue.COMPLEX_UNIT_SP);
|
||||||
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(outputTextView, 10, 50, 2, TypedValue.COMPLEX_UNIT_SP);
|
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(outputTextView, 10, 50, 2, TypedValue.COMPLEX_UNIT_SP);
|
||||||
|
|||||||
@@ -11,13 +11,10 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.media.AudioAttributes;
|
import android.media.AudioAttributes;
|
||||||
import android.media.AudioManager;
|
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -31,14 +28,11 @@ import android.util.Log;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
@@ -46,7 +40,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import androidx.cardview.widget.CardView;
|
import androidx.cardview.widget.CardView;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.king.app.updater.AppUpdater;
|
import com.king.app.updater.AppUpdater;
|
||||||
@@ -59,14 +52,12 @@ import com.tencent.smtt.sdk.WebChromeClient;
|
|||||||
import com.tencent.smtt.sdk.WebSettings;
|
import com.tencent.smtt.sdk.WebSettings;
|
||||||
import com.tencent.smtt.sdk.WebView;
|
import com.tencent.smtt.sdk.WebView;
|
||||||
import com.tencent.smtt.sdk.WebViewClient;
|
import com.tencent.smtt.sdk.WebViewClient;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
@@ -78,8 +69,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
LinearLayout layoutError;
|
LinearLayout layoutError;
|
||||||
ImageView show_top_v;
|
ImageView show_top_v;
|
||||||
private ImageView showTopV1;
|
private ImageView showTopV1;
|
||||||
ImageView menu_iv;
|
|
||||||
private ImageView helpIv;
|
|
||||||
private LinearLayout showTopLy;
|
private LinearLayout showTopLy;
|
||||||
FloatingActionButton floatingActionButton;
|
FloatingActionButton floatingActionButton;
|
||||||
CardView otherApp;
|
CardView otherApp;
|
||||||
@@ -94,35 +83,17 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
TextView tvLink;
|
TextView tvLink;
|
||||||
ImageView ivLinkBg;
|
ImageView ivLinkBg;
|
||||||
CardView ivHome;
|
CardView ivHome;
|
||||||
|
|
||||||
String downloadImageUrl = "";
|
|
||||||
private int requestCode;
|
|
||||||
private String[] permissions;
|
|
||||||
private int[] grantResults;
|
|
||||||
private View topVvvv;
|
private View topVvvv;
|
||||||
private int index = 0;
|
|
||||||
private FrameLayout videoContainer;
|
|
||||||
|
|
||||||
private ImageView backIv;
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
//https://m.xiannvtu.com/
|
|
||||||
//https://m.xiannvtu.com/
|
|
||||||
// public static String url = "https://candy916.co/";
|
|
||||||
public static String url = "https://candy916.co/";
|
public static String url = "https://candy916.co/";
|
||||||
|
|
||||||
//先定义
|
//先定义
|
||||||
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
||||||
|
|
||||||
public static int userId = 2;
|
public static int userId = 2;
|
||||||
private int notifyVisible = View.GONE;
|
|
||||||
|
|
||||||
private String shareUrl;
|
private String shareUrl;
|
||||||
private String myInviteCode;
|
private String myInviteCode;
|
||||||
private int myInviteNum;
|
|
||||||
|
|
||||||
private int contactApply = 1;
|
private int contactApply = 1;
|
||||||
private int notifyApply = 1;
|
private int notifyApply = 1;
|
||||||
|
|
||||||
private String facebookUrl = "";
|
private String facebookUrl = "";
|
||||||
private String whatsappUrl = "";
|
private String whatsappUrl = "";
|
||||||
private String telegramUrl = "";
|
private String telegramUrl = "";
|
||||||
@@ -143,31 +114,14 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
recordNotify(messageInfo.getPushId());
|
recordNotify(messageInfo.getPushId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
// if (Build.VERSION.SDK_INT >= 30) {
|
|
||||||
// } else {
|
|
||||||
// setTheme(R.style.AppThemeStart1);
|
|
||||||
// getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
|
||||||
// getWindow().setStatusBarColor(Color.TRANSPARENT);
|
|
||||||
// }
|
|
||||||
// if (Build.VERSION.SDK_INT >= 33) {
|
|
||||||
// getWindow().setDecorFitsSystemWindows(false);
|
|
||||||
// } else {
|
|
||||||
// getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
|
||||||
// }
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
getWindow().setNavigationBarColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "style_color", "#FFFFFF")));
|
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().setBackgroundColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "windows_color", "#FFFFFF")));
|
||||||
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
View decor = getWindow().getDecorView();
|
View decor = getWindow().getDecorView();
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
||||||
@@ -181,13 +135,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
actionBar.hide();
|
actionBar.hide();
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_main2);
|
setContentView(R.layout.activity_main2);
|
||||||
// View bottomV = findViewById(R.id.bottom_v);
|
|
||||||
// if (Build.VERSION.SDK_INT >= 30) {
|
|
||||||
// ViewGroup.LayoutParams layoutParams = bottomV.getLayoutParams();
|
|
||||||
// layoutParams.height = getNavigationBarHeight(this);
|
|
||||||
// bottomV.setLayoutParams(layoutParams);
|
|
||||||
// getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
|
||||||
// }
|
|
||||||
String body = getIntent().getStringExtra("message");
|
String body = getIntent().getStringExtra("message");
|
||||||
if (!TextUtils.isEmpty(body)) {
|
if (!TextUtils.isEmpty(body)) {
|
||||||
MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
||||||
@@ -195,39 +142,14 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
startActivity(new Intent(MainActivity2.this, NotifyListActivity.class).putExtra("message", messageInfo));
|
startActivity(new Intent(MainActivity2.this, NotifyListActivity.class).putExtra("message", messageInfo));
|
||||||
recordNotify(messageInfo.getPushId());
|
recordNotify(messageInfo.getPushId());
|
||||||
}
|
}
|
||||||
// if (messageInfo != null && (messageInfo.getType() == 2 || messageInfo.getType() == 3)) {
|
|
||||||
// startActivity(new Intent(MainActivity2.this, NotifyDetailsActivity.class).putExtra("message", messageInfo));
|
|
||||||
// } else {
|
|
||||||
// recordNotify(messageInfo.getPushId());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FirebaseMessaging.getInstance().getToken()
|
|
||||||
// .addOnCompleteListener(new OnCompleteListener<String>() {
|
|
||||||
// @Override
|
|
||||||
// public void onComplete(@NonNull Task<String> task) {
|
|
||||||
// if (!task.isSuccessful()) {
|
|
||||||
// LogUtils.d("Fetching FCM registration token failed" + task.getException());
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Get new FCM registration token
|
|
||||||
// String token = task.getResult();
|
|
||||||
//
|
|
||||||
// // Log and toast
|
|
||||||
//
|
|
||||||
// LogUtils.d("token=="+token);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
boolean isDownload = MainActivity.getBoolean(MainActivity2.this, "download", false);
|
boolean isDownload = MainActivity.getBoolean(MainActivity2.this, "download", false);
|
||||||
if (!isDownload) {
|
if (!isDownload) {
|
||||||
setDownloadNumbers();
|
setDownloadNumbers();
|
||||||
}
|
}
|
||||||
initView();
|
initView();
|
||||||
// setopHeight();
|
|
||||||
findViewById(R.id.back_iv).setOnClickListener(view -> onBackPressed());
|
findViewById(R.id.back_iv).setOnClickListener(view -> onBackPressed());
|
||||||
|
|
||||||
|
|
||||||
floatingActionButton = findViewById(R.id.bt_menu);
|
floatingActionButton = findViewById(R.id.bt_menu);
|
||||||
otherApp = findViewById(R.id.bt_otherapp);
|
otherApp = findViewById(R.id.bt_otherapp);
|
||||||
ivotherApp = findViewById(R.id.iv_otherApp);
|
ivotherApp = findViewById(R.id.iv_otherApp);
|
||||||
@@ -241,30 +163,22 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
tvLink = findViewById(R.id.tv_link);
|
tvLink = findViewById(R.id.tv_link);
|
||||||
ivLinkBg = findViewById(R.id.iv_linkbg);
|
ivLinkBg = findViewById(R.id.iv_linkbg);
|
||||||
ivHome = findViewById(R.id.iv_home);
|
ivHome = findViewById(R.id.iv_home);
|
||||||
// List<String> telpacks = new ArrayList<>();
|
|
||||||
// telpacks.add("org.telegram.messenger");
|
|
||||||
// telpacks.add("org.telegram.messenger.web");
|
|
||||||
ivNotify.setOnClickListener(view -> {
|
ivNotify.setOnClickListener(view -> {
|
||||||
notifyclick();
|
notifyclick();
|
||||||
});
|
});
|
||||||
ivFaceBook.setOnClickListener(view -> {
|
ivFaceBook.setOnClickListener(view -> {
|
||||||
//isLuncher = false;
|
|
||||||
toOtherApp(facebookUrl, "com.facebook.katana", 1);
|
toOtherApp(facebookUrl, "com.facebook.katana", 1);
|
||||||
});
|
});
|
||||||
ivTelG.setOnClickListener(view -> {
|
ivTelG.setOnClickListener(view -> {
|
||||||
// isLuncher = false;
|
|
||||||
toOtherApp(telegramUrl, "org.telegram.messenger", 2);
|
toOtherApp(telegramUrl, "org.telegram.messenger", 2);
|
||||||
});
|
});
|
||||||
ivWhatsApp.setOnClickListener(view -> {
|
ivWhatsApp.setOnClickListener(view -> {
|
||||||
//isLuncher = false;
|
|
||||||
toOtherApp(whatsappUrl, "com.whatsapp", 3);
|
toOtherApp(whatsappUrl, "com.whatsapp", 3);
|
||||||
});
|
});
|
||||||
ivLink.setOnClickListener(view -> {
|
ivLink.setOnClickListener(view -> {
|
||||||
//isLuncher = false;
|
|
||||||
webView.loadUrl(linkconfiglist.get(0).getLinkUrl());
|
webView.loadUrl(linkconfiglist.get(0).getLinkUrl());
|
||||||
});
|
});
|
||||||
ivHome.setOnClickListener(view -> {
|
ivHome.setOnClickListener(view -> {
|
||||||
//isLuncher = false;
|
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
});
|
});
|
||||||
floatingActionButton.setOnClickListener(view -> {
|
floatingActionButton.setOnClickListener(view -> {
|
||||||
@@ -313,18 +227,8 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// getMyInvite(false);
|
|
||||||
setTotalTongJi(); //每日活跃统计
|
setTotalTongJi(); //每日活跃统计
|
||||||
|
|
||||||
// findViewById(R.id.home).setOnClickListener(view -> {
|
|
||||||
// webView.loadUrl(url);
|
|
||||||
// });
|
|
||||||
// findViewById(R.id.tv_other).setOnClickListener(view -> {
|
|
||||||
// if (TextUtils.isEmpty(linkconfig)) {
|
|
||||||
// linkconfig = "https://missav.com/dm37";
|
|
||||||
// }
|
|
||||||
// webView.loadUrl(linkconfig);
|
|
||||||
// });
|
|
||||||
if (userId == 75) {
|
if (userId == 75) {
|
||||||
toPlayers();
|
toPlayers();
|
||||||
timer.schedule(timerTask,0,3000);
|
timer.schedule(timerTask,0,3000);
|
||||||
@@ -356,43 +260,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toOtherApp(String uri, String packagenames, int type) {
|
private void toOtherApp(String uri, String packagenames, int type) {
|
||||||
|
|
||||||
// if (type == 1) {
|
|
||||||
// try {
|
|
||||||
// // 跳转到 Facebook 应用的页面(使用 URI 的页面 ID 或用户名)
|
|
||||||
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/<" + uri + ">")); // 替换 <PAGE_ID>
|
|
||||||
// startActivity(intent);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 如果没有安装 Facebook 应用,跳转到网页
|
|
||||||
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/<" + uri + ">")); // 替换 <PAGE_ID>
|
|
||||||
// startActivity(intent);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (type == 2) {
|
|
||||||
// try {
|
|
||||||
// // 跳转到 Telegram 应用中的特定用户
|
|
||||||
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=<" + uri + ">")); // 替换 <USERNAME>
|
|
||||||
// startActivity(intent);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 如果 Telegram 未安装,跳转到网页版
|
|
||||||
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://t.me/<" + uri + ">")); // 替换 <USERNAME>
|
|
||||||
// startActivity(intent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (type == 3) {
|
|
||||||
// Intent intent = getPackageManager().getLaunchIntentForPackage("com.whatsapp");
|
|
||||||
// if (intent != null) {
|
|
||||||
// startActivity(intent);
|
|
||||||
// } else {
|
|
||||||
// // WhatsApp 未安装,跳转到 Google Play 商店
|
|
||||||
// Intent playStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.whatsapp"));
|
|
||||||
// startActivity(playStoreIntent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//https://www.facebook.com/profile.php?id=61568556460025
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(uri));
|
intent.setData(Uri.parse(uri));
|
||||||
@@ -403,59 +270,9 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
intent.setData(Uri.parse(uri));
|
intent.setData(Uri.parse(uri));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
// layoutOtherApp.setVisibility(View.GONE);
|
|
||||||
// ivotherApp.setImageResource(R.mipmap.ic_zhangkai);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLuncher = false;
|
|
||||||
|
|
||||||
//多个APPName
|
|
||||||
private void toOtherApps(String uri, List<String> packagenames) {
|
|
||||||
int i = 0;
|
|
||||||
while (i < packagenames.size() && !isLuncher) {
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setData(Uri.parse(uri));
|
|
||||||
intent.setPackage(packagenames.get(i));
|
|
||||||
startActivity(intent);
|
|
||||||
isLuncher = true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
i++;
|
|
||||||
isLuncher = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isLuncher) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setData(Uri.parse(uri));
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if (intent.resolveActivity(getPackageManager()) != null) {
|
|
||||||
// startActivity(intent);
|
|
||||||
// } else {
|
|
||||||
// Toast.makeText(this, getString(R.string.app_notinstall), Toast.LENGTH_SHORT).show();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNavigationBarHeight(Context context) {
|
|
||||||
Resources resources = context.getResources();
|
|
||||||
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
|
||||||
return resources.getDimensionPixelSize(resourceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isAppInstall(String packagename) {
|
|
||||||
PackageManager packageManager = getPackageManager();
|
|
||||||
try {
|
|
||||||
PackageInfo packageInfo = packageManager.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
|
|
||||||
if (packageInfo != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showBottomDialog() {
|
public void showBottomDialog() {
|
||||||
ActionSelectDialog actionDialog = new ActionSelectDialog(MainActivity2.this);
|
ActionSelectDialog actionDialog = new ActionSelectDialog(MainActivity2.this);
|
||||||
@@ -640,36 +457,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// // Declare the launcher at the top of your Activity/Fragment:
|
|
||||||
// private final ActivityResultLauncher<String> requestPermissionLauncher =
|
|
||||||
// registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> {
|
|
||||||
// if (isGranted) {
|
|
||||||
// // FCM SDK (and your app) can post notifications.
|
|
||||||
// } else {
|
|
||||||
// // TODO: Inform user that that your app will not show notifications.
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// private void askNotificationPermission() {
|
|
||||||
// // This is only necessary for API level >= 33 (TIRAMISU)
|
|
||||||
// if (Build.VERSION.SDK_INT >= 33) {
|
|
||||||
// if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) ==
|
|
||||||
// PackageManager.PERMISSION_GRANTED) {
|
|
||||||
// // FCM SDK (and your app) can post notifications.
|
|
||||||
// } else if (shouldShowRequestPermissionRationale(Manifest.permission.POST_NOTIFICATIONS)) {
|
|
||||||
// // TODO: display an educational UI explaining to the user the features that will be enabled
|
|
||||||
// // by them granting the POST_NOTIFICATION permission. This UI should provide the user
|
|
||||||
// // "OK" and "No thanks" buttons. If the user selects "OK," directly request the permission.
|
|
||||||
// // If the user selects "No thanks," allow the user to continue without notifications.
|
|
||||||
// } else {
|
|
||||||
// // Directly ask for the permission
|
|
||||||
// requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
@@ -715,42 +502,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeChildView(int child) {
|
|
||||||
WebView childView = (WebView) webView.getChildAt(child - 1);
|
|
||||||
webView.removeView(childView);
|
|
||||||
if (webView.canGoBack()) {
|
|
||||||
webView.goBack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改图标和名称的方法
|
|
||||||
*/
|
|
||||||
public void changeIcon() {
|
|
||||||
PackageManager pm = getApplicationContext().getPackageManager();
|
|
||||||
|
|
||||||
pm.setComponentEnabledSetting(new ComponentName(
|
|
||||||
this,
|
|
||||||
"com.web.base.MainActivity"),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
|
||||||
PackageManager.DONT_KILL_APP);
|
|
||||||
Log.d("TAG", "换Test的图标");
|
|
||||||
|
|
||||||
pm.setComponentEnabledSetting(new ComponentName(
|
|
||||||
this,
|
|
||||||
"com.web.base.MainActivityNew"),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
|
||||||
PackageManager.DONT_KILL_APP);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setopHeight() {
|
|
||||||
RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) topVvvv.getLayoutParams(); //取控件textView当前的布局参数
|
|
||||||
linearParams.height = getStatusBarHeight();// 控件的宽强制设成30
|
|
||||||
|
|
||||||
topVvvv.setLayoutParams(linearParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static String[] PERMISSIONS_STORAGE = {
|
private static String[] PERMISSIONS_STORAGE = {
|
||||||
"android.permission.READ_EXTERNAL_STORAGE",
|
"android.permission.READ_EXTERNAL_STORAGE",
|
||||||
@@ -776,8 +527,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
|
|
||||||
showTopV1 = (ImageView) findViewById(R.id.show_top_v1);
|
showTopV1 = (ImageView) findViewById(R.id.show_top_v1);
|
||||||
showTopLy = findViewById(R.id.show_top_ly);
|
showTopLy = findViewById(R.id.show_top_ly);
|
||||||
videoContainer = (FrameLayout) findViewById(R.id.videoContainer);
|
|
||||||
backIv = (ImageView) findViewById(R.id.back_iv);
|
|
||||||
progressBar = (ProgressBar) findViewById(R.id.progressbar);
|
progressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||||
tvErrorMsg = findViewById(R.id.errormsg);
|
tvErrorMsg = findViewById(R.id.errormsg);
|
||||||
layoutError = findViewById(R.id.layoutError);
|
layoutError = findViewById(R.id.layoutError);
|
||||||
@@ -821,8 +570,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
webView.setWebViewClient(webViewClient);
|
webView.setWebViewClient(webViewClient);
|
||||||
Log.i("XHXDEBUG", "XHXDEBUGURL:::" + url);
|
Log.i("XHXDEBUG", "XHXDEBUGURL:::" + url);
|
||||||
|
|
||||||
// new Handler().postDelayed(() -> showTopLy.setVisibility(View.GONE), 3000);
|
|
||||||
// verifyStoragePermissions(this);
|
|
||||||
showTopLy.setBackgroundColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "windows_color", "#FFFFFF")));
|
showTopLy.setBackgroundColor(Color.parseColor(MainActivity.getString(MainActivity2.this, "windows_color", "#FFFFFF")));
|
||||||
webView.setDownloadListener(new DownloadListener() {
|
webView.setDownloadListener(new DownloadListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -853,7 +600,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(Result<ResultDataInfo<MessageInfo>> o) {
|
public void onSuccess(Result<ResultDataInfo<MessageInfo>> o) {
|
||||||
if (o.data != null && o.data.getTotal() > 0) {
|
if (o.data != null && o.data.getTotal() > 0) {
|
||||||
// notifyVisible = View.VISIBLE;
|
|
||||||
otherApp.setVisibility(View.INVISIBLE);
|
otherApp.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
ivNotify.setVisibility(View.VISIBLE);
|
ivNotify.setVisibility(View.VISIBLE);
|
||||||
@@ -947,13 +693,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
otherApp.setVisibility(View.INVISIBLE);
|
otherApp.setVisibility(View.INVISIBLE);
|
||||||
ivWhatsApp.setVisibility(View.VISIBLE);
|
ivWhatsApp.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
// if (linkconfiglist != null && linkconfiglist.size() > 0) {
|
|
||||||
// otherApp.setVisibility(View.VISIBLE);
|
|
||||||
// ivLink.setVisibility(View.VISIBLE);
|
|
||||||
// tvLink.setText(linkconfiglist.get(0).getName());
|
|
||||||
// ivHome.setVisibility(View.VISIBLE);
|
|
||||||
// Glide.with(MainActivity2.this).load(linkconfiglist.get(0).getIcon()).error(R.color.dialog_bg).into(ivLinkBg);
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
url = MainActivity.getString(MainActivity2.this, "base_url", url);
|
url = MainActivity.getString(MainActivity2.this, "base_url", url);
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
@@ -974,70 +713,12 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Api.getInstance().geUrlNew(userId)
|
|
||||||
// .subscribeOn(Schedulers.io())
|
|
||||||
// .observeOn(AndroidSchedulers.mainThread())
|
|
||||||
// .subscribe(new BaseObserver<Result>() {
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(Result o) {
|
|
||||||
// LogUtils.i("URL是啥获取的文件地址:" + o.url);
|
|
||||||
// if (!TextUtils.isEmpty(o.url)) {
|
|
||||||
// MainActivity.saveString(MainActivity2.this, "base_url", o.url);
|
|
||||||
// url = MainActivity.getString(MainActivity2.this, "base_url", url);
|
|
||||||
// webView.loadUrl(url);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onError(int code, String msg) {
|
|
||||||
// url = MainActivity.getString(MainActivity2.this, "base_url", url);
|
|
||||||
// webView.loadUrl(url);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersionUrl() {
|
|
||||||
// Api.getInstance().getVersion(System.currentTimeMillis())
|
|
||||||
// .subscribeOn(Schedulers.io())
|
|
||||||
// .observeOn(AndroidSchedulers.mainThread())
|
|
||||||
// .subscribe(new BaseObserver<Result>() {
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(Result o) {
|
|
||||||
// if (!TextUtils.isEmpty(o.version_code)) {
|
|
||||||
// if (Integer.parseInt(o.version_code) > com.web.base.BuildConfig.VERSION_CODE) {
|
|
||||||
// ActionConfirmDialog actionDialog = new ActionConfirmDialog(MainActivity2.this,
|
|
||||||
// getString(R.string.banbengengxin_txt), getString(R.string.xiacigengxin_txt),
|
|
||||||
// getString(R.string.lijigengxin_txt));
|
|
||||||
// actionDialog.setOnToActionListener(new ActionConfirmDialog.OnToActionListener() {
|
|
||||||
// @Override
|
|
||||||
// public void toSumbit() {
|
|
||||||
// checkUpdate(o.url);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void toCancel() {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// actionDialog.show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onError(int code, String msg) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkUpdate(String url) {
|
private void checkUpdate(String url) {
|
||||||
// Constants.isUpdate = true;
|
|
||||||
new AppUpdater(this, url).start();
|
new AppUpdater(this, url).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContactBean> contents = new ArrayList<>();
|
List<ContactBean> contents = new ArrayList<>();
|
||||||
@@ -1049,31 +730,28 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
ActivityCompat.requestPermissions(MainActivity2.this, PERMISSIONS_READCONTACT, 2222);
|
ActivityCompat.requestPermissions(MainActivity2.this, PERMISSIONS_READCONTACT, 2222);
|
||||||
} else {
|
} else {
|
||||||
//开启线程上传数据
|
//开启线程上传数据
|
||||||
new Thread(new Runnable() {
|
new Thread(() -> {
|
||||||
@Override
|
//获取通讯录
|
||||||
public void run() {
|
contents = new ArrayList<>();
|
||||||
//获取通讯录
|
Cursor cursor = null;
|
||||||
contents = new ArrayList<>();
|
try {
|
||||||
Cursor cursor = null;
|
cursor = getContentResolver().query(
|
||||||
try {
|
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
|
||||||
cursor = getContentResolver().query(
|
null, null, null, null);
|
||||||
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
|
while (cursor.moveToNext()) {
|
||||||
null, null, null, null);
|
int i_name = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
|
||||||
while (cursor.moveToNext()) {
|
String displayName = cursor.getString(i_name);
|
||||||
int i_name = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
|
int i_number = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||||
String displayName = cursor.getString(i_name);
|
String number = cursor.getString(i_number);
|
||||||
int i_number = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
ContactBean bean = new ContactBean(displayName, number.trim());
|
||||||
String number = cursor.getString(i_number);
|
contents.add(bean);
|
||||||
ContactBean bean = new ContactBean(displayName, number.trim());
|
}
|
||||||
contents.add(bean);
|
} catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
} finally {
|
||||||
e.printStackTrace();
|
if (cursor != null) {
|
||||||
} finally {
|
cursor.close();
|
||||||
if (cursor != null) {
|
postReadContact(contents);
|
||||||
cursor.close();
|
|
||||||
postReadContact(contents);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
@@ -1082,19 +760,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContactBean> removeSameContact(List<ContactBean> contents) {
|
|
||||||
List<String> contactBeans = new ArrayList<String>();
|
|
||||||
for (int i = 0; i < contents.size(); i++) {
|
|
||||||
String phone = contents.get(i).getPhone();
|
|
||||||
if (contactBeans.contains(phone)) {
|
|
||||||
contents.remove(i);
|
|
||||||
} else {
|
|
||||||
contactBeans.add(phone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postReadContact(List<ContactBean> contents) {
|
public void postReadContact(List<ContactBean> contents) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
@@ -1150,64 +815,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionInviteDialog invitedDialog;
|
|
||||||
|
|
||||||
//展示邀请码
|
|
||||||
public void showInviteCode() {
|
|
||||||
invitedDialog = new ActionInviteDialog(MainActivity2.this,
|
|
||||||
false);
|
|
||||||
invitedDialog.setOnToActionListener(new ActionInviteDialog.OnToActionListener() {
|
|
||||||
@Override
|
|
||||||
public void toSumbit(String content) {
|
|
||||||
checkInvited(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toCancel() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
invitedDialog.setCanceledOnTouchOutside(false);
|
|
||||||
invitedDialog.setCancelable(false);
|
|
||||||
invitedDialog.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkInvited(String code) {
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("userId", userId);
|
|
||||||
map.put("code", code);
|
|
||||||
map.put("deviceCode", Utils.getUniqueId(MainActivity2.this));
|
|
||||||
Api.getInstance().checkInvited(map)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BaseObserver<Result<InviteInfo>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Result<InviteInfo> o) {
|
|
||||||
if (o.isSuccessful() && invitedDialog != null) {
|
|
||||||
invitedDialog.dismiss();
|
|
||||||
MainActivity.saveBoolean(MainActivity2.this, "invited", true);
|
|
||||||
MainActivity.saveString(MainActivity2.this, "code", code);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(int code, String msg) {
|
|
||||||
Toast.makeText(MainActivity2.this, msg + "", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError2(Result<InviteInfo> o) {
|
|
||||||
if (o.code == 40001) {
|
|
||||||
invitedDialog.dismiss();
|
|
||||||
MainActivity.saveBoolean(MainActivity2.this, "invited", true);
|
|
||||||
MainActivity.saveString(MainActivity2.this, "code", o.data.getInviteCode());
|
|
||||||
}
|
|
||||||
Toast.makeText(MainActivity2.this, TextUtils.isEmpty(o.message) ? o.error : o.message, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalTongJi() {
|
public void setTotalTongJi() {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
@@ -1271,7 +878,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
public void onSuccess(Result<InviteInfo> o) {
|
public void onSuccess(Result<InviteInfo> o) {
|
||||||
if (o.data != null) {
|
if (o.data != null) {
|
||||||
myInviteCode = o.data.getInviteCode();
|
myInviteCode = o.data.getInviteCode();
|
||||||
myInviteNum = o.data.getInviteNum();
|
// myInviteNum = o.data.getInviteNum();
|
||||||
MainActivity.saveString(MainActivity2.this, "balance", o.data.getBalance());
|
MainActivity.saveString(MainActivity2.this, "balance", o.data.getBalance());
|
||||||
MainActivity.saveString(MainActivity2.this, "income", o.data.getIncome());
|
MainActivity.saveString(MainActivity2.this, "income", o.data.getIncome());
|
||||||
MainActivity.saveString(MainActivity2.this, "bankname", o.data.getBankName());
|
MainActivity.saveString(MainActivity2.this, "bankname", o.data.getBankName());
|
||||||
@@ -1324,7 +931,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
if (showTopLy.getVisibility() == View.VISIBLE) {
|
if (showTopLy.getVisibility() == View.VISIBLE) {
|
||||||
handler.postDelayed(() -> showTopLy.setVisibility(View.GONE), 1000);
|
handler.postDelayed(() -> showTopLy.setVisibility(View.GONE), 1000);
|
||||||
}
|
}
|
||||||
// notifyCardView.setVisibility(notifyVisible);
|
|
||||||
if (webView.getUrl().equals(url + "index") || webView.getUrl().equals(url + "/index")) {
|
if (webView.getUrl().equals(url + "index") || webView.getUrl().equals(url + "/index")) {
|
||||||
isAtGame = false;
|
isAtGame = false;
|
||||||
topVvvv.setVisibility(View.GONE);
|
topVvvv.setVisibility(View.GONE);
|
||||||
@@ -1337,10 +943,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (isNetError&&isAtGame) {
|
|
||||||
// topVvvv.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1394,9 +996,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (url1.contains("facebook") || url1.contains("https://t.me") ||
|
if (isToOutSideUrl(url1)) {
|
||||||
url1.contains("instagram") || url1.contains("https://x.com")||url1.contains("https://wa.me")||
|
|
||||||
url1.contains("https://m.me")||url1.contains("http://m.me")) {
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
@@ -1449,9 +1049,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
toStopPlayers();
|
toStopPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (url1.contains("facebook") || url1.contains("https://t.me") || url1.contains("instagram")
|
if (isToOutSideUrl(url1)) {
|
||||||
|| url1.contains("https://x.com")||url1.contains("https://wa.me")||
|
|
||||||
url1.contains("https://m.me")||url1.contains("http://m.me")) {
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
@@ -1496,6 +1094,12 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private boolean isToOutSideUrl(String url1) {
|
||||||
|
return url1.contains("facebook") || url1.contains("https://t.me") ||
|
||||||
|
url1.contains("instagram") || url1.contains("https://x.com")||url1.contains("https://wa.me")||
|
||||||
|
url1.contains("https://m.me")||url1.contains("http://m.me");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static MediaPlayer mp = null;
|
private static MediaPlayer mp = null;
|
||||||
|
|
||||||
@@ -1529,8 +1133,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
private int rawRes = -1;
|
private int rawRes = -1;
|
||||||
|
|
||||||
private void toPlayers() {
|
private void toPlayers() {
|
||||||
// AudioManager audioManager = (AudioManager) MainActivity2.this.getSystemService(Context.AUDIO_SERVICE);
|
|
||||||
// stop(context);
|
|
||||||
if (mp == null) {
|
if (mp == null) {
|
||||||
if (rawRes == -1) {
|
if (rawRes == -1) {
|
||||||
int rands = new Random().nextInt(2);
|
int rands = new Random().nextInt(2);
|
||||||
@@ -1541,7 +1143,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mp = MediaPlayer.create(MainActivity2.this, rawRes);
|
mp = MediaPlayer.create(MainActivity2.this, rawRes);
|
||||||
// mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
|
||||||
mp.setAudioAttributes(new AudioAttributes
|
mp.setAudioAttributes(new AudioAttributes
|
||||||
.Builder()
|
.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||||
@@ -1554,15 +1155,13 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNetError = false;
|
|
||||||
|
|
||||||
public void onShowErrorView(String errorMsg) { //网络不可用的情况
|
public void onShowErrorView(String errorMsg) { //网络不可用的情况
|
||||||
// topVvvv.setVisibility(View.GONE);
|
|
||||||
webView.setVisibility(View.GONE);
|
webView.setVisibility(View.GONE);
|
||||||
layoutError.setVisibility(View.VISIBLE);
|
layoutError.setVisibility(View.VISIBLE);
|
||||||
tvErrorMsg.setText(errorMsg);
|
tvErrorMsg.setText(errorMsg);
|
||||||
showTopLy.setVisibility(View.GONE);
|
showTopLy.setVisibility(View.GONE);
|
||||||
isNetError = true;
|
// isNetError = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1571,7 +1170,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
webView.setVisibility(View.VISIBLE);
|
webView.setVisibility(View.VISIBLE);
|
||||||
layoutError.setVisibility(View.GONE);
|
layoutError.setVisibility(View.GONE);
|
||||||
showTopLy.setVisibility(View.GONE);
|
showTopLy.setVisibility(View.GONE);
|
||||||
isNetError = false;
|
// isNetError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1584,21 +1183,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateWindow(WebView webViewdd, boolean b, boolean b1, Message resultMsg) {
|
public boolean onCreateWindow(WebView webViewdd, boolean b, boolean b1, Message resultMsg) {
|
||||||
LogUtils.i("URL是啥onCreateWindow:" + webView.getUrl());
|
LogUtils.i("URL是啥onCreateWindow:" + webView.getUrl());
|
||||||
// WebView newWebView = new WebView(MainActivity2.this);
|
|
||||||
// topVvvv.setVisibility(View.VISIBLE);
|
|
||||||
// webView.addView(newWebView);
|
|
||||||
// WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
|
||||||
// transport.setWebView(newWebView);
|
|
||||||
// resultMsg.sendToTarget();
|
|
||||||
//
|
|
||||||
// newWebView.setWebViewClient(new WebViewClient() {
|
|
||||||
// @Override
|
|
||||||
// public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
||||||
// isAtGame = true;
|
|
||||||
// webView.loadUrl(url);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
WebView newWebView = new WebView(webViewdd.getContext());
|
WebView newWebView = new WebView(webViewdd.getContext());
|
||||||
newWebView.setWebViewClient(new WebViewClient() {
|
newWebView.setWebViewClient(new WebViewClient() {
|
||||||
@@ -1613,10 +1197,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
toStopPlayers();
|
toStopPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isToOutSideUrl(url)) {
|
||||||
if (url.contains("facebook") || url.contains("https://t.me") || url.contains("instagram")
|
|
||||||
|| url.contains("https://x.com")||url.contains("https://wa.me")||
|
|
||||||
url.contains("https://m.me")||url.contains("http://m.me")) {
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
@@ -1644,7 +1225,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1660,7 +1240,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
public void onCloseWindow(WebView window) {
|
public void onCloseWindow(WebView window) {
|
||||||
super.onCloseWindow(window);
|
super.onCloseWindow(window);
|
||||||
LogUtils.i("URL是啥新窗口结束:"+url);
|
LogUtils.i("URL是啥新窗口结束:"+url);
|
||||||
|
|
||||||
if (userId == 75) {
|
if (userId == 75) {
|
||||||
if ((window.getUrl().startsWith("https://mgiwallet.com"))) {
|
if ((window.getUrl().startsWith("https://mgiwallet.com"))) {
|
||||||
toPlayers();
|
toPlayers();
|
||||||
@@ -1692,29 +1271,18 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
Intent intent = fileChooserParams.createIntent();
|
Intent intent = fileChooserParams.createIntent();
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
startActivityForResult(Intent.createChooser(intent, "File chooser"), REQUEST_CODE_FILE_CHOOSER);
|
startActivityForResult(Intent.createChooser(intent, "File chooser"), REQUEST_CODE_FILE_CHOOSER);
|
||||||
// try {
|
|
||||||
// startActivityForResult(intent, REQUEST_CODE_FILE_CHOOSER);
|
|
||||||
// } catch (ActivityNotFoundException e) {
|
|
||||||
//// mUploadCallbackForHighApi = null;
|
|
||||||
//// WidgetUtils.showToast(JsBridgeActivity.this, "未知错误", WidgetUtils.ToastType.ERROR);
|
|
||||||
// // Toast.makeText(MainActivity2.this, "未知错误", Toast.LENGTH_SHORT).show();
|
|
||||||
// startActivityForResult(Intent.createChooser(intent, "File chooser"), REQUEST_CODE_FILE_CHOOSER);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For 3.0+
|
// For 3.0+
|
||||||
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
|
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
|
||||||
LogUtils.i("数据接口:openFileChooseracceptType");
|
LogUtils.i("数据接口:openFileChooseracceptType");
|
||||||
|
|
||||||
openFilerChooser(uploadMsg);
|
openFilerChooser(uploadMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void openFilerChooser(ValueCallback<Uri> uploadMsg) {
|
private void openFilerChooser(ValueCallback<Uri> uploadMsg) {
|
||||||
LogUtils.i("数据接口:openFileChooser");
|
LogUtils.i("数据接口:openFileChooser");
|
||||||
|
|
||||||
mUploadCallbackForLowApi = uploadMsg;
|
mUploadCallbackForLowApi = uploadMsg;
|
||||||
startActivityForResult(Intent.createChooser(getFilerChooserIntent(), "File Chooser"), REQUEST_CODE_FILE_CHOOSER);
|
startActivityForResult(Intent.createChooser(getFilerChooserIntent(), "File Chooser"), REQUEST_CODE_FILE_CHOOSER);
|
||||||
}
|
}
|
||||||
@@ -1730,32 +1298,22 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onPermissionRequest(PermissionRequest request) {
|
public void onPermissionRequest(PermissionRequest request) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
MainActivity2.this.runOnUiThread(new Runnable() {
|
MainActivity2.this.runOnUiThread(() -> {
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
for (String permisson : request.getResources()) {
|
||||||
@Override
|
permissionRequest = request;
|
||||||
public void run() {
|
if (permisson.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
|
||||||
for (String permisson : request.getResources()) {
|
if (ContextCompat.checkSelfPermission(MainActivity2.this, Manifest.permission.CAMERA) != 0) {
|
||||||
permissionRequest = request;
|
ActivityCompat.requestPermissions(MainActivity2.this, PERMISSIONS_CAMERA, 1111);
|
||||||
if (permisson.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
|
} else {
|
||||||
if (ContextCompat.checkSelfPermission(MainActivity2.this, Manifest.permission.CAMERA) != 0) {
|
request.grant(request.getResources());
|
||||||
ActivityCompat.requestPermissions(MainActivity2.this, PERMISSIONS_CAMERA, 1111);
|
request.getOrigin();
|
||||||
} else {
|
|
||||||
request.grant(request.getResources());
|
|
||||||
request.getOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private PermissionRequest permissionRequest;
|
private PermissionRequest permissionRequest;
|
||||||
@@ -1798,15 +1356,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JavaScriptinterface {
|
|
||||||
Context context;
|
|
||||||
|
|
||||||
public JavaScriptinterface(Context c) {
|
|
||||||
context = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode,
|
public void onRequestPermissionsResult(int requestCode,
|
||||||
String permissions[], int[] grantResults) {
|
String permissions[], int[] grantResults) {
|
||||||
@@ -1840,15 +1389,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置网页中图片的点击事件
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
*/
|
|
||||||
public static void setWebImageClick(WebView view, String method) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1896,22 +1436,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取状态栏高度
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getStatusBarHeight() {
|
|
||||||
int result = 0;
|
|
||||||
//获取状态栏高度的资源id
|
|
||||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
|
||||||
if (resourceId > 0) {
|
|
||||||
result = getResources().getDimensionPixelSize(resourceId);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
//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 sp = context.getSharedPreferences("InitApp", Activity.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
SharedPreferences.Editor editor = sp.edit();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user