This commit is contained in:
JG-Cody 2021-06-09 20:15:55 +02:00
parent 6f90cb957c
commit e4f7fb59c5
4 changed files with 45 additions and 21 deletions

View File

@ -13,6 +13,7 @@ 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.Color;
import android.graphics.Paint;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.net.Uri; import android.net.Uri;
@ -21,9 +22,11 @@ import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.Log;
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.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
@ -37,6 +40,7 @@ import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI; import androidx.navigation.ui.NavigationUI;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -47,6 +51,8 @@ import java.util.Locale;
import de.jg_cody.Teraplex.ui.Credits.CreditsFragment; import de.jg_cody.Teraplex.ui.Credits.CreditsFragment;
import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment; import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment;
import de.jg_cody.Teraplex.ui.Konsole.KonsoleFragment;
import de.jg_cody.Teraplex.ui.home.HomeFragment;
public class MainActivity extends AppCompatActivity implements AddButtonDialog.AddButtonDialogListener { public class MainActivity extends AppCompatActivity implements AddButtonDialog.AddButtonDialogListener {
@ -85,25 +91,25 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialog.A
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setBackgroundResource(R.drawable.toolbartop); toolbar.setBackgroundResource(R.drawable.toolbartop);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
// FloatingActionButton addfab = findViewById(R.id.addbutton_fab); FloatingActionButton addfab = findViewById(R.id.addbutton_fab);
// addfab.setOnClickListener(new View.OnClickListener() { addfab.setOnClickListener(new View.OnClickListener() {
// @Override @Override
// public void onClick(View v) { public void onClick(View v) {
// showChooseElement(); showChooseElement();
// } }
// }); });
// FloatingActionButton mfab = findViewById(R.id.fab); FloatingActionButton mfab = findViewById(R.id.fab);
// mfab.setOnClickListener(new View.OnClickListener() { mfab.setOnClickListener(new View.OnClickListener() {
// @Override @Override
// public void onClick(View view) { public void onClick(View view) {
// try { try {
// Log.d("I", "ACTION BUTTON CLICKED"); Log.d("I", "ACTION BUTTON CLICKED");
// SSH_connection.executeRemoteCommand(HomeFragment.ip, HomeFragment.user, HomeFragment.password, KonsoleFragment.command); SSH_connection.executeRemoteCommand(HomeFragment.ip, HomeFragment.user, HomeFragment.password, KonsoleFragment.command);
// } catch (Exception e) { } catch (Exception e) {
// } }
// } }
// }); });
DrawerLayout drawer = findViewById(R.id.drawer_layout); DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view); NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
@ -313,4 +319,12 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialog.A
return dest; return dest;
} }
public static Bitmap createImage(int width, int height, int color) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setColor(color);
canvas.drawRect(0F, 0F, (float) width, (float) height, paint);
return bitmap;
}
} }

View File

@ -188,6 +188,8 @@ public class EinstellungenFragment extends Fragment {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }
}).create(); }).create();
mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round);

View File

@ -20,7 +20,7 @@
app:layout_anchor="@+id/include" app:layout_anchor="@+id/include"
app:layout_anchorGravity="center" /> app:layout_anchorGravity="center" />
<!-- <de.jg_cody.Teraplex.MovableFloatingActionButton <de.jg_cody.Teraplex.MovableFloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -37,7 +37,7 @@
android:layout_marginVertical="70dp" android:layout_marginVertical="70dp"
android:background="@drawable/button_round" android:background="@drawable/button_round"
android:hapticFeedbackEnabled="true" android:hapticFeedbackEnabled="true"
android:src="@drawable/add_black_24dp" /> --> android:src="@drawable/add_black_24dp" />
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar

View File

@ -21,7 +21,7 @@
android:title="@string/menu_zeitsteuerung" /> android:title="@string/menu_zeitsteuerung" />
</group> </group>
<group > <group>
<item <item
android:id="@+id/nav_flur" android:id="@+id/nav_flur"
android:title="@string/menu_flur" /> android:title="@string/menu_flur" />
@ -32,4 +32,12 @@
android:id="@+id/nav_kueche" android:id="@+id/nav_kueche"
android:title="@string/menu_küche" /> android:title="@string/menu_küche" />
</group> </group>
<group android:checkableBehavior="single"
android:id="@+id/Down">
<item
android:id="@+id/app_bar_switch"
android:title="BEARBEITUNGSMODUS"
app:actionLayout="@layout/switch_item"
app:showAsAction="always" />
</group>
</menu> </menu>