use of android.annotation.TargetApi in project SeriesGuide by UweTrottmann.
the class DataLiberationFragment method onActivityResult.
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK || !isAdded() || data == null) {
return;
}
if (requestCode == REQUEST_CODE_SHOWS_EXPORT_URI || requestCode == REQUEST_CODE_SHOWS_IMPORT_URI || requestCode == REQUEST_CODE_LISTS_EXPORT_URI || requestCode == REQUEST_CODE_LISTS_IMPORT_URI || requestCode == REQUEST_CODE_MOVIES_EXPORT_URI || requestCode == REQUEST_CODE_MOVIES_IMPORT_URI) {
Uri uri = data.getData();
// try to persist read and write permission for this URI across device reboots
try {
getContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
} catch (SecurityException e) {
Timber.e(e, "Could not persist r/w permission for backup file URI.");
}
if (requestCode == REQUEST_CODE_SHOWS_EXPORT_URI) {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_SHOWS_EXPORT_URI, uri);
} else if (requestCode == REQUEST_CODE_SHOWS_IMPORT_URI) {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_SHOWS_IMPORT_URI, uri);
} else if (requestCode == REQUEST_CODE_LISTS_EXPORT_URI) {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_LISTS_EXPORT_URI, uri);
} else if (requestCode == REQUEST_CODE_LISTS_IMPORT_URI) {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_LISTS_IMPORT_URI, uri);
} else if (requestCode == REQUEST_CODE_MOVIES_EXPORT_URI) {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_MOVIES_EXPORT_URI, uri);
} else {
BackupSettings.storeFileUri(getContext(), BackupSettings.KEY_MOVIES_IMPORT_URI, uri);
}
updateFileViews();
}
}
use of android.annotation.TargetApi in project SeriesGuide by UweTrottmann.
the class MoviesSearchActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movies_search);
setupNavDrawer();
int linkId = getIntent().getIntExtra(EXTRA_ID_LINK, MoviesDiscoverAdapter.DISCOVER_LINK_DEFAULT.id);
MoviesDiscoverLink link = MoviesDiscoverLink.fromId(linkId);
showSearchView = link == MoviesDiscoverAdapter.DISCOVER_LINK_DEFAULT;
if (savedInstanceState != null) {
showSearchView = savedInstanceState.getBoolean(STATE_SEARCH_VISIBLE, showSearchView);
}
ButterKnife.bind(this);
setupActionBar(link);
if (savedInstanceState == null) {
if (showSearchView) {
Utils.showSoftKeyboardOnSearchView(this, searchView);
}
getSupportFragmentManager().beginTransaction().add(R.id.containerMoviesSearchFragment, MoviesSearchFragment.newInstance(link)).commit();
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
postponeEnterTransition();
containerMoviesSearchFragment.post(new Runnable() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void run() {
// allow the adapter to repopulate during the next layout pass
// before starting the transition animation
startPostponedEnterTransition();
}
});
}
}
}
use of android.annotation.TargetApi in project Signal-Android by WhisperSystems.
the class AttachmentTypeSelector method animateWindowOutCircular.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateWindowOutCircular(@Nullable View anchor, @NonNull View contentView) {
Pair<Integer, Integer> coordinates = getClickOrigin(anchor, contentView);
Animator animator = ViewAnimationUtils.createCircularReveal(getContentView(), coordinates.first, coordinates.second, Math.max(getContentView().getWidth(), getContentView().getHeight()), 0);
animator.setDuration(ANIMATION_DURATION);
animator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
AttachmentTypeSelector.super.dismiss();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animator.start();
}
use of android.annotation.TargetApi in project lottie-android by airbnb.
the class MergePathsContent method opFirstPathWithRest.
@TargetApi(Build.VERSION_CODES.KITKAT)
private void opFirstPathWithRest(Path.Op op) {
remainderPath.reset();
firstPath.reset();
for (int i = pathContents.size() - 1; i >= 1; i--) {
PathContent content = pathContents.get(i);
if (content instanceof ContentGroup) {
List<PathContent> pathList = ((ContentGroup) content).getPathList();
for (int j = pathList.size() - 1; j >= 0; j--) {
Path path = pathList.get(j).getPath();
path.transform(((ContentGroup) content).getTransformationMatrix());
this.remainderPath.addPath(path);
}
} else {
remainderPath.addPath(content.getPath());
}
}
PathContent lastContent = pathContents.get(0);
if (lastContent instanceof ContentGroup) {
List<PathContent> pathList = ((ContentGroup) lastContent).getPathList();
for (int j = 0; j < pathList.size(); j++) {
Path path = pathList.get(j).getPath();
path.transform(((ContentGroup) lastContent).getTransformationMatrix());
this.firstPath.addPath(path);
}
} else {
firstPath.set(lastContent.getPath());
}
path.op(firstPath, remainderPath, op);
}
use of android.annotation.TargetApi in project Carbon by ZieIony.
the class RippleDrawableFroyo method getOutline.
/**
* Populates <code>outline</code> with the first available layer outline,
* excluding the mask layer.
*
* @param outline Outline in which to place the first available layer outline
*/
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(@NonNull Outline outline) {
final LayerState state = mLayerState;
final ChildDrawable[] children = state.mChildren;
final int N = state.mNum;
for (int i = 0; i < N; i++) {
if (children[i].mId != R.id.carbon_mask) {
children[i].mDrawable.getOutline(outline);
if (!outline.isEmpty())
return;
}
}
}
Aggregations