Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main
README.md
build.gradle
proguard-rules.pro

README.md

Alfonz - Media Module

Utilities for working with images, sounds and videos.

How to use ImagePicker

Create a new instance of ImagePicker. Specify the name of the album directory.

private ImagePicker mImagePicker = new ImagePicker(getContext(), getString(R.string.app_name));

Override onActivityResult() as follows.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
	mImagePicker.onActivityResult(this, requestCode, resultCode, data);
}

Pick an image from camera or gallery when user clicks on a button. Note that it requires READ_EXTERNAL_STORAGE permission.

mImagePicker.pickImageFromCamera(
		this,
		(pickable, bitmap, path) -> pickable.handleImagePicked(bitmap, path),
		pickable -> pickable.handleImageCanceled());
mImagePicker.pickImageFromGallery(
		this,
		(pickable, bitmap, path) -> pickable.handleImagePicked(bitmap, path),
		pickable -> pickable.handleImageCanceled());

Pickable variable in the lambda expression represents current instance of Fragment or Activity which has been passed in onActivityResult() method.

How to use SoundManager

Create a new instance of SoundManager. You can choose which playback mode you prefer to use.

private SoundManager mSoundManager = new SoundManager(getContext(), SoundManager.PLAY_SINGLE);

Play a sound from storage or assets.

mSoundManager.play(path);
mSoundManager.playAsset(filename);

Stop all playing sounds and release resources in Activity.onStop().

@Override
public void onStop() {
	mSoundManager.stopAll();
}

Dependencies

  • Alfonz Graphics Module
  • Android Support Library

Samples and download

See the main README file.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.