forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
3,506 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ src/obj | |
src/local.properties | ||
src/default.properties | ||
dist | ||
*.pyc | ||
testsuite |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="horizontal" | ||
android:gravity="center" | ||
> | ||
|
||
<ImageView | ||
android:id="@+id/icon" | ||
android:layout_width="64sp" | ||
android:layout_height="64sp" | ||
android:scaleType="fitCenter" | ||
android:padding="2sp" | ||
/> | ||
|
||
<LinearLayout | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/title" | ||
android:textSize="18sp" | ||
android:textColor="#fff" | ||
android:singleLine="true" | ||
/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:singleLine="true" | ||
android:id="@+id/author" | ||
/> | ||
|
||
</LinearLayout> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
> | ||
</LinearLayout> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
> | ||
|
||
<TextView | ||
android:text="Please choose a project:" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="4sp" | ||
/> | ||
|
||
<ListView | ||
android:id="@+id/projectList" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
/> | ||
|
||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
> | ||
|
||
<TextView | ||
android:id="@+id/emptyText" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="4sp" | ||
/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="appName">Kivy Launcher</string> | ||
<string name="iconName">Kivy Launcher</string> | ||
|
||
<string name="private_version">1323531558.3</string> | ||
|
||
|
||
<string name="urlScheme">kivy</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// This string is autogenerated by ChangeAppSettings.sh, do not change | ||
// spaces amount | ||
package org.renpy.android; | ||
|
||
import java.io.*; | ||
|
||
import android.app.Activity; | ||
import android.util.Log; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.BufferedOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.File; | ||
|
||
import java.util.zip.GZIPInputStream; | ||
|
||
import android.content.res.AssetManager; | ||
|
||
import org.xeustechnologies.jtar.*; | ||
|
||
class AssetExtract { | ||
|
||
private AssetManager mAssetManager = null; | ||
private Activity mActivity = null; | ||
|
||
AssetExtract(Activity act) { | ||
mActivity = act; | ||
mAssetManager = act.getAssets(); | ||
} | ||
|
||
public boolean extractTar(String asset, String target) { | ||
|
||
byte buf[] = new byte[1024 * 1024]; | ||
|
||
InputStream assetStream = null; | ||
TarInputStream tis = null; | ||
|
||
try { | ||
assetStream = mAssetManager.open(asset, AssetManager.ACCESS_STREAMING); | ||
tis = new TarInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(assetStream, 8192)), 8192)); | ||
} catch (IOException e) { | ||
Log.e("python", "opening up extract tar", e); | ||
return false; | ||
} | ||
|
||
while (true) { | ||
TarEntry entry = null; | ||
|
||
try { | ||
entry = tis.getNextEntry(); | ||
} catch ( java.io.IOException e ) { | ||
Log.e("python", "extracting tar", e); | ||
return false; | ||
} | ||
|
||
if ( entry == null ) { | ||
break; | ||
} | ||
|
||
Log.i("python", "extracting " + entry.getName()); | ||
|
||
if (entry.isDirectory()) { | ||
|
||
try { | ||
new File(target +"/" + entry.getName()).mkdirs(); | ||
} catch ( SecurityException e ) { }; | ||
|
||
continue; | ||
} | ||
|
||
OutputStream out = null; | ||
String path = target + "/" + entry.getName(); | ||
|
||
try { | ||
out = new BufferedOutputStream(new FileOutputStream(path), 8192); | ||
} catch ( FileNotFoundException e ) { | ||
} catch ( SecurityException e ) { }; | ||
|
||
if ( out == null ) { | ||
Log.e("python", "could not open " + path); | ||
return false; | ||
} | ||
|
||
try { | ||
while (true) { | ||
int len = tis.read(buf); | ||
|
||
if (len == -1) { | ||
break; | ||
} | ||
|
||
out.write(buf, 0, len); | ||
} | ||
|
||
out.flush(); | ||
out.close(); | ||
} catch ( java.io.IOException e ) { | ||
Log.e("python", "extracting zip", e); | ||
return false; | ||
} | ||
} | ||
|
||
try { | ||
tis.close(); | ||
assetStream.close(); | ||
} catch (IOException e) { | ||
// pass | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Java source code (C) 2009-2011 Sergii Pylypenko | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source distribution. | ||
*/ | ||
|
||
package org.renpy.android; | ||
|
||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.view.MotionEvent; | ||
import android.view.KeyEvent; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
import android.media.AudioTrack; | ||
import android.media.AudioManager; | ||
import android.media.AudioFormat; | ||
import java.io.*; | ||
import java.nio.ByteBuffer; | ||
import android.util.Log; | ||
import java.lang.Thread; | ||
|
||
|
||
class AudioThread { | ||
|
||
private PythonActivity mParent; | ||
private AudioTrack mAudio; | ||
private byte[] mAudioBuffer; | ||
private int mVirtualBufSize; | ||
|
||
public AudioThread(PythonActivity parent) | ||
{ | ||
mParent = parent; | ||
mAudio = null; | ||
mAudioBuffer = null; | ||
nativeAudioInitJavaCallbacks(); | ||
} | ||
|
||
public int fillBuffer() | ||
{ | ||
if( mParent.isPaused() ) | ||
{ | ||
try{ | ||
Thread.sleep(200); | ||
} catch (InterruptedException e) {} | ||
} | ||
else | ||
{ | ||
//if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse | ||
// mAudio.flush(); | ||
|
||
mAudio.write( mAudioBuffer, 0, mVirtualBufSize ); | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
public int initAudio(int rate, int channels, int encoding, int bufSize) | ||
{ | ||
if( mAudio == null ) | ||
{ | ||
channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO : | ||
AudioFormat.CHANNEL_CONFIGURATION_STEREO; | ||
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT : | ||
AudioFormat.ENCODING_PCM_8BIT; | ||
|
||
mVirtualBufSize = bufSize; | ||
|
||
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize ) | ||
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding ); | ||
|
||
/** | ||
if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer | ||
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f)); | ||
mVirtualBufSize = bufSize; | ||
} | ||
**/ | ||
mAudioBuffer = new byte[bufSize]; | ||
|
||
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC, | ||
rate, | ||
channels, | ||
encoding, | ||
bufSize, | ||
AudioTrack.MODE_STREAM ); | ||
mAudio.play(); | ||
} | ||
return mVirtualBufSize; | ||
} | ||
|
||
public byte[] getBuffer() | ||
{ | ||
return mAudioBuffer; | ||
} | ||
|
||
public int deinitAudio() | ||
{ | ||
if( mAudio != null ) | ||
{ | ||
mAudio.stop(); | ||
mAudio.release(); | ||
mAudio = null; | ||
} | ||
mAudioBuffer = null; | ||
return 1; | ||
} | ||
|
||
public int initAudioThread() | ||
{ | ||
// Make audio thread priority higher so audio thread won't get underrun | ||
Thread.currentThread().setPriority(Thread.MAX_PRIORITY); | ||
return 1; | ||
} | ||
|
||
public int pauseAudioPlayback() | ||
{ | ||
if( mAudio != null ) | ||
{ | ||
mAudio.pause(); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
public int resumeAudioPlayback() | ||
{ | ||
if( mAudio != null ) | ||
{ | ||
mAudio.play(); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
private native int nativeAudioInitJavaCallbacks(); | ||
} | ||
|
Oops, something went wrong.