|
|
@@ -20,11 +20,19 @@ import android.widget.ToggleButton; |
|
|
|
import com.example.ueberwachungssystem.Detection.DetectionReport; |
|
|
|
import com.example.ueberwachungssystem.Detection.Detector; |
|
|
|
import com.example.ueberwachungssystem.Detection.VideoDetector; |
|
|
|
import com.example.ueberwachungssystem.Fragments.Fragment1; |
|
|
|
import com.example.ueberwachungssystem.Fragments.Fragment2; |
|
|
|
import com.example.ueberwachungssystem.Fragments.Fragment3; |
|
|
|
|
|
|
|
import org.w3c.dom.Text; |
|
|
|
|
|
|
|
@ExperimentalGetImage |
|
|
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener { |
|
|
|
private Fragment aktuellesFragment; |
|
|
|
private Fragment1 fragment1; |
|
|
|
private Fragment2 fragment2; |
|
|
|
private Fragment3 fragment3; |
|
|
|
|
|
|
|
WifiCommunication communication; |
|
|
|
private TextView alarm; |
|
|
|
private String text = "Das ist ein Alarm des Sensors"; |
|
|
@@ -84,18 +92,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
public void onClickZeigeFragment1(View view) { |
|
|
|
Button button = (Button) view; |
|
|
|
log(button.getText() + " ausgewählt"); |
|
|
|
zeigeFragment(Fragment1.erstellen("Fragment 1 wurde angeklickt")); |
|
|
|
zeigeFragment(fragment1.erstellen("Fragment 1 wurde angeklickt")); |
|
|
|
} |
|
|
|
public void onClickZeigeFragment2(View view) { |
|
|
|
Button button = (Button) view; |
|
|
|
log(button.getText() + " ausgewählt"); |
|
|
|
zeigeFragment(Fragment2.erstellen("Fragment 2 wurde angeklickt")); |
|
|
|
zeigeFragment(fragment2.erstellen("Fragment 2 wurde angeklickt")); |
|
|
|
} |
|
|
|
|
|
|
|
public void onClickZeigeFragment3(View view) { |
|
|
|
Button button = (Button) view; |
|
|
|
log(button.getText() + " ausgewählt"); |
|
|
|
zeigeFragment(Fragment3.erstellen("Fragment 3 wurde angeklickt")); |
|
|
|
zeigeFragment(fragment3.erstellen("Fragment 3 wurde angeklickt")); |
|
|
|
} |
|
|
|
|
|
|
|
public void onClickEntferneFragment(View view) { |
|
|
@@ -115,106 +123,4 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
aktuellesFragment = null ; |
|
|
|
} |
|
|
|
} |
|
|
|
public static class Fragment1 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.fragment1, container, false); |
|
|
|
TextView Sensor = (TextView) view.findViewById(R.id.Sensor); |
|
|
|
Sensor.setText(text); |
|
|
|
return view; |
|
|
|
} |
|
|
|
public static Fragment1 erstellen(String text) { |
|
|
|
Fragment1 fragment = new Fragment1(); |
|
|
|
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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
public static class Fragment2 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 Fragment2 erstellen(String text) { |
|
|
|
Fragment2 fragment = new Fragment2(); |
|
|
|
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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static 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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |