Search in sources :

Example 81 with RequiresApi

use of android.support.annotation.RequiresApi in project TumCampusApp by TCA-Team.

the class SilenceService method requestPermissionsSDK23.

@RequiresApi(Build.VERSION_CODES.M)
private static void requestPermissionsSDK23(Context context) {
    Intent intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
    context.startActivity(intent);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) RequiresApi(android.support.annotation.RequiresApi)

Example 82 with RequiresApi

use of android.support.annotation.RequiresApi in project glide by bumptech.

the class RequestManagerRetrieverTest method testDoesNotThrowIfAskedToGetManagerForActivityPreJellYBeanMr1.

@Test
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void testDoesNotThrowIfAskedToGetManagerForActivityPreJellYBeanMr1() {
    Util.setSdkVersionInt(Build.VERSION_CODES.JELLY_BEAN);
    Activity activity = Robolectric.buildActivity(Activity.class).create().start().resume().get();
    Activity spyActivity = Mockito.spy(activity);
    when(spyActivity.isDestroyed()).thenThrow(new NoSuchMethodError());
    assertNotNull(retriever.get(spyActivity));
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Activity(android.app.Activity) Test(org.junit.Test) RequiresApi(android.support.annotation.RequiresApi)

Example 83 with RequiresApi

use of android.support.annotation.RequiresApi in project run-wallet-android by runplay.

the class NotificationHelper method createNotificationChannel.

@RequiresApi(api = Build.VERSION_CODES.O)
private static void createNotificationChannel(Context context) {
    NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
    NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL, context.getResources().getString(R.string.app_name), NotificationManager.IMPORTANCE_MIN);
    notificationManager.createNotificationChannel(channel);
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationManager(android.app.NotificationManager) RequiresApi(android.support.annotation.RequiresApi)

Example 84 with RequiresApi

use of android.support.annotation.RequiresApi in project AlarmAndJob by dxsdyhm.

the class TostServiceHelper method initScedule.

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void initScedule(Context context) {
    JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
    JobInfo jobInfo = new JobInfo.Builder(1, new ComponentName(context.getPackageName(), ToastJobService.class.getName())).setPeriodic(SCEDULE_TIME).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY).setRequiresCharging(true).build();
    jobScheduler.schedule(jobInfo);
}
Also used : JobScheduler(android.app.job.JobScheduler) JobInfo(android.app.job.JobInfo) ComponentName(android.content.ComponentName) RequiresApi(android.support.annotation.RequiresApi)

Example 85 with RequiresApi

use of android.support.annotation.RequiresApi in project tutorial-view by msayan.

the class TutorialActivity method changeStatusBarColor.

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void changeStatusBarColor(int backgroundColor) {
    Window window = getWindow();
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(backgroundColor);
}
Also used : Window(android.view.Window) RequiresApi(android.support.annotation.RequiresApi)

Aggregations

RequiresApi (android.support.annotation.RequiresApi)191 Intent (android.content.Intent)30 NotificationChannel (android.app.NotificationChannel)28 View (android.view.View)25 NotificationManager (android.app.NotificationManager)17 ViewGroup (android.view.ViewGroup)15 Allocation (android.renderscript.Allocation)14 Bitmap (android.graphics.Bitmap)13 RecyclerView (android.support.v7.widget.RecyclerView)13 ViewTreeObserver (android.view.ViewTreeObserver)12 WindowInsets (android.view.WindowInsets)12 TextView (android.widget.TextView)12 ActionBar (android.support.v7.app.ActionBar)11 Toolbar (android.support.v7.widget.Toolbar)11 Handler (android.os.Handler)10 StatFs (android.os.StatFs)9 Button (android.widget.Button)8 Cipher (javax.crypto.Cipher)8 SuppressLint (android.annotation.SuppressLint)7 Uri (android.net.Uri)7