Skip to content

Commit

Permalink
Remove instructions dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mklkj committed May 20, 2020
1 parent 24d13e2 commit 587f58e
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 595 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.widget.AppCompatCheckBox;

import com.thelittlefireman.appkillermanager.AppKillerManager;
import com.thelittlefireman.appkillermanager.exceptions.NoActionFoundException;
import com.thelittlefireman.appkillermanager.ui.DialogKillerManagerBuilder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -25,7 +22,6 @@ public class MainActivity extends Activity {
Button powerSavingManagerButton;
Button autoStartManagerButton;
Button notificationManagerButton;
AppCompatCheckBox mAppCompatCheckBoxByDialog;

AppKillerManager.Action currentAction = null;

Expand All @@ -50,52 +46,39 @@ protected void log(int priority, @Nullable String tag, @NotNull String message,
powerSavingManagerButton = findViewById(R.id.powerSavingManagerButton);
autoStartManagerButton = findViewById(R.id.autoStartManagerButton);
notificationManagerButton = findViewById(R.id.notificationManagerButton);
mAppCompatCheckBoxByDialog = findViewById(R.id.idByDialog);


//ButterKnife.bind(this);
powerSavingManagerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentAction = AppKillerManager.Action.ACTION_POWER_SAVING;
if (mAppCompatCheckBoxByDialog.isChecked()) {
startDialog(currentAction);
} else {
try {
AppKillerManager.doActionPowerSaving(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
try {
AppKillerManager.doActionPowerSaving(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
}
});
autoStartManagerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentAction = AppKillerManager.Action.ACTION_AUTO_START;
if (mAppCompatCheckBoxByDialog.isChecked()) {
startDialog(currentAction);
} else {
try {
AppKillerManager.doActionAutoStart(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
try {
AppKillerManager.doActionAutoStart(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
}
});
notificationManagerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentAction = AppKillerManager.Action.ACTION_NOTIFICATIONS;
if (mAppCompatCheckBoxByDialog.isChecked()) {
startDialog(currentAction);
} else {
try {
AppKillerManager.doActionNotification(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
try {
AppKillerManager.doActionNotification(MainActivity.this);
} catch (NoActionFoundException e) {
Timber.e(e);
}
}
});
Expand All @@ -107,19 +90,6 @@ public void onClick(View v) {

}

public void startDialog(AppKillerManager.Action action) {

try {
new DialogKillerManagerBuilder(this).setAction(action).show();

} catch (DialogKillerManagerBuilder.UnAvailableActionException e) {
Timber.e(e);
} catch (DialogKillerManagerBuilder.UnSupportedDeviceException e) {
Timber.e(e);
}

}

@Override
public void onResume() {

Expand Down
85 changes: 0 additions & 85 deletions app/src/main/res/layout/activity_instructions.xml

This file was deleted.

21 changes: 1 addition & 20 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,6 @@
app:layout_constraintVertical_bias="0.0"
tools:layout_editor_absoluteX="0dp" />

<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/idByDialog"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="404dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:checked="true"
android:text="Enable dialog"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.028"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<TextView
android:id="@+id/logs"
android:layout_width="match_parent"
Expand All @@ -84,7 +65,7 @@
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/idByDialog"
app:layout_constraintTop_toBottomOf="@id/notificationManagerButton"
tools:text="@tools:sample/lorem/random" />

</androidx.constraintlayout.widget.ConstraintLayout>
10 changes: 0 additions & 10 deletions appkillermanager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,8 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'androidx.annotation:annotation:1.1.0'

implementation "androidx.core:core-ktx:1.2.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'

testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

dependencyUpdates.resolutionStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ class Asus : Device {
override val manufacturer: Manufacturer
get() = Manufacturer.ASUS

override val helpImageAutoStart: Int
get() = R.drawable.asus_autostart

override val helpImageNotification: Int
get() = R.drawable.asus_notification

override fun isActionPowerSavingAvailable(context: Context): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.thelittlefireman.appkillermanager.devices

import android.content.Context
import android.content.Intent
import androidx.annotation.DrawableRes
import com.thelittlefireman.appkillermanager.utils.Manufacturer

interface Device {
Expand All @@ -11,18 +10,6 @@ interface Device {

val manufacturer: Manufacturer

@get:DrawableRes
val helpImagePowerSaving: Int
get() = 0

@get:DrawableRes
val helpImageAutoStart: Int
get() = 0

@get:DrawableRes
val helpImageNotification: Int
get() = 0

fun isActionPowerSavingAvailable(context: Context): Boolean = false

fun isActionAutoStartAvailable(context: Context): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import com.thelittlefireman.appkillermanager.R
import com.thelittlefireman.appkillermanager.utils.ActionsUtils
import com.thelittlefireman.appkillermanager.utils.Manufacturer
import com.thelittlefireman.appkillermanager.utils.SystemUtils.getEmuiRomName
Expand Down Expand Up @@ -40,9 +39,6 @@ class Huawei : Device {
override val manufacturer: Manufacturer
get() = Manufacturer.HUAWEI

override val helpImagePowerSaving: Int
get() = R.drawable.huawei_powersaving

override fun isActionPowerSavingAvailable(context: Context) = true

override fun isActionNotificationAvailable(context: Context) = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class Samsung : Device {
private const val SAMSUNG_SYSTEMMANAGER_AUTOSTART_PACKAGE_V1_ACTIVITY = "com.samsung.memorymanager.RamActivity"
}

override val helpImagePowerSaving: Int
get() = R.drawable.samsung

override val isThatRom: Boolean
get() = Build.BRAND.equals(manufacturer.toString(), ignoreCase = true) ||
Build.MANUFACTURER.equals(manufacturer.toString(), ignoreCase = true) ||
Expand Down
Loading

0 comments on commit 587f58e

Please sign in to comment.