opening TIC-80 sources
54
build/android/AndroidManifest.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
|
||||
com.gamemaker.game
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.nesbox.tic"
|
||||
android:versionCode="4500"
|
||||
android:versionName="0.45.0"
|
||||
android:installLocation="auto">
|
||||
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- Create a Java class extending SDLActivity and place it in a
|
||||
directory under src matching the package, e.g.
|
||||
src/com/gamemaker/game/MyGame.java
|
||||
|
||||
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
||||
in the XML below.
|
||||
|
||||
An example Java class can be found in README-android.txt
|
||||
-->
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:allowBackup="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:hardwareAccelerated="true" >
|
||||
<activity android:name="TIC"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboardHidden|keyboard|orientation"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- Drop file event -->
|
||||
<!--
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
-->
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
19
build/android/ant.properties
Normal file
@@ -0,0 +1,19 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
key.store=my-release-key.keystore
|
||||
key.alias=alias_name
|
||||
17
build/android/build.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
93
build/android/build.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This should be changed to the name of your project -->
|
||||
<project name="TIC" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
11
build/android/default.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-12
|
||||
1
build/android/jni/Android.mk
Normal file
@@ -0,0 +1 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
5
build/android/jni/Application.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
# Uncomment this if you're using STL in your project
|
||||
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
|
||||
|
||||
APP_ABI := armeabi armeabi-v7a x86
|
||||
6
build/android/jni/SDL2/Android.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := SDL2
|
||||
LOCAL_SRC_FILES := ../../../../lib/android/sdl2/$(TARGET_ARCH_ABI)/libSDL2.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
6
build/android/jni/gif/Android.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gif
|
||||
LOCAL_SRC_FILES := ../../../../lib/android/gif/$(TARGET_ARCH_ABI)/libgif.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
6
build/android/jni/lua/Android.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := lua
|
||||
LOCAL_SRC_FILES := ../../../../lib/android/lua/$(TARGET_ARCH_ABI)/liblua.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
56
build/android/jni/src/Android.mk
Normal file
@@ -0,0 +1,56 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CFLAGS += -O3 -Wall -std=c99 -D"log2(x)=(log(x)/log(2))"
|
||||
LOCAL_MODULE := main
|
||||
|
||||
SDL_PATH := ../../../../../../sdk/SDL2-2.0.5
|
||||
SRC_PATH := ../../../../src
|
||||
INCLUDE_PATH := ../../../../include
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/$(SDL_PATH)/include \
|
||||
$(LOCAL_PATH)/$(INCLUDE_PATH)/lua \
|
||||
$(LOCAL_PATH)/$(INCLUDE_PATH)/tic80 \
|
||||
$(LOCAL_PATH)/$(INCLUDE_PATH)/gif
|
||||
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
|
||||
$(SRC_PATH)/studio.c \
|
||||
$(SRC_PATH)/console.c \
|
||||
$(SRC_PATH)/html.c \
|
||||
$(SRC_PATH)/run.c \
|
||||
$(SRC_PATH)/ext/blip_buf.c \
|
||||
$(SRC_PATH)/ext/file_dialog.c \
|
||||
$(SRC_PATH)/ext/md5.c \
|
||||
$(SRC_PATH)/ext/gif.c \
|
||||
$(SRC_PATH)/ext/net/SDLnet.c \
|
||||
$(SRC_PATH)/ext/net/SDLnetTCP.c \
|
||||
$(SRC_PATH)/ext/net/SDLnetselect.c \
|
||||
$(SRC_PATH)/ext/duktape/duktape.c \
|
||||
$(SRC_PATH)/fs.c \
|
||||
$(SRC_PATH)/tools.c \
|
||||
$(SRC_PATH)/start.c \
|
||||
$(SRC_PATH)/sprite.c \
|
||||
$(SRC_PATH)/map.c \
|
||||
$(SRC_PATH)/sfx.c \
|
||||
$(SRC_PATH)/music.c \
|
||||
$(SRC_PATH)/history.c \
|
||||
$(SRC_PATH)/world.c \
|
||||
$(SRC_PATH)/code.c \
|
||||
$(SRC_PATH)/config.c \
|
||||
$(SRC_PATH)/keymap.c \
|
||||
$(SRC_PATH)/net.c \
|
||||
$(SRC_PATH)/luaapi.c \
|
||||
$(SRC_PATH)/jsapi.c \
|
||||
$(SRC_PATH)/tic.c \
|
||||
$(SRC_PATH)/dialog.c \
|
||||
$(SRC_PATH)/menu.c \
|
||||
$(SRC_PATH)/surf.c \
|
||||
$(SRC_PATH)/tic80.c
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := SDL2 lua z gif
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
12
build/android/jni/src/Android_static.mk
Normal file
@@ -0,0 +1,12 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := main
|
||||
|
||||
LOCAL_SRC_FILES := YourSourceHere.c
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := SDL2_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
$(call import-module,SDL)LOCAL_PATH := $(call my-dir)
|
||||
6
build/android/jni/zlib/Android.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := z
|
||||
LOCAL_SRC_FILES := ../../../../lib/android/zlib/$(TARGET_ARCH_ABI)/libz.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
BIN
build/android/my-release-key.keystore
Normal file
20
build/android/proguard-project.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
14
build/android/project.properties
Normal file
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-12
|
||||
BIN
build/android/res/drawable-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
build/android/res/drawable-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
build/android/res/drawable-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
build/android/res/drawable-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
build/android/res/drawable/file.png
Normal file
|
After Width: | Height: | Size: 963 B |
BIN
build/android/res/drawable/folder.png
Normal file
|
After Width: | Height: | Size: 846 B |
BIN
build/android/res/drawable/up_folder.png
Normal file
|
After Width: | Height: | Size: 975 B |
60
build/android/res/layout/dialog.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/saveFileDialog"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
<ListView
|
||||
android:id="@+id/fileList"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/fileLinearLayout2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fileTextView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="@string/enterFileName"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<EditText
|
||||
android:id="@+id/fileName"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/enterFileName"
|
||||
android:inputType="text"
|
||||
android:padding="10dp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/fileLinearLayout3"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
<Button
|
||||
android:id="@+id/fileSaveLoad"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/saveButtonText" />
|
||||
<Button
|
||||
android:id="@+id/fileCancel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/cancelButtonText" />
|
||||
<Button
|
||||
android:id="@+id/newFolder"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/newFolderButtonText" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
7
build/android/res/layout/item.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<com.samsung.sprc.fileselector.TextViewWithImage xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="10dp"
|
||||
android:textSize="16sp" >
|
||||
|
||||
</com.samsung.sprc.fileselector.TextViewWithImage>
|
||||
19
build/android/res/values/strings.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">TIC-80</string>
|
||||
<string name="enterFileName">Enter file name:</string>
|
||||
<string name="saveButtonText">Save</string>
|
||||
<string name="cancelButtonText">Cancel</string>
|
||||
<string name="cannotSaveFileMessage">Cannot save file</string>
|
||||
<string name="fileNameFirstMessage">Please enter the file name first</string>
|
||||
<string name="okButtonText">OK</string>
|
||||
<string name="loadButtonText">Load</string>
|
||||
<string name="accessDenied">Access denied</string>
|
||||
<string name="missingFile">No such file</string>
|
||||
<string name="newFolderButtonText">New folder</string>
|
||||
<string name="newFolderDialogMessage">Create new folder</string>
|
||||
<string name="createButtonText">Create</string>
|
||||
<string name="folderCreationOk">Folder created sucessfully</string>
|
||||
<string name="folderCreationError">Error while creating folder</string>
|
||||
<string name="information">Information</string>
|
||||
</resources>
|
||||
129
build/android/src/com/nesbox/tic/TIC.java
Normal file
@@ -0,0 +1,129 @@
|
||||
package com.nesbox.tic;
|
||||
|
||||
import com.samsung.sprc.fileselector.FileSelector;
|
||||
import com.samsung.sprc.fileselector.FileOperation;
|
||||
import com.samsung.sprc.fileselector.OnHandleFileListener;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class TIC extends SDLActivity
|
||||
{
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[] {
|
||||
"SDL2",
|
||||
"lua",
|
||||
"z",
|
||||
"gif",
|
||||
"main"
|
||||
};
|
||||
}
|
||||
|
||||
protected final String[] fileSelectorResult = new String[]{""};
|
||||
|
||||
public String saveFile(final String name)
|
||||
{
|
||||
fileSelectorResult[0] = "";
|
||||
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new FileSelector(TIC.this, FileOperation.SAVE, mSaveFileListener, name).show();
|
||||
}
|
||||
});
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
fileSelectorResult.wait();
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return fileSelectorResult[0];
|
||||
}
|
||||
|
||||
OnHandleFileListener mSaveFileListener = new OnHandleFileListener()
|
||||
{
|
||||
@Override
|
||||
public void handleFile(final String filePath)
|
||||
{
|
||||
fileSelectorResult[0] = filePath;
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
fileSelectorResult.notify();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCancel()
|
||||
{
|
||||
fileSelectorResult[0] = "";
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
fileSelectorResult.notify();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public String loadFile()
|
||||
{
|
||||
fileSelectorResult[0] = "";
|
||||
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new FileSelector(TIC.this, FileOperation.LOAD, mLoadFileListener, "").show();
|
||||
}
|
||||
});
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
fileSelectorResult.wait();
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return fileSelectorResult[0];
|
||||
}
|
||||
|
||||
OnHandleFileListener mLoadFileListener = new OnHandleFileListener()
|
||||
{
|
||||
@Override
|
||||
public void handleFile(final String filePath)
|
||||
{
|
||||
fileSelectorResult[0] = filePath;
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
fileSelectorResult.notify();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCancel()
|
||||
{
|
||||
fileSelectorResult[0] = "";
|
||||
|
||||
synchronized (fileSelectorResult)
|
||||
{
|
||||
fileSelectorResult.notify();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
/**
|
||||
* This class contais information about the file name and type
|
||||
*/
|
||||
public class FileData implements Comparable<FileData> {
|
||||
|
||||
/** Constant that specifies the object is a reference to the parent */
|
||||
public static final int UP_FOLDER = 0;
|
||||
/** Constant that specifies the object is a folder */
|
||||
public static final int DIRECTORY = 1;
|
||||
/** Constant that specifies the object is a file */
|
||||
public static final int FILE = 2;
|
||||
|
||||
/** The file's name */
|
||||
final private String mFileName;
|
||||
|
||||
/** Defines the type of file. Can be one of UP_FOLDER, DIRECTORY or FILE */
|
||||
final private int mFileType;
|
||||
|
||||
/**
|
||||
* This class holds information about the file.
|
||||
*
|
||||
* @param fileName
|
||||
* - file name
|
||||
* @param fileType
|
||||
* - file type - can be UP_FOLDER, DIRECTORY or FILE
|
||||
* @throws IllegalArgumentException
|
||||
* - when illegal type (different than UP_FOLDER, DIRECTORY or
|
||||
* FILE)
|
||||
*/
|
||||
public FileData(final String fileName, final int fileType) {
|
||||
|
||||
if (fileType != UP_FOLDER && fileType != DIRECTORY && fileType != FILE) {
|
||||
throw new IllegalArgumentException("Illegel type of file");
|
||||
}
|
||||
this.mFileName = fileName;
|
||||
this.mFileType = fileType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final FileData another) {
|
||||
if (mFileType != another.mFileType) {
|
||||
return mFileType - another.mFileType;
|
||||
}
|
||||
return mFileName.compareTo(another.mFileName);
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
public int getFileType() {
|
||||
return mFileType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
import com.nesbox.tic.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
/**
|
||||
* Adapter used to display a files list
|
||||
*/
|
||||
public class FileListAdapter extends BaseAdapter {
|
||||
|
||||
/** Array of FileData objects that will be used to display a list */
|
||||
private final ArrayList<FileData> mFileDataArray;
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public FileListAdapter(Context context, List<FileData> aFileDataArray) {
|
||||
mFileDataArray = (ArrayList<FileData>) aFileDataArray;
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFileDataArray.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mFileDataArray.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
FileData tempFileData = mFileDataArray.get(position);
|
||||
TextViewWithImage tempView = new TextViewWithImage(mContext);
|
||||
tempView.setText(tempFileData.getFileName());
|
||||
int imgRes = -1;
|
||||
switch (tempFileData.getFileType()) {
|
||||
case FileData.UP_FOLDER: {
|
||||
imgRes = R.drawable.up_folder;
|
||||
break;
|
||||
}
|
||||
case FileData.DIRECTORY: {
|
||||
imgRes = R.drawable.folder;
|
||||
break;
|
||||
}
|
||||
case FileData.FILE: {
|
||||
imgRes = R.drawable.file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tempView.setImageResource(imgRes);
|
||||
return tempView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
/** Enum used to determine the file operation being performed. */
|
||||
public enum FileOperation {
|
||||
SAVE, LOAD
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
import com.nesbox.tic.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Environment;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Create the file selection dialog. This class will create a custom dialog for
|
||||
* file selection which can be used to save files.
|
||||
*/
|
||||
public class FileSelector {
|
||||
|
||||
/** The list of files and folders which you can choose from */
|
||||
private ListView mFileListView;
|
||||
|
||||
/** Button to save/load file */
|
||||
private Button mSaveLoadButton;
|
||||
/** Cancel Button - close dialog */
|
||||
private Button mCancelButton;
|
||||
/** Button to create a new folder */
|
||||
private Button mNewFolderButton;
|
||||
|
||||
/** Spinner by which to select the file type filtering */
|
||||
// private Spinner mFilterSpinner;
|
||||
|
||||
/**
|
||||
* Indicates current location in the directory structure displayed in the
|
||||
* dialog.
|
||||
*/
|
||||
private File mCurrentLocation;
|
||||
|
||||
/**
|
||||
* The file selector dialog.
|
||||
*/
|
||||
private final Dialog mDialog;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
/** Save or Load file listener. */
|
||||
final OnHandleFileListener mOnHandleFileListener;
|
||||
|
||||
/**
|
||||
* Constructor that creates the file selector dialog.
|
||||
*
|
||||
* @param context
|
||||
* The current context.
|
||||
* @param operation
|
||||
* LOAD - to load file / SAVE - to save file
|
||||
* @param onHandleFileListener
|
||||
* Notified after pressing the save or load button.
|
||||
*/
|
||||
public FileSelector(final Context context, final FileOperation operation,
|
||||
final OnHandleFileListener onHandleFileListener, final String fileName) {
|
||||
mContext = context;
|
||||
mOnHandleFileListener = onHandleFileListener;
|
||||
|
||||
final File sdCard = Environment.getExternalStorageDirectory();
|
||||
if (sdCard.canRead()) {
|
||||
mCurrentLocation = sdCard;
|
||||
} else {
|
||||
mCurrentLocation = Environment.getRootDirectory();
|
||||
}
|
||||
|
||||
mDialog = new Dialog(context);
|
||||
mDialog.setContentView(R.layout.dialog);
|
||||
mDialog.setTitle(mCurrentLocation.getAbsolutePath());
|
||||
|
||||
switch(operation)
|
||||
{
|
||||
case SAVE:
|
||||
((EditText) mDialog.findViewById(R.id.fileName)).setText(fileName);
|
||||
break;
|
||||
}
|
||||
|
||||
prepareFilesList();
|
||||
|
||||
setSaveLoadButton(operation);
|
||||
setNewFolderButton(operation);
|
||||
setCancelButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method prepares the mFileListView
|
||||
*
|
||||
*/
|
||||
private void prepareFilesList() {
|
||||
mFileListView = (ListView) mDialog.findViewById(R.id.fileList);
|
||||
|
||||
mFileListView.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
// Check if "../" item should be added.
|
||||
if (id == 0) {
|
||||
final String parentLocation = mCurrentLocation.getParent();
|
||||
if (parentLocation != null) { // text == "../"
|
||||
mCurrentLocation = new File(parentLocation);
|
||||
makeList(mCurrentLocation, "*.*");
|
||||
} else {
|
||||
onItemSelect(parent, position);
|
||||
}
|
||||
} else {
|
||||
onItemSelect(parent, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
makeList(mCurrentLocation, "*.*");
|
||||
}
|
||||
|
||||
/**
|
||||
* The method that fills the list with a directories contents.
|
||||
*
|
||||
* @param location
|
||||
* Indicates the directory whose contents should be displayed in
|
||||
* the dialog.
|
||||
* @param fitlesFilter
|
||||
* The filter specifies the type of file to be displayed
|
||||
*/
|
||||
private void makeList(final File location, final String fitlesFilter) {
|
||||
final ArrayList<FileData> fileList = new ArrayList<FileData>();
|
||||
final String parentLocation = location.getParent();
|
||||
if (parentLocation != null) {
|
||||
// First item on the list.
|
||||
fileList.add(new FileData("../", FileData.UP_FOLDER));
|
||||
}
|
||||
File listFiles[] = location.listFiles();
|
||||
if (listFiles != null) {
|
||||
ArrayList<FileData> fileDataList = new ArrayList<FileData>();
|
||||
for (int index = 0; index < listFiles.length; index++) {
|
||||
File tempFile = listFiles[index];
|
||||
if (FileUtils.accept(tempFile, fitlesFilter)) {
|
||||
int type = tempFile.isDirectory() ? FileData.DIRECTORY : FileData.FILE;
|
||||
fileDataList.add(new FileData(listFiles[index].getName(), type));
|
||||
}
|
||||
}
|
||||
fileList.addAll(fileDataList);
|
||||
Collections.sort(fileList);
|
||||
}
|
||||
// Fill the list with the contents of fileList.
|
||||
if (mFileListView != null) {
|
||||
FileListAdapter adapter = new FileListAdapter(mContext, fileList);
|
||||
mFileListView.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the file list item selection.
|
||||
*
|
||||
* Change the directory on the list or change the name of the saved file if
|
||||
* the user selected a file.
|
||||
*
|
||||
* @param parent
|
||||
* First parameter of the onItemClick() method of
|
||||
* OnItemClickListener. It's a value of text property of the
|
||||
* item.
|
||||
* @param position
|
||||
* Third parameter of the onItemClick() method of
|
||||
* OnItemClickListener. It's the index on the list of the
|
||||
* selected item.
|
||||
*/
|
||||
private void onItemSelect(final AdapterView<?> parent, final int position) {
|
||||
final String itemText = ((FileData) parent.getItemAtPosition(position)).getFileName();
|
||||
final String itemPath = mCurrentLocation.getAbsolutePath() + File.separator + itemText;
|
||||
final File itemLocation = new File(itemPath);
|
||||
|
||||
if (!itemLocation.canRead()) {
|
||||
Toast.makeText(mContext, "Access denied!!!", Toast.LENGTH_SHORT).show();
|
||||
} else if (itemLocation.isDirectory()) {
|
||||
mCurrentLocation = itemLocation;
|
||||
makeList(mCurrentLocation, "*.*");
|
||||
} else if (itemLocation.isFile()) {
|
||||
final EditText fileName = (EditText) mDialog.findViewById(R.id.fileName);
|
||||
fileName.setText(itemText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button name and click handler for Save or Load button.
|
||||
*
|
||||
* @param operation
|
||||
* Performed file operation.
|
||||
*/
|
||||
private void setSaveLoadButton(final FileOperation operation) {
|
||||
mSaveLoadButton = (Button) mDialog.findViewById(R.id.fileSaveLoad);
|
||||
switch (operation) {
|
||||
case SAVE:
|
||||
mSaveLoadButton.setText(R.string.saveButtonText);
|
||||
break;
|
||||
case LOAD:
|
||||
mSaveLoadButton.setText(R.string.loadButtonText);
|
||||
break;
|
||||
}
|
||||
mSaveLoadButton.setOnClickListener(new SaveLoadClickListener(operation, this, mContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set button visibility and click handler for New folder button.
|
||||
*
|
||||
* @param operation
|
||||
* Performed file operation.
|
||||
*/
|
||||
private void setNewFolderButton(final FileOperation operation) {
|
||||
mNewFolderButton = (Button) mDialog.findViewById(R.id.newFolder);
|
||||
OnClickListener newFolderListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
openNewFolderDialog();
|
||||
}
|
||||
};
|
||||
switch (operation) {
|
||||
case SAVE:
|
||||
mNewFolderButton.setVisibility(View.VISIBLE);
|
||||
mNewFolderButton.setOnClickListener(newFolderListener);
|
||||
break;
|
||||
case LOAD:
|
||||
mNewFolderButton.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Opens a dialog for creating a new folder. */
|
||||
private void openNewFolderDialog() {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
|
||||
alert.setTitle(R.string.newFolderButtonText);
|
||||
alert.setMessage(R.string.newFolderDialogMessage);
|
||||
final EditText input = new EditText(mContext);
|
||||
alert.setView(input);
|
||||
alert.setPositiveButton(R.string.createButtonText, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int whichButton) {
|
||||
File file = new File(mCurrentLocation.getAbsolutePath() + File.separator + input.getText().toString());
|
||||
if (file.mkdir()) {
|
||||
Toast t = Toast.makeText(mContext, R.string.folderCreationOk, Toast.LENGTH_SHORT);
|
||||
t.setGravity(Gravity.CENTER, 0, 0);
|
||||
t.show();
|
||||
} else {
|
||||
Toast t = Toast.makeText(mContext, R.string.folderCreationError, Toast.LENGTH_SHORT);
|
||||
t.setGravity(Gravity.CENTER, 0, 0);
|
||||
t.show();
|
||||
}
|
||||
makeList(mCurrentLocation, "*.*");
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
|
||||
/** Set onClick() event handler for the cancel button. */
|
||||
private void setCancelButton()
|
||||
{
|
||||
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener()
|
||||
{
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog)
|
||||
{
|
||||
mOnHandleFileListener.handleCancel();
|
||||
}
|
||||
});
|
||||
|
||||
mCancelButton = (Button) mDialog.findViewById(R.id.fileCancel);
|
||||
mCancelButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
mDialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public String getSelectedFileName() {
|
||||
final EditText fileName = (EditText) mDialog.findViewById(R.id.fileName);
|
||||
return fileName.getText().toString();
|
||||
}
|
||||
|
||||
public File getCurrentLocation() {
|
||||
return mCurrentLocation;
|
||||
}
|
||||
|
||||
/** Simple wrapper around the Dialog.show() method. */
|
||||
public void show() {
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
/** Simple wrapper around the Dialog.dissmiss() method. */
|
||||
public void dismiss() {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* A set of tools for file operations
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
/** Filter which accepts every file */
|
||||
public static final String FILTER_ALLOW_ALL = "*.*";
|
||||
|
||||
/**
|
||||
* This method checks that the file is accepted by the filter
|
||||
*
|
||||
* @param file
|
||||
* - file that will be checked if there is a specific type
|
||||
* @param filter
|
||||
* - criterion - the file type(for example ".jpg")
|
||||
* @return true - if file meets the criterion - false otherwise.
|
||||
*/
|
||||
public static boolean accept(final File file, final String filter) {
|
||||
if (filter.compareTo(FILTER_ALLOW_ALL) == 0) {
|
||||
return true;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
int lastIndexOfPoint = file.getName().lastIndexOf('.');
|
||||
if (lastIndexOfPoint == -1) {
|
||||
return false;
|
||||
}
|
||||
String fileType = file.getName().substring(lastIndexOfPoint).toLowerCase();
|
||||
return fileType.compareTo(filter) == 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
public interface OnHandleFileListener {
|
||||
/**
|
||||
* This method is called after clicking the Save or Load button on the
|
||||
* dialog, if the file name was correct. It should be used to save or load a
|
||||
* file using the filePath path.
|
||||
*
|
||||
* @param filePath
|
||||
* File path set in the dialog when the Save or Load button was
|
||||
* clicked.
|
||||
*/
|
||||
void handleFile(String filePath);
|
||||
void handleCancel();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
import com.nesbox.tic.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* This Listener handles Save or Load button clicks.
|
||||
*/
|
||||
public class SaveLoadClickListener implements OnClickListener {
|
||||
|
||||
/** Performed operation. */
|
||||
private final FileOperation mOperation;
|
||||
|
||||
/** FileSelector in which you used SaveLoadClickListener */
|
||||
private final FileSelector mFileSelector;
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
/**
|
||||
* @param operation
|
||||
* Performed operation.
|
||||
* @param fileSelector
|
||||
* The FileSeletor which used this Listener.
|
||||
* @param context
|
||||
* context.
|
||||
*/
|
||||
public SaveLoadClickListener(final FileOperation operation, final FileSelector fileSelector, final Context context) {
|
||||
mOperation = operation;
|
||||
mFileSelector = fileSelector;
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
final String text = mFileSelector.getSelectedFileName();
|
||||
if (checkFileName(text)) {
|
||||
final String filePath = mFileSelector.getCurrentLocation().getAbsolutePath() + File.separator + text;
|
||||
final File file = new File(filePath);
|
||||
int messageText = 0;
|
||||
// Check file access rights.
|
||||
switch (mOperation) {
|
||||
case SAVE:
|
||||
if ((file.exists()) && (!file.canWrite())) {
|
||||
messageText = R.string.cannotSaveFileMessage;
|
||||
}
|
||||
break;
|
||||
case LOAD:
|
||||
if (!file.exists()) {
|
||||
messageText = R.string.missingFile;
|
||||
} else if (!file.canRead()) {
|
||||
messageText = R.string.accessDenied;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (messageText != 0) {
|
||||
// Access denied.
|
||||
final Toast t = Toast.makeText(mContext, messageText, Toast.LENGTH_SHORT);
|
||||
t.setGravity(Gravity.CENTER, 0, 0);
|
||||
t.show();
|
||||
} else {
|
||||
// Access granted.
|
||||
mFileSelector.mOnHandleFileListener.handleFile(filePath);
|
||||
mFileSelector.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if file name is correct, e.g. if it isn't empty.
|
||||
*
|
||||
* @return False, if file name is empty true otherwise.
|
||||
*/
|
||||
boolean checkFileName(String text) {
|
||||
if (text.length() == 0) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
||||
builder.setTitle(R.string.information);
|
||||
builder.setMessage(R.string.fileNameFirstMessage);
|
||||
builder.setNeutralButton(R.string.okButtonText, null);
|
||||
builder.show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.samsung.sprc.fileselector;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Class which combines ImageView and TextView in LineralLayout with horizontal
|
||||
* orientation
|
||||
*/
|
||||
public class TextViewWithImage extends LinearLayout {
|
||||
|
||||
/**
|
||||
* Image - in this project will be used to display icon representing the
|
||||
* file type
|
||||
*/
|
||||
private ImageView mImage;
|
||||
/** Text - in this project will be used to display the file name */
|
||||
private TextView mText;
|
||||
|
||||
public TextViewWithImage(Context context) {
|
||||
super(context);
|
||||
setOrientation(HORIZONTAL);
|
||||
mImage = new ImageView(context);
|
||||
mText = new TextView(context);
|
||||
|
||||
LayoutParams lp = new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1);
|
||||
lp.weight = 1;
|
||||
addView(mImage, lp);
|
||||
lp = new LayoutParams(0, LayoutParams.WRAP_CONTENT, 3);
|
||||
addView(mText, lp);
|
||||
}
|
||||
|
||||
/** Simple wrapper around the TextView.getText() method. */
|
||||
public CharSequence getText() {
|
||||
return mText.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple wrapper around ImageView.setImageResource() method. but if resId
|
||||
* is equal -1 this method sets Images visibility as GONE
|
||||
*/
|
||||
public void setImageResource(int resId) {
|
||||
if (resId == -1) {
|
||||
mImage.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
mImage.setImageResource(resId);
|
||||
}
|
||||
|
||||
/** Simple wrapper around TextView.setText() method. */
|
||||
public void setText(String aText) {
|
||||
mText.setText(aText);
|
||||
}
|
||||
|
||||
}
|
||||
1742
build/android/src/org/libsdl/app/SDLActivity.java
Normal file
BIN
build/android/store/0.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
build/android/store/1.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
build/android/store/2.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
build/android/store/3.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
build/android/store/logo-1024x500.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
build/android/store/logo-512.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |