Browse Source

Version 5 working with Fragment 3

ms_master_copie
Miguel Siebenhaar 1 year ago
parent
commit
b900ec2e04

+ 3
- 5
app/src/main/java/com/example/ueberwachungssystem/Fragments/Fragment3.java View File

View view = inflater.inflate(R.layout.fragment3, container, false); View view = inflater.inflate(R.layout.fragment3, container, false);
if (onImageViewReadyListener != null) { if (onImageViewReadyListener != null) {
ImageView ivp = (ImageView) view.findViewById(R.id.Video); ImageView ivp = (ImageView) view.findViewById(R.id.Video);
onImageViewReadyListener.onImageViewReady(ivp);
ImageView ivp2 = (ImageView) view.findViewById(R.id.Video2);
onImageViewReadyListener.onImageViewReady(ivp, ivp2);
} }
return view; return view;
} }
public static Fragment3 erstellen(View view) { public static Fragment3 erstellen(View view) {
Fragment3 fragment = new Fragment3(); Fragment3 fragment = new Fragment3();
Bundle b = new Bundle();
b.putString(KEY_TEXT, "Test");
fragment.setArguments(b);
return fragment; return fragment;
} }
public interface OnImageViewReadyListener { public interface OnImageViewReadyListener {
void onImageViewReady(ImageView imageView);
void onImageViewReady(ImageView imageView, ImageView imageView2);
} }
public void onAttach(Context context) { public void onAttach(Context context) {
super.onAttach(context); super.onAttach(context);

+ 4
- 2
app/src/main/java/com/example/ueberwachungssystem/MainActivity.java View File

private Fragment3 fragment3; private Fragment3 fragment3;


private ImageView fragmentImage; private ImageView fragmentImage;
private ImageView fragmentImage2;
private DetectorService detectorService = new DetectorService(); private DetectorService detectorService = new DetectorService();
int num=0; int num=0;
//Textviews //Textviews
Button button = (Button) view; Button button = (Button) view;
fragment3_ = zeigeFragment(fragment3.erstellen(view)); fragment3_ = zeigeFragment(fragment3.erstellen(view));
} }
public void onImageViewReady(ImageView imageView) {
public void onImageViewReady(ImageView imageView, ImageView imageView2) {
fragmentImage = imageView; fragmentImage = imageView;
detectorService.videoDetector.debugProcessing(null, fragmentImage); //inputImageView
fragmentImage2 = imageView2;
detectorService.videoDetector.debugProcessing(fragmentImage, fragmentImage2); //inputImageView
} }


public void onClickEntferneFragment(View view) { public void onClickEntferneFragment(View view) {

+ 1
- 1
app/src/main/res/layout/activity_main.xml View File

android:layout_alignBottom="@+id/btnAufnahmen" android:layout_alignBottom="@+id/btnAufnahmen"
android:layout_toRightOf="@id/btnAufnahmen" android:layout_toRightOf="@id/btnAufnahmen"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:text="Anzeige verbergen"
android:text="Life Vorschau"
android:onClick="onClickZeigeFragment3"/> android:onClick="onClickZeigeFragment3"/>


<FrameLayout <FrameLayout

+ 12
- 2
app/src/main/res/layout/fragment3.xml View File



<ImageView <ImageView
android:id="@+id/Video" android:id="@+id/Video"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:rotation="90">
</ImageView>
<ImageView
android:id="@+id/Video2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/Video"
android:layout_marginTop="70dp"
android:rotation="-90">
</ImageView> </ImageView>


</RelativeLayout> </RelativeLayout>

Loading…
Cancel
Save