Debug prefsManager usage

This commit is contained in:
jacques 2021-02-07 21:51:19 +01:00
parent d2dce12c22
commit 602374522e

View file

@ -1,6 +1,7 @@
package net.foucry.pilldroid; package net.foucry.pilldroid;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -13,6 +14,7 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
@ -28,13 +30,18 @@ public class WelcomeActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Boolean DEBUG = false;
// Checking for first time launch - before calling setContentView() // Checking for first time launch - before calling setContentView()
prefManager = new PrefManager(this); prefManager = new PrefManager(this);
if (DEBUG) {
prefManager.setFirstTimeLaunch(true);
}
if (!prefManager.isFirstTimeLaunch()) { if (!prefManager.isFirstTimeLaunch()) {
launchHomeScreen();
finish(); finish();
} }
prefManager.setFirstTimeLaunch(false);
// Making notification bar transparent // Making notification bar transparent
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
@ -98,20 +105,20 @@ public class WelcomeActivity extends AppCompatActivity {
private void addBottomDots(int currentPage) { private void addBottomDots(int currentPage) {
TextView[] dots = new TextView[layouts.length]; TextView[] dots = new TextView[layouts.length];
int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); //int[] colorsActive = getResources().getIntArray(R.array.array_dot_active);
int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); //int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive);
dotsLayout.removeAllViews(); dotsLayout.removeAllViews();
for (int i = 0; i < dots.length; i++) { for (int i = 0; i < dots.length; i++) {
dots[i] = new TextView(this); dots[i] = new TextView(this);
dots[i].setText(""); dots[i].setText("");
dots[i].setTextSize(35); dots[i].setTextSize(35);
dots[i].setTextColor(colorsInactive[currentPage]); dots[i].setTextColor(ContextCompat.getColor(this, R.color.dot_dark));
dotsLayout.addView(dots[i]); dotsLayout.addView(dots[i]);
} }
if (dots.length > 0) if (dots.length > 0)
dots[currentPage].setTextColor(colorsActive[currentPage]); dots[currentPage].setTextColor(ContextCompat.getColor(this, R.color.dot_light));
} }
private int getItem(int i) { private int getItem(int i) {