ensure speed dials clickable (for pre-Android 5 devices)

This commit is contained in:
orionlee 2019-03-20 13:12:39 -07:00
parent 4918a743a7
commit 53e2511642
2 changed files with 22 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package de.danoeh.antennapod.dialog;
import android.app.AlertDialog;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
@ -201,7 +202,24 @@ public class EpisodesApplyActionFragment extends Fragment {
return view;
}
@Override
public void onStart() {
super.onStart();
compatEnsureSpeedDialClickable();
}
private void compatEnsureSpeedDialClickable() {
// On pre-Lolliop devices (that does not support elevation),
// need to explicitly bring the fab to the front, otherwise it won't be clickable.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
ViewGroup root = (ViewGroup)getView();
root.bringChildToFront(root.findViewById(R.id.fabSDScrollCtr));
root.requestLayout();
root.invalidate();
}
}
private void showSpeedDialIfAnyChecked() {
mSpeedDialView.setVisibility(checkedIds.size() > 0 ? View.VISIBLE : View.GONE);
}

View File

@ -104,6 +104,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ScrollView
android:id="@+id/fabSDScrollCtr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
@ -136,6 +137,7 @@
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
android:layout_alignParentTop="true"
android:layout_marginTop="0dp" />
</RelativeLayout>