|
|
@@ -16,9 +16,18 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import org.las2mile.scrcpy.BuildConfig;
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.TextView;
|
|
|
+import android.app.Activity;
|
|
|
+import org.las2mile.scrcpy.R;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
|
|
|
public class SystemUtils {
|
|
|
private static final String LOG_TAG = "TelephonyManagerSub";
|
|
|
+ private static final String PREFERENCE_KEY = "default";
|
|
|
|
|
|
public static boolean isDateValid(){
|
|
|
String buildTime = BuildConfig.BUILD_TIME;
|
|
|
@@ -46,4 +55,43 @@ public class SystemUtils {
|
|
|
Log.d(LOG_TAG,"no need update "+isValid+" "+day);
|
|
|
return isValid;
|
|
|
}
|
|
|
+
|
|
|
+ public static void enableStartLegalNotice(Activity activity,Button startButton){
|
|
|
+ CheckBox checkBox = activity.findViewById(R.id.cb_legal_notice);
|
|
|
+ checkBox.setClickable(false);
|
|
|
+ boolean agree = activity.getSharedPreferences(PREFERENCE_KEY, 0).getBoolean("agree notice", false);
|
|
|
+ checkBox.setChecked(agree);
|
|
|
+ startButton.setEnabled(agree);
|
|
|
+
|
|
|
+ activity.findViewById(R.id.ll_legal_notice).setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ Log.d("OkioMain","onClick");
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
+ builder.setTitle("深圳恺恩科技有限公司法律声明");
|
|
|
+ builder.setMessage(R.string.legal_notice);
|
|
|
+ builder.setCancelable(false);
|
|
|
+ builder.setPositiveButton("同意",new DialogInterface.OnClickListener(){
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ activity.getSharedPreferences(PREFERENCE_KEY, 0).edit().putBoolean("agree notice", true).apply();
|
|
|
+ checkBox.setChecked(true);
|
|
|
+ startButton.setEnabled(true);
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ builder.setNegativeButton("不同意",new DialogInterface.OnClickListener(){
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ activity.getSharedPreferences(PREFERENCE_KEY, 0).edit().putBoolean("agree notice", false).apply();
|
|
|
+ checkBox.setChecked(false);
|
|
|
+ startButton.setEnabled(false);
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ AlertDialog dialog = builder.create();
|
|
|
+ dialog.show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|