This file contains hidden or 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 shouldStoreLastSentTextMessageParameters() { | |
smsManager.sendTextMessage(testDestinationAddress, testScAddress, testText, null, null); | |
ShadowSmsManager.TextSmsParams lastParams = shadowSmsManager.getLastSentTextMessageParams(); | |
Assert.assertEquals(testDestinationAddress, lastParams.getDestinationAddress()); | |
Assert.assertEquals(testScAddress, lastParams.getScAddress()); | |
Assert.assertEquals(testText, lastParams.getText()); | |
} |
This file contains hidden or 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 Intent createYoutubeIntent(MovieBean movie) { | |
Builder youtubeUri = new Builder(); | |
youtubeUri.scheme("http"); | |
youtubeUri.authority("m.youtube.com"); | |
youtubeUri.path("results"); | |
youtubeUri.appendQueryParameter("q", new StringBuilder("\"").append(movie.getMovieName()).append("\" trailer").toString()); | |
StringBuilder youtubeUriStr = new StringBuilder("http://m.youtube.com/results?q="); | |
youtubeUriStr.append(new StringBuilder("\"").append(Uri.encode(movie.getMovieName())).append("\"+trailer").toString()); | |
Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(youtubeUriStr.toString())); |
This file contains hidden or 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 ifGPSregisterOneShotNetworkUpdate() { | |
String bestEnabledProvider = locationManager.getBestProvider(criteria, true); | |
if (bestEnabledProvider != null && LocationManager.GPS_PROVIDER.equals(bestEnabledProvider)) { | |
locationManager.removeUpdates(oneShotNetworkLocationListener); | |
if (isNetworkProviderEnabled()) { | |
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, oneShotNetworkLocationListener); | |
} | |
} | |
} |
This file contains hidden or 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 boolean haveNetworkConnection(Context context) { | |
ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); | |
if(activeNetwork == null) return false; | |
return activeNetwork.isConnected(); | |
} |
This file contains hidden or 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
AnimatorSet set = new AnimatorSet(); | |
set.playSequentially(moveAnim, skewAnim, wobbleAnim); | |
if (finishDownAnim != null) { | |
set.play(finishDownAnim).before(moveAnim); | |
} |
This file contains hidden or 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
toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100); | |
toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50); | |
if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) { | |
Thread.sleep(100); | |
if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) { | |
Thread.sleep(500); | |
toneGen1.stopTone(); | |
Thread.sleep(100); | |
toneGen2.stopTone(); |
This file contains hidden or 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
Paint paint = new Paint(); | |
paint.setAntiAlias(true); | |
paint.setColor(WHITE); | |
Bitmap clipped = Bitmap.createBitmap(width, height, ARGB_8888); | |
Canvas canvas = new Canvas(clipped); | |
canvas.drawRoundRect(new RectF(0, 0, width, height), radius, radius, paint); | |
paint.setXfermode(new PorterDuffXfermode(DST_IN)); |
This file contains hidden or 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 AlertDialog newMessageDialog(final Context context, String dialogTitle, | |
String screenMessage, int iconResourceId) { | |
AlertDialog.Builder builder = new AlertDialog.Builder(context); | |
builder.setCancelable(false); | |
builder.setPositiveButton("Okay", new OnClickListener() { | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
} | |
}); |
This file contains hidden or 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 Cursor query(Uri uri, String[] projection, String selection, | |
String[] selectionArgs, String sortOrder) { | |
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); | |
int uriType = sURIMatcher.match(uri); | |
switch (uriType) { | |
case SIMPLEENTITY_DIR: | |
queryBuilder.setTables(TABLENAME); | |
break; | |
case SIMPLEENTITY_ID: |
This file contains hidden or 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
HandlerThread thr = new HandlerThread("SystemUI StorageNotification"); | |
thr.start(); | |
mAsyncEventHandler = new Handler(thr.getLooper()); |