Search in sources :

Example 21 with RequiresApi

use of android.support.annotation.RequiresApi in project grafika by google.

the class ScreenRecordActivity method prepareVideoEncoder.

@RequiresApi(api = Build.VERSION_CODES.M)
private void prepareVideoEncoder(int width, int height) {
    MediaFormat format = MediaFormat.createVideoFormat(VIDEO_MIME_TYPE, width, height);
    // 30 fps
    int frameRate = 30;
    // Set some required properties. The media codec may fail if these aren't defined.
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
    // 6Mbps
    format.setInteger(MediaFormat.KEY_BIT_RATE, 6000000);
    format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
    format.setInteger(MediaFormat.KEY_CAPTURE_RATE, frameRate);
    format.setInteger(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, 1000000 / frameRate);
    format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1);
    // 1 seconds between I-frames
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1);
    // Create a MediaCodec encoder and configure it. Get a Surface we can use for recording into.
    try {
        videoEncoder = MediaCodec.createEncoderByType(VIDEO_MIME_TYPE);
        videoEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
        inputSurface = videoEncoder.createInputSurface();
        videoEncoder.setCallback(encoderCallback);
        videoEncoder.start();
    } catch (IOException e) {
        releaseEncoders();
    }
}
Also used : MediaFormat(android.media.MediaFormat) IOException(java.io.IOException) RequiresApi(android.support.annotation.RequiresApi)

Example 22 with RequiresApi

use of android.support.annotation.RequiresApi in project SpotiQ by ZinoKader.

the class ShortcutUtil method addSearchShortcut.

@RequiresApi(api = Build.VERSION_CODES.N_MR1)
public static void addSearchShortcut(Context context, String searchWithPartyTitle) {
    ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
    Intent openSearch = new Intent(context.getApplicationContext(), SearchActivity.class);
    openSearch.putExtra(ApplicationConstants.PARTY_NAME_EXTRA, searchWithPartyTitle);
    openSearch.setAction(Intent.ACTION_VIEW);
    ShortcutInfo shortcut = new ShortcutInfo.Builder(context, ApplicationConstants.SEARCH_SHORTCUT_ID).setShortLabel("Search songs").setLongLabel("Search for songs to add to the queue").setIcon(Icon.createWithResource(context, R.drawable.ic_shortcut_search)).setIntent(openSearch).build();
    shortcutManager.setDynamicShortcuts(Arrays.asList(shortcut));
}
Also used : ShortcutInfo(android.content.pm.ShortcutInfo) ShortcutManager(android.content.pm.ShortcutManager) Intent(android.content.Intent) RequiresApi(android.support.annotation.RequiresApi)

Example 23 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 24 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 25 with RequiresApi

use of android.support.annotation.RequiresApi in project focus-android by mozilla-mobile.

the class TextActionActivity method onCreate.

@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final SafeIntent intent = new SafeIntent(getIntent());
    final CharSequence searchTextCharSequence = intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
    final String searchText;
    if (searchTextCharSequence != null) {
        searchText = searchTextCharSequence.toString();
    } else {
        searchText = "";
    }
    final String searchUrl = UrlUtils.createSearchUrl(this, searchText);
    final Intent searchIntent = new Intent(this, MainActivity.class);
    searchIntent.setAction(Intent.ACTION_VIEW);
    searchIntent.putExtra(MainActivity.EXTRA_TEXT_SELECTION, true);
    searchIntent.setData(Uri.parse(searchUrl));
    startActivity(searchIntent);
    finish();
}
Also used : SafeIntent(mozilla.components.utils.SafeIntent) SafeIntent(mozilla.components.utils.SafeIntent) Intent(android.content.Intent) RequiresApi(android.support.annotation.RequiresApi)

Aggregations

RequiresApi (android.support.annotation.RequiresApi)217 Intent (android.content.Intent)30 Allocation (android.renderscript.Allocation)30 NotificationChannel (android.app.NotificationChannel)27 View (android.view.View)26 Bitmap (android.graphics.Bitmap)24 Paint (android.graphics.Paint)20 Point (android.graphics.Point)20 NotificationManager (android.app.NotificationManager)17 ViewGroup (android.view.ViewGroup)15 RecyclerView (android.support.v7.widget.RecyclerView)13 Uri (android.net.Uri)12 ViewTreeObserver (android.view.ViewTreeObserver)12 WindowInsets (android.view.WindowInsets)12 SuppressLint (android.annotation.SuppressLint)11 ActionBar (android.support.v7.app.ActionBar)11 Toolbar (android.support.v7.widget.Toolbar)11 TextView (android.widget.TextView)11 IOException (java.io.IOException)10 StatFs (android.os.StatFs)9