Search in sources :

Example 36 with RequiresApi

use of android.support.annotation.RequiresApi in project AndroidUtilLib by SiberiaDante.

the class SDStorageUtil method getSDCardSizeKB.

/**
 * 获取SD卡的完整空间大小,返回KB
 * 需要最小API18
 *
 * @return
 */
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static long getSDCardSizeKB() {
    if (isSDCardMounted()) {
        StatFs fs = new StatFs(getSDCardBaseDir());
        long count = fs.getBlockCountLong();
        long size = fs.getBlockSizeLong();
        return count * size / 1024;
    }
    return 0;
}
Also used : StatFs(android.os.StatFs) RequiresApi(android.support.annotation.RequiresApi)

Example 37 with RequiresApi

use of android.support.annotation.RequiresApi in project AndroidUtilLib by SiberiaDante.

the class SDStorageUtil method getSDCardFreeSizeMB.

/**
 * 获取SD卡的剩余空间大小
 *
 * @return MB
 */
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static long getSDCardFreeSizeMB() {
    if (isSDCardMounted()) {
        StatFs fs = new StatFs(getSDCardBaseDir());
        long count = fs.getFreeBlocksLong();
        long size = fs.getBlockSizeLong();
        return count * size / 1024 / 1024;
    }
    return 0;
}
Also used : StatFs(android.os.StatFs) RequiresApi(android.support.annotation.RequiresApi)

Example 38 with RequiresApi

use of android.support.annotation.RequiresApi in project AndroidUtilLib by SiberiaDante.

the class SDStorageUtil method getSDCardSizeMB.

/**
 * 获取SD卡的完整空间大小,返回MB
 * 需要最小API18
 *
 * @return
 */
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static long getSDCardSizeMB() {
    if (isSDCardMounted()) {
        StatFs fs = new StatFs(getSDCardBaseDir());
        long count = fs.getBlockCountLong();
        long size = fs.getBlockSizeLong();
        return count * size / 1024 / 1024;
    }
    return 0;
}
Also used : StatFs(android.os.StatFs) RequiresApi(android.support.annotation.RequiresApi)

Example 39 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)

Example 40 with RequiresApi

use of android.support.annotation.RequiresApi in project UniPool by divya21raj.

the class SentRequestsTEA method onBindViewHolder.

// Replace the contents of a view (invoked by the layout manager)
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onBindViewHolder(MyHolder holder, int position) {
    TripEntry tripEntry = list.get(position);
    UtilityMethods.fillTripEntryHolder(holder, tripEntry);
    holder.cardArrow.setOnClickListener(v -> {
        if (holder.tripEntryExpand.isExpanded()) {
            holder.tripEntryExpand.collapse();
            holder.cardArrow.setImageResource(R.drawable.ic_arrow_left_24px);
        } else {
            holder.tripEntryExpand.expand();
            holder.cardArrow.setImageResource(R.drawable.ic_arrow_drop_down_circle_24px);
        }
    });
    holder.requestButton.setVisibility(View.INVISIBLE);
}
Also used : TripEntry(garbagecollectors.com.unipool.models.TripEntry) 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