Skip to content

Commit

Permalink
Add simple textview with logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mklkj committed May 17, 2020
1 parent ee019dd commit 24d13e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.thelittlefireman.appkillermanager_exemple;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
Expand All @@ -12,9 +13,13 @@
import com.thelittlefireman.appkillermanager.exceptions.NoActionFoundException;
import com.thelittlefireman.appkillermanager.ui.DialogKillerManagerBuilder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import timber.log.Timber;

public class MainActivity extends Activity {
TextView logs;
TextView deviceName;
TextView isDeviceSupported;
Button powerSavingManagerButton;
Expand All @@ -25,20 +30,27 @@ public class MainActivity extends Activity {
AppKillerManager.Action currentAction = null;



@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

logs = findViewById(R.id.logs);
Timber.plant(new Timber.DebugTree());
Timber.plant(new Timber.Tree() {
@SuppressLint("SetTextI18n")
@Override
protected void log(int priority, @Nullable String tag, @NotNull String message, @Nullable Throwable t) {
logs.setText(tag + ": " + message + "\n" + logs.getText());
}
});

deviceName = (TextView) findViewById(R.id.device_name);
isDeviceSupported = (TextView) findViewById(R.id.is_device_supported);
deviceName = findViewById(R.id.device_name);
isDeviceSupported = findViewById(R.id.is_device_supported);
powerSavingManagerButton = findViewById(R.id.powerSavingManagerButton);
autoStartManagerButton = findViewById(R.id.autoStartManagerButton);
notificationManagerButton = findViewById(R.id.notificationManagerButton);
mAppCompatCheckBoxByDialog = (AppCompatCheckBox) findViewById(R.id.idByDialog);
mAppCompatCheckBoxByDialog = findViewById(R.id.idByDialog);


//ButterKnife.bind(this);
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<TextView
android:id="@+id/logs"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimaryDark"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/idByDialog"
tools:text="@tools:sample/lorem/random" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 24d13e2

Please sign in to comment.