Search in sources :

Example 91 with RequiresApi

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);
            }
        }
    });
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) RequiresApi(android.support.annotation.RequiresApi)

Example 92 with RequiresApi

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);
    }
}
Also used : NotificationChannel(android.app.NotificationChannel) RequiresApi(android.support.annotation.RequiresApi)

Example 93 with RequiresApi

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;
}
Also used : ValueAnimator(android.animation.ValueAnimator) RequiresApi(android.support.annotation.RequiresApi)

Example 94 with RequiresApi

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;
}
Also used : JobScheduler(android.app.job.JobScheduler) JobInfo(android.app.job.JobInfo) RequiresApi(android.support.annotation.RequiresApi)

Example 95 with RequiresApi

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());
    }
}
Also used : JobScheduler(android.app.job.JobScheduler) JobInfo(android.app.job.JobInfo) ComponentName(android.content.ComponentName) 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