background changed to neutral color

This commit is contained in:
JG-Cody 2021-06-20 17:43:18 +02:00
parent 4a4a808a88
commit e835e3bf4c
13 changed files with 24 additions and 30 deletions

View File

@ -1,17 +1,12 @@
package de.jg_cody.Teraplex.ui.Flur;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListView;
import androidx.annotation.NonNull;
@ -22,15 +17,16 @@ import androidx.lifecycle.ViewModelProvider;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Objects;
import de.jg_cody.Teraplex.AddButtonDialogSingle;
import de.jg_cody.Teraplex.AddButtonsDialogDouble;
import de.jg_cody.Teraplex.Cricketer;
import de.jg_cody.Teraplex.MainActivity;
import de.jg_cody.Teraplex.R;
import de.jg_cody.Teraplex.ui.rooms.*;
import de.jg_cody.Teraplex.ui.rooms.ListAdapter;
import de.jg_cody.Teraplex.ui.rooms.ListItem;
import de.jg_cody.Teraplex.ui.rooms.ListItemDouble;
import de.jg_cody.Teraplex.ui.rooms.ListItemSingle;
public class FlurFragment extends Fragment{
@ -53,14 +49,14 @@ public class FlurFragment extends Fragment{
flurViewModel =
new ViewModelProvider(this).get(FlurViewModel.class);
View root = inflater.inflate(R.layout.fragment_flur, container, false);
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
/* SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
String Background = p.getString("Background", null);
if (Background != null) {
ImageView I = root.findViewById(R.id.Background);
byte[] BA = Base64.getDecoder().decode(Background);
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
} */
@ -112,7 +108,7 @@ public class FlurFragment extends Fragment{
}
public void openDialog1() {
AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle();
addButtonDialogSingle.show(getActivity().getSupportFragmentManager(), "example dialog");
addButtonDialogSingle.show(requireActivity().getSupportFragmentManager(), "example dialog");
items.add(new ListItemSingle(addButtonDialogSingle.getCommand(),1, addButtonDialogSingle.getName(), addButtonDialogSingle.getButtonName()));
listAdapter.notifyDataSetChanged();
@ -121,7 +117,7 @@ public class FlurFragment extends Fragment{
public void openDialog2() {
AddButtonsDialogDouble addButtonsDialogDouble = new AddButtonsDialogDouble();
addButtonsDialogDouble.show(getActivity().getSupportFragmentManager(), "example dialog");
addButtonsDialogDouble.show(requireActivity().getSupportFragmentManager(), "example dialog");
items.add(new ListItemDouble(2,addButtonsDialogDouble.getName(), addButtonsDialogDouble.getCommand1(), addButtonsDialogDouble.getCommand2(), addButtonsDialogDouble.getButton1(), addButtonsDialogDouble.getButton2()));
listAdapter.notifyDataSetChanged();
}

View File

@ -1,5 +1,6 @@
package de.jg_cody.Teraplex.ui.rooms;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@ -7,10 +8,11 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import de.jg_cody.Teraplex.R;
import de.jg_cody.Teraplex.ui.Flur.FlurFragment;
public class ListAdapter extends ArrayAdapter {
@ -37,8 +39,10 @@ public class ListAdapter extends ArrayAdapter {
this.objects = objects;
}
@SuppressLint("InflateParams")
@NotNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(int position, View convertView, @NotNull ViewGroup parent) {
IViewHolder viewHolder= null;
ListItem listViewItem = objects.get(position);
@ -68,10 +72,6 @@ public class ListAdapter extends ArrayAdapter {
convertView.setTag(viewHolder);
}
else if(listViewItemType == OPTION3BUTTON)
{
}
}
else{

View File

@ -39,8 +39,7 @@ public class ViewHolderDoubleButton implements IViewHolder{
@Override
public View[] getViews()
{
View[] views = {getbLeft(),getbRight()};
return views;
return new View[]{getbLeft(),getbRight()};
}

View File

@ -32,8 +32,7 @@ public class ViewHolderSingleButton implements IViewHolder {
@Override
public View[] getViews()
{
View[] views = {getbRun(),};
return views;
return new View[]{getbRun(),};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -10,7 +10,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"

View File

@ -10,7 +10,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"

View File

@ -15,7 +15,7 @@
android:layout_height="0dp"
android:background="#80FFFFFF"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,7 +13,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:src="@drawable/fog_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"