Use monochrome special icon for status bar service. Add RoDir settings to the launcher.

This commit is contained in:
Alibek Omarov 2018-03-21 02:18:25 +03:00
parent 88873cad9d
commit 1c1cab6e30
13 changed files with 281 additions and 172 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -13,11 +13,8 @@
android:id="@+id/textView_tittle"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginBottom="1dp"
android:layout_marginLeft="5dp"
android:layout_margin="5dp"
android:background="#555555"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:text="@string/launcher_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25sp"
@ -30,10 +27,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.20"
android:paddingBottom="10dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="8dp">
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -56,10 +53,7 @@
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="25dp"
android:layout_margin="10dp"
android:background="#333333"
android:orientation="vertical"
android:text="@string/text_tab1"
@ -80,20 +74,15 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:background="#444444"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:text="@string/volume"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ToggleButton
@ -101,9 +90,7 @@
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:layout_marginTop="5dp"
android:text="nothing"
android:textOff="@string/no_volume"
android:textOn="@string/use_volume" />
@ -111,10 +98,7 @@
android:id="@+id/textView_path"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_margin="10dp"
android:text="@string/text_res_path"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
@ -122,20 +106,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:onClick="selectFolder"
android:text="@string/select_folder" />
<Button
android:id="@+id/button_shortcut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:onClick="createShortcut"
android:text="@string/create_shortcut_button" />
</LinearLayout>
@ -143,13 +122,12 @@
<LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#333333"
android:orientation="vertical"
android:text="@string/text_tab2">
android:text="@string/text_tab2"
android:weightSum="0.6">
<TextView
android:id="@+id/textView_path2"
android:layout_width="fill_parent"
@ -158,7 +136,7 @@
android:layout_marginLeft="10dp"
android:background="#444444"
android:layout_marginRight="10dp"
android:layout_marginTop="13dp"
android:layout_marginTop="10dp"
android:text="@string/text_res_tittle3"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20sp"
@ -166,10 +144,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:background="#444444"
android:orientation="vertical"
android:weightSum="1">
@ -177,62 +152,123 @@
android:id="@+id/textView_args"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:text="@string/cmd_args_text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/cmdArgs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp" />
android:layout_margin="10dp"
android:layout_marginTop="5dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_margin="10dp"
android:text="@string/text_res_path"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/cmdPath"
<LinearLayout
android:orientation="horizontal"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:text="@string/pixel_format"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="5dp" >
<EditText
android:id="@+id/cmd_path"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:inputType="text"
android:layout_gravity="center_vertical"
android:scrollHorizontally="true" />
<Button
android:id="@+id/cmd_path_select"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="..."
android:onClick="selectFolder" />
</LinearLayout>
<ToggleButton
android:id="@+id/use_rodir"
android:layout_width="match_parent"
android:id="@+id/pixelSpinner"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textOff="@string/no_rodir"
android:textOn="@string/use_rodir" />
<LinearLayout
android:id="@+id/rodir_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_res_rw_path"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/use_rodir_auto"
android:text="@string/use_rodir_auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp" />
<LinearLayout
android:orientation="horizontal"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/cmd_path_rw"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:inputType="text"
android:layout_gravity="center_vertical"
android:scrollHorizontally="true" />
<Button
android:id="@+id/cmd_path_rw_select"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="..."
android:onClick="selectRwFolder" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="@string/pixel_format"
android:id="@+id/pixel_format"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:layout_height="40dp"
android:layout_alignBaseline="@id/pixel_format"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="right|center_vertical"
android:id="@+id/pixelSpinner"/>
</LinearLayout>
<ToggleButton
android:id="@+id/enableResizeWorkaround"
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="enableResizeWorkaround"
android:textOff="@string/resize_off"
android:textOn="@string/resize_on" />
@ -241,130 +277,101 @@
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/update_button" />
<!--<CheckBox
android:id="@+id/check_betas"
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/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" />
<CheckBox
android:id="@+id/resolution"
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/resolution" />
<RadioGroup
android:id="@+id/scale_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_margin="10dp"
android:text="@string/resolution_mod_warn"
android:textAppearance="@style/red_small_text" />
<TextView
android:id="@+id/resolution_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<RadioButton
android:id="@+id/resolution_scale_r"
android:text="@string/resolution_scale"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/resolution_scale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_margin="10dp"
android:layout_marginTop="3dp"
android:numeric="decimal" />
<RadioButton
android:id="@+id/resolution_custom_r"
android:text="@string/resolution_custom"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:id="@+id/resolution_width"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:numeric="integer" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="x"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="@+id/resolution_height"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="3dp"
android:layout_marginTop="5dp"
android:numeric="integer" />
</LinearLayout>
</RadioGroup>
<TextView
<!--<TextView
android:id="@+id/textView7"
android:layout_marginBottom="10dp"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:clickable="false" />
android:clickable="false" />-->
</LinearLayout>
</LinearLayout>
</FrameLayout>
@ -376,7 +383,6 @@
android:layout_height="50dp"
android:background="#444444"
android:layout_marginBottom="-20dp"
android:paddingTop="5dp"
android:layout_gravity="bottom"
android:orientation="horizontal">
<Button

View file

@ -28,7 +28,10 @@
<!-- Launcher(advanced) -->
<string name="text_res_tittle3">Продвинутые настройки</string>
<string name="cmd_args_text">Аргументы командной строки(только для экспертов)</string>
<string name="pixel_format">Pixel format</string>
<string name="no_rodir">Классическое расположение игровых файлов</string>
<string name="use_rodir">Хранить записываемые данные отдельно</string>
<string name="text_res_rw_path">Путь для записываемых данных(конфиги, игровые сохранения и т.д.)</string>
<string name="use_rodir_auto">Использовать каталог приложения</string>
<string name="resize_off">Клавиатура не меняет размер экрана игры</string>
<string name="resize_on">Клавиатура меняет размер экрана игры</string>
<string name="update_button">Проверять обновления при запуске</string>
@ -38,8 +41,7 @@
<string name="resolution_scale">Масштабировать сохраняя соотношение сторон</string>
<string name="resolution_custom">Указать точный размер экрана</string>
<string name="resolution_result">Разрешение: </string>
<string name="resolution_mod_warn">Используйте с осторожностью! Некоторые игры не поддерживают слишком низкое разрешение. В случае ошибок, увеличьте разрешение до 640x480 или больше.\n
Разрешения ниже 320x280 игнорируются.</string>
<string name="resolution_mod_warn">Используйте с осторожностью! Некоторые игры не поддерживают слишком низкое разрешение. В случае ошибок, увеличьте разрешение до 640x480 или больше.\nРазрешения ниже 320x280 игнорируются.</string>
<!-- Launcher(advanced) -->
<!-- Launcher(buttons) -->

View file

@ -33,7 +33,11 @@
<!-- Launcher(advanced) -->
<string name="text_res_tittle3">Advanced settings</string>
<string name="cmd_args_text">Command line arguments(experts only)</string>
<string name="pixel_format">Pixel format</string>
<string name="no_rodir">Classic game data placement</string>
<string name="use_rodir">Store writable data separately</string>
<string name="text_res_rw_path">Path to store writable data(configs, game saves, etc)</string>
<string name="use_rodir_auto">Use application folder</string>
<string name="pixel_format" translatable="false">Pixel format:</string>
<string name="resize_off">Keyboard does not resize screen</string>
<string name="resize_on">Keyboard resizes screen</string>
<string name="update_button">Check updates on start</string>
@ -43,8 +47,7 @@
<string name="resolution_scale">Scale screen keeping aspect ratio</string>
<string name="resolution_custom">Specify screen width and height</string>
<string name="resolution_result">Resolution: </string>
<string name="resolution_mod_warn">Use with caution! Some games does not support too low resolution, in case of bugs increase resolution to 640x480 or higher.\n
Resolution lower than 320x240 is ignored.</string>
<string name="resolution_mod_warn">Use with caution! Some games does not support too low resolution, in case of bugs increase resolution to 640x480 or higher.\nResolution lower than 320x240 is ignored.</string>
<!-- Launcher(advanced) -->
<!-- Launcher(buttons) -->

