Full screen open full

This commit is contained in:
M66B 2020-11-18 23:06:27 +01:00
parent 83714160d3
commit c2cf366e30
2 changed files with 26 additions and 13 deletions

View File

@ -118,8 +118,8 @@ import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat; import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.ColorUtils; import androidx.core.graphics.ColorUtils;
import androidx.core.util.PatternsCompat; import androidx.core.util.PatternsCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
@ -3718,7 +3718,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onActionOpenFull(final TupleMessageEx message) { private void onActionOpenFull(final TupleMessageEx message) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", message.id); args.putLong("id", message.id);
args.putString("subject", message.subject);
new SimpleTask<String>() { new SimpleTask<String>() {
@Override @Override
@ -3744,14 +3743,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onExecuted(Bundle args, String html) { protected void onExecuted(Bundle args, String html) {
Bundle fargs = new Bundle(); Bundle fargs = new Bundle();
fargs.putString("html", html); fargs.putString("html", html);
fargs.putString("subject", args.getString("subject"));
FragmentOpenFull fragment = new FragmentOpenFull(); FragmentDialogOpenFull dialog = new FragmentDialogOpenFull();
fragment.setArguments(fargs); dialog.setArguments(fargs);
dialog.show(parentFragment.getParentFragmentManager(), "open");
FragmentTransaction fragmentTransaction = parentFragment.getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("open");
fragmentTransaction.commit();
} }
@Override @Override
@ -6522,18 +6517,31 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
} }
public static class FragmentOpenFull extends FragmentBase { public static class FragmentDialogOpenFull extends FragmentDialogBase {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.fullScreenDialog);
}
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null)
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
String html = getArguments().getString("html"); String html = getArguments().getString("html");
String subject = getArguments().getString("subject");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean overview_mode = prefs.getBoolean("overview_mode", false); boolean overview_mode = prefs.getBoolean("overview_mode", false);
boolean safe_browsing = prefs.getBoolean("safe_browsing", false); boolean safe_browsing = prefs.getBoolean("safe_browsing", false);
setSubtitle(subject);
View view = inflater.inflate(R.layout.fragment_open_full, container, false); View view = inflater.inflate(R.layout.fragment_open_full, container, false);
WebView wv = view.findViewById(R.id.wv); WebView wv = view.findViewById(R.id.wv);

View File

@ -453,4 +453,9 @@
<item name="android:scrollbarTrackVertical">@drawable/scroll_track_popup</item> <item name="android:scrollbarTrackVertical">@drawable/scroll_track_popup</item>
<item name="android:fadeScrollbars">false</item> <item name="android:fadeScrollbars">false</item>
</style> </style>
<style name="fullScreenDialog" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
</style>
</resources> </resources>