mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
safely let overlay buttons float
This commit is contained in:
parent
709d46473a
commit
e7bc89c15f
5 changed files with 22 additions and 12 deletions
|
@ -39,7 +39,7 @@
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toRightOf="@id/reading_overlay_text"
|
android:layout_toRightOf="@id/reading_overlay_text"
|
||||||
android:layout_marginLeft="1dp"
|
android:layout_marginLeft="2dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
style="?selectorOverlayBackgroundSend"
|
style="?selectorOverlayBackgroundSend"
|
||||||
android:onClick="overlaySend" />
|
android:onClick="overlaySend" />
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toLeftOf="@id/reading_overlay_right"
|
android:layout_toLeftOf="@id/reading_overlay_right"
|
||||||
android:layout_marginRight="1dp"
|
android:layout_marginRight="2dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
style="?selectorOverlayBackgroundLeft"
|
style="?selectorOverlayBackgroundLeft"
|
||||||
android:onClick="overlayLeft" />
|
android:onClick="overlayLeft" />
|
||||||
|
|
|
@ -64,6 +64,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
||||||
/** special value for starting story hash that jumps to the first unread. */
|
/** special value for starting story hash that jumps to the first unread. */
|
||||||
public static final String FIND_FIRST_UNREAD = "FIND_FIRST_UNREAD";
|
public static final String FIND_FIRST_UNREAD = "FIND_FIRST_UNREAD";
|
||||||
|
|
||||||
|
private static final float OVERLAY_ELEVATION_DP = 1.5f;
|
||||||
private static final int OVERLAY_RANGE_TOP_DP = 40;
|
private static final int OVERLAY_RANGE_TOP_DP = 40;
|
||||||
private static final int OVERLAY_RANGE_BOT_DP = 60;
|
private static final int OVERLAY_RANGE_BOT_DP = 60;
|
||||||
|
|
||||||
|
@ -163,6 +164,14 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
||||||
|
|
||||||
this.pageHistory = new ArrayList<Story>();
|
this.pageHistory = new ArrayList<Story>();
|
||||||
|
|
||||||
|
ViewUtils.setViewElevation(overlayLeft, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlayRight, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlayText, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlaySend, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlayProgress, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlayProgressLeft, OVERLAY_ELEVATION_DP);
|
||||||
|
ViewUtils.setViewElevation(overlayProgressRight, OVERLAY_ELEVATION_DP);
|
||||||
|
|
||||||
// this likes to default to 'on' for some platforms
|
// this likes to default to 'on' for some platforms
|
||||||
enableProgressCircle(overlayProgressLeft, false);
|
enableProgressCircle(overlayProgressLeft, false);
|
||||||
enableProgressCircle(overlayProgressRight, false);
|
enableProgressCircle(overlayProgressRight, false);
|
||||||
|
|
|
@ -181,16 +181,6 @@ public class ReadingItemFragment extends NbFragment implements ClassifierDialogF
|
||||||
|
|
||||||
Reading activity = (Reading) getActivity();
|
Reading activity = (Reading) getActivity();
|
||||||
|
|
||||||
// the share/save buttons us compound drawables for layout speed, but they
|
|
||||||
// cannot correctly compute padding. hard resize the icons to use padding.
|
|
||||||
/*int iconSizePx = UIUtils.dp2px(activity, 30);
|
|
||||||
Drawable shareButtonIcon = shareButton.getCompoundDrawables()[0];
|
|
||||||
shareButtonIcon.setBounds(0, 0, iconSizePx, iconSizePx);
|
|
||||||
shareButton.setCompoundDrawables(shareButtonIcon, null, null, null);
|
|
||||||
Drawable saveButtonIcon = saveButton.getCompoundDrawables()[0];
|
|
||||||
saveButtonIcon.setBounds(0, 0, iconSizePx, iconSizePx);
|
|
||||||
saveButton.setCompoundDrawables(saveButtonIcon, null, null, null);*/
|
|
||||||
|
|
||||||
registerForContextMenu(web);
|
registerForContextMenu(web);
|
||||||
web.setCustomViewLayout(webviewCustomViewLayout);
|
web.setCustomViewLayout(webviewCustomViewLayout);
|
||||||
web.setWebviewWrapperLayout(fragmentScrollview);
|
web.setWebviewWrapperLayout(fragmentScrollview);
|
||||||
|
|
|
@ -71,6 +71,11 @@ public class UIUtils {
|
||||||
return (int) (dp * scale + 0.5f);
|
return (int) (dp * scale + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float dp2px(Context context, float dp) {
|
||||||
|
float scale = context.getResources().getDisplayMetrics().density;
|
||||||
|
return dp * scale;
|
||||||
|
}
|
||||||
|
|
||||||
public static float px2dp(Context context, int px) {
|
public static float px2dp(Context context, int px) {
|
||||||
return ((float) px) / context.getResources().getDisplayMetrics().density;
|
return ((float) px) / context.getResources().getDisplayMetrics().density;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,4 +81,10 @@ public class ViewUtils {
|
||||||
return pm.isPowerSaveMode();
|
return pm.isPowerSaveMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setViewElevation(View v, float elevationDP) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
|
||||||
|
float elevationPX = UIUtils.dp2px(v.getContext(), elevationDP);
|
||||||
|
v.setElevation(elevationPX);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue