diff --git a/overlay/src/main/java/com/hannesdorfmann/debugoverlay/DebugOverlayView.java b/overlay/src/main/java/com/hannesdorfmann/debugoverlay/DebugOverlayView.java
index df0ba14..add049b 100644
--- a/overlay/src/main/java/com/hannesdorfmann/debugoverlay/DebugOverlayView.java
+++ b/overlay/src/main/java/com/hannesdorfmann/debugoverlay/DebugOverlayView.java
@@ -23,6 +23,8 @@
class DebugOverlayView extends FrameLayout {
private ImageView closeButton;
+ private ImageView upButton;
+ private ImageView downButton;
private WindowManager windowManager;
private LoggingAdapter adapter;
private ListView listView;
@@ -34,16 +36,23 @@ public DebugOverlayView(Context context) {
Point windowDimen = new Point();
windowManager.getDefaultDisplay().getSize(windowDimen);
- int desiredLayoutHeight = dpToPx(context, 100);
- int layoutHeight = desiredLayoutHeight < windowDimen.y ? desiredLayoutHeight : windowDimen.y;
+ // Use 1/2 of screen height for overlay
+ int desiredLayoutHeight = windowDimen.y / 2;
+ int layoutHeight = Math.min(desiredLayoutHeight, windowDimen.y);
// Setup the GUI
- // Close Button
+ // Buttons
int buttonHeight = dpToPx(context, 40);
closeButton = new ImageView(context);
closeButton.setImageResource(R.drawable.ic_close_circle);
closeButton.setLayoutParams(new FrameLayout.LayoutParams(buttonHeight, buttonHeight, Gravity.TOP | Gravity.END));
+ upButton = new ImageView(context);
+ upButton.setImageResource(R.drawable.ic_up_circle);
+ upButton.setLayoutParams(new FrameLayout.LayoutParams(buttonHeight, buttonHeight, Gravity.CENTER | Gravity.END));
+ downButton = new ImageView(context);
+ downButton.setImageResource(R.drawable.ic_down_circle);
+ downButton.setLayoutParams(new FrameLayout.LayoutParams(buttonHeight, buttonHeight, Gravity.BOTTOM | Gravity.END));
// Logging Console
adapter = new LoggingAdapter(context);
@@ -60,6 +69,27 @@ public DebugOverlayView(Context context) {
// Add views
addView(listView);
addView(closeButton);
+ addView(upButton);
+ addView(downButton);
+
+ upButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ int firstVisiblePosition = listView.getFirstVisiblePosition();
+ int lastVisiblePosition = listView.getLastVisiblePosition();
+ listView.smoothScrollToPosition(firstVisiblePosition - (lastVisiblePosition - firstVisiblePosition));
+ }
+ }
+ );
+
+ downButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ int lastVisiblePosition = listView.getLastVisiblePosition();
+ listView.smoothScrollToPosition(lastVisiblePosition+1);
+ }
+ }
+ );
// Set View parameters
WindowManager.LayoutParams windowParams;
@@ -74,7 +104,7 @@ public DebugOverlayView(Context context) {
windowParams.gravity = Gravity.TOP | Gravity.START;
windowParams.x = 0;
- windowParams.y = windowDimen.y - layoutHeight;
+ windowParams.y = 100;
// Attach and display View
windowManager.addView(this, windowParams);
diff --git a/overlay/src/main/res/drawable-mdpi/ic_down.png b/overlay/src/main/res/drawable-mdpi/ic_down.png
new file mode 100644
index 0000000..62266ef
Binary files /dev/null and b/overlay/src/main/res/drawable-mdpi/ic_down.png differ
diff --git a/overlay/src/main/res/drawable-mdpi/ic_up.png b/overlay/src/main/res/drawable-mdpi/ic_up.png
new file mode 100644
index 0000000..6e38f86
Binary files /dev/null and b/overlay/src/main/res/drawable-mdpi/ic_up.png differ
diff --git a/overlay/src/main/res/drawable/ic_down_circle.xml b/overlay/src/main/res/drawable/ic_down_circle.xml
new file mode 100644
index 0000000..6f185e6
--- /dev/null
+++ b/overlay/src/main/res/drawable/ic_down_circle.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/overlay/src/main/res/drawable/ic_up_circle.xml b/overlay/src/main/res/drawable/ic_up_circle.xml
new file mode 100644
index 0000000..700669c
--- /dev/null
+++ b/overlay/src/main/res/drawable/ic_up_circle.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file