mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Combine transfer data graphics to reduce layout complexity
and make scaling work better on smaller screens
This commit is contained in:
@@ -7,6 +7,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
@@ -23,6 +24,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import static android.view.View.FOCUS_DOWN;
|
||||
|
||||
/**
|
||||
* A fragment to be used at the end of a user flow
|
||||
* where the user should not have the option to go back.
|
||||
@@ -55,6 +58,7 @@ public class FinalFragment extends Fragment {
|
||||
return f;
|
||||
}
|
||||
|
||||
private ScrollView scrollView;
|
||||
protected Button buttonView;
|
||||
|
||||
@Nullable
|
||||
@@ -65,6 +69,7 @@ public class FinalFragment extends Fragment {
|
||||
View v = inflater
|
||||
.inflate(R.layout.fragment_final, container, false);
|
||||
|
||||
scrollView = (ScrollView) v;
|
||||
ImageView iconView = v.findViewById(R.id.iconView);
|
||||
TextView titleView = v.findViewById(R.id.titleView);
|
||||
TextView textView = v.findViewById(R.id.textView);
|
||||
@@ -97,6 +102,13 @@ public class FinalFragment extends Fragment {
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// Scroll down in case the screen is small, so the button is visible
|
||||
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the action that the system back button
|
||||
* and the button at the bottom will perform.
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
@@ -18,6 +19,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import static android.view.View.FOCUS_DOWN;
|
||||
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@@ -30,6 +32,7 @@ public class ChooserFragment extends Fragment {
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
private RemovableDriveViewModel viewModel;
|
||||
private ScrollView scrollView;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -47,6 +50,7 @@ public class ChooserFragment extends Fragment {
|
||||
View v = inflater.inflate(R.layout.fragment_transfer_data_chooser,
|
||||
container, false);
|
||||
|
||||
scrollView = (ScrollView) v;
|
||||
Button sendButton = v.findViewById(R.id.sendButton);
|
||||
sendButton.setOnClickListener(i -> viewModel.startSendData());
|
||||
|
||||
@@ -65,6 +69,9 @@ public class ChooserFragment extends Fragment {
|
||||
// we can't come back here now to start another task
|
||||
// as we only support one per ViewModel instance
|
||||
requireActivity().supportFinishAfterTransition();
|
||||
} else {
|
||||
// Scroll down in case the screen is small, so the button is visible
|
||||
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
@@ -24,6 +24,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import static android.view.View.FOCUS_DOWN;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
||||
@@ -41,10 +42,10 @@ public class ReceiveFragment extends Fragment {
|
||||
@Inject
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
RemovableDriveViewModel viewModel;
|
||||
TextView introTextView;
|
||||
Button button;
|
||||
ProgressBar progressBar;
|
||||
private RemovableDriveViewModel viewModel;
|
||||
private ScrollView scrollView;
|
||||
private Button button;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -62,7 +63,7 @@ public class ReceiveFragment extends Fragment {
|
||||
View v = inflater.inflate(R.layout.fragment_transfer_data_receive,
|
||||
container, false);
|
||||
|
||||
introTextView = v.findViewById(R.id.introTextView);
|
||||
scrollView = (ScrollView) v;
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
button = v.findViewById(R.id.fileButton);
|
||||
button.setOnClickListener(view ->
|
||||
@@ -79,6 +80,8 @@ public class ReceiveFragment extends Fragment {
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
requireActivity().setTitle(R.string.removable_drive_title_receive);
|
||||
// Scroll down in case the screen is small, so the button is visible
|
||||
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
||||
}
|
||||
|
||||
private void onOldTaskResumed(boolean resumed) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -26,6 +27,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.view.View.FOCUS_DOWN;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
||||
@@ -43,10 +45,11 @@ public class SendFragment extends Fragment {
|
||||
@Inject
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
RemovableDriveViewModel viewModel;
|
||||
TextView introTextView;
|
||||
Button button;
|
||||
ProgressBar progressBar;
|
||||
private RemovableDriveViewModel viewModel;
|
||||
private ScrollView scrollView;
|
||||
private TextView introTextView;
|
||||
private Button button;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -64,6 +67,7 @@ public class SendFragment extends Fragment {
|
||||
View v = inflater.inflate(R.layout.fragment_transfer_data_send,
|
||||
container, false);
|
||||
|
||||
scrollView = (ScrollView) v;
|
||||
introTextView = v.findViewById(R.id.introTextView);
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
button = v.findViewById(R.id.fileButton);
|
||||
@@ -83,6 +87,8 @@ public class SendFragment extends Fragment {
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
requireActivity().setTitle(R.string.removable_drive_title_send);
|
||||
// Scroll down in case the screen is small, so the button is visible
|
||||
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
||||
}
|
||||
|
||||
private void onOldTaskResumed(boolean resumed) {
|
||||
|
||||
Reference in New Issue
Block a user