Use FragmentContainerView for displaying FallbackFragment

This commit is contained in:
Sebastian Kürten
2021-06-14 17:07:34 +02:00
parent f8b645d2b1
commit bfcb469d49
4 changed files with 12 additions and 22 deletions

View File

@@ -15,7 +15,6 @@ import org.briarproject.briar.android.fragment.BaseFragment;
import javax.inject.Inject;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import static org.briarproject.briar.android.util.UiUtils.triggerFeedback;
@@ -74,10 +73,6 @@ public class HotspotErrorFragment extends BaseFragment {
Button feedbackButton = v.findViewById(R.id.feedbackButton);
feedbackButton.setOnClickListener(
button -> triggerFeedback(requireContext(), errorMessage));
FallbackFragment fallbackFragment = new FallbackFragment();
FragmentTransaction ta = getChildFragmentManager().beginTransaction();
ta.replace(R.id.fallbackPlaceholder, fallbackFragment).commit();
}
}

View File

@@ -11,7 +11,6 @@ import org.briarproject.briar.R;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
@@ -27,13 +26,4 @@ public class HotspotHelpFragment extends Fragment {
.inflate(R.layout.fragment_hotspot_help, container, false);
}
@Override
public void onViewCreated(View v, @Nullable Bundle savedInstanceState) {
super.onViewCreated(v, savedInstanceState);
FallbackFragment fallbackFragment = new FallbackFragment();
FragmentTransaction ta = getChildFragmentManager().beginTransaction();
ta.replace(R.id.fallbackPlaceholder, fallbackFragment).commit();
}
}

View File

@@ -65,13 +65,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/errorMessageDetail" />
<FrameLayout
android:id="@+id/fallbackPlaceholder"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fallbackFragment"
android:name="org.briarproject.briar.android.hotspot.FallbackFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/feedbackButton" />
app:layout_constraintTop_toBottomOf="@+id/feedbackButton"
tools:layout="@layout/fragment_hotspot_save_apk" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,7 +2,8 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -110,13 +111,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/site3View" />
<FrameLayout
android:id="@+id/fallbackPlaceholder"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fallbackFragment"
android:name="org.briarproject.briar.android.hotspot.FallbackFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/site4View" />
app:layout_constraintTop_toBottomOf="@+id/site4View"
tools:layout="@layout/fragment_hotspot_save_apk" />
</androidx.constraintlayout.widget.ConstraintLayout>