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

@@ -36,19 +36,17 @@ public class Fragment3 extends Fragment {
View view = inflater.inflate(R.layout.fragment3, container, false);
if (onImageViewReadyListener != null) {
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;
}
public static Fragment3 erstellen(View view) {
Fragment3 fragment = new Fragment3();
Bundle b = new Bundle();
b.putString(KEY_TEXT, "Test");
fragment.setArguments(b);
return fragment;
}
public interface OnImageViewReadyListener {
void onImageViewReady(ImageView imageView);
void onImageViewReady(ImageView imageView, ImageView imageView2);
}
public void onAttach(Context context) {
super.onAttach(context);

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

@@ -44,6 +44,7 @@ public class MainActivity extends AppCompatActivity implements Fragment3.OnImage
private Fragment3 fragment3;

private ImageView fragmentImage;
private ImageView fragmentImage2;
private DetectorService detectorService = new DetectorService();
int num=0;
//Textviews
@@ -202,9 +203,10 @@ public class MainActivity extends AppCompatActivity implements Fragment3.OnImage
Button button = (Button) view;
fragment3_ = zeigeFragment(fragment3.erstellen(view));
}
public void onImageViewReady(ImageView imageView) {
public void onImageViewReady(ImageView imageView, ImageView imageView2) {
fragmentImage = imageView;
detectorService.videoDetector.debugProcessing(null, fragmentImage); //inputImageView
fragmentImage2 = imageView2;
detectorService.videoDetector.debugProcessing(fragmentImage, fragmentImage2); //inputImageView
}

public void onClickEntferneFragment(View view) {

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

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

<FrameLayout

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

@@ -8,8 +8,18 @@

<ImageView
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>

</RelativeLayout>

Loading…
Cancel
Save