made statusbar and toolbar (bottom) black

and some bugfixes
This commit is contained in:
JG-Cody 2021-06-07 20:48:51 +02:00
parent c9a4a7fbdd
commit e17596951c
12 changed files with 133 additions and 53 deletions

View File

@ -12,7 +12,9 @@ import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -22,6 +24,7 @@ import android.text.style.ForegroundColorSpan;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
@ -50,9 +53,19 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialog.A
public static int RESULT_LOAD_IMAGE = 0; public static int RESULT_LOAD_IMAGE = 0;
private AppBarConfiguration mAppBarConfiguration; private AppBarConfiguration mAppBarConfiguration;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.BLUE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getWindow().setStatusBarContrastEnforced(false);
}
//getWindow().setBackgroundDrawableResource(R.drawable.toolbartop);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
if (savedInstanceState == null) { if (savedInstanceState == null) {
/*getSupportFragmentManager().beginTransaction() /*getSupportFragmentManager().beginTransaction()
.replace(android.R.id.content, new DemoPreferenceFragment()) .replace(android.R.id.content, new DemoPreferenceFragment())

View File

@ -156,9 +156,9 @@ public class EinstellungenFragment extends Fragment {
} }
private void showChangeBackgroundDialog() { private void showChangeBackgroundDialog() {
final String[] listItems = {"FARBE", "GRAFIK", "RESET BACKGROUND"}; final String[] listItems = {"FARBE","GRADIENT", "GRAFIK", "RESET BACKGROUND"};
AlertDialog.Builder mBuilder = new AlertDialog.Builder(getContext()); AlertDialog.Builder mBuilder = new AlertDialog.Builder(getContext());
mBuilder.setTitle("CHOOSE LANGUAGE"); mBuilder.setTitle("CHOOSE BACKGROUND-TYPE");
mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() { mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
@ -178,10 +178,25 @@ public class EinstellungenFragment extends Fragment {
} catch (Exception e) { } catch (Exception e) {
} }
} else if (i == 1) { } else if (i == 1) {
try {
Toast.makeText(getContext(), "Colorpicker", Toast.LENGTH_SHORT).show();
final ColorPickerView picker = new ColorPickerView(getContext());
picker.setColor(0xff12345);
AlertDialog mDialog = new AlertDialog.Builder(getContext()).setView(picker).setTitle(R.string.colorpicker).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).create();
mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round);
mDialog.show();
} catch (Exception e) {
}
} else if (i == 2) {
Intent a = new Intent( Intent a = new Intent(
Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
getActivity().startActivityForResult(a, MainActivity.RESULT_LOAD_IMAGE); getActivity().startActivityForResult(a, MainActivity.RESULT_LOAD_IMAGE);
} else if (i == 2) { } else if (i == 3) {
getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("Background").commit(); getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("Background").commit();
startActivity(getActivity().getIntent()); startActivity(getActivity().getIntent());
getActivity().finish(); getActivity().finish();

View File

@ -59,7 +59,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
schlafzimmeru1aus = (Button) root.findViewById(R.id.schlafzimmeru1an); schlafzimmeru1aus = (Button) root.findViewById(R.id.schlafzimmeru1aus);
schlafzimmeru1aus.setOnClickListener(new View.OnClickListener() { schlafzimmeru1aus.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -72,7 +72,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
}); });
schlafzimmeru1an = (Button) root.findViewById(R.id.schlafzimmeru1aus); schlafzimmeru1an = (Button) root.findViewById(R.id.schlafzimmeru1an);
schlafzimmeru1an.setOnClickListener(new View.OnClickListener() { schlafzimmeru1an.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -85,7 +85,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
}); });
schlafzimmeru2aus = (Button) root.findViewById(R.id.schlafzimmeru2an); schlafzimmeru2aus = (Button) root.findViewById(R.id.schlafzimmeru2aus);
schlafzimmeru2aus.setOnClickListener(new View.OnClickListener() { schlafzimmeru2aus.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -98,7 +98,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
}); });
schlafzimmeru2an = (Button) root.findViewById(R.id.schlafzimmeru2aus); schlafzimmeru2an = (Button) root.findViewById(R.id.schlafzimmeru2an);
schlafzimmeru2an.setOnClickListener(new View.OnClickListener() { schlafzimmeru2an.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -111,7 +111,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
}); });
schlafzimmeru3aus = (Button) root.findViewById(R.id.schlafzimmeru3an); schlafzimmeru3aus = (Button) root.findViewById(R.id.schlafzimmeru3aus);
schlafzimmeru3aus.setOnClickListener(new View.OnClickListener() { schlafzimmeru3aus.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -124,7 +124,7 @@ public class SchlafzimmerFragment extends Fragment {
} }
}); });
schlafzimmeru3an = (Button) root.findViewById(R.id.schlafzimmeru3aus); schlafzimmeru3an = (Button) root.findViewById(R.id.schlafzimmeru3an);
schlafzimmeru3an.setOnClickListener(new View.OnClickListener() { schlafzimmeru3an.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -77,16 +77,17 @@ public class HomeFragment extends Fragment {
SharedPreferences t = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); SharedPreferences t = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
if (user == null || ip == null) { if (user == null || ip == null) {
loginButton.setVisibility(View.VISIBLE); loginButton.setVisibility(View.VISIBLE);
} } else {
else {loginButton.setVisibility(View.INVISIBLE); loginButton.setVisibility(View.INVISIBLE);
ipInput.setVisibility(View.GONE); ipInput.setVisibility(View.GONE);
userInput.setVisibility(View.GONE); userInput.setVisibility(View.GONE);
passwordInput.setVisibility(View.GONE);} passwordInput.setVisibility(View.GONE);
}
loginButton.setOnClickListener(new View.OnClickListener() { loginButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (userInput.getText().toString().trim().length() == 0 || ipInput.getText().toString().trim().length() == 0 || passwordInput.getText().toString().trim().length() == 0) { if (userInput.getText().toString().trim().length() == 0 || ipInput.getText().toString().trim().length() == 0 || passwordInput.getText().toString().trim().length() == 0) {
Toast.makeText(getContext(),getString(R.string.felder_dürfen_nicht_leer_sein), Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), getString(R.string.felder_dürfen_nicht_leer_sein), Toast.LENGTH_SHORT).show();
} else { } else {
user = userInput.getText().toString(); user = userInput.getText().toString();
password = passwordInput.getText().toString(); password = passwordInput.getText().toString();
@ -113,17 +114,18 @@ public class HomeFragment extends Fragment {
ipInput.setVisibility(View.VISIBLE); ipInput.setVisibility(View.VISIBLE);
userInput.setVisibility(View.VISIBLE); userInput.setVisibility(View.VISIBLE);
passwordInput.setVisibility(View.VISIBLE); passwordInput.setVisibility(View.VISIBLE);
} else {
logoutButton.setVisibility(View.VISIBLE);
} }
else {logoutButton.setVisibility(View.VISIBLE);}
logoutButton.setOnClickListener(new View.OnClickListener() { logoutButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").commit(); getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").commit();
startActivity(getActivity().getIntent()); startActivity(getActivity().getIntent());
getActivity().finish(); getActivity().finish();
} }
}); });
wlan_aus_Button = (Button) root.findViewById(R.id.wlan_an); wlan_aus_Button = (Button) root.findViewById(R.id.wlan_aus);
wlan_aus_Button.setOnClickListener(new View.OnClickListener() { wlan_aus_Button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -135,7 +137,7 @@ public class HomeFragment extends Fragment {
} }
} }
}); });
wlan_an_Button = (Button) root.findViewById(R.id.wlan_aus); wlan_an_Button = (Button) root.findViewById(R.id.wlan_an);
wlan_an_Button.setOnClickListener(new View.OnClickListener() { wlan_an_Button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -147,7 +149,7 @@ public class HomeFragment extends Fragment {
} }
} }
}); });
kodiaus = (Button) root.findViewById(R.id.kodian); kodiaus = (Button) root.findViewById(R.id.kodiaus);
kodiaus.setOnClickListener(new View.OnClickListener() { kodiaus.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -160,7 +162,7 @@ public class HomeFragment extends Fragment {
} }
}); });
kodian = (Button) root.findViewById(R.id.kodiaus); kodian = (Button) root.findViewById(R.id.kodian);
kodian.setOnClickListener(new View.OnClickListener() { kodian.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="0dp"
android:color="#FFFFFF" />
<gradient
android:angle="180"
android:endColor="@color/purple_200"
android:startColor="#0088FF" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="00dp"
android:topLeftRadius="0dp"
android:topRightRadius="00dp" />
</shape>
</item>
<item
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="2dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="0dp"
android:color="#FFFFFF" />
<gradient
android:angle="180"
android:endColor="?attr/colorOnBackground"
android:startColor="?attr/colorOnBackground" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
</item>
</layer-list>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,10 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView
android:id="@+id/Background"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -12,37 +30,22 @@
android:clickable="true" android:clickable="true"
tools:context=".ui.Credits.CreditsFragment"> tools:context=".ui.Credits.CreditsFragment">
<ImageView
android:id="@+id/Background"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ImageView <ImageView
android:id="@drawable/backgroundoverlay" android:id="@drawable/backgroundoverlay"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="-25dp" android:layout_marginStart="-25dp"
android:layout_marginLeft="-25dp" android:layout_marginLeft="-25dp"
android:layout_marginTop="-50dp" android:layout_marginTop="-25dp"
android:layout_marginEnd="-25dp" android:layout_marginEnd="-25dp"
android:layout_marginRight="-25dp" android:layout_marginRight="-25dp"
android:layout_marginBottom="-100dp" android:layout_marginBottom="-25dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/backgroundoverlay" android:src="@drawable/backgroundoverlay"
app:layout_constraintBottom_toBottomOf="@+id/Background" app:layout_constraintBottom_toBottomOf="@+id/JulianK"
app:layout_constraintEnd_toEndOf="@+id/TERAPLEX_Version" app:layout_constraintEnd_toEndOf="@+id/TERAPLEX_Version"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/TERAPLEX_Version" app:layout_constraintStart_toStartOf="@+id/TERAPLEX_Version"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="@+id/TERAPLEX_Version" />
app:layout_constraintVertical_bias="1.0" />
<TextView <TextView
android:id="@+id/lizenz" android:id="@+id/lizenz"
@ -296,3 +299,4 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -116,7 +116,7 @@
<Button <Button
android:id="@+id/button_reset" android:id="@+id/button_reset"
android:layout_width="150dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
@ -129,7 +129,7 @@
<Button <Button
android:id="@+id/button_colorpicker" android:id="@+id/button_colorpicker"
android:layout_width="150dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="85dp" android:layout_marginTop="85dp"
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
@ -143,7 +143,7 @@
<Button <Button
android:id="@+id/button_language" android:id="@+id/button_language"
android:layout_width="150dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
@ -157,7 +157,7 @@
<Button <Button
android:id="@+id/button_pickimage" android:id="@+id/button_pickimage"
android:layout_width="150dp" android:layout_width="140dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"

View File

@ -226,7 +226,7 @@
android:id="@+id/textView5" android:id="@+id/textView5"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginTop="25dp" android:layout_marginTop="50dp"
android:background="@drawable/button_middle" android:background="@drawable/button_middle"
android:gravity="center" android:gravity="center"
android:text="@string/wlan" android:text="@string/wlan"
@ -243,6 +243,7 @@
android:id="@+id/textView7" android:id="@+id/textView7"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginBottom="25dp"
android:background="@drawable/button_middle" android:background="@drawable/button_middle"
android:gravity="center" android:gravity="center"
android:text="@string/kodi" android:text="@string/kodi"

View File

@ -2,6 +2,10 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.Teraplex" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.Teraplex" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
<item name="android:windowTranslucentNavigation" tools:targetApi="kitkat">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/red</item> <item name="colorPrimary">@color/red</item>
<item name="colorPrimaryVariant">@color/red_dark</item> <item name="colorPrimaryVariant">@color/red_dark</item>
<item name="colorOnPrimary">@color/white</item> <item name="colorOnPrimary">@color/white</item>
@ -12,7 +16,7 @@
<item name="colorSecondaryVariant">@color/blue</item> <item name="colorSecondaryVariant">@color/blue</item>
<item name="colorOnSecondary">@color/white</item> <item name="colorOnSecondary">@color/white</item>
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- <item name="android:statusBarColor" tools:targetApi="l">#00FFFFFF</item> -->
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:actionMenuTextColor">@color/white</item> <item name="android:actionMenuTextColor">@color/white</item>

View File

@ -2,6 +2,10 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.Teraplex" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.Teraplex" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
<item name="android:windowTranslucentNavigation" tools:targetApi="kitkat">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/red</item> <item name="colorPrimary">@color/red</item>
<item name="colorPrimaryVariant">@color/red_dark</item> <item name="colorPrimaryVariant">@color/red_dark</item>
<item name="colorOnPrimary">@color/black</item> <item name="colorOnPrimary">@color/black</item>