Skip to content

Commit

Permalink
Merge pull request #37 from scala-network/2.0.1
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
Mas7erMind authored Feb 22, 2021
2 parents 173f270 + cb1f49b commit 55b88b4
Show file tree
Hide file tree
Showing 122 changed files with 1,764 additions and 3,401 deletions.
9 changes: 7 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "io.scalaproject.androidminer"
minSdkVersion 19
targetSdkVersion 28 // keep version 28 to avoid an error 13 when running exe in assets folder (sdk 29 gives the error)
versionCode 10
versionName "2.0.0"
versionCode 11
versionName "2.1.0"
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -43,4 +43,9 @@ dependencies {
implementation 'com.github.anastr:speedviewlib:1.5.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.polyak:icon-switch:1.0.0'

def acraVersion = '5.7.0'
implementation "ch.acra:acra-core:$acraVersion"
implementation "ch.acra:acra-mail:$acraVersion"
}
30 changes: 16 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.scalaproject.androidminer"
<manifest xmlns:tools="http://schemas.android.com/tools"
package="io.scalaproject.androidminer"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:name=".MobileMinerApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:hardwareAccelerated="false"
android:largeHeap="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:targetApi="m">

<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
Expand All @@ -43,71 +45,71 @@
android:windowSoftInputMode="adjustPan|stateHidden"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleTask"
android:screenOrientation="behind">
android:screenOrientation="portrait">
</activity>

<activity
android:name=".QrCodeScannerActivity"
android:configChanges="orientation|keyboardHidden"
android:label="QrCode"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".WizardHomeActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Welcome"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".VaultActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Vault"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".WizardAddressActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Address"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".PoolActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Pool"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".WizardSettingsActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Settings"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".SupportActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Support"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".PaymentsActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Payments"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<activity
android:name=".BaseActivity"
android:configChanges="orientation|keyboardHidden"
android:label="Base"
android:launchMode="singleTask"
android:screenOrientation="behind" />
android:screenOrientation="portrait" />

<service
android:name=".MiningService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.Objects;

import io.scalaproject.androidminer.dialogs.CreditsFragment;
import io.scalaproject.androidminer.dialogs.DonationsFragment;

Expand Down Expand Up @@ -173,11 +175,11 @@ public void updateDrawState(TextPaint ds) {
}

private void onShowCredits() {
CreditsFragment.display(getActivity().getSupportFragmentManager());
CreditsFragment.display(Objects.requireNonNull(getActivity()).getSupportFragmentManager());
}

private void onShowDonations() {
DonationsFragment.display(getActivity().getSupportFragmentManager());
DonationsFragment.display(Objects.requireNonNull(getActivity()).getSupportFragmentManager());
}

private void onShareApp() {
Expand All @@ -201,7 +203,7 @@ private void showDisclaimer() {
btnOK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Config.write("disclaimer_agreed", "1");
Config.write(Config.CONFIG_DISCLAIMER_AGREED, "1");
dialog.dismiss();
}
});
Expand Down
31 changes: 28 additions & 3 deletions app/src/main/java/io/scalaproject/androidminer/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.content.SharedPreferences;

import java.util.HashMap;
import java.util.Objects;

public class Config {

Expand All @@ -22,15 +23,39 @@ public class Config {

public final static String[] SUPPORTED_ARCHITECTURES = {"arm64-v8a", "armeabi-v7a", "x86_64"};

public final static String CONFIG_INIT = "init";
public final static String CONFIG_USERDEFINED_POOLS = "userdefined_pools";
public final static String CONFIG_SELECTED_POOL = "selected_pool";
public final static String CONFIG_POOL_PORT = "custom_port";
public final static String CONFIG_CORES = "cores";
public final static String CONFIG_CUSTOM_PORT = "custom_port";
public final static String CONFIG_TEMPERATURE_UNIT = "temperature_unit";
public final static String CONFIG_TEMPERATURE_SENSOR_SHOW_WARNING = "temp_sensor_warning";
public final static String CONFIG_HASHRATE_REFRESH_DELAY = "hashrate_refresh_delay";
public final static String CONFIG_SEND_DEBUG_INFO = "send_debug_info";
//public final static String CONFIG_DISABLE_RESTART_MINING_ABORTED = "disable_restart_mining_aborted";
public final static String CONFIG_ADDRESS = "address";
public final static String CONFIG_USERNAME_PARAMETERS = "usernameparameters";
public final static String CONFIG_WORKERNAME = "workername";
public final static String CONFIG_MAX_CPU_TEMP = "maxcputemp";
public final static String CONFIG_MAX_BATTERY_TEMP = "maxbatterytemp";
public final static String CONFIG_COOLDOWN_THRESHOLD = "cooldownthreshold";
public final static String CONFIG_DISABLE_TEMPERATURE_CONTROL = "disable_temperature_control";
public final static String CONFIG_MINING_GOAL = "mininggoal";
public final static String CONFIG_PAUSE_ON_BATTERY = "pauseonbattery";
public final static String CONFIG_PAUSE_ON_NETWORK = "pauseonnetwork";
public final static String CONFIG_KEEP_SCREEN_ON_WHEN_MINING = "keepscreenonwhenmining";
public final static String CONFIG_HIDE_SETUP_WIZARD = "hide_setup_wizard";
public final static String CONFIG_CPU_INFO = "cpu_info";
public final static String CONFIG_DISCLAIMER_AGREED = "disclaimer_agreed";
public final static String CONFIG_POOLS_REPOSITORY_LAST_FETCHED = "pools_respository_last_fetched";
public final static String CONFIG_POOLS_REPOSITORY_JSON = "pools_respository_json";

public final static int DefaultRefreshDelay = 30; // In seconds

public final static int CHECK_TEMPERATURE_DELAY = 10000; // In milliseconds
public final static int CHECK_MINING_SANITY_DELAY = 10000; // In milliseconds
public final static int CHECK_MINING_TIME_DELAY = 60000; // In milliseconds

private static Config mSettings;
private SharedPreferences preferences;

Expand All @@ -50,7 +75,7 @@ public class Config {
static final Integer logPruneLength = 1000;
static final String debugAddress = "Ssy2HXpWZ9RhXbb9uNFTeHjaYfexa3suDbGJDSfUWSEpSajSmjQXwLh2xqCAAUQfZrdiRkvpUZvBceT8d6zKc6aV9NaZVYXFsY";

private HashMap<String,String> mConfigs = new HashMap<String, String>();
private final HashMap<String,String> mConfigs = new HashMap<String, String>();

static void initialize(SharedPreferences preferences) {
mSettings = new Config();
Expand Down Expand Up @@ -83,7 +108,7 @@ public static String read(String key, String fallback) {
return mSettings.preferences.getString(key, fallback);
}

if(!mSettings.mConfigs.containsKey(key) || mSettings.mConfigs.get(key).isEmpty()) {
if(!mSettings.mConfigs.containsKey(key) || Objects.requireNonNull(mSettings.mConfigs.get(key)).isEmpty()) {
return fallback;
}

Expand Down
Loading

0 comments on commit 55b88b4

Please sign in to comment.