use of android.support.annotation.RequiresApi in project HumaneApp by Ganesh1010.
the class NeedReceivalCard method onBindViewHolder.
@RequiresApi(api = Build.VERSION_CODES.ECLAIR_MR1)
@Override
public void onBindViewHolder(final NeedCardHolder holder, int position) {
/*DonationDetails items = (DonationDetails) donatedCardDetails.get(position);
holder.itemName.setText(items.getItemName());
holder.donorName.setText(items.getDonorName());
holder.quantity.setText(items.getQuantity());
*/
DonationDetails items = (DonationDetails) donatedCardDetails.get(position);
holder.donorName.setText(items.getUser());
Toast.makeText(context, "donor Name" + items.getUser(), Toast.LENGTH_LONG).show();
donatedItem = items.getDonatedItemDetails();
needId = donatedItem.getDonated_item_id();
needQuantity = donatedItem.getQuantity();
needItemDetails = new NeedItemDetails(needId, needQuantity);
needItems = new ArrayList<>();
needItems.add(needItemDetails);
Toast.makeText(context, "size" + needItems.size(), Toast.LENGTH_LONG).show();
// needItemDetails.setNeed_item_id(needId);
//needItemDetails.setQuantity(needQuantity);
///needItemDetails = new DonatedItemDetails(2,100);
//needItems = new ArrayList();
// needItems.add(needItemDetails);
// holder.itemName.setText(donatedItem.getDonated_item_id());
// holder.quantity.setText(donatedItem.getQuantity());
holder.itemName.setText("1");
holder.quantity.setText("123");
// Toast.makeText(context,"Quantity"+donatedItem.getQuantity(),Toast.LENGTH_LONG).show();
holder.donatedItemDetails.setAdapter(adapter);
//Toast.makeText(context,"after adapter",Toast.LENGTH_LONG).show();
holder.donatedItemDetails.setLayoutManager(new LinearLayoutManager(context));
// Toast.makeText(context,"donor NAme"+items.getItemName(),Toast.LENGTH_LONG).show();*/
holder.listImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(context," list image",Toast.LENGTH_LONG).show();
if (holder.layout.getVisibility() == View.GONE) {
holder.layout.setVisibility(View.VISIBLE);
holder.cardListHeading.setVisibility(View.VISIBLE);
} else {
holder.layout.setVisibility(View.GONE);
holder.cardListHeading.setVisibility(View.GONE);
}
}
});
}
use of android.support.annotation.RequiresApi in project android-UniversalMusicPlayer by googlesamples.
the class MediaNotificationManager method createNotificationChannel.
/**
* Creates Notification Channel. This is required in Android O+ to display notifications.
*/
@RequiresApi(Build.VERSION_CODES.O)
private void createNotificationChannel() {
if (mNotificationManager.getNotificationChannel(CHANNEL_ID) == null) {
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, mService.getString(R.string.notification_channel), NotificationManager.IMPORTANCE_LOW);
notificationChannel.setDescription(mService.getString(R.string.notification_channel_description));
mNotificationManager.createNotificationChannel(notificationChannel);
}
}
use of android.support.annotation.RequiresApi in project WilliamChart by diogobernardino.
the class ChartEntry method animateColor.
/**
* Animate entry color.
*
* @param color0 Start color resource.
* @param color1 End color resource.
* @return {@link ValueAnimator} responsible to handle animation.
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public ValueAnimator animateColor(int color0, int color1) {
final ValueAnimator animator = ValueAnimator.ofArgb(color0, color1);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mColor = (int) animation.getAnimatedValue();
}
});
mColor = color0;
return animator;
}
use of android.support.annotation.RequiresApi in project android by nextcloud.
the class FilesSyncHelper method isContentObserverJobScheduled.
@RequiresApi(api = Build.VERSION_CODES.N)
public static boolean isContentObserverJobScheduled() {
JobScheduler js = MainApp.getAppContext().getSystemService(JobScheduler.class);
List<JobInfo> jobs = js.getAllPendingJobs();
if (jobs == null || jobs.size() == 0) {
return false;
}
for (int i = 0; i < jobs.size(); i++) {
if (jobs.get(i).getId() == ContentSyncJobId) {
return true;
}
}
return false;
}
use of android.support.annotation.RequiresApi in project android by nextcloud.
the class FilesSyncHelper method scheduleJobOnN.
@RequiresApi(api = Build.VERSION_CODES.N)
private static void scheduleJobOnN(boolean hasImageFolders, boolean hasVideoFolders, boolean force) {
JobScheduler jobScheduler = MainApp.getAppContext().getSystemService(JobScheduler.class);
if ((hasImageFolders || hasVideoFolders) && (!isContentObserverJobScheduled() || force)) {
JobInfo.Builder builder = new JobInfo.Builder(ContentSyncJobId, new ComponentName(MainApp.getAppContext(), NContentObserverJob.class.getName()));
builder.addTriggerContentUri(new JobInfo.TriggerContentUri(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS));
builder.addTriggerContentUri(new JobInfo.TriggerContentUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS));
builder.addTriggerContentUri(new JobInfo.TriggerContentUri(android.provider.MediaStore.Video.Media.INTERNAL_CONTENT_URI, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS));
builder.addTriggerContentUri(new JobInfo.TriggerContentUri(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS));
builder.setTriggerContentMaxDelay(1500);
jobScheduler.schedule(builder.build());
}
}
Aggregations