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 show() { | |
| FragmentManager fragmentManager = mActivity.getSupportFragmentManager(); | |
| FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); | |
| Fragment prev = fragmentManager.findFragmentByTag(FRAGMENT_TAG); | |
| if (prev != null) { | |
| fragmentTransaction.remove(prev); | |
| } | |
| fragmentTransaction.addToBackStack(null); | |
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
| final RingtoneManager manager = new RingtoneManager(this); | |
| manager.setType(RingtoneManager.TYPE_ALL); | |
| ringtone = manager.getRingtone(manager.getRingtonePosition(Uri.parse(s))); | |
| if (ringtone == null) { | |
| return; | |
| } |
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()); |
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
| 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
| 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
| 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
| 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
| 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
| 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); | |
| } | |
| } | |
| } |
NewerOlder