Merge branch 'remove-sdl' of https://github.com/SDLash3D/xash3d-android-project into remove-sdl

This commit is contained in:
a1batross 2016-06-11 20:06:40 +03:00
commit 276afa836b
7 changed files with 89 additions and 31 deletions

@ -1 +1 @@
Subproject commit 973f8686e0884c04f79eb0265f3a7ce2bc3235ad
Subproject commit a581d08683dd5c6b5695cc334acd9d5d56b23f31

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -7,20 +7,20 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="in.celest.xash3dVR.FPicker">
tools:context="in.celest.xash3dVR.FPicker"
android:orientation="vertical">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/FileView"
android:layout_above="@+id/button2" />
android:id="@+id/FileView"
android:layout_weight="1"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/folder"
android:id="@+id/button_fpicker_select"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:onClick="onFileClick" />
</RelativeLayout>
</LinearLayout>

View file

@ -97,6 +97,15 @@
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:text="@string/volume"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ToggleButton
android:id="@+id/useVolume"
@ -125,6 +134,17 @@
<!--android:id="@+id/Tracking"/>-->
<TextView
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:text="@string/text_res_path"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/button_select"
@ -137,8 +157,16 @@
android:layout_marginRight="10dp"
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:onClick="createShortcut"
android:text="@string/create_shortcut_button" />
</LinearLayout>
@ -203,7 +231,6 @@
android:layout_marginTop="3dp" />
<TextView
android:id="@+id/textView_path"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
@ -213,6 +240,7 @@
android:text="@string/text_res_path"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/cmdPath"
android:layout_width="match_parent"
@ -223,19 +251,19 @@
android:layout_marginTop="3dp" />
<Button
android:id="@+id/button_shortcut"
android:layout_width="match_parent"
<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="10dp"
android:onClick="createShortcut"
android:text="@string/create_shortcut_button" />
android:layout_marginTop="3dp"
android:text="Pixel format"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/pixelSpinner"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"

View file

@ -3,7 +3,9 @@
<string name="cmd_args_text">Аргументы командной строки(только для экспертов)</string>
<string name="launch_button">Запустить Xash3D</string>
<string name="use_controls">Включить экранное управление</string>
<string name="use_volume">Использовать кнопки громкости</string>
<string name="volume">Действие кнопок громкости</string>
<string name="use_volume">Регулировка громкости</string>
<string name="no_volume">Использовать в игре</string>
<string name="text_res_path">Путь к ресурсам игры</string>
<string name="touch_set">Настройки управления</string>
<string name="text_shortcut">Ярлык Xash3D</string>
@ -26,4 +28,6 @@
<string name="action_settings">Настройки</string>
<string name="text_shortcut_test">Ярлык Xash3D (тест)</string>
<string name="create_shortcut_button">Создать ярлык</string>
<string name="select_folder">Выбрать</string>
</resources>

View file

@ -35,13 +35,14 @@ Special thanks to:\n
&#8226; <a href="https://github.com/SDLash3D">GitHub</a></string>
<string name="about_button">About Xash3D Android</string>
<string name="create_shortcut_button">Create mod shortcut</string>
<string name="select_folder">(select)</string>
<string name="select_folder">Select folder</string>
<string name="text_tab1">Normal</string>
<string name="text_tab2">Advanced</string>
<string name="text_res_tittle2">Normal settings</string>
<string name="text_res_tittle3">Advanced settings</string>
<string name="use_volume">Gamepad support off!</string>
<string name="no_volume">Gamepad support active!</string>
<string name="volume">Volume buttons mode</string>
<string name="use_volume">Default action</string>
<string name="no_volume">Use in game</string>
<string name="folder">Set current folder</string>
</resources>

View file

@ -10,6 +10,8 @@ import android.view.View;
import android.content.Intent;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Button;
@ -40,6 +42,7 @@ public class LauncherActivity extends Activity {
static EditText resPath;
static SharedPreferences mPref;
static Spinner pixelSpinner;
static TextView tvResPath;
String getDefaultPath()
{
File dir = Environment.getExternalStorageDirectory();
@ -72,12 +75,12 @@ public class LauncherActivity extends Activity {
tabHost.addTab(tabSpec);
final String[] list = {
"RGBA8888",
"RGBA888",
"RGB565",
"RGBA5551",
"RGBA4444",
"RGB332"
"32 bit (RGBA8888)",
"24 bit (RGB888)",
"16 bit (RGB565)",
"15 bit (RGBA5551)",
"12 bit (RGBA4444)",
"8 bit (RGB332)"
};
pixelSpinner = (Spinner) findViewById(R.id.pixelSpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
@ -117,10 +120,26 @@ public class LauncherActivity extends Activity {
useVolume = ( ToggleButton ) findViewById( R.id.useVolume );
useVolume.setChecked(mPref.getBoolean("usevolume",true));
resPath = ( EditText ) findViewById( R.id.cmdPath );
resPath.setText(mPref.getString("basedir", getDefaultPath()));
tvResPath = ( TextView ) findViewById( R.id.textView_path );
updatePath(mPref.getString("basedir", getDefaultPath()));
resPath.setOnFocusChangeListener( new View.OnFocusChangeListener()
{
@Override
public void onFocusChange(View v, boolean hasFocus)
{
updatePath( resPath.getText().toString() );
}
} );
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
}
void updatePath( String text )
{
tvResPath.setText(getResources().getString(R.string.text_res_path) + ":\n" + text );
resPath.setText(text);
}
public void startXash(View view)
{
Intent intent = new Intent(this, XashActivity.class);
@ -163,8 +182,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent resultData)
if (resultCode == RESULT_OK) {
try{
resPath = ( EditText ) findViewById( R.id.cmdPath );
resPath.setText( resultData.getStringExtra("GetPath"));
if( resPath == null )
return;
updatePath( resultData.getStringExtra("GetPath"));
// final List<String> paths = resultData.getData().getPathSegments();
// String[] parts = paths.get(1).split(":");

View file

@ -40,6 +40,7 @@ public class XashActivity extends Activity {
// Preferences
public static SharedPreferences mPref = null;
private static boolean mUseVolume;
// Audio
private static Thread mAudioThread;
@ -125,6 +126,7 @@ public class XashActivity extends Activity {
InstallReceiver.extractPAK(this, false);
mPixelFormat = mPref.getInt("pixelformat", 0);
mUseVolume = mPref.getBoolean("usevolume", false);
AndroidBug5497Workaround.assistActivity(this);
}
@ -211,6 +213,9 @@ public class XashActivity extends Activity {
public static boolean handleKey( int keyCode, KeyEvent event )
{
if ( mUseVolume && ( keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
keyCode == KeyEvent.KEYCODE_VOLUME_UP ) )
return false;
//Log.d( TAG, "Keycode " + keyCode );
if (event.getAction() == KeyEvent.ACTION_DOWN)
{