Add autoupdate checker
This commit is contained in:
parent
e5c3122ba7
commit
9b2c616baa
3 changed files with 497 additions and 418 deletions
|
@ -1,296 +1,265 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/layout_shortcut"
|
android:id="@+id/layout_shortcut"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#252525"
|
android:background="#252525"
|
||||||
android:weightSum="1"
|
android:weightSum="1"
|
||||||
tools:context="in.celest.xash3d.LauncherActivity">
|
tools:context="in.celest.xash3d.LauncherActivity">
|
||||||
|
<TextView
|
||||||
<TextView
|
android:id="@+id/textView_tittle"
|
||||||
android:id="@+id/textView_tittle"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_marginBottom="1dp"
|
||||||
android:layout_marginBottom="1dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:background="#555555"
|
||||||
android:background="#555555"
|
android:layout_marginRight="5dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginTop="20dp"
|
android:text="@string/launcher_name"
|
||||||
android:text="@string/launcher_name"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textSize="25sp"
|
||||||
android:textSize="25sp"
|
android:drawableLeft="@drawable/ic_launcher"
|
||||||
android:drawableLeft="@drawable/ic_launcher"
|
android:drawablePadding="10dp"
|
||||||
android:drawablePadding="10dp"
|
android:singleLine="true"
|
||||||
android:singleLine="true"
|
android:gravity="center_vertical" />
|
||||||
android:gravity="center_vertical" />
|
<TabHost
|
||||||
|
android:id="@+id/tabhost"
|
||||||
<TabHost
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/tabhost"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_weight="1.20"
|
||||||
android:layout_height="match_parent"
|
android:paddingBottom="10dp"
|
||||||
android:layout_weight="1.20"
|
android:paddingLeft="3dp"
|
||||||
android:paddingBottom="10dp"
|
android:paddingRight="3dp"
|
||||||
android:paddingLeft="3dp"
|
android:paddingTop="8dp">
|
||||||
android:paddingRight="3dp"
|
<LinearLayout
|
||||||
android:paddingTop="8dp">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
<LinearLayout
|
android:background="#555555"
|
||||||
android:layout_width="match_parent"
|
android:orientation="vertical">
|
||||||
android:layout_height="match_parent"
|
<TabWidget
|
||||||
android:background="#555555"
|
android:id="@android:id/tabs"
|
||||||
android:orientation="vertical">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
<TabWidget
|
android:showDividers="middle" />
|
||||||
android:id="@android:id/tabs"
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:showDividers="middle"></TabWidget>
|
android:id="@+id/scrollView2">
|
||||||
|
<FrameLayout
|
||||||
<ScrollView
|
android:id="@android:id/tabcontent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:id="@+id/scrollView2" >
|
<LinearLayout
|
||||||
<FrameLayout
|
android:id="@+id/tab1"
|
||||||
android:id="@android:id/tabcontent"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_marginLeft="10dp"
|
||||||
>
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
<LinearLayout
|
android:layout_marginBottom="25dp"
|
||||||
android:id="@+id/tab1"
|
android:background="#333333"
|
||||||
android:layout_width="match_parent"
|
android:orientation="vertical"
|
||||||
android:layout_height="wrap_content"
|
android:text="@string/text_tab1"
|
||||||
android:layout_marginLeft="10dp"
|
android:weightSum="0.6">
|
||||||
android:layout_marginRight="10dp"
|
<TextView
|
||||||
android:layout_marginTop="15dp"
|
android:id="@+id/textView_path1"
|
||||||
android:layout_marginBottom="25dp"
|
android:layout_width="fill_parent"
|
||||||
android:background="#333333"
|
android:layout_height="40dp"
|
||||||
android:orientation="vertical"
|
android:layout_marginBottom="2dp"
|
||||||
android:text="@string/text_tab1"
|
android:layout_marginLeft="10dp"
|
||||||
android:weightSum="0.6">
|
android:background="#444444"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
<TextView
|
android:layout_marginTop="10dp"
|
||||||
android:id="@+id/textView_path1"
|
android:text="@string/text_res_tittle2"
|
||||||
android:layout_width="fill_parent"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_height="40dp"
|
android:textSize="20sp"
|
||||||
android:layout_marginBottom="2dp"
|
android:gravity="center_vertical|center_horizontal" />
|
||||||
android:layout_marginLeft="10dp"
|
<LinearLayout
|
||||||
android:background="#444444"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:text="@string/text_res_tittle2"
|
android:layout_marginLeft="10dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:layout_marginRight="10dp"
|
||||||
android:textSize="20sp"
|
android:layout_marginTop="10dp"
|
||||||
android:gravity="center_vertical|center_horizontal" />
|
android:background="#444444"
|
||||||
|
android:orientation="vertical"
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
android:weightSum="1">
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
<ToggleButton
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/useVolume"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="#444444"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical"
|
android:text="nothing"
|
||||||
android:weightSum="1">
|
android:textOff="@string/no_volume"
|
||||||
|
android:textOn="@string/use_volume" />
|
||||||
|
<!--
|
||||||
<ToggleButton
|
<CheckBox
|
||||||
android:id="@+id/useVolume"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_margin="10dp"
|
android:text="@string/use_volume"
|
||||||
android:layout_marginLeft="10dp"
|
android:id="@+id/useVolume"/>
|
||||||
android:layout_marginRight="10dp"
|
-->
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="nothing"
|
<!--
|
||||||
android:textOff="@string/no_volume"
|
<CheckBox
|
||||||
android:textOn="@string/use_volume" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
<!--<CheckBox-->
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
<!--android:layout_height="wrap_content"-->
|
android:text="@string/tracking"
|
||||||
<!--android:layout_width="match_parent"-->
|
android:id="@+id/Tracking"/>
|
||||||
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
|
-->
|
||||||
<!--android:text="@string/use_volume"-->
|
<Button
|
||||||
<!--android:id="@+id/useVolume"/>-->
|
android:id="@+id/button_select"
|
||||||
|
android:layout_width="match_parent"
|
||||||
<!--<CheckBox-->
|
android:layout_height="wrap_content"
|
||||||
<!--android:layout_height="wrap_content"-->
|
android:layout_gravity="bottom"
|
||||||
<!--android:layout_width="match_parent"-->
|
android:layout_marginLeft="10dp"
|
||||||
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
|
android:layout_marginTop="10dp"
|
||||||
<!--android:text="@string/tracking"-->
|
android:layout_marginBottom="10dp"
|
||||||
<!--android:id="@+id/Tracking"/>-->
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="selectFolder"
|
||||||
|
android:text="@string/select_folder" />
|
||||||
|
</LinearLayout>
|
||||||
<Button
|
</LinearLayout>
|
||||||
android:id="@+id/button_select"
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/tab2"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="10dp"
|
android:background="#333333"
|
||||||
android:onClick="selectFolder"
|
android:orientation="vertical"
|
||||||
android:text="@string/select_folder" />
|
android:text="@string/text_tab2">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_path2"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
</LinearLayout>
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
</LinearLayout>
|
android:background="#444444"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
<LinearLayout
|
android:layout_marginTop="13dp"
|
||||||
android:id="@+id/tab2"
|
android:text="@string/text_res_tittle3"
|
||||||
android:layout_width="match_parent"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_height="match_parent"
|
android:textSize="20sp"
|
||||||
android:layout_marginLeft="10dp"
|
android:gravity="center_vertical|center_horizontal" />
|
||||||
android:layout_marginRight="10dp"
|
<LinearLayout
|
||||||
android:layout_marginTop="15dp"
|
android:layout_width="match_parent"
|
||||||
android:background="#333333"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:layout_marginBottom="10dp"
|
||||||
android:text="@string/text_tab2">
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
<TextView
|
android:layout_marginTop="10dp"
|
||||||
android:id="@+id/textView_path2"
|
android:background="#444444"
|
||||||
android:layout_width="fill_parent"
|
android:orientation="vertical"
|
||||||
android:layout_height="40dp"
|
android:weightSum="1">
|
||||||
android:layout_marginBottom="2dp"
|
<TextView
|
||||||
android:layout_marginLeft="10dp"
|
android:id="@+id/textView_args"
|
||||||
android:background="#444444"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="13dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:text="@string/text_res_tittle3"
|
android:layout_marginLeft="10dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:layout_marginRight="10dp"
|
||||||
android:textSize="20sp"
|
android:layout_marginTop="20dp"
|
||||||
android:gravity="center_vertical|center_horizontal" />
|
android:text="@string/cmd_args_text"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<EditText
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
android:id="@+id/cmdArgs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="3dp" />
|
||||||
android:background="#444444"
|
<TextView
|
||||||
android:orientation="vertical"
|
android:id="@+id/textView_path"
|
||||||
android:weightSum="1">
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:layout_marginBottom="10dp"
|
||||||
android:id="@+id/textView_args"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="3dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:text="@string/text_res_path"
|
||||||
android:layout_marginLeft="10dp"
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
android:layout_marginRight="10dp"
|
<EditText
|
||||||
android:layout_marginTop="20dp"
|
android:id="@+id/cmdPath"
|
||||||
android:text="@string/cmd_args_text"
|
android:layout_width="match_parent"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
<EditText
|
android:layout_marginLeft="10dp"
|
||||||
android:id="@+id/cmdArgs"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginTop="3dp" />
|
||||||
android:layout_height="wrap_content"
|
<Button
|
||||||
android:layout_marginBottom="10dp"
|
android:id="@+id/button_shortcut"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="3dp" />
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
<TextView
|
android:layout_marginRight="10dp"
|
||||||
android:id="@+id/textView_path"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="fill_parent"
|
android:onClick="createShortcut"
|
||||||
android:layout_height="wrap_content"
|
android:text="@string/create_shortcut_button" />
|
||||||
android:layout_marginBottom="10dp"
|
<Spinner
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginTop="3dp"
|
android:id="@+id/pixelSpinner"
|
||||||
android:text="@string/text_res_path"
|
android:layout_marginBottom="10dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
<EditText
|
android:layout_marginTop="10dp" />
|
||||||
android:id="@+id/cmdPath"
|
<CheckBox
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/check_updates"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="3dp" />
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="@string/update_button" />
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/button_shortcut"
|
android:id="@+id/textView7"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_weight="1"
|
||||||
android:layout_marginTop="10dp"
|
android:clickable="false" />
|
||||||
android:onClick="createShortcut"
|
</LinearLayout>
|
||||||
android:text="@string/create_shortcut_button" />
|
</LinearLayout>
|
||||||
<Spinner
|
</FrameLayout>
|
||||||
android:layout_height="match_parent"
|
</ScrollView>
|
||||||
android:layout_width="wrap_content"
|
</LinearLayout>
|
||||||
android:id="@+id/pixelSpinner"
|
</TabHost>
|
||||||
android:layout_marginBottom="10dp"
|
<LinearLayout
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="10dp"/>
|
android:background="#444444"
|
||||||
|
android:layout_marginBottom="-20dp"
|
||||||
<TextView
|
android:paddingTop="5dp"
|
||||||
android:id="@+id/textView7"
|
android:layout_gravity="bottom"
|
||||||
android:layout_marginBottom="10dp"
|
android:orientation="horizontal">
|
||||||
android:layout_width="fill_parent"
|
<Button
|
||||||
android:layout_height="0dp"
|
android:id="@+id/button_about"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_width="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false" />
|
android:layout_gravity="left"
|
||||||
</LinearLayout>
|
android:onClick="aboutXash"
|
||||||
</LinearLayout>
|
android:text="@string/about_button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_launch"
|
||||||
</FrameLayout>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
</ScrollView>
|
android:layout_column="6"
|
||||||
</LinearLayout>
|
android:layout_marginLeft="0dp"
|
||||||
|
android:layout_weight="0.87"
|
||||||
</TabHost>
|
android:onClick="startXash"
|
||||||
|
android:text="@string/launch_button" />
|
||||||
<LinearLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
</LinearLayout>
|
||||||
android:layout_height="50dp"
|
|
||||||
android:background="#444444"
|
|
||||||
android:layout_marginBottom="-20dp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_about"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
|
|
||||||
android:onClick="aboutXash"
|
|
||||||
android:text="@string/about_button" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_launch"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="6"
|
|
||||||
android:layout_marginLeft="0dp"
|
|
||||||
android:layout_weight="0.87"
|
|
||||||
android:onClick="startXash"
|
|
||||||
android:text="@string/launch_button" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">Xash3D</string>
|
<string name="app_name">Xash3D</string>
|
||||||
<string name="launcher_name">Xash3D</string>
|
<string name="launcher_name">Xash3D</string>
|
||||||
<string name="launcher_name_test">Xash3D (test)</string>
|
<string name="launcher_name_test">Xash3D (test)</string>
|
||||||
|
<string name="version_string" translatable="false">v0.17.1</string>
|
||||||
|
|
||||||
<string name="launch_button">Launch Xash3D!</string>
|
<string name="launch_button">Launch Xash3D!</string>
|
||||||
<string name="cmd_args_text">Command line arguments(experts only)</string>
|
<string name="cmd_args_text">Command line arguments(experts only)</string>
|
||||||
|
@ -16,26 +16,29 @@
|
||||||
<string name="pkgname">Mod package name (experts only)</string>
|
<string name="pkgname">Mod package name (experts only)</string>
|
||||||
<string name="shortcut_name">Shortcut name</string>
|
<string name="shortcut_name">Shortcut name</string>
|
||||||
|
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
|
||||||
<string name="about_main">Xash3D Android</string>
|
<string name="about_main">Xash3D Android</string>
|
||||||
<string name="about_copyright">SDLash3D is not affiliated with Valve or any of their partners. All copyrights reserved to their respective owners.</string>
|
<string name="about_copyright">SDLash3D is not affiliated with Valve or any of their partners. All copyrights reserved to their respective owners.</string>
|
||||||
<string name="version_string" translatable="false">v0.17.1</string>
|
<!-- Seems Android skips any line breaks and tabs here. -->
|
||||||
<string name="about_authors">Port to Android by SDLash3D team: \n
|
<string name="about_authors">
|
||||||
• a1batross\n
|
Port to Android by SDLash3D team: \n
|
||||||
• mittorn \n
|
• a1batross\n
|
||||||
• nicknekit.\n
|
• mittorn \n
|
||||||
|
• nicknekit.\n
|
||||||
|
|
||||||
Special thanks to:\n
|
Special thanks to:\n
|
||||||
• Uncle Mike for Xash3D engine\n
|
• Uncle Mike for Xash3D engine\n
|
||||||
• Valve for Half-Life\n
|
• Valve for Half-Life\n
|
||||||
• libSDL2 developers.\n</string>
|
• libSDL2 developers.\n
|
||||||
<string name="about_links">Follow us in:
|
</string>
|
||||||
• <a href="https://vk.com/xashdroid">VK</a>
|
<string name="about_links">
|
||||||
• <a href="http://moddb.com/game/xash3d-android">ModDB</a>
|
Follow us in: \n
|
||||||
• <a href="https://github.com/SDLash3D">GitHub</a></string>
|
• <a href="https://vk.com/xashdroid">VK</a>\n
|
||||||
<string name="about_button">About Xash3D Android</string>
|
• <a href="http://moddb.com/game/xash3d-android">ModDB</a>\n
|
||||||
|
• <a href="https://github.com/SDLash3D">GitHub</a>
|
||||||
|
</string>
|
||||||
|
<string name="about_button">About</string>
|
||||||
<string name="create_shortcut_button">Create mod shortcut</string>
|
<string name="create_shortcut_button">Create mod shortcut</string>
|
||||||
<string name="select_folder">(select)</string>
|
<string name="select_folder">Select game data location</string>
|
||||||
|
|
||||||
<string name="text_tab1">Normal</string>
|
<string name="text_tab1">Normal</string>
|
||||||
<string name="text_tab2">Advanced</string>
|
<string name="text_tab2">Advanced</string>
|
||||||
|
@ -44,4 +47,11 @@ Special thanks to:\n
|
||||||
<string name="use_volume">Gamepad support off!</string>
|
<string name="use_volume">Gamepad support off!</string>
|
||||||
<string name="no_volume">Gamepad support active!</string>
|
<string name="no_volume">Gamepad support active!</string>
|
||||||
<string name="folder">Set current folder</string>
|
<string name="folder">Set current folder</string>
|
||||||
|
|
||||||
|
<string name="update_button">Check updates on start</string>
|
||||||
|
<string name="update_message">%s is available!</string>
|
||||||
|
<string name="update">Update</string>
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
|
<string name="no_updates">No updates was found</string>
|
||||||
|
<string name="checking_updates">Working...</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2,44 +2,67 @@ package in.celest.xash3d;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
|
||||||
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.content.Intent;
|
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Environment;
|
import android.widget.EditText;
|
||||||
import java.lang.reflect.Method;
|
import android.widget.CheckBox;
|
||||||
import java.util.List;
|
import android.widget.CompoundButton;
|
||||||
import java.io.File;
|
import android.widget.Button;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.json.*;
|
||||||
|
|
||||||
import in.celest.xash3d.hl.R;
|
import in.celest.xash3d.hl.R;
|
||||||
|
|
||||||
public class LauncherActivity extends Activity {
|
public class LauncherActivity extends Activity {
|
||||||
// public final static String ARGV = "in.celest.xash3d.MESSAGE";
|
// public final static String ARGV = "in.celest.xash3d.MESSAGE";
|
||||||
public final static int sdk = Integer.valueOf(Build.VERSION.SDK);
|
public final static int sdk = Integer.valueOf(Build.VERSION.SDK);
|
||||||
|
public final static String UPDATE_LINK = "https://api.github.com/repos/SDLash3D/xash3d-android-project/releases/latest";
|
||||||
static EditText cmdArgs;
|
static EditText cmdArgs;
|
||||||
static ToggleButton useVolume;
|
static ToggleButton useVolume;
|
||||||
|
static CheckBox checkUpdates;
|
||||||
static EditText resPath;
|
static EditText resPath;
|
||||||
static SharedPreferences mPref;
|
static SharedPreferences mPref;
|
||||||
static Spinner pixelSpinner;
|
static Spinner pixelSpinner;
|
||||||
|
|
||||||
String getDefaultPath()
|
String getDefaultPath()
|
||||||
{
|
{
|
||||||
File dir = Environment.getExternalStorageDirectory();
|
File dir = Environment.getExternalStorageDirectory();
|
||||||
|
@ -47,104 +70,87 @@ public class LauncherActivity extends Activity {
|
||||||
return dir.getPath() + "/xash";
|
return dir.getPath() + "/xash";
|
||||||
return "/sdcard/xash";
|
return "/sdcard/xash";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
super.onCreate(savedInstanceState);
|
{
|
||||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
super.onCreate(savedInstanceState);
|
||||||
//super.setTheme( 0x01030005 );
|
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
if ( sdk >= 21 )
|
//super.setTheme( 0x01030005 );
|
||||||
|
if ( sdk >= 21 )
|
||||||
super.setTheme( 0x01030224 );
|
super.setTheme( 0x01030224 );
|
||||||
setContentView(R.layout.activity_launcher);
|
setContentView(R.layout.activity_launcher);
|
||||||
|
|
||||||
TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
|
TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
|
||||||
|
tabHost.setup();
|
||||||
|
|
||||||
|
TabHost.TabSpec tabSpec;
|
||||||
|
tabSpec = tabHost.newTabSpec("tabtag1");
|
||||||
|
tabSpec.setIndicator(getString(R.string.text_tab1));
|
||||||
|
tabSpec.setContent(R.id.tab1);
|
||||||
|
tabHost.addTab(tabSpec);
|
||||||
|
|
||||||
tabHost.setup();
|
tabSpec = tabHost.newTabSpec("tabtag2");
|
||||||
|
tabSpec.setIndicator(getString(R.string.text_tab2));
|
||||||
|
tabSpec.setContent(R.id.tab2);
|
||||||
|
tabHost.addTab(tabSpec);
|
||||||
|
|
||||||
TabHost.TabSpec tabSpec;
|
mPref = getSharedPreferences("engine", 0);
|
||||||
tabSpec = tabHost.newTabSpec("tabtag1");
|
cmdArgs = (EditText)findViewById(R.id.cmdArgs);
|
||||||
tabSpec.setIndicator(getString(R.string.text_tab1));
|
useVolume = ( ToggleButton ) findViewById( R.id.useVolume );
|
||||||
tabSpec.setContent(R.id.tab1);
|
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
||||||
tabHost.addTab(tabSpec);
|
checkUpdates = (CheckBox)findViewById(R.id.check_updates);
|
||||||
|
pixelSpinner = (Spinner) findViewById(R.id.pixelSpinner);
|
||||||
|
|
||||||
tabSpec = tabHost.newTabSpec("tabtag2");
|
final String[] list = {
|
||||||
tabSpec.setIndicator(getString(R.string.text_tab2));
|
"RGBA8888",
|
||||||
tabSpec.setContent(R.id.tab2);
|
"RGBA888",
|
||||||
tabHost.addTab(tabSpec);
|
"RGB565",
|
||||||
|
"RGBA5551",
|
||||||
|
"RGBA4444",
|
||||||
|
"RGB332"
|
||||||
|
};
|
||||||
|
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
|
||||||
|
pixelSpinner.setAdapter(adapter);
|
||||||
|
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
||||||
|
checkUpdates.setChecked(mPref.getBoolean("check_updates",true));
|
||||||
|
resPath.setText(mPref.getString("basedir", getDefaultPath()));
|
||||||
|
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
|
||||||
|
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
|
||||||
|
|
||||||
|
if(mPref.getBoolean("check_updates", true))
|
||||||
|
{
|
||||||
|
new RetrieveJSON(true).execute(UPDATE_LINK);
|
||||||
|
}
|
||||||
|
|
||||||
final String[] list = {
|
|
||||||
"RGBA8888",
|
|
||||||
"RGBA888",
|
|
||||||
"RGB565",
|
|
||||||
"RGBA5551",
|
|
||||||
"RGBA4444",
|
|
||||||
"RGB332"
|
|
||||||
};
|
|
||||||
pixelSpinner = (Spinner) findViewById(R.id.pixelSpinner);
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
|
|
||||||
//ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, list, android.R.layout.simple_spinner_item);
|
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// if ( Build.VERSION.SDK_INT < 21 )
|
|
||||||
// selectFolder.setVisibility( View.GONE );
|
|
||||||
mPref = getSharedPreferences("engine", 0);
|
|
||||||
cmdArgs = (EditText)findViewById(R.id.cmdArgs);
|
|
||||||
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
|
|
||||||
useVolume = ( ToggleButton ) findViewById( R.id.useVolume );
|
|
||||||
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
|
||||||
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
|
||||||
resPath.setText(mPref.getString("basedir", getDefaultPath()));
|
|
||||||
pixelSpinner.setSelection(mPref.getInt("pixelformat", 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startXash(View view)
|
public void startXash(View view)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(this, XashActivity.class);
|
Intent intent = new Intent(this, XashActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
SharedPreferences.Editor editor = mPref.edit();
|
SharedPreferences.Editor editor = mPref.edit();
|
||||||
editor.putString("argv", cmdArgs.getText().toString());
|
editor.putString("argv", cmdArgs.getText().toString());
|
||||||
editor.putBoolean("usevolume",useVolume.isChecked());
|
editor.putBoolean("usevolume",useVolume.isChecked());
|
||||||
editor.putString("basedir", resPath.getText().toString());
|
editor.putString("basedir", resPath.getText().toString());
|
||||||
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
|
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
|
||||||
editor.commit();
|
editor.putBoolean("check_updates", checkUpdates.isChecked());
|
||||||
startActivity(intent);
|
editor.commit();
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aboutXash(View view)
|
public void aboutXash(View view)
|
||||||
{
|
{
|
||||||
final Activity a = this;
|
final Activity a = this;
|
||||||
this.runOnUiThread(new Runnable() {
|
this.runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
final Dialog dialog = new Dialog(a);
|
final Dialog dialog = new Dialog(a);
|
||||||
dialog.setContentView(R.layout.about);
|
dialog.setContentView(R.layout.about);
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -154,30 +160,32 @@ public class LauncherActivity extends Activity {
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(this, in.celest.xash3d.FPicker.class);
|
Intent intent = new Intent(this, in.celest.xash3d.FPicker.class);
|
||||||
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
// Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
|
//Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
|
||||||
startActivityForResult(intent, 42);
|
startActivityForResult(intent, 42);
|
||||||
resPath.setEnabled(false);
|
resPath.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
|
public void onActivityResult(int requestCode, int resultCode, Intent resultData)
|
||||||
if (resultCode == RESULT_OK) {
|
{
|
||||||
try{
|
if (resultCode == RESULT_OK)
|
||||||
|
|
||||||
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
|
||||||
resPath.setText( resultData.getStringExtra("GetPath"));
|
|
||||||
|
|
||||||
// final List<String> paths = resultData.getData().getPathSegments();
|
|
||||||
// String[] parts = paths.get(1).split(":");
|
|
||||||
// String storagepath = Environment.getExternalStorageDirectory().getPath() + "/";
|
|
||||||
// String path = storagepath + parts[1];
|
|
||||||
// if( path != null)
|
|
||||||
// resPath.setText( path );
|
|
||||||
resPath.setEnabled(true);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
try
|
||||||
}
|
{
|
||||||
|
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
||||||
|
resPath.setText( resultData.getStringExtra("GetPath"));
|
||||||
|
|
||||||
|
// final List<String> paths = resultData.getData().getPathSegments();
|
||||||
|
// String[] parts = paths.get(1).split(":");
|
||||||
|
// String storagepath = Environment.getExternalStorageDirectory().getPath() + "/";
|
||||||
|
// String path = storagepath + parts[1];
|
||||||
|
// if( path != null)
|
||||||
|
// resPath.setText( path );
|
||||||
|
resPath.setEnabled(true);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resPath.setEnabled(true);
|
resPath.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -212,4 +220,96 @@ try{
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class RetrieveJSON extends AsyncTask<String, Void, String> {
|
||||||
|
InputStream is = null;
|
||||||
|
ByteArrayOutputStream os = null;
|
||||||
|
boolean mSilent;
|
||||||
|
|
||||||
|
public RetrieveJSON( boolean silent )
|
||||||
|
{
|
||||||
|
mSilent = silent;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String doInBackground(String... urls) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
URL url = new URL(urls[0]);
|
||||||
|
is = url.openConnection().getInputStream();
|
||||||
|
os = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
byte[] buffer = new byte[8196];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
while ((len = is.read(buffer)) > 0)
|
||||||
|
{
|
||||||
|
os.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
return os.toString();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPostExecute(String result)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (is != null)
|
||||||
|
{
|
||||||
|
is.close();
|
||||||
|
is = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
JSONObject obj = new JSONObject(os.toString());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (os != null) {
|
||||||
|
os.close();
|
||||||
|
os = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
final String version = obj.getString("tag_name");
|
||||||
|
final String url = obj.getString("html_url");
|
||||||
|
final String name = obj.getString("name");
|
||||||
|
|
||||||
|
Log.d("Xash", "Found: " + version +
|
||||||
|
", I: " + getString(R.string.version_string));
|
||||||
|
|
||||||
|
if( !getString(R.string.version_string).equals(version) )
|
||||||
|
{
|
||||||
|
String dialog_message = getString(R.string.update_message).format(name);
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getBaseContext());
|
||||||
|
builder.setMessage(dialog_message)
|
||||||
|
.setPositiveButton(R.string.update, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
final Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int which){}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
else if( !mSilent )
|
||||||
|
{
|
||||||
|
Toast.makeText(getBaseContext(), R.string.no_updates, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue