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
public class NetworkTasksTest extends InstrumentationTestCase{ | |
public void testGetMedia() throws Throwable{ | |
final Context context = getInstrumentation().getTargetContext(); | |
final CountDownLatch signal = new CountDownLatch(1); | |
final NetworkTasks networkTasks = new NetworkTasks(context, new GetMediaListener(signal)); | |
runTestOnUiThread(new Runnable() { |
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
public void testGetMedia() throws Throwable{ | |
final Context context = getInstrumentation().getTargetContext(); | |
final CountDownLatch signal = new CountDownLatch(1); | |
final NetworkTasks networkTasks = new NetworkTasks(context, new GetMediaListener(signal)); | |
runTestOnUiThread(new Runnable() { | |
public void run() { | |
Media media = new Media(); | |
media.setId("179"); |
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
public void getMedia(Media m){ | |
AsyncTask<Media, Void, Throwable> task = new GetMediaAsycnTask<Media,Void,Throwable>(); | |
task.execute(); | |
} |
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
private abstract class CallbackListener implements INetworkTasksListener{ | |
private CountDownLatch signal; | |
CallbackListener(CountDownLatch signal){ | |
this.signal = signal; | |
} | |
public void onSuccess(Media... medias) { | |
signal.countDown(); |
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
public static final int FREQUENCY = 44100; | |
public static final int CHANNEL_CONFIGURATION = AudioFormat.CHANNEL_CONFIGURATION_MONO; | |
public static final int AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; | |
private void recordSound(){ | |
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/"+RECORDED_FILENAME); | |
// Delete any previous recording. | |
if (file.exists()) |
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
private void mixFiles(){ | |
try { | |
InputStream is1 = getResources().openRawResource(R.raw.test1); | |
List<Short> music1 = createMusicArray(is1); | |
InputStream is2 = getResources().openRawResource(R.raw.test2); | |
List<Short> music2 = createMusicArray(is2); | |
InputStream is3 = getResources().openRawResource(R.raw.test3); | |
List<Short> music3 = createMusicArray(is3); |
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
private void mixFiles(){ | |
try { | |
InputStream is1 = getResources().openRawResource(R.raw.test1); | |
List<Short> music1 = createMusicArray(is1); | |
InputStream is2 = getResources().openRawResource(R.raw.test2); | |
List<Short> music2 = createMusicArray(is2); | |
InputStream is3 = getResources().openRawResource(R.raw.test3); | |
List<Short> music3 = createMusicArray(is3); |
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
- (IBAction)deleteTapped:(id)sender { | |
[_delegate contentViewWillDelete:self]; | |
[UIView animateWithDuration:0.5 animations:^{ | |
self.alpha = 0.0f; | |
CGAffineTransform rotate = CGAffineTransformRotate(self.transform, 1); | |
CGAffineTransform translate = CGAffineTransformTranslate(self.transform, 300, -100); | |
self.transform = CGAffineTransformConcat(rotate, translate); | |
} completion:^(BOOL finished){ | |
[self removeFromSuperview]; |
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
-(NSArray *)findAfterViewsAfter:(ContentView *)contentView{ | |
int viewIndex = contentView.tag; | |
NSMutableArray *afterViews = [NSMutableArray array]; | |
BOOL isBefore = YES; | |
for(int i=0; i < _views.count; i++){ | |
ContentView *currentView = [_views objectAtIndex:i]; | |
if(currentView.tag == viewIndex){ | |
isBefore = NO; | |
continue; |
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
-(void)translateUp:(NSArray *)views{ | |
[UIView animateWithDuration:0.5 animations:^{ | |
for(ContentView *contentView in views){ | |
contentView.transform = CGAffineTransformTranslate(contentView.transform, 0, -contentView.frame.size.height -_initialOffset); | |
} | |
}]; | |
} |
OlderNewer