forked from bepass-org/oblivion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
uoosef
committed
Feb 8, 2024
1 parent
f9b354c
commit 2491237
Showing
99 changed files
with
2,178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
namespace 'com.yoosef.oblivion' | ||
compileSdk 34 | ||
|
||
defaultConfig { | ||
applicationId "com.yoosef.oblivion" | ||
minSdk 23 | ||
targetSdk 34 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
buildFeatures { | ||
compose true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion '1.4.3' | ||
} | ||
packaging { | ||
resources { | ||
excludes += '/META-INF/{AL2.0,LGPL2.1}' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.activity:activity-compose:1.8.2' | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.11.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
implementation 'com.hluhovskyi.camerabutton:camerabutton:2.0.1' | ||
implementation 'com.airbnb.android:lottie:4.2.2' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.OblivionUI" | ||
tools:targetApi="31"> | ||
|
||
<activity | ||
android:name="org.bepass.oblivion.MainActivity" | ||
android:exported="true" | ||
android:label="@string/app_name" | ||
android:theme="@style/Theme.OblivionUI"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name="org.bepass.oblivion.InfoActivity" | ||
android:exported="false" /> | ||
|
||
<activity | ||
android:name="org.bepass.oblivion.BugActivity" | ||
android:exported="false" /> | ||
|
||
<activity | ||
android:name="org.bepass.oblivion.SettingsActivity" | ||
android:exported="false" | ||
android:windowSoftInputMode="stateAlwaysHidden" /> | ||
|
||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
package org.bepass.oblivion; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import com.yoosef.oblivion.R; | ||
|
||
import java.util.Timer; | ||
import java.util.TimerTask; | ||
|
||
public class BugActivity extends AppCompatActivity { | ||
FileManager fileManager; | ||
|
||
ImageView back; | ||
TextView logs; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_bug); | ||
|
||
fileManager = new FileManager(getApplicationContext()); | ||
|
||
back = findViewById(R.id.back); | ||
logs = findViewById(R.id.logs); | ||
|
||
back.setOnClickListener(v -> onBackPressed()); | ||
logs.setText(fileManager.getLog()); | ||
|
||
// Update Log Every 1 Second | ||
new Timer().scheduleAtFixedRate(new TimerTask() { | ||
@Override | ||
public void run() { | ||
logs.setText(fileManager.getLog()); | ||
} | ||
}, 0, 1000); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.bepass.oblivion; | ||
|
||
import android.content.Context; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.TextView; | ||
|
||
import com.google.android.material.bottomsheet.BottomSheetDialog; | ||
import com.yoosef.oblivion.R; | ||
|
||
public class EditSheet { | ||
|
||
FileManager fileManager; | ||
|
||
Context context; | ||
BottomSheetDialog sheet; | ||
|
||
String title; | ||
String sharedPrefKey; | ||
|
||
TextView titleView; | ||
EditText value; | ||
Button apply, cancel; | ||
|
||
SheetsCallBack sheetsCallBack; | ||
|
||
public EditSheet(Context context, String title, String sharedPrefKey, SheetsCallBack sheetsCallBack) { | ||
this.context = context; | ||
fileManager = new FileManager(context); | ||
|
||
this.title = "تغییر مقدار " + title; | ||
this.sharedPrefKey = sharedPrefKey; | ||
|
||
this.sheetsCallBack = sheetsCallBack; | ||
|
||
init(); | ||
} | ||
|
||
|
||
private void init() { | ||
// Initialize | ||
sheet = new BottomSheetDialog(context); | ||
sheet.setContentView(R.layout.edit_sheet); | ||
|
||
titleView = sheet.findViewById(R.id.title); | ||
value = sheet.findViewById(R.id.edittext); | ||
|
||
apply = sheet.findViewById(R.id.applyButton); | ||
cancel = sheet.findViewById(R.id.cancelButton); | ||
} | ||
|
||
public boolean isElementsNull() { | ||
return titleView == null || value == null || apply == null || cancel == null; | ||
} | ||
|
||
public void start() { | ||
if (isElementsNull()) { | ||
return; | ||
} | ||
|
||
titleView.setText(title); | ||
value.setText(fileManager.getString("USERSETTING_" + sharedPrefKey)); | ||
|
||
cancel.setOnClickListener(v -> sheet.cancel()); | ||
apply.setOnClickListener(v -> { | ||
fileManager.set("USERSETTING_" + sharedPrefKey, value.getText().toString()); | ||
sheet.cancel(); | ||
}); | ||
|
||
sheet.show(); | ||
value.requestFocus(); | ||
sheet.setOnCancelListener(dialog -> sheetsCallBack.onSheetClosed()); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package org.bepass.oblivion; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
|
||
public class FileManager { | ||
SharedPreferences sharedPreferences; | ||
SharedPreferences sharedPreferencesAppender; | ||
|
||
public FileManager(Context context) { | ||
sharedPreferences = context.getSharedPreferences("UserData", Context.MODE_PRIVATE); | ||
sharedPreferencesAppender = context.getSharedPreferences("UserData", Context.MODE_PRIVATE); | ||
} | ||
|
||
public void set(String name, String value) { | ||
this.sharedPreferences. | ||
edit() | ||
.putString(name, value) | ||
.apply(); | ||
} | ||
|
||
public void set(String name, boolean value) { | ||
this.sharedPreferences | ||
.edit() | ||
.putBoolean(name, value) | ||
.apply(); | ||
} | ||
|
||
public void set(String name, int value) { | ||
this.sharedPreferences | ||
.edit() | ||
.putInt(name, value) | ||
.apply(); | ||
} | ||
|
||
public void set(String name, float value) { | ||
this.sharedPreferences | ||
.edit() | ||
.putFloat(name, value) | ||
.apply(); | ||
} | ||
|
||
public void set(String name, double value) { | ||
this.sharedPreferences | ||
.edit() | ||
.putLong(name, Double.doubleToRawLongBits(value)) | ||
.apply(); | ||
} | ||
|
||
public void set(String name, long value) { | ||
this.sharedPreferences | ||
.edit() | ||
.putLong(name, value) | ||
.apply(); | ||
} | ||
|
||
public double getDouble(String name) { | ||
return Double.longBitsToDouble(this.sharedPreferences.getLong(name, 0)); | ||
} | ||
|
||
public long getLong(String name) { | ||
return this.sharedPreferences.getLong(name, 0L); | ||
} | ||
|
||
public String getString(String name) { | ||
return this.sharedPreferences.getString(name, ""); | ||
} | ||
|
||
public Integer getInt(String name) { | ||
return this.sharedPreferences.getInt(name, 0); | ||
} | ||
|
||
public Boolean getBoolean(String name) { | ||
return this.sharedPreferences.getBoolean(name, false); | ||
} | ||
|
||
public Float getFloat(String name) { | ||
return this.sharedPreferences.getFloat(name, 0f); | ||
} | ||
|
||
public void resetLog() { | ||
this.sharedPreferences | ||
.edit() | ||
.putString("APP_LOG", "") | ||
.apply(); | ||
} | ||
|
||
public void addLog(String log) { | ||
this.sharedPreferencesAppender | ||
.edit() | ||
.putString("APP_LOG", log) | ||
.apply(); | ||
} | ||
|
||
public String getLog() { | ||
return getString("APP_LOG"); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.