Skip to content

Commit c1038d1

Browse files
committed
indent and normalize all java files
1 parent c7614a7 commit c1038d1

13 files changed

+840
-851
lines changed

src/src/org/renpy/android/Action.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88

99
public class Action {
1010

11-
static Context context;
11+
static Context context;
1212

13-
/* Deliver some data to someone else
14-
*/
15-
static void send(String mimeType, String filename, String subject, String text, String chooser_title) {
16-
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
17-
emailIntent.setType(mimeType);
18-
/** tryied with String [] emails, but hard to code the whole C/Cython part.
19-
if (emails != null)
20-
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emails);
21-
**/
22-
if (subject != null)
23-
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
24-
if (text != null)
25-
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
26-
if (filename != null)
27-
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filename));
28-
if (chooser_title == null)
29-
chooser_title = "Send mail";
30-
context.startActivity(Intent.createChooser(emailIntent, chooser_title));
31-
}
13+
/* Deliver some data to someone else
14+
*/
15+
static void send(String mimeType, String filename, String subject, String text, String chooser_title) {
16+
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
17+
emailIntent.setType(mimeType);
18+
/** tryied with String [] emails, but hard to code the whole C/Cython part.
19+
if (emails != null)
20+
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emails);
21+
**/
22+
if (subject != null)
23+
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
24+
if (text != null)
25+
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
26+
if (filename != null)
27+
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filename));
28+
if (chooser_title == null)
29+
chooser_title = "Send mail";
30+
context.startActivity(Intent.createChooser(emailIntent, chooser_title));
31+
}
3232
}

src/src/org/renpy/android/AssetExtract.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ class AssetExtract {
2525

2626
private AssetManager mAssetManager = null;
2727
private Activity mActivity = null;
28-
28+
2929
AssetExtract(Activity act) {
3030
mActivity = act;
3131
mAssetManager = act.getAssets();
3232
}
33-
33+
3434
public boolean extractTar(String asset, String target) {
3535

3636
byte buf[] = new byte[1024 * 1024];
37-
37+
3838
InputStream assetStream = null;
3939
TarInputStream tis = null;
40-
40+
4141
try {
4242
assetStream = mAssetManager.open(asset, AssetManager.ACCESS_STREAMING);
4343
tis = new TarInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(assetStream, 8192)), 8192));
4444
} catch (IOException e) {
4545
Log.e("python", "opening up extract tar", e);
4646
return false;
4747
}
48-
48+
4949
while (true) {
5050
TarEntry entry = null;
5151

@@ -61,7 +61,7 @@ public boolean extractTar(String asset, String target) {
6161
}
6262

6363
Log.i("python", "extracting " + entry.getName());
64-
64+
6565
if (entry.isDirectory()) {
6666

6767
try {
@@ -87,14 +87,14 @@ public boolean extractTar(String asset, String target) {
8787
try {
8888
while (true) {
8989
int len = tis.read(buf);
90-
90+
9191
if (len == -1) {
9292
break;
9393
}
94-
94+
9595
out.write(buf, 0, len);
9696
}
97-
97+
9898
out.flush();
9999
out.close();
100100
} catch ( java.io.IOException e ) {
@@ -109,7 +109,7 @@ public boolean extractTar(String asset, String target) {
109109
} catch (IOException e) {
110110
// pass
111111
}
112-
112+
113113
return true;
114114
}
115115
}

src/src/org/renpy/android/Audio.java

Lines changed: 125 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/*
2-
Simple DirectMedia Layer
3-
Java source code (C) 2009-2011 Sergii Pylypenko
4-
5-
This software is provided 'as-is', without any express or implied
6-
warranty. In no event will the authors be held liable for any damages
7-
arising from the use of this software.
8-
9-
Permission is granted to anyone to use this software for any purpose,
10-
including commercial applications, and to alter it and redistribute it
11-
freely, subject to the following restrictions:
12-
13-
1. The origin of this software must not be misrepresented; you must not
2+
Simple DirectMedia Layer
3+
Java source code (C) 2009-2011 Sergii Pylypenko
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
1414
claim that you wrote the original software. If you use this software
1515
in a product, an acknowledgment in the product documentation would be
1616
appreciated but is not required.
17-
2. Altered source versions must be plainly marked as such, and must not be
17+
2. Altered source versions must be plainly marked as such, and must not be
1818
misrepresented as being the original software.
19-
3. This notice may not be removed or altered from any source distribution.
20-
*/
19+
3. This notice may not be removed or altered from any source distribution.
20+
*/
2121

2222
package org.renpy.android;
2323

@@ -40,115 +40,115 @@ Java source code (C) 2009-2011 Sergii Pylypenko
4040

4141
class AudioThread {
4242

43-
private PythonActivity mParent;
44-
private AudioTrack mAudio;
45-
private byte[] mAudioBuffer;
46-
private int mVirtualBufSize;
47-
48-
public AudioThread(PythonActivity parent)
49-
{
50-
mParent = parent;
51-
mAudio = null;
52-
mAudioBuffer = null;
53-
nativeAudioInitJavaCallbacks();
54-
}
55-
56-
public int fillBuffer()
57-
{
58-
if( mParent.isPaused() )
59-
{
60-
try{
61-
Thread.sleep(200);
62-
} catch (InterruptedException e) {}
63-
}
64-
else
65-
{
66-
//if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse
67-
// mAudio.flush();
68-
69-
mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
70-
}
71-
72-
return 1;
73-
}
74-
75-
public int initAudio(int rate, int channels, int encoding, int bufSize)
76-
{
77-
if( mAudio == null )
78-
{
79-
channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO :
80-
AudioFormat.CHANNEL_CONFIGURATION_STEREO;
81-
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
82-
AudioFormat.ENCODING_PCM_8BIT;
83-
84-
mVirtualBufSize = bufSize;
85-
86-
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize )
87-
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding );
88-
89-
/**
90-
if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer
91-
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f));
92-
mVirtualBufSize = bufSize;
93-
}
94-
**/
95-
mAudioBuffer = new byte[bufSize];
96-
97-
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC,
98-
rate,
99-
channels,
100-
encoding,
101-
bufSize,
102-
AudioTrack.MODE_STREAM );
103-
mAudio.play();
104-
}
105-
return mVirtualBufSize;
106-
}
107-
108-
public byte[] getBuffer()
109-
{
110-
return mAudioBuffer;
111-
}
112-
113-
public int deinitAudio()
114-
{
115-
if( mAudio != null )
116-
{
117-
mAudio.stop();
118-
mAudio.release();
119-
mAudio = null;
120-
}
121-
mAudioBuffer = null;
122-
return 1;
123-
}
124-
125-
public int initAudioThread()
126-
{
127-
// Make audio thread priority higher so audio thread won't get underrun
128-
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
129-
return 1;
130-
}
131-
132-
public int pauseAudioPlayback()
133-
{
134-
if( mAudio != null )
135-
{
136-
mAudio.pause();
137-
return 1;
138-
}
139-
return 0;
140-
}
141-
142-
public int resumeAudioPlayback()
143-
{
144-
if( mAudio != null )
145-
{
146-
mAudio.play();
147-
return 1;
148-
}
149-
return 0;
150-
}
151-
152-
private native int nativeAudioInitJavaCallbacks();
43+
private PythonActivity mParent;
44+
private AudioTrack mAudio;
45+
private byte[] mAudioBuffer;
46+
private int mVirtualBufSize;
47+
48+
public AudioThread(PythonActivity parent)
49+
{
50+
mParent = parent;
51+
mAudio = null;
52+
mAudioBuffer = null;
53+
nativeAudioInitJavaCallbacks();
54+
}
55+
56+
public int fillBuffer()
57+
{
58+
if( mParent.isPaused() )
59+
{
60+
try{
61+
Thread.sleep(200);
62+
} catch (InterruptedException e) {}
63+
}
64+
else
65+
{
66+
//if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse
67+
// mAudio.flush();
68+
69+
mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
70+
}
71+
72+
return 1;
73+
}
74+
75+
public int initAudio(int rate, int channels, int encoding, int bufSize)
76+
{
77+
if( mAudio == null )
78+
{
79+
channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO :
80+
AudioFormat.CHANNEL_CONFIGURATION_STEREO;
81+
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
82+
AudioFormat.ENCODING_PCM_8BIT;
83+
84+
mVirtualBufSize = bufSize;
85+
86+
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize )
87+
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding );
88+
89+
/**
90+
if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer
91+
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f));
92+
mVirtualBufSize = bufSize;
93+
}
94+
**/
95+
mAudioBuffer = new byte[bufSize];
96+
97+
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC,
98+
rate,
99+
channels,
100+
encoding,
101+
bufSize,
102+
AudioTrack.MODE_STREAM );
103+
mAudio.play();
104+
}
105+
return mVirtualBufSize;
106+
}
107+
108+
public byte[] getBuffer()
109+
{
110+
return mAudioBuffer;
111+
}
112+
113+
public int deinitAudio()
114+
{
115+
if( mAudio != null )
116+
{
117+
mAudio.stop();
118+
mAudio.release();
119+
mAudio = null;
120+
}
121+
mAudioBuffer = null;
122+
return 1;
123+
}
124+
125+
public int initAudioThread()
126+
{
127+
// Make audio thread priority higher so audio thread won't get underrun
128+
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
129+
return 1;
130+
}
131+
132+
public int pauseAudioPlayback()
133+
{
134+
if( mAudio != null )
135+
{
136+
mAudio.pause();
137+
return 1;
138+
}
139+
return 0;
140+
}
141+
142+
public int resumeAudioPlayback()
143+
{
144+
if( mAudio != null )
145+
{
146+
mAudio.play();
147+
return 1;
148+
}
149+
return 0;
150+
}
151+
152+
private native int nativeAudioInitJavaCallbacks();
153153
}
154154

0 commit comments

Comments
 (0)