removed Fragment classes from MainActivity
- removed fragments - removed unnecessary classes - removed unnecessary code
This commit is contained in:
parent
076db89147
commit
6a251fbb27
@ -48,7 +48,6 @@ public class Fragment2 extends Fragment {
|
||||
Bundle args = getArguments();
|
||||
c = getContext();
|
||||
ListView listView = new ListView(c);
|
||||
setContentView(R.layout.fragment2);
|
||||
listView.setAdapter(new MeinAdapter(c, getVideoFiles()));
|
||||
if (args != null) {
|
||||
text = args.getString(KEY_TEXT);
|
||||
|
@ -1,46 +0,0 @@
|
||||
package com.example.ueberwachungssystem.Fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.ueberwachungssystem.R;
|
||||
|
||||
public class Fragment3 extends Fragment {
|
||||
private String text;
|
||||
private final static String KEY_TEXT = "KEY_TEXT" ;
|
||||
private void log(String nachricht) {
|
||||
Log.d(this.getClass().getSimpleName(), nachricht);
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
log( "onCreateView" );
|
||||
View view = inflater.inflate(R.layout.fragment2, container, false );
|
||||
TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
|
||||
Sensor.setText(text);
|
||||
return view;
|
||||
}
|
||||
public static Fragment3 erstellen(String text) {
|
||||
Fragment3 fragment = new Fragment3();
|
||||
Bundle b = new Bundle();
|
||||
b.putString(KEY_TEXT, text);
|
||||
fragment.setArguments(b);
|
||||
return fragment;
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
text = args.getString(KEY_TEXT);
|
||||
log("onCreate: text=" + text);
|
||||
} else {
|
||||
log("onCreate");
|
||||
}
|
||||
}
|
||||
}
|
@ -27,20 +27,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
private TextView AoderA;
|
||||
private String auswahltext = "Wahl des Detektionsmodus";
|
||||
private String auswahlAoderA = "Wahl von Alarmmeldungen oder Auswahl von Alarmaufzeichnungen";
|
||||
|
||||
//Sensoren und Kommunikation
|
||||
WifiCommunication communication;
|
||||
//Buttons
|
||||
private ToggleButton toggleKamera;
|
||||
private ToggleButton toggleAudio;
|
||||
private ToggleButton toggleBewegung;
|
||||
|
||||
//Überprüfungswerte
|
||||
boolean wahr;
|
||||
private void log(String nachricht) {
|
||||
Log.d(this.getClass().getSimpleName(), nachricht);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -62,47 +53,33 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
public void onClick(View v) {
|
||||
if (v == toggleKamera) {
|
||||
if (toggleKamera.isChecked()) {
|
||||
wahr = true;
|
||||
|
||||
} else {
|
||||
wahr = false;
|
||||
|
||||
}
|
||||
}
|
||||
if (v == toggleAudio) {
|
||||
if (toggleAudio.isChecked()) {
|
||||
wahr = true;
|
||||
|
||||
} else {
|
||||
wahr = false;
|
||||
|
||||
}
|
||||
}
|
||||
if (v == toggleBewegung) {
|
||||
if (toggleBewegung.isChecked()) {
|
||||
wahr = true;
|
||||
|
||||
} else {
|
||||
wahr = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
communication.stopCommunication();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
communication = new WifiCommunication(1234);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void onClickZeigeFragment1(View view) {
|
||||
Button button = (Button) view;
|
||||
log(button.getText() + " ausgewählt");
|
||||
zeigeFragment(fragment1.erstellen("Hier stehen dann die Alarme"));
|
||||
}
|
||||
|
||||
public void onClickZeigeFragment2(View view) {
|
||||
Button button = (Button) view;
|
||||
log(button.getText() + " ausgewählt");
|
||||
zeigeFragment(fragment2.erstellen("Hier stehen dann die Videos"));
|
||||
}
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.example.ueberwachungssystem;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class VideoListAdapter extends ArrayAdapter<File> {
|
||||
|
||||
public VideoListAdapter(Context context, List<File> videoList) {
|
||||
super(context, 0, videoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_video, parent, false);
|
||||
}
|
||||
|
||||
File videoFile = getItem(position);
|
||||
|
||||
ImageView thumbnailImageView = convertView.findViewById(R.id.imageViewThumbnail);
|
||||
TextView titleTextView = convertView.findViewById(R.id.textViewTitle);
|
||||
|
||||
// Set tag to identify the clicked item
|
||||
convertView.setTag(videoFile.getAbsolutePath());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/holo_blue_light" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Sensor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Alarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/Sensor"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user