Make lib compileable with AndroidStudio
parent
bb2efc1c4e
commit
ec96c5052c
|
@ -0,0 +1,6 @@
|
|||
bin
|
||||
gen
|
||||
obj
|
||||
**/.DS_Store
|
||||
build
|
||||
*.iml
|
|
@ -1,16 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.vorbisdemo" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
package="com.vorbisdemo"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="9"
|
||||
android:targetSdkVersion="9" />
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".MainActivity" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<application
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
|
@ -0,0 +1,39 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion project.hasProperty("defaultCompileSdkVersion") ? defaultCompileSdkVersion : 23
|
||||
buildToolsVersion project.hasProperty("defaultBuildToolsVersion") ? defaultBuildToolsVersion : "23.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion project.hasProperty("defaultTargetSdkVersion") ? defaultTargetSdkVersion : 23
|
||||
}
|
||||
|
||||
lintOptions { abortOnError false }
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src', 'src-gen']
|
||||
resources.srcDirs = ['src']
|
||||
aidl.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
instrumentTest.setRoot('tests')
|
||||
}
|
||||
}
|
||||
|
|
@ -9,11 +9,11 @@ import android.text.method.ScrollingMovementMethod;
|
|||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.xiph.vorbis.player.VorbisPlayer;
|
||||
import org.xiph.vorbis.recorder.VorbisRecorder;
|
||||
|
||||
|
@ -194,15 +194,14 @@ public class MainActivity extends Activity {
|
|||
encodingTypeRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
|
||||
switch (checkedId) {
|
||||
case R.id.with_bitrate:
|
||||
availableBitratesLayout.setVisibility(View.VISIBLE);
|
||||
availableQualitiesLayout.setVisibility(View.GONE);
|
||||
break;
|
||||
case R.id.with_quality:
|
||||
availableBitratesLayout.setVisibility(View.GONE);
|
||||
availableQualitiesLayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
if (checkedId == R.id.with_bitrate) {
|
||||
availableBitratesLayout.setVisibility(View.VISIBLE);
|
||||
availableQualitiesLayout.setVisibility(View.GONE);
|
||||
|
||||
} else if (checkedId == R.id.with_quality) {
|
||||
availableBitratesLayout.setVisibility(View.GONE);
|
||||
availableQualitiesLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -228,15 +227,15 @@ public class MainActivity extends Activity {
|
|||
Long channels = (long) (chanelConfigSpinner.getSelectedItemPosition() + 1);
|
||||
|
||||
//Start recording with selected encoding options
|
||||
switch (encodingTypeRadioGroup.getCheckedRadioButtonId()) {
|
||||
case R.id.with_bitrate:
|
||||
Long bitrate = Long.parseLong(bitrateSpinner.getSelectedItem().toString());
|
||||
vorbisRecorder.start(sampleRate, channels, bitrate);
|
||||
break;
|
||||
case R.id.with_quality:
|
||||
Float quality = Float.parseFloat(qualitySpinner.getSelectedItem().toString());
|
||||
vorbisRecorder.start(sampleRate, channels, quality);
|
||||
break;
|
||||
int i = encodingTypeRadioGroup.getCheckedRadioButtonId();
|
||||
if (i == R.id.with_bitrate) {
|
||||
Long bitrate = Long.parseLong(bitrateSpinner.getSelectedItem().toString());
|
||||
vorbisRecorder.start(sampleRate, channels, bitrate);
|
||||
|
||||
} else if (i == R.id.with_quality) {
|
||||
Float quality = Float.parseFloat(qualitySpinner.getSelectedItem().toString());
|
||||
vorbisRecorder.start(sampleRate, channels, quality);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +268,7 @@ public class MainActivity extends Activity {
|
|||
vorbisPlayer = new VorbisPlayer(fileToPlay, playbackHandler);
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(TAG, "Failed to find saveTo.ogg", e);
|
||||
Toast.makeText(this, "Failed to find file to play!", 2000).show();
|
||||
Toast.makeText(this, "Failed to find file to play!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue