Implement Immediate Mode(sticky) on 4.4 or higher
This commit is contained in:
parent
e75f120cf7
commit
8133cd9d01
6 changed files with 77 additions and 33 deletions
4
build.sh
4
build.sh
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=0 V=0 XASH_SDL=1 -j 8 APP_CFLAGS="-w -Wl,--no-undefined" APP_LDFLAGS="-Wl,--no-undefined"
|
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=0 V=0 XASH_SDL=0 -j 8 APP_CFLAGS="-w -Wl,--no-undefined" APP_LDFLAGS="-Wl,--no-undefined"
|
||||||
sh gen-version.sh default-release
|
sh gen-version.sh default-release
|
||||||
rm assets/extras.pak 2>/dev/null
|
rm assets/extras.pak 2>/dev/null
|
||||||
python2 makepak.py xash-extras assets/extras.pak
|
python2 makepak.py xash-extras assets/extras.pak
|
||||||
ant release
|
ant release
|
||||||
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid
|
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid
|
||||||
rm bin/xashdroid-release.apk
|
rm bin/xashdroid-release.apk
|
||||||
/home/a1ba/.android/android-sdk-linux/build-tools/22.0.1/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
#/home/a1ba/.android/android-sdk-linux/build-tools/22.0.1/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-13
|
target=android-19
|
||||||
|
|
|
@ -254,6 +254,15 @@
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/update_to_beta" />
|
android:text="@string/update_to_beta" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/immersive_mode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="@string/immersive_mode" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView7"
|
android:id="@+id/textView7"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
|
|
|
@ -56,4 +56,5 @@
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="no_updates">No updates was found</string>
|
<string name="no_updates">No updates was found</string>
|
||||||
<string name="checking_updates">Working...</string>
|
<string name="checking_updates">Working...</string>
|
||||||
|
<string name="immersive_mode">Enable Immersive Mode(fullscreen, KitKat or higher)</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
@ -63,6 +64,7 @@ public class LauncherActivity extends Activity {
|
||||||
static ToggleButton resizeWorkaround;
|
static ToggleButton resizeWorkaround;
|
||||||
static CheckBox checkUpdates;
|
static CheckBox checkUpdates;
|
||||||
static CheckBox updateToBeta;
|
static CheckBox updateToBeta;
|
||||||
|
static CheckBox immersiveMode;
|
||||||
static SharedPreferences mPref;
|
static SharedPreferences mPref;
|
||||||
static Spinner pixelSpinner;
|
static Spinner pixelSpinner;
|
||||||
static TextView tvResPath;
|
static TextView tvResPath;
|
||||||
|
@ -82,7 +84,9 @@ public class LauncherActivity extends Activity {
|
||||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
//super.setTheme( 0x01030005 );
|
//super.setTheme( 0x01030005 );
|
||||||
if ( sdk >= 21 )
|
if ( sdk >= 21 )
|
||||||
|
{
|
||||||
super.setTheme( 0x01030224 );
|
super.setTheme( 0x01030224 );
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_launcher);
|
setContentView(R.layout.activity_launcher);
|
||||||
|
|
||||||
|
@ -109,6 +113,7 @@ public class LauncherActivity extends Activity {
|
||||||
pixelSpinner = (Spinner) findViewById( R.id.pixelSpinner );
|
pixelSpinner = (Spinner) findViewById( R.id.pixelSpinner );
|
||||||
resizeWorkaround = (ToggleButton) findViewById( R.id.enableResizeWorkaround );
|
resizeWorkaround = (ToggleButton) findViewById( R.id.enableResizeWorkaround );
|
||||||
tvResPath = (TextView) findViewById( R.id.textView_path );
|
tvResPath = (TextView) findViewById( R.id.textView_path );
|
||||||
|
immersiveMode = (CheckBox) findViewById( R.id.immersive_mode );
|
||||||
|
|
||||||
final String[] list = {
|
final String[] list = {
|
||||||
"32 bit (RGBA8888)",
|
"32 bit (RGBA8888)",
|
||||||
|
@ -121,31 +126,6 @@ public class LauncherActivity extends Activity {
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
|
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
|
||||||
pixelSpinner.setAdapter(adapter);
|
pixelSpinner.setAdapter(adapter);
|
||||||
Button selectFolderButton = ( Button ) findViewById( R.id.button_select );
|
|
||||||
selectFolderButton.setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
selectFolder(v);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
((Button)findViewById( R.id.button_launch )).setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
startXash(v);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
((Button)findViewById( R.id.button_shortcut )).setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
createShortcut(v);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
((Button)findViewById( R.id.button_about )).setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
aboutXash(v);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
||||||
checkUpdates.setChecked(mPref.getBoolean("check_updates",true));
|
checkUpdates.setChecked(mPref.getBoolean("check_updates",true));
|
||||||
updateToBeta.setChecked(mPref.getBoolean("check_betas", false));
|
updateToBeta.setChecked(mPref.getBoolean("check_betas", false));
|
||||||
|
@ -154,6 +134,15 @@ public class LauncherActivity extends Activity {
|
||||||
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
|
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
|
||||||
resizeWorkaround.setChecked(mPref.getBoolean("enableResizeWorkaround", true));
|
resizeWorkaround.setChecked(mPref.getBoolean("enableResizeWorkaround", true));
|
||||||
|
|
||||||
|
if( sdk >= 19 )
|
||||||
|
{
|
||||||
|
immersiveMode.setChecked(mPref.getBoolean("immersive_mode", true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
immersiveMode.setVisibility(View.GONE); // not available
|
||||||
|
}
|
||||||
|
|
||||||
resPath.setOnFocusChangeListener( new View.OnFocusChangeListener()
|
resPath.setOnFocusChangeListener( new View.OnFocusChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,6 +177,10 @@ public class LauncherActivity extends Activity {
|
||||||
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
|
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
|
||||||
editor.putBoolean("enableResizeWorkaround",resizeWorkaround.isChecked());
|
editor.putBoolean("enableResizeWorkaround",resizeWorkaround.isChecked());
|
||||||
editor.putBoolean("check_updates", checkUpdates.isChecked());
|
editor.putBoolean("check_updates", checkUpdates.isChecked());
|
||||||
|
if( sdk >= 19 )
|
||||||
|
editor.putBoolean("immersive_mode", immersiveMode.isChecked());
|
||||||
|
else
|
||||||
|
editor.putBoolean("immersive_mode", false); // just in case...
|
||||||
editor.commit();
|
editor.commit();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ public class XashActivity extends Activity {
|
||||||
// Preferences
|
// Preferences
|
||||||
public static SharedPreferences mPref = null;
|
public static SharedPreferences mPref = null;
|
||||||
private static boolean mUseVolume;
|
private static boolean mUseVolume;
|
||||||
|
private static boolean mEnableImmersive;
|
||||||
|
private static View mDecorView;
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
private static Thread mAudioThread;
|
private static Thread mAudioThread;
|
||||||
|
@ -68,6 +70,7 @@ public class XashActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.v(TAG, "onCreate()");
|
Log.v(TAG, "onCreate()");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -153,19 +156,42 @@ public class XashActivity extends Activity {
|
||||||
mUseVolume = mPref.getBoolean("usevolume", false);
|
mUseVolume = mPref.getBoolean("usevolume", false);
|
||||||
if( mPref.getBoolean("enableResizeWorkaround", true) )
|
if( mPref.getBoolean("enableResizeWorkaround", true) )
|
||||||
AndroidBug5497Workaround.assistActivity(this);
|
AndroidBug5497Workaround.assistActivity(this);
|
||||||
|
|
||||||
|
// Immersive Mode is available only at >KitKat
|
||||||
|
mEnableImmersive = (sdk >= 19 && mPref.getBoolean("immersive_mode", true));
|
||||||
|
mDecorView = getWindow().getDecorView();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.v(TAG, "onPause()");
|
Log.v(TAG, "onPause()");
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
Log.v(TAG, "onResume()");
|
Log.v(TAG, "onResume()");
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWindowFocusChanged(boolean hasFocus)
|
||||||
|
{
|
||||||
|
super.onWindowFocusChanged(hasFocus);
|
||||||
|
|
||||||
|
if( mEnableImmersive && hasFocus )
|
||||||
|
{
|
||||||
|
mDecorView.setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
||||||
|
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static native int nativeInit(Object arguments);
|
public static native int nativeInit(Object arguments);
|
||||||
public static native void nativeQuit();
|
public static native void nativeQuit();
|
||||||
public static native void onNativeResize(int x, int y);
|
public static native void onNativeResize(int x, int y);
|
||||||
|
@ -207,6 +233,11 @@ public class XashActivity extends Activity {
|
||||||
mSurface.toggleEGL(toggle);
|
mSurface.toggleEGL(toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean deleteGLContext() {
|
||||||
|
mSurface.ShutdownGL();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static Context getContext() {
|
public static Context getContext() {
|
||||||
return mSingleton;
|
return mSingleton;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +570,6 @@ View.OnKeyListener {
|
||||||
|
|
||||||
// EGL functions
|
// EGL functions
|
||||||
public boolean InitGL() {
|
public boolean InitGL() {
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||||
|
@ -664,6 +694,17 @@ View.OnKeyListener {
|
||||||
mEGLSurface = null;
|
mEGLSurface = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void ShutdownGL()
|
||||||
|
{
|
||||||
|
mEGL.eglDestroyContext(mEGLDisplay, mEGLContext);
|
||||||
|
mEGLContext = null;
|
||||||
|
|
||||||
|
mEGL.eglDestroySurface(mEGLDisplay, mEGLSurface);
|
||||||
|
mEGLSurface = null;
|
||||||
|
|
||||||
|
mEGL.eglTerminate(mEGLDisplay);
|
||||||
|
mEGLDisplay = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue