Commit 63938632 authored by Oliver Adams's avatar Oliver Adams

Finished javadocs

parent 4df5b86a
......@@ -27,16 +27,27 @@ public class Aikuma extends android.app.Application {
private static Aikuma instance;
private static List<Language> languages;
/**
* The constructor.
*/
public Aikuma() {
instance = this;
}
/**
* Static method that provides a context when needed by code not bound to
* any meaningful context.
*
* @return A Context
*/
public static Context getContext() {
return instance;
}
/**
* Gets the android ID of the phone.
*
* @return The android ID as a String.
*/
public static String getAndroidID() {
return Secure.getString(
......@@ -79,6 +90,10 @@ public class Aikuma extends android.app.Application {
}
}
/**
* The thread used to load the language codes without interrupting the
* main thread.
*/
public static Thread loadLangCodesThread;
}
......
......@@ -57,7 +57,6 @@ import org.lp20.aikuma.model.WaveFile;
*/
public class MainActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
......@@ -93,10 +92,6 @@ public class MainActivity extends ListActivity {
setListAdapter(adapter);
}
/**
* When a recording item in the list is clicked, start the ListenActivity
* and send the relevant UUID through.
*/
@Override
public void onListItemClick(ListView l, View v, int position, long id){
Recording recording = (Recording) getListAdapter().getItem(position);
......@@ -116,7 +111,7 @@ public class MainActivity extends ListActivity {
/**
* Called when the import button is pressed; starts the import process.
*
* @param view the audio import button.
* @param _view the audio import button.
*/
public void audioImport(View _view) {
mPath = Environment.getExternalStorageDirectory();
......
......@@ -17,29 +17,48 @@ import android.media.AudioManager;
* @author Florian Hanke <florian.hanke@gmail.com>
*/
public class Audio {
/**
* Resets the activity playing through the main speakers.
*
* @param activity The activity in question.
*/
public static void reset(Activity activity) {
playThroughSpeaker(activity);
}
/**
* Plays the audio through the earpiece, like a phone call.
*
* @param activity The activity that this method governs.
* @param toSetMode True if the Audiomanager needs to be set to call mode.
*/
public static void playThroughEarpiece(Activity activity, boolean toSetMode) {
AudioManager audioManager = getAudioManager(activity);
if (toSetMode) {
audioManager.setMode(AudioManager.MODE_IN_CALL);
}
Log.i("speaker", "setting it off");
audioManager.setSpeakerphoneOn(false);
Log.i("speaker", "set it off. isSpeakerphoneOn: " + audioManager.isSpeakerphoneOn());
}
/**
* Plays the audio through the main speaker (not the earpiece as a phone
* call would)
*
* @param activity The activity that this method governs.
*/
public static void playThroughSpeaker(Activity activity) {
AudioManager audioManager = getAudioManager(activity);
audioManager.setMode(AudioManager.MODE_NORMAL);
Log.i("speaker", "setting it on");
audioManager.setSpeakerphoneOn(true);
Log.i("speaker", "set it on. isSpeakerphoneOn: " + audioManager.isSpeakerphoneOn());
}
/**
* Gets the audio manager for the given activity.
*
* @param activity The activity whose AudioManager is needed.
* @return The audiomanager.
*/
protected static AudioManager getAudioManager(Activity activity) {
return (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
}
......
......@@ -26,31 +26,69 @@ public class Beeper {
private MediaPlayer beep;
private MediaPlayer beepBeep;
/**
* Constructor
*
* @param context The context that the Beeper should beep in.
*/
public Beeper(Context context) {
this.context = context;
}
/**
* Plays one beep.
*/
public void beep() { beep(null); }
/**
* Plays one beep.
*
* @param listener The callback to play when the beep is complete.
*/
public void beep(OnCompletionListener listener) {
getBeep(listener).start();
}
/**
* Plays two beeps in succession.
*/
public void beepBeep() { beepBeep(null); }
/**
* Plays two beeps in succession.
*
* @param listener The callback to play when the beep is complete.
*/
public void beepBeep(OnCompletionListener listener) {
getBeepBeep(listener).start();
}
/** Static convenience methods */
/**
* Plays one beep.
*
* @param context The context to play the beep in
* @param listener The callback to play when the beep is complete.
*/
public static void beep(Context context, OnCompletionListener listener) {
start(context, listener, R.raw.beep);
}
/**
* Plays two beeps in succession.
*
* @param context The context to play the beep in
* @param listener The callback to play when the beep is complete.
*/
public static void beepBeep(Context context, OnCompletionListener listener) {
start(context, listener, R.raw.beeps2);
}
/**
* Plays a long beep.
*
* @param context The context to play the beep in
* @param listener The callback to play when the beep is complete.
*/
public static void longBeep(Context context, OnCompletionListener listener) {
start(context, listener, R.raw.longbeep);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment