正在查看: Mantra Counter v25.01 应用的 Settings.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mantra Counter v25.01 应用的 Settings.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.sweetedge.mantracounter;
import alarmreminder.ReminderCreateDialog;
import alarmreminder.ReminderDatabase;
import alarmreminder.ReminderList;
import alarmreminder.ResetAllAlarm;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Environment;
import android.os.Vibrator;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import android.window.OnBackInvokedDispatcher;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.sweetedge.mantracounter.Authentication.UserWebService;
import com.sweetedge.mantracounter.group.GroupConst;
import java.io.File;
import sweetedge.extra.PLog;
import sweetedge.popup.PDialog;
import sweetedge.popup.PToast;
import sweetedge.preference.PSharedPreference;
import sweetedge.screen.PIntent;
import sweetedge.statusbar.PStatusBar;
public class Settings extends AppCompatActivity {
RelativeLayout Background_settings;
Switch Bell;
RelativeLayout RelTarget;
RelativeLayout RelTimer;
RelativeLayout ReminderLayout;
TextView ReminderText;
TextView ReminderTextCounter;
ImageView RightTargetMode;
ImageView RightTimerMode;
Spinner TapOption;
TextView Version;
ImageView lang;
RelativeLayout mantralayout;
File photoDir;
ImageView rec;
Switch sound;
TextView soundfilename;
Switch vibrate;
String[] tapOp = new String[0];
ActivityResultLauncher<String> StorageLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new ActivityResultCallback<Boolean>() {
public void onActivityResult(Boolean bool) {
if (bool.booleanValue()) {
PLog.print("Got it");
} else {
PLog.print("Not Got");
}
}
});
public static String getAppVersion(Context context) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
protected void onResume() {
super.onResume();
MainActivity.setLanguage(this);
if (this.vibrate.isChecked()) {
this.vibrate.setText(getResources().getString(R.string.Vibon));
} else {
this.vibrate.setText(getResources().getString(R.string.VibOff));
}
if (this.sound.isChecked()) {
this.sound.setText(getResources().getString(R.string.soundOn));
this.mantralayout.setClickable(true);
this.mantralayout.setAlpha(1.0f);
} else {
this.sound.setText(getResources().getString(R.string.soundOff));
this.mantralayout.setClickable(false);
this.mantralayout.setAlpha(0.4f);
}
updateSoundFile();
ReminderDatabase reminderDatabase = new ReminderDatabase(this);
reminderDatabase.open();
Cursor cursor = reminderDatabase.getall();
if (cursor != null) {
if (cursor.getCount() > 0) {
this.ReminderTextCounter.setVisibility(0);
this.ReminderTextCounter.setText(cursor.getCount() + "");
} else {
this.ReminderTextCounter.setVisibility(4);
}
} else {
this.ReminderTextCounter.setVisibility(4);
}
reminderDatabase.close();
}
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i == 4) {
LoadAdClass2.showIAd(this);
}
return super.onKeyDown(i, keyEvent);
}
public OnBackInvokedDispatcher getOnBackInvokedDispatcher() {
PLog.print("Back Displatec");
return super.getOnBackInvokedDispatcher();
}
void updateSoundFile() {
String string = PSharedPreference.getString(this, "Mantra", "Default");
if (string.contains("/")) {
this.soundfilename.setText(string.substring(string.lastIndexOf("/") + 1));
} else {
this.soundfilename.setText(string);
}
}
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
PStatusBar.changeColor(getWindow(), getColor(R.color.orangeFontColor));
MainActivity.setLanguage(this);
setContentView(R.layout.activity_settings);
this.RelTarget = (RelativeLayout) findViewById(R.id.rel_target);
this.RelTimer = (RelativeLayout) findViewById(R.id.rel_timer);
this.ReminderText = (TextView) findViewById(R.id.reminderText);
this.ReminderTextCounter = (TextView) findViewById(R.id.reminderTextCounter);
this.sound = (Switch) findViewById(R.id.sound);
this.Bell = (Switch) findViewById(R.id.bell);
this.vibrate = (Switch) findViewById(R.id.vib);
this.ReminderLayout = (RelativeLayout) findViewById(R.id.Reminderinner);
this.rec = (ImageView) findViewById(R.id.record);
this.Background_settings = (RelativeLayout) findViewById(R.id.background_settings);
this.mantralayout = (RelativeLayout) findViewById(R.id.mantraLayout);
this.soundfilename = (TextView) findViewById(R.id.filename);
this.Version = (TextView) findViewById(R.id.version);
LoadAdClass2.LoadIAd(this);
this.lang = (ImageView) findViewById(R.id.lang);
this.TapOption = (Spinner) findViewById(R.id.spinner_tapOption);
String[] strArr = new String[3];
this.tapOp = strArr;
strArr[0] = getResources().getString(R.string.none);
this.tapOp[1] = getResources().getString(R.string.count);
this.tapOp[2] = getResources().getString(R.string.hide);
this.RightTimerMode = (ImageView) findViewById(R.id.right_timer);
this.RightTargetMode = (ImageView) findViewById(R.id.right_target);
ArrayAdapter arrayAdapter = new ArrayAdapter((Context) this, R.layout.tap_list_textview, (Object[]) this.tapOp);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.TapOption.setAdapter((SpinnerAdapter) arrayAdapter);
if (PSharedPreference.getInteger(this, getResources().getStringArray(R.array.ProductID)[0], 0) == 1 || UserWebService.Prime.equals("1")) {
this.TapOption.setSelection(PSharedPreference.getInteger(this, "TAPID", 0), false);
} else {
PSharedPreference.setInteger(this, "TAPID", 0);
this.TapOption.setSelection(PSharedPreference.getInteger(this, "TAPID", 0), false);
}
this.sound.setChecked(PSharedPreference.getBoolean(this, "SOUND", true));
this.Bell.setChecked(PSharedPreference.getBoolean(this, "BELL", true));
this.vibrate.setChecked(PSharedPreference.getBoolean(this, "VIB", true));
this.ReminderLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ResetAllAlarm.resetAllAlarms(Settings.this);
if (Settings.this.ReminderTextCounter.getVisibility() == 0) {
PIntent.goNewScreen(Settings.this, ReminderList.class);
} else {
PIntent.goNewScreen(Settings.this, ReminderCreateDialog.class);
}
}
});
this.Version.setText("Version : " + getAppVersion(this));
if (PSharedPreference.getBoolean(this, "IS_Target_mode", true)) {
this.RightTargetMode.setVisibility(0);
this.RightTimerMode.setVisibility(4);
} else {
this.RightTargetMode.setVisibility(4);
this.RightTimerMode.setVisibility(0);
}
this.RelTarget.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PSharedPreference.setBoolean(Settings.this, "IS_Target_mode", true);
Settings.this.RightTargetMode.setVisibility(0);
Settings.this.RightTimerMode.setVisibility(4);
}
});
this.RelTimer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PSharedPreference.setBoolean(Settings.this, "IS_Target_mode", false);
Settings.this.RightTargetMode.setVisibility(4);
Settings.this.RightTimerMode.setVisibility(0);
}
});
this.Version.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
this.TapOption.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
?? r1 = Settings.this;
if (PSharedPreference.getInteger((Context) r1, r1.getResources().getStringArray(R.array.ProductID)[0], 0) == 1 || UserWebService.Prime.equals("1")) {
PLog.print("Touched Selected ID = " + i);
PSharedPreference.setInteger(Settings.this, "TAPID", i);
return;
}
Settings.this.TapOption.setSelection(0);
?? r12 = Settings.this;
PToast.showT((Context) r12, r12.getResources().getString(R.string.notprime));
PIntent.goNewScreen(Settings.this, SubscriptionViewActivity.class);
}
});
this.lang.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PSharedPreference.setBoolean(Settings.this, "FIRSTRUN", true);
PIntent.goNewScreen(Settings.this, Country.class);
Settings.this.finishAffinity();
}
});
this.sound.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (MainActivity.isGroup) {
Settings.this.sound.setChecked(true);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == -1) {
MainActivity.isGroup = false;
PSharedPreference.setBoolean(Settings.this, GroupConst.isGroup, false);
PSharedPreference.setString(Settings.this, GroupConst.Grpid, "null");
}
}
};
?? r0 = Settings.this;
PDialog.showSimple((Context) r0, onClickListener, r0.getResources().getString(R.string.stop), Settings.this.getResources().getString(R.string.stopgroupchanting), Settings.this.getResources().getString(R.string.Yes), Settings.this.getResources().getString(R.string.No));
return;
}
if (Settings.this.sound.isChecked()) {
PSharedPreference.setBoolean(Settings.this, "SOUND", true);
Settings.this.sound.setText(Settings.this.getResources().getString(R.string.soundOn));
Settings.this.mantralayout.setClickable(true);
Settings.this.mantralayout.setAlpha(1.0f);
return;
}
PSharedPreference.setBoolean(Settings.this, "SOUND", false);
Settings.this.sound.setText(Settings.this.getResources().getString(R.string.soundOff));
Settings.this.mantralayout.setClickable(false);
Settings.this.mantralayout.setAlpha(0.4f);
}
});
this.Bell.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
?? r2 = Settings.this;
PSharedPreference.setBoolean((Context) r2, "BELL", r2.Bell.isChecked());
}
});
this.vibrate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (Settings.this.vibrate.isChecked()) {
PSharedPreference.setBoolean(Settings.this, "VIB", true);
Settings.this.vibrate.setText(Settings.this.getResources().getString(R.string.Vibon));
((Vibrator) Settings.this.getSystemService("vibrator")).vibrate(600L);
} else {
PSharedPreference.setBoolean(Settings.this, "VIB", false);
Settings.this.vibrate.setText(Settings.this.getResources().getString(R.string.VibOff));
}
}
});
this.mantralayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!PermissionClass.checkforAudioFile(Settings.this.StorageLauncher, Settings.this)) {
Settings.this.requestPermission();
return;
}
if (MainActivity.isGroup) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == -1) {
MainActivity.isGroup = false;
PSharedPreference.setBoolean(Settings.this, GroupConst.isGroup, false);
PSharedPreference.setString(Settings.this, GroupConst.Grpid, "null");
}
}
};
?? r0 = Settings.this;
PDialog.showSimple((Context) r0, onClickListener, r0.getResources().getString(R.string.stop), Settings.this.getResources().getString(R.string.stopgroupchanting), Settings.this.getResources().getString(R.string.Yes), Settings.this.getResources().getString(R.string.No));
return;
}
Settings.this.photoDir = new File(Environment.getExternalStorageDirectory() + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getName() + "/Download/.MantraCounter/");
Settings.this.photoDir.mkdirs();
RecordList.isSelectforNewList = false;
PIntent.goNewScreen(Settings.this, RecordList.class);
}
});
}
public void requestPermission() {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.RECORD_AUDIO"}, 1);
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
if (i != 1 || iArr.length <= 0) {
return;
}
if (iArr[0] == 0) {
Toast.makeText((Context) this, (CharSequence) "Permission Granted", 1).show();
} else {
Toast.makeText((Context) this, (CharSequence) "PermissionDenied", 1).show();
}
}
}