Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a SeekBar so that the user can specify after which delay the sc…

…reenshot may be resized.
  • Loading branch information...
commit c22aa2ae8cf00659ef5bf8be4bd38b767a72a0d3 1 parent f761655
@pingtimeout authored
View
8 android-client/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@@ -23,13 +23,13 @@
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
- <application android:label="@string/app_name">
- <activity android:name=".ConnectionActivity" android:label="@string/app_name">
+ <application android:label="@string/application.name">
+ <activity android:name=".ConnectionActivity" android:label="@string/application.name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
- <activity android:name=".PresentationActivity" android:label="@string/app_name"/>
+ <activity android:name=".PresentationActivity" android:label="@string/application.name"/>
</application>
</manifest>
View
2  android-client/ant.properties
@@ -1,5 +1,5 @@
#
-# This file is part of Android-Showoff.
+# This file is part of Android-Showoff created by Pierre Laporte.
#
# Android-Showoff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
View
2  android-client/build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
View
2  android-client/local.properties
@@ -1,5 +1,5 @@
#
-# This file is part of Android-Showoff.
+# This file is part of Android-Showoff created by Pierre Laporte.
#
# Android-Showoff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
View
2  android-client/project.properties
@@ -1,5 +1,5 @@
#
-# This file is part of Android-Showoff.
+# This file is part of Android-Showoff created by Pierre Laporte.
#
# Android-Showoff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
View
2  android-client/res/layout/connection.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
View
66 android-client/res/layout/presentation.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@@ -29,35 +29,61 @@
android:id="@+id/screenshotImageView"
android:layout_width="fill_parent"
android:layout_height="0dp"
- android:layout_weight="0.7"
+ android:layout_weight="0.6"
android:scaleType="center"
android:src="#BBB"
android:contentDescription="@string/screenshot"
/>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:paddingLeft="16dp"
- android:paddingTop="16dp"
- android:paddingBottom="16dp"
- android:paddingRight="16dp"
- android:layout_width="fill_parent"
- android:layout_height="0dp"
- android:layout_weight="0.3"
- android:gravity="center_horizontal|bottom"
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
+ android:layout_weight="0.4"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:paddingTop="16dp"
+ android:gravity="center_horizontal|bottom"
>
- <Button android:id="@+id/leftButton"
- android:layout_width="0dp"
+ <TextView
+ android:id="@+id/refreshAfterTextView"
+ android:text="@string/refresh.screenshot.after.x.seconds"
android:layout_height="wrap_content"
- android:layout_weight=".50"
- android:text="@string/left"
+ android:layout_width="fill_parent"
/>
- <Button android:id="@+id/rightButton"
- android:layout_width="0dp"
+ <SeekBar
+ android:id="@+id/refreshAfterSeekBar"
+ android:max="5"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_weight=".50"
- android:text="@string/right"
+ android:progress="2"
/>
+ <LinearLayout
+ android:orientation="horizontal"
+ android:paddingTop="10dp"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center_horizontal|bottom"
+ >
+ <Button android:id="@+id/leftButton"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight=".37"
+ android:text="@string/back"
+ />
+ <Button android:id="@+id/refreshButton"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight=".26"
+ android:text="@string/refresh"
+ />
+ <Button android:id="@+id/rightButton"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight=".37"
+ android:text="@string/next"
+ />
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
View
12 android-client/res/values/strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@@ -17,12 +17,14 @@
-->
<resources>
- <string name="app_name">Android Showoff</string>
+ <string name="application.name">Android Showoff</string>
<string name="server.ip">Server IP</string>
- <string name="default.ip">192.168.1.13</string>
+ <string name="default.ip">192.168.1.17</string>
<string name="connect">Connect to server</string>
<string name="error.could.not.connect.to.server">Could not connect to server.</string>
- <string name="right">Right</string>
- <string name="left">Left</string>
+ <string name="next">Next</string>
+ <string name="back">Back</string>
<string name="screenshot">Screenshot</string>
+ <string name="refresh.screenshot.after.x.seconds">Refresh screenshot after %ds</string>
+ <string name="refresh">Refresh</string>
</resources>
View
4 android-client/src/fr/pingtimeout/ConnectToServerAction.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
/**
* Date: 7/20/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class ConnectToServerAction implements Runnable {
private final static String loggerName = ConnectToServerAction.class.getName();
View
7 android-client/src/fr/pingtimeout/ConnectionActivity.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@
import android.widget.EditText;
import android.widget.TextView;
+/**
+ * Date: 7/20/12
+ *
+ * @author Pierre Laporte
+ */
public class ConnectionActivity extends Activity {
private final static String loggerName = ConnectionActivity.class.getName();
View
7 android-client/src/fr/pingtimeout/ConnectionUtils.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,11 @@
import java.io.InputStreamReader;
import java.net.URI;
+/**
+ * Date: 7/20/12
+ *
+ * @author Pierre Laporte
+ */
public class ConnectionUtils {
private final static String loggerName = ConnectionUtils.class.getName();
View
48 android-client/src/fr/pingtimeout/PresentationActivity.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,11 +21,12 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
-import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
+import android.widget.SeekBar;
+import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
@@ -38,7 +39,7 @@
/**
* Date: 7/20/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class PresentationActivity extends Activity {
private final static String loggerName = PresentationActivity.class.getName();
@@ -51,7 +52,11 @@
private Button leftButton;
private Button rightButton;
+ private Button refreshButton;
private ImageView screenshotImageView;
+ private TextView refreshAfterTextView;
+ private SeekBar refreshAfterSeekBar;
+ private int refreshScreenshotAfterValue;
/**
* Called when the activity is first created.
@@ -69,13 +74,34 @@ public void onCreate(Bundle savedInstanceState) {
leftButton = (Button) findViewById(R.id.leftButton);
rightButton = (Button) findViewById(R.id.rightButton);
screenshotImageView = (ImageView) findViewById(R.id.screenshotImageView);
+ refreshAfterTextView = (TextView) findViewById(R.id.refreshAfterTextView);
+ refreshAfterSeekBar = (SeekBar) findViewById(R.id.refreshAfterSeekBar);
+ refreshButton = (Button) findViewById(R.id.refreshButton);
+
+ refreshScreenshotAfterValue = refreshAfterSeekBar.getProgress();
+ updateRefreshTextView();
+ refreshScreenshot();
+
+ refreshAfterSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean b) {
+ refreshScreenshotAfterValue = progress;
+ updateRefreshTextView();
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {}
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {}
+ });
leftButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(loggerName, "Sending LEFT keypress on server");
ConnectionUtils.pressLeftOnServer(serverHostname);
- scheduleTaskExecutor.schedule(refreshScreenshotAction, 2, TimeUnit.SECONDS);
+ scheduleTaskExecutor.schedule(refreshScreenshotAction, refreshScreenshotAfterValue, TimeUnit.SECONDS);
}
});
@@ -84,11 +110,23 @@ public void onClick(View view) {
public void onClick(View view) {
Log.d(loggerName, "Sending RIGHT keypress on server");
ConnectionUtils.pressRightOnServer(serverHostname);
- scheduleTaskExecutor.schedule(refreshScreenshotAction, 2, TimeUnit.SECONDS);
+ scheduleTaskExecutor.schedule(refreshScreenshotAction, refreshScreenshotAfterValue, TimeUnit.SECONDS);
+ }
+ });
+
+ refreshButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Log.d(loggerName, "Manually refreshing screenshot");
+ refreshScreenshotAction.run();
}
});
}
+ private void updateRefreshTextView() {
+ refreshAfterTextView.setText(String.format(getString(R.string.refresh_screenshot_after_x_seconds), refreshScreenshotAfterValue));
+ }
+
public void refreshScreenshot() {
int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
View
4 android-client/src/fr/pingtimeout/ProgressMonitorHandler.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
/**
* Date: 7/20/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class ProgressMonitorHandler extends Handler {
public final static int UPDATE_PROGRESS_MESSAGE = 1;
View
4 android-client/src/fr/pingtimeout/RefreshScreenshotAction.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
/**
* Date: 7/21/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class RefreshScreenshotAction implements Runnable {
private final static String loggerName = RefreshScreenshotAction.class.getName();
View
4 android-client/src/fr/pingtimeout/ScreenshotHandler.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
/**
* Date: 7/21/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class ScreenshotHandler extends Handler {
public final static int REFRESH_SCREENSHOT = 1;
View
2  server/pom.xml
@@ -1,5 +1,5 @@
<!--
- ~ This file is part of Android-Showoff.
+ ~ This file is part of Android-Showoff created by Pierre Laporte.
~
~ Android-Showoff is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
View
4 server/src/main/java/fr/pingtimeout/EmbeddedServer.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
/**
* Date: 7/7/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
public class EmbeddedServer {
public static void main(String args[]) throws Exception {
View
4 server/src/main/java/fr/pingtimeout/LeftRightHandler.java
@@ -1,5 +1,5 @@
/*
- * This file is part of Android-Showoff.
+ * This file is part of Android-Showoff created by Pierre Laporte.
*
* Android-Showoff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
* <p/>
* Date: 7/17/12
*
- * @author pingtimeout
+ * @author Pierre Laporte
*/
@Path("/")
@Produces(MediaType.TEXT_PLAIN)
Please sign in to comment.
Something went wrong with that request. Please try again.