View file

@ -19,25 +19,22 @@ import org.json.*;
import android.preference.*;
import su.xash.fwgslib.*;
public class LauncherActivity extends Activity {
// public final static String ARGV = "in.celest.xash3d.MESSAGE";
public final static int sdk = FWGSLib.sdk;
public class LauncherActivity extends Activity
{
// public final static String ARGV = "in.celest.xash3d.MESSAGE";
public final static int sdk = FWGSLib.sdk;
public final static String UPDATE_LINK = "https://api.github.com/repos/FWGS/xash3d-android-project/releases"; // releases/latest doesn't return prerelease and drafts
static EditText cmdArgs;
static EditText resPath;
static ToggleButton useVolume;
static ToggleButton resizeWorkaround;
static CheckBox checkUpdates;
//static CheckBox updateToBeta;
static CheckBox immersiveMode;
static SharedPreferences mPref;
static Spinner pixelSpinner;
static TextView tvResPath;
static TextView resResult;
static EditText resScale, resWidth, resHeight;
static EditText cmdArgs, resPath, writePath, resScale, resWidth, resHeight;
static ToggleButton useVolume, resizeWorkaround, useRoDir;
static CheckBox checkUpdates, immersiveMode, useRoDirAuto;
static TextView tvResPath, resResult;
static RadioButton radioScale, radioCustom;
static RadioGroup scaleGroup;
static CheckBox resolution;
static Spinner pixelSpinner;
static LinearLayout rodirSettings; // to easy show/hide
static int mEngineWidth, mEngineHeight;
@ -93,7 +90,7 @@ public class LauncherActivity extends Activity {
if ( sdk >= 21 )
super.setTheme( 0x01030224 );
else super.setTheme( 0x01030005 );
if( CertCheck.dumbAntiPDALifeCheck( this ) )
{
finish();
@ -123,8 +120,8 @@ public class LauncherActivity extends Activity {
tabHost.invalidate();
for(int i = 0; i < tabHost.getTabWidget().getChildCount(); i++)
{
tabHost.getTabWidget().getChildAt(i).getBackground().setAlpha(96);
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = (int) (40 * this.getResources().getDisplayMetrics().density);
tabHost.getTabWidget().getChildAt(i).getBackground().setAlpha(255);
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = (int) (40 * getResources().getDisplayMetrics().density);
}
}
catch(Exception e){}
@ -134,7 +131,7 @@ public class LauncherActivity extends Activity {
mPref = getSharedPreferences("engine", 0);
cmdArgs = (EditText) findViewById(R.id.cmdArgs);
useVolume = (ToggleButton) findViewById( R.id.useVolume );
resPath = (EditText) findViewById( R.id.cmdPath );
resPath = (EditText) findViewById( R.id.cmd_path );
checkUpdates = (CheckBox)findViewById( R.id.check_updates );
//updateToBeta = (CheckBox)findViewById( R.id.check_betas );
pixelSpinner = (Spinner) findViewById( R.id.pixelSpinner );
@ -149,6 +146,10 @@ public class LauncherActivity extends Activity {
radioScale = (RadioButton) findViewById(R.id.resolution_scale_r);
scaleGroup = (RadioGroup) findViewById( R.id.scale_group );
resResult = (TextView) findViewById( R.id.resolution_result );
writePath = (EditText) findViewById( R.id.cmd_path_rw );
useRoDir = (ToggleButton) findViewById( R.id.use_rodir );
useRoDirAuto = (CheckBox) findViewById( R.id.use_rodir_auto );
rodirSettings = (LinearLayout) findViewById( R.id.rodir_settings );
final String[] list = {
"32 bit (RGBA8888)",
@ -201,9 +202,10 @@ public class LauncherActivity extends Activity {
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
resizeWorkaround.setChecked(mPref.getBoolean("enableResizeWorkaround", true));
boolean enableResolutionChange = mPref.getBoolean("resolution_fixed", false );
resolution.setChecked( enableResolutionChange );
useRoDir.setChecked( mPref.getBoolean("use_rodir", false) );
useRoDirAuto.setChecked( mPref.getBoolean("use_rodir_auto", true) );
writePath.setText(mPref.getString("writedir", FWGSLib.getExternalFilesDir(this)));
resolution.setChecked( mPref.getBoolean("resolution_fixed", false ) );
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
@ -250,6 +252,16 @@ public class LauncherActivity extends Activity {
}
});
useRoDir.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged( CompoundButton v, boolean isChecked )
{
enableRoDir( isChecked );
}
});
if( sdk >= 19 )
{
immersiveMode.setChecked(mPref.getBoolean("immersive_mode", true));
@ -258,7 +270,7 @@ public class LauncherActivity extends Activity {
{
immersiveMode.setVisibility(View.GONE); // not available
}
resPath.setOnFocusChangeListener( new View.OnFocusChangeListener()
{
@Override
@ -270,14 +282,28 @@ public class LauncherActivity extends Activity {
XashActivity.setFolderAsk( LauncherActivity.this, false );
}
} );
useRoDirAuto.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged( CompoundButton b, boolean isChecked )
{
if( isChecked )
{
writePath.setText( FWGSLib.getExternalFilesDir( LauncherActivity.this ) );
}
writePath.setEnabled( !isChecked );
}
});
if( !XashConfig.GP_VERSION && // disable autoupdater for Google Play
mPref.getBoolean("check_updates", true))
// disable autoupdater for Google Play
if( !XashConfig.GP_VERSION && mPref.getBoolean("check_updates", true))
{
new CheckUpdate(true, false).execute(UPDATE_LINK);
}
changeButtonsStyle((ViewGroup)tabHost.getParent());
hideResolutionSettings( !enableResolutionChange );
hideResolutionSettings( !resolution.isChecked() );
enableRoDir( useRoDir.isChecked() );
updateResolutionResult();
toggleResolutionFields();
if( !mPref.getBoolean("successfulRun",false) )
@ -294,6 +320,11 @@ public class LauncherActivity extends Activity {
{
scaleGroup.setVisibility( hide ? View.GONE : View.VISIBLE );
}
void enableRoDir( boolean enable )
{
rodirSettings.setVisibility( enable ? View.VISIBLE : View.GONE );
}
TextWatcher resTextChangeWatcher = new TextWatcher()
{
@ -359,6 +390,9 @@ public class LauncherActivity extends Activity {
SharedPreferences.Editor editor = mPref.edit();
editor.putString("argv", cmdArgs.getText().toString());
editor.putBoolean("usevolume",useVolume.isChecked());
editor.putBoolean("use_rodir", useRoDir.isChecked() );
editor.putBoolean("use_rodir_auto", useRoDirAuto.isChecked() );
editor.putString("writedir", writePath.getText().toString());
editor.putString("basedir", resPath.getText().toString());
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
editor.putBoolean("enableResizeWorkaround",resizeWorkaround.isChecked());
@ -495,30 +529,63 @@ public class LauncherActivity extends Activity {
public void selectFolder(View view)
{
Intent intent = new Intent(this, in.celest.xash3d.FPicker.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
startActivityForResult(intent, 42);
resPath.setEnabled(false);
XashActivity.setFolderAsk( this, false );
}
public void selectRwFolder(View view)
{
Intent intent = new Intent(this, in.celest.xash3d.FPicker.class);
startActivityForResult(intent, 43);
writePath.setEnabled(false);
XashActivity.setFolderAsk( this, false );
}
public void onActivityResult(int requestCode, int resultCode, Intent resultData)
{
if (resultCode == RESULT_OK)
switch(requestCode)
{
try
case 42:
{
if (resultCode == RESULT_OK)
{
if( resPath == null )
return;
updatePath(resultData.getStringExtra("GetPath"));
resPath.setEnabled( true );
}
catch(Exception e)
{
e.printStackTrace();
try
{
if( resPath == null )
return;
updatePath(resultData.getStringExtra("GetPath"));
resPath.setEnabled( true );
}
catch(Exception e)
{
e.printStackTrace();
}
}
resPath.setEnabled(true);
break;
}
case 43:
{
if (resultCode == RESULT_OK)
{
try
{
if( writePath == null )
return;
writePath.setText(resultData.getStringExtra("GetPath"));
writePath.setEnabled( true );
}
catch(Exception e)
{
e.printStackTrace();
}
}
writePath.setEnabled(true);
break;
}
}
resPath.setEnabled(true);
}
public void createShortcut(View view)

View file

@ -47,6 +47,10 @@ public class XashActivity extends Activity {
protected static XashActivity mSingleton;
protected static View mTextEdit;
protected static ViewGroup mLayout;
private static boolean mUseRoDir;
private static String mWriteDir;
public static EngineSurface mSurface;
public static String mArgv[];
public static final int sdk = Integer.valueOf( Build.VERSION.SDK );
@ -129,6 +133,9 @@ public class XashActivity extends Activity {
mPref = this.getSharedPreferences( "engine", 0 );
mUseRoDir = mPref.getBoolean("use_rodir", false);
mWriteDir = mPref.getString("writedir", FWGSLib.getExternalFilesDir(this) );
if( mPref.getBoolean( "folderask", true ) )
{
Log.v( TAG, "folderask == true. Opening FPicker..." );
@ -330,8 +337,10 @@ public class XashActivity extends Activity {
private void checkWritePermission( String basedir )
{
Log.v( TAG, "Checking write permissions..." );
String testDir = mUseRoDir ? mWriteDir : basedir;
if( nativeTestWritePermission( basedir ) == 0 )
if( nativeTestWritePermission( testDir ) == 0 )
{
Log.v( TAG, "First check has failed!" );
@ -490,7 +499,20 @@ public class XashActivity extends Activity {
mArgv = argv.split( " " );
setenv( "XASH3D_BASEDIR", basedir, true );
if( mUseRoDir )
{
Log.d( TAG, "Enabled RoDir: " + basedir + " -> " + mWriteDir );
setenv( "XASH3D_RODIR", basedir, true );
setenv( "XASH3D_BASEDIR", mWriteDir, true );
}
else
{
Log.d( TAG, "Disabled RoDir: " + basedir );
setenv( "XASH3D_BASEDIR", basedir, true );
}
setenv( "XASH3D_ENGLIBDIR", enginedir, true );
setenv( "XASH3D_GAMELIBDIR", gamelibdir, true );
setenv( "XASH3D_GAMEDIR", gamedir, true );

View file

@ -81,7 +81,7 @@ public class XashService extends Service
Intent exitIntent = new Intent(this, exitButtonListener.class);
final PendingIntent pendingExitIntent = PendingIntent.getBroadcast(this, 0, exitIntent, 0);
notification = new Notification(R.drawable.ic_launcher, "Xash3D", System.currentTimeMillis());
notification = new Notification(R.drawable.ic_statusbar, "Xash3D", System.currentTimeMillis());
notification.contentView = new RemoteViews(getApplicationContext().getPackageName(), notify);
notification.contentView.setTextViewText(status_text, "Xash3D Engine");

View file

@ -111,6 +111,15 @@ public class FWGSLib
return "/sdcard/xash";
}
public static String getExternalFilesDir( Context ctx )
{
File f = ctx.getExternalFilesDir( null );
f.mkdirs();
return f.getAbsolutePath();
}
public static boolean isLandscapeOrientation( Activity act )
{
DisplayMetrics metrics = new DisplayMetrics();