mirror of
https://github.com/rfc2822/GfxTablet
synced 2025-10-03 09:39:16 +02:00
Optional full-screen support
This commit is contained in:
parent
4fa5d31b7b
commit
2dba2a4042
7 changed files with 49 additions and 18 deletions
|
@ -1,14 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="at.bitfire.gfxtablet"
|
||||
android:versionCode="2"
|
||||
android:versionName="1.1" >
|
||||
android:versionCode="3"
|
||||
android:versionName="1.2" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="14" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-configuration android:reqTouchScreen="stylus"/>
|
||||
<uses-configuration android:reqTouchScreen="finger"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
@ -3,5 +3,3 @@ Issues URL: https://github.com/rfc2822/GfxTablet/issues/
|
|||
|
||||
Possible improvements:
|
||||
* allow more than one network host in settings [issue #13]
|
||||
* full-screen mode [issue #24]
|
||||
|
||||
|
|
|
@ -7,5 +7,7 @@
|
|||
<string name="stylus_preference">Sense stylus only</string>
|
||||
<string name="fullscreen_preference">Fullscreen</string>
|
||||
<string name="menu_about">About / Help</string>
|
||||
<string name="fullscreen_preference_summary">Title bar will only be hidden when hardware menu button is present</string>
|
||||
<string name="stylus_preference_summary">Ignores touch events from fingers</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<CheckBoxPreference android:title="@string/stylus_preference" android:key="stylus_only_preference" android:defaultValue="false"/>
|
||||
<CheckBoxPreference android:title="@string/fullscreen_preference" android:key="fullscreen_preference" android:defaultValue="true"/>
|
||||
<CheckBoxPreference android:title="@string/stylus_preference" android:key="stylus_only_preference" android:defaultValue="false" android:summary="@string/stylus_preference_summary"/>
|
||||
<CheckBoxPreference android:title="@string/fullscreen_preference" android:key="fullscreen_preference" android:defaultValue="false" android:summary="@string/fullscreen_preference_summary"/>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package at.bitfire.gfxtablet;
|
||||
|
||||
import at.bitfire.gfxtablet.R;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class CanvasActivity extends Activity {
|
||||
CanvasView canvas;
|
||||
|
@ -27,10 +27,14 @@ public class CanvasActivity extends Activity {
|
|||
PreferenceManager.setDefaultValues(this, R.xml.drawing_preferences, false);
|
||||
|
||||
settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (settings.getBoolean(SettingsActivity.KEY_PREF_FULLSCREEN, true)) {
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (settings.getBoolean(SettingsActivity.KEY_PREF_FULLSCREEN, false)) {
|
||||
if (ViewConfiguration.get(this).hasPermanentMenuKey())
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
else
|
||||
Toast.makeText(this, "Limited full-screen due to missing hardware menu button", Toast.LENGTH_LONG).show();
|
||||
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_canvas);
|
||||
|
@ -55,10 +59,20 @@ public class CanvasActivity extends Activity {
|
|||
}
|
||||
|
||||
public void showAbout(MenuItem item) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(("http://rfc2822.github.com/GfxTablet"))));
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(("http://rfc2822.github.io/GfxTablet/"))));
|
||||
}
|
||||
|
||||
public void showSettings(MenuItem item) {
|
||||
startActivity(new Intent(CanvasActivity.this, SettingsActivity.class));
|
||||
startActivityForResult(new Intent(this, SettingsActivity.class), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == SettingsActivity.RESULT_RESTART) {
|
||||
finish();
|
||||
Intent i = new Intent(this, CanvasActivity.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public class NetEvent {
|
|||
case TYPE_BUTTON:
|
||||
dos.writeByte(1);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
dos.writeShort(x);
|
||||
|
|
|
@ -1,25 +1,34 @@
|
|||
package at.bitfire.gfxtablet;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import at.bitfire.gfxtablet.R;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
|
||||
public static final int RESULT_RESTART = RESULT_FIRST_USER;
|
||||
|
||||
public static final String
|
||||
KEY_PREF_HOST = "host_preference",
|
||||
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
|
||||
KEY_PREF_FULLSCREEN = "fullscreen_preference";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,6 +43,11 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals(SettingsActivity.KEY_PREF_FULLSCREEN))
|
||||
setResult(RESULT_RESTART);
|
||||
}
|
||||
|
||||
|
||||
public static class NetworkPrefsFragment extends PreferenceFragment {
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue