Fix bugs with PIP mode

This commit is contained in:
Wisest_wizard 2021-08-11 08:38:38 +05:30 committed by Wisest_wizard
parent c1ce878b06
commit 051a9a1620
2 changed files with 9 additions and 2 deletions

View File

@ -30,7 +30,7 @@ public class MainActivity extends AppCompatActivity {
}; };
AdditionalKeyboardView kbd; AdditionalKeyboardView kbd;
FrameLayout frm;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -46,6 +46,7 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.main_activity); setContentView(R.layout.main_activity);
kbd = findViewById(R.id.additionalKbd); kbd = findViewById(R.id.additionalKbd);
frm = findViewById(R.id.frame);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
getWindow(). getWindow().
@ -126,10 +127,15 @@ public class MainActivity extends AppCompatActivity {
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
if (kbd.getVisibility() != View.GONE) if (kbd.getVisibility() != View.GONE)
kbd.setVisibility(View.GONE); kbd.setVisibility(View.GONE);
frm.setPadding(0,0,0,0);
return; return;
} else { } else {
if (kbd.getVisibility() != View.VISIBLE) if (kbd.getVisibility() != View.VISIBLE)
kbd.setVisibility(View.VISIBLE); kbd.setVisibility(View.VISIBLE);
int paddingDp = 35;
float density = context.getResources().getDisplayMetrics().density;
int paddingPixel = (int)(paddingDp * density);
frm.setPadding(0,0,0,paddingPixel);
return; return;
} }
} }

View File

@ -6,7 +6,8 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="35dp"> android:paddingBottom="35dp"
android:id="@+id/frame">
<SurfaceView <SurfaceView
android:id="@+id/lorieView" android:id="@+id/lorieView"