Various changes
* show full-screen option only for Android 4.4+ (no immersive mode below) * show toast with destination IP address at start-up * add option to keep display active (fixes #71)
|
@ -1,14 +1,18 @@
|
||||||
package at.bitfire.gfxtablet;
|
package at.bitfire.gfxtablet;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class CanvasActivity extends ActionBarActivity {
|
public class CanvasActivity extends ActionBarActivity {
|
||||||
NetworkClient netClient;
|
NetworkClient netClient;
|
||||||
|
@ -24,6 +28,10 @@ public class CanvasActivity extends ActionBarActivity {
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
if (prefs.getBoolean(SettingsActivity.KEY_KEEP_DISPLAY_ACTIVE, false))
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
|
||||||
new ConfigureNetworkingTask().execute();
|
new ConfigureNetworkingTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +47,12 @@ public class CanvasActivity extends ActionBarActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
menu.findItem(R.id.menu_fullscreen).setVisible(Build.VERSION.SDK_INT >= 19);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void showAbout(MenuItem item) {
|
public void showAbout(MenuItem item) {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(("https://rfc2822.github.io/GfxTablet/"))));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(("https://rfc2822.github.io/GfxTablet/"))));
|
||||||
}
|
}
|
||||||
|
@ -70,6 +84,8 @@ public class CanvasActivity extends ActionBarActivity {
|
||||||
if (success) {
|
if (success) {
|
||||||
setContentView(new CanvasView(CanvasActivity.this, netClient));
|
setContentView(new CanvasView(CanvasActivity.this, netClient));
|
||||||
new Thread(netClient).start();
|
new Thread(netClient).start();
|
||||||
|
|
||||||
|
Toast.makeText(CanvasActivity.this, "Touch events will be sent to " + netClient.destAddress.getHostAddress() + ":" + NetworkClient.GFXTABLET_PORT, Toast.LENGTH_LONG).show();
|
||||||
} else
|
} else
|
||||||
setContentView(R.layout.activity_no_host);
|
setContentView(R.layout.activity_no_host);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ public class SettingsActivity extends ActionBarActivity {
|
||||||
public static final String
|
public static final String
|
||||||
KEY_PREF_HOST = "host_preference",
|
KEY_PREF_HOST = "host_preference",
|
||||||
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
|
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
|
||||||
KEY_DARK_CANVAS = "dark_canvas_preference";
|
KEY_DARK_CANVAS = "dark_canvas_preference",
|
||||||
|
KEY_KEEP_DISPLAY_ACTIVE = "keep_display_active_preference";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1,019 B |
After Width: | Height: | Size: 2.7 KiB |
|
@ -2,13 +2,16 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
android:id="@+id/menu_fullscreen"
|
||||||
android:onClick="switchFullScreen"
|
android:onClick="switchFullScreen"
|
||||||
android:title="Fullscreen"
|
android:title="Fullscreen"
|
||||||
|
android:icon="@drawable/ic_arrow_expand_white_48dp"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:onClick="showSettings"
|
android:onClick="showSettings"
|
||||||
android:title="@string/menu_settings"
|
android:title="@string/menu_settings"
|
||||||
|
android:icon="@drawable/ic_settings_white_48dp"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
<string name="preferences_stylus_only">Sense stylus only</string>
|
<string name="preferences_stylus_only">Sense stylus only</string>
|
||||||
<string name="preferences_stylus_only_on">Only stylus input will be processed</string>
|
<string name="preferences_stylus_only_on">Only stylus input will be processed</string>
|
||||||
<string name="preferences_stylus_only_off">Finger and stylus input will be processed</string>
|
<string name="preferences_stylus_only_off">Finger and stylus input will be processed</string>
|
||||||
|
|
||||||
<string name="preferences_dark_canvas">Use dark canvas</string>
|
<string name="preferences_dark_canvas">Use dark canvas</string>
|
||||||
<string name="preferences_dark_canvas_on">Black canvas will be used</string>
|
<string name="preferences_dark_canvas_on">Black canvas will be used</string>
|
||||||
<string name="preferences_dark_canvas_off">White canvas will be used</string>
|
<string name="preferences_dark_canvas_off">White canvas will be used</string>
|
||||||
|
<string name="preferences_keep_display_active">Keep display active</string>
|
||||||
|
<string name="preferences_keep_display_active_on">Display won\'t turn off while GfxTablet is active</string>
|
||||||
|
<string name="preferences_keep_display_active_off">Display will turn off according to system settings</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="Drawing preferences">
|
<PreferenceCategory android:title="Drawing preferences">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="keep_display_active_preference"
|
||||||
|
android:title="@string/preferences_keep_display_active"
|
||||||
|
android:summaryOn="@string/preferences_keep_display_active_on"
|
||||||
|
android:summaryOff="@string/preferences_keep_display_active_off" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="stylus_only_preference"
|
android:key="stylus_only_preference"
|
||||||
|
|