android.os.Build.VERSION Java Examples

The following examples show how to use android.os.Build.VERSION. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X8MainPowerView.java    From FimiX8-RE with MIT License 7 votes vote down vote up
@SuppressLint({"WrongConstant"})
public void onDraw(Canvas canvas) {
    float src;
    super.onDraw(canvas);
    if (VERSION.SDK_INT <= 19) {
        this.mPaint.setColor(Color.argb(1, 0, 0, 0));
    }
    canvas.saveLayer(0.0f, 0.0f, (float) getWidth(), (float) getHeight(), null, 31);
    Rect dst = new Rect();
    dst.left = 0;
    dst.top = 0;
    dst.right = getWidth();
    dst.bottom = getHeight();
    canvas.drawBitmap(this.mBitmap, null, dst, null);
    this.mPaint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    if (this.percent == 0) {
        src = 1.0f;
    } else {
        src = (100.0f - (((((float) this.percent) / 100.0f) * 85.0f) + 15.0f)) / 100.0f;
    }
    canvas.drawRect(new Rect((int) (((float) getWidth()) - (((float) getWidth()) * src)), 0, getWidth(), getHeight()), this.mPaint);
    this.mPaint.setXfermode(null);
}
 
Example #2
Source File: ActivityUtils.java    From Android-utils with Apache License 2.0 6 votes vote down vote up
public void launch(@NonNull Fragment f, int requestCode) {
    Activity a = f.getActivity();
    Intent i = getIntent(a);
    if (options == null && sharedElements != null) {
        options = getOptionsBundle(a, sharedElements);
    }
    if (options != null && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        f.startActivityForResult(i, requestCode, options);
    } else {
        f.startActivityForResult(i, requestCode);
    }
    if (enterAnim != 0 && exitAnim != 0 && a != null) {
        a.overridePendingTransition(enterAnim, exitAnim);
    }
    if (direction != 0) {
        overridePendingTransition(a, direction);
    }
}
 
Example #3
Source File: SegmentedButtonGroup.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
/**
 * Set the radius of this button group
 *
 * @param radius value of new corner radius, in pixels
 */
public void setRadius(final int radius)
{
    this.radius = radius;

    // Update radius for each button
    for (SegmentedButton button : buttons)
    {
        button.setBackgroundRadius(radius);
        button.setupBackgroundClipPath();

        button.invalidate();
    }

    // Update border for new radius
    GradientDrawable borderDrawable = (GradientDrawable)borderView.getBackground();
    if (borderDrawable != null)
        borderDrawable.setCornerRadius(radius - borderWidth / 2.0f);

    // Invalidate shadow outline so that it will be updated to follow the new radius
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP)
        invalidateOutline();
}
 
Example #4
Source File: SegmentedButton.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
/**
 * Create a bitmap from a specified vector drawable
 *
 * @param vectorDrawable vector drawable to convert to a bitmap
 */
public static Bitmap getBitmapFromVectorDrawable(Drawable vectorDrawable)
{
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
    {
        vectorDrawable = (DrawableCompat.wrap(vectorDrawable)).mutate();
    }

    Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
        vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    vectorDrawable.draw(canvas);

    return bitmap;
}
 
Example #5
Source File: TextureRenderView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@TargetApi(16)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp != null) {
        if (VERSION.SDK_INT < 16 || !(mp instanceof ISurfaceTextureHolder)) {
            mp.setSurface(openSurface());
            return;
        }
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        this.mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);
        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            this.mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(this.mSurfaceTexture);
        }
    }
}
 
Example #6
Source File: Compat.java    From giffun with Apache License 2.0 6 votes vote down vote up
public static void postOnAnimation(View view, Runnable runnable) {
    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        postOnAnimationJellyBean(view, runnable);
    } else {
        view.postDelayed(runnable, SIXTY_FPS_INTERVAL);
    }
}
 
Example #7
Source File: CameraView.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private Rect getCroppedRect(Size cameraPreviewSize, Rect visibleRect, int rotation) {
  final int previewWidth  = cameraPreviewSize.width;
  final int previewHeight = cameraPreviewSize.height;

  if (rotation % 180 > 0) rotateRect(visibleRect);

  float scale = (float) previewWidth / visibleRect.width();
  if (visibleRect.height() * scale > previewHeight) {
    scale = (float) previewHeight / visibleRect.height();
  }
  final float newWidth  = visibleRect.width()  * scale;
  final float newHeight = visibleRect.height() * scale;
  final float centerX   = (VERSION.SDK_INT < 14 || isTroublemaker()) ? previewWidth - newWidth / 2 : previewWidth / 2;
  final float centerY   = previewHeight / 2;

  visibleRect.set((int) (centerX - newWidth  / 2),
                  (int) (centerY - newHeight / 2),
                  (int) (centerX + newWidth  / 2),
                  (int) (centerY + newHeight / 2));

  if (rotation % 180 > 0) rotateRect(visibleRect);
  return visibleRect;
}
 
Example #8
Source File: FimiMediaCodecInfo.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@TargetApi(16)
public void dumpProfileLevels(String mimeType) {
    if (VERSION.SDK_INT >= 16) {
        try {
            CodecCapabilities caps = this.mCodecInfo.getCapabilitiesForType(mimeType);
            int maxProfile = 0;
            int maxLevel = 0;
            if (!(caps == null || caps.profileLevels == null)) {
                for (CodecProfileLevel profileLevel : caps.profileLevels) {
                    if (profileLevel != null) {
                        maxProfile = Math.max(maxProfile, profileLevel.profile);
                        maxLevel = Math.max(maxLevel, profileLevel.level);
                    }
                }
            }
            Log.i(TAG, String.format(Locale.US, "%s", new Object[]{getProfileLevelName(maxProfile, maxLevel)}));
        } catch (Throwable th) {
            Log.i(TAG, "profile-level: exception");
        }
    }
}
 
Example #9
Source File: Util.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static boolean isLowMemory(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

  return (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) ||
         activityManager.getLargeMemoryClass() <= 64;
}
 
Example #10
Source File: ContactPhotoLocalUriFetcher.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected InputStream loadResource(Uri uri, ContentResolver contentResolver)
    throws FileNotFoundException
{
  if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
    return ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri, true);
  } else {
    return ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri);
  }
}
 
Example #11
Source File: DownloadApkService.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onSuccess(Object responseObj) {
    Uri data;
    DownloadApkService.this.handler.sendEmptyMessage(1);
    Toast.makeText(DownloadApkService.this, R.string.fimi_sdk_apk_down_success, 0).show();
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.setFlags(NTLMConstants.FLAG_UNIDENTIFIED_11);
    if (VERSION.SDK_INT >= 24) {
        data = FileProvider.getUriForFile(DownloadApkService.this, DownloadApkService.this.getPackageName() + ".fileprovider", new File(DownloadApkService.this.path));
        intent.addFlags(1);
    } else {
        data = Uri.fromFile(new File(DownloadApkService.this.path));
    }
    intent.setDataAndType(data, "application/vnd.android.package-archive");
    DownloadApkService.this.startActivity(intent);
    DownloadApkService.this.notificationManager.cancel(DownloadApkService.NOTIFACTION_ID);
    DownloadApkService.isDownApking = false;
    DownloadApkService.this.stopSelf();
}
 
Example #12
Source File: FimiMediaPlayer.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@TargetApi(13)
public void setDataSource(FileDescriptor fd) throws IOException, IllegalArgumentException, IllegalStateException {
    if (VERSION.SDK_INT < 12) {
        try {
            Field f = fd.getClass().getDeclaredField("descriptor");
            f.setAccessible(true);
            _setDataSourceFd(f.getInt(fd));
            return;
        } catch (NoSuchFieldException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e2) {
            throw new RuntimeException(e2);
        }
    }
    ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
    try {
        _setDataSourceFd(pfd.getFd());
    } finally {
        pfd.close();
    }
}
 
Example #13
Source File: AnimationsContainer.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public FramesSequenceAnimation(ImageView imageView, int[] frames, int fps) {
    this.mFrames = frames;
    this.mIndex = -1;
    this.mSoftReferenceImageView = new SoftReference(imageView);
    this.mShouldRun = false;
    this.mIsRunning = false;
    this.mDelayMillis = 100;
    imageView.setImageResource(this.mFrames[0]);
    if (VERSION.SDK_INT >= 11) {
        Bitmap bmp = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
        this.mBitmap = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
        this.mBitmapOptions = new Options();
        this.mBitmapOptions.inBitmap = this.mBitmap;
        this.mBitmapOptions.inMutable = true;
        this.mBitmapOptions.inSampleSize = 1;
        this.mBitmapOptions.inPreferredConfig = Config.RGB_565;
    }
}
 
Example #14
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
    if (VERSION.SDK_INT >= 19) {
        if (VERSION.SDK_INT >= 21) {
            activity.getWindow().addFlags(Integer.MIN_VALUE);
            activity.getWindow().clearFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
            activity.getWindow().setStatusBarColor(0);
        } else {
            activity.getWindow().addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        }
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        if (!((contentLayout instanceof LinearLayout) || contentLayout.getChildAt(1) == null)) {
            contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
        }
        setDrawerLayoutProperty(drawerLayout, contentLayout);
    }
}
 
Example #15
Source File: GglMapLocationManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onLocationChanged(Location location) {
    startMoveLocationAndMap(location);
    float verticalAccuracyMeter = 0.0f;
    if (VERSION.SDK_INT >= 26) {
        verticalAccuracyMeter = location.getVerticalAccuracyMeters();
    }
    X8PressureGpsInfo.getInstance().setmLongitude(location.getLongitude());
    X8PressureGpsInfo.getInstance().setmLatitude(location.getLatitude());
    X8PressureGpsInfo.getInstance().setmAltitude(location.getAltitude());
    X8PressureGpsInfo.getInstance().setmHorizontalAccuracyMeters(location.getAccuracy());
    X8PressureGpsInfo.getInstance().setmVerticalAccuracyMeters(verticalAccuracyMeter);
    X8PressureGpsInfo.getInstance().setmSpeed(location.getSpeed());
    X8PressureGpsInfo.getInstance().setmBearing(location.getBearing());
    X8PressureGpsInfo.getInstance().setHasLocation(true);
    this.accuracy = location.getAccuracy();
    getCityThread(location);
}
 
Example #16
Source File: LanguageUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@RequiresApi(api = 24)
public static void changeAppLanguage(Context context, Locale setLocale) {
    Resources resources = context.getApplicationContext().getResources();
    DisplayMetrics dm = resources.getDisplayMetrics();
    Configuration config = resources.getConfiguration();
    Locale locale = getLocaleByLanguage(setLocale);
    config.locale = locale;
    if (VERSION.SDK_INT >= 24) {
        LocaleList localeList = new LocaleList(new Locale[]{locale});
        LocaleList.setDefault(localeList);
        config.setLocales(localeList);
        context.getApplicationContext().createConfigurationContext(config);
        Locale.setDefault(locale);
    }
    resources.updateConfiguration(config, dm);
}
 
Example #17
Source File: ActivityUtils.java    From Android-utils with Apache License 2.0 6 votes vote down vote up
public void launch(@NonNull Activity activity, int requestCode) {
    Intent i = getIntent(activity);
    if (options == null && sharedElements != null) {
        options = getOptionsBundle(activity, sharedElements);
    }
    if (options != null && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        activity.startActivityForResult(i, requestCode, options);
    } else {
        activity.startActivityForResult(i, requestCode);
    }
    if (enterAnim != 0 && exitAnim != 0) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
    if (direction != 0) {
        overridePendingTransition(activity, direction);
    }
}
 
Example #18
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static void setColor(Activity activity, @ColorInt int color, int statusBarAlpha) {
    if (VERSION.SDK_INT >= 21) {
        activity.getWindow().addFlags(Integer.MIN_VALUE);
        activity.getWindow().clearFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        activity.getWindow().setStatusBarColor(calculateStatusColor(color, statusBarAlpha));
    } else if (VERSION.SDK_INT >= 19) {
        activity.getWindow().addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
        int count = decorView.getChildCount();
        if (count <= 0 || !(decorView.getChildAt(count - 1) instanceof StatusBarView)) {
            decorView.addView(createStatusBarView(activity, color, statusBarAlpha));
        } else {
            decorView.getChildAt(count - 1).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
        }
        setRootView(activity);
    }
}
 
Example #19
Source File: StickyListHeadersListView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void dispatchDraw(Canvas canvas) {
    if (VERSION.SDK_INT < 8) {
        scrollChanged(getFirstVisiblePosition());
    }
    positionSelectorRect();
    if (!this.mAreHeadersSticky || this.mHeader == null) {
        super.dispatchDraw(canvas);
        return;
    }
    if (!this.mDrawingListUnderStickyHeader) {
        this.mClippingRect.set(0, this.mHeaderBottomPosition, getWidth(), getHeight());
        canvas.save();
        canvas.clipRect(this.mClippingRect);
    }
    super.dispatchDraw(canvas);
    if (!this.mDrawingListUnderStickyHeader) {
        canvas.restore();
    }
    drawStickyHeader(canvas);
}
 
Example #20
Source File: FimiMediaCodecInfo.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@TargetApi(16)
public void dumpProfileLevels(String mimeType) {
    if (VERSION.SDK_INT >= 16) {
        try {
            CodecCapabilities caps = this.mCodecInfo.getCapabilitiesForType(mimeType);
            int maxProfile = 0;
            int maxLevel = 0;
            if (!(caps == null || caps.profileLevels == null)) {
                for (CodecProfileLevel profileLevel : caps.profileLevels) {
                    if (profileLevel != null) {
                        maxProfile = Math.max(maxProfile, profileLevel.profile);
                        maxLevel = Math.max(maxLevel, profileLevel.level);
                    }
                }
            }
            Log.i(TAG, String.format(Locale.US, "%s", new Object[]{getProfileLevelName(maxProfile, maxLevel)}));
        } catch (Throwable th) {
            Log.i(TAG, "profile-level: exception");
        }
    }
}
 
Example #21
Source File: PermissionHelper.java    From Android-utils with Apache License 2.0 6 votes vote down vote up
/**
 * Map from permission code of {@link PermissionHelper} to string in {@link Manifest}.
 *
 * @param permission permission code
 * @return permission name
 */
public static String map(@Permission int permission) {
    switch (permission) {
        case Permission.STORAGE: return Manifest.permission.WRITE_EXTERNAL_STORAGE;
        case Permission.PHONE_STATE: return Manifest.permission.READ_PHONE_STATE;
        case Permission.LOCATION: return Manifest.permission.ACCESS_FINE_LOCATION;
        case Permission.MICROPHONE: return Manifest.permission.RECORD_AUDIO;
        case Permission.SMS: return Manifest.permission.SEND_SMS;
        case Permission.SENSORS:
            if (VERSION.SDK_INT >= VERSION_CODES.KITKAT_WATCH) {
                return Manifest.permission.BODY_SENSORS;
            }
            return "android.permission.BODY_SENSORS";
        case Permission.CONTACTS: return Manifest.permission.READ_CONTACTS;
        case Permission.CAMERA: return Manifest.permission.CAMERA;
        case Permission.CALENDAR: return Manifest.permission.READ_CALENDAR;
        default:throw new IllegalArgumentException("Unrecognized permission code " + permission);
    }
}
 
Example #22
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color, int statusBarAlpha) {
    if (VERSION.SDK_INT >= 19) {
        if (VERSION.SDK_INT >= 21) {
            activity.getWindow().addFlags(Integer.MIN_VALUE);
            activity.getWindow().clearFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
            activity.getWindow().setStatusBarColor(0);
        } else {
            activity.getWindow().addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        }
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        if (contentLayout.getChildCount() <= 0 || !(contentLayout.getChildAt(0) instanceof StatusBarView)) {
            contentLayout.addView(createStatusBarView(activity, color), 0);
        } else {
            contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
        }
        if (!((contentLayout instanceof LinearLayout) || contentLayout.getChildAt(1) == null)) {
            contentLayout.getChildAt(1).setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(), contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
        }
        setDrawerLayoutProperty(drawerLayout, contentLayout);
        addTranslucentView(activity, statusBarAlpha);
    }
}
 
Example #23
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@Deprecated
public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
    if (VERSION.SDK_INT >= 19) {
        activity.getWindow().addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        if (contentLayout.getChildCount() <= 0 || !(contentLayout.getChildAt(0) instanceof StatusBarView)) {
            contentLayout.addView(createStatusBarView(activity, color), 0);
        } else {
            contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, 0));
        }
        if (!((contentLayout instanceof LinearLayout) || contentLayout.getChildAt(1) == null)) {
            contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
        }
        setDrawerLayoutProperty(drawerLayout, contentLayout);
    }
}
 
Example #24
Source File: ActivityUtils.java    From Android-utils with Apache License 2.0 6 votes vote down vote up
public void launch(@NonNull Context context) {
    Intent i = getIntent(context);
    if (context instanceof Activity) {
        if (options == null && sharedElements != null) {
            options = getOptionsBundle((Activity) context, sharedElements);
        }
        if (options != null && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
            context.startActivity(i, options);
        } else {
            context.startActivity(i);
        }
        if (enterAnim != 0 && exitAnim != 0) {
            ((Activity) context).overridePendingTransition(enterAnim, exitAnim);
        }
        if (direction != 0) {
            overridePendingTransition((Activity) context, direction);
        }
    } else {
        context.startActivity(i);
    }
}
 
Example #25
Source File: FimiMediaPlayer.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@TargetApi(13)
public void setDataSource(FileDescriptor fd) throws IOException, IllegalArgumentException, IllegalStateException {
    if (VERSION.SDK_INT < 12) {
        try {
            Field f = fd.getClass().getDeclaredField("descriptor");
            f.setAccessible(true);
            _setDataSourceFd(f.getInt(fd));
            return;
        } catch (NoSuchFieldException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e2) {
            throw new RuntimeException(e2);
        }
    }
    ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
    try {
        _setDataSourceFd(pfd.getFd());
    } finally {
        pfd.close();
    }
}
 
Example #26
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
@Deprecated
public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
    if (VERSION.SDK_INT >= 19) {
        activity.getWindow().addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        contentLayout.setFitsSystemWindows(true);
        contentLayout.setClipToPadding(true);
        ((ViewGroup) drawerLayout.getChildAt(1)).setFitsSystemWindows(false);
        drawerLayout.setFitsSystemWindows(false);
    }
}
 
Example #27
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public static void setStatusBarColor(Activity activity, int colorId) {
    if (VERSION.SDK_INT >= 21) {
        Window window = activity.getWindow();
        window.addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9);
        window.getDecorView().setSystemUiVisibility(FimiAppContext.UI_HEIGHT);
    } else if (VERSION.SDK_INT >= 19) {
        transparencyBar(activity);
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(colorId);
    }
}
 
Example #28
Source File: WrapperView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (this.mHeader == null && this.mDivider != null) {
        if (VERSION.SDK_INT < 11) {
            canvas.clipRect(0, 0, getWidth(), this.mDividerHeight);
        }
        this.mDivider.draw(canvas);
    }
}
 
Example #29
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 5 votes vote down vote up
@Deprecated
public static void setColorDiff(Activity activity, @ColorInt int color) {
    if (VERSION.SDK_INT >= 19) {
        transparentStatusBar(activity);
        ViewGroup contentView = (ViewGroup) activity.findViewById(16908290);
        if (contentView.getChildCount() > 1) {
            contentView.getChildAt(1).setBackgroundColor(color);
        } else {
            contentView.addView(createStatusBarView(activity, color));
        }
        setRootView(activity);
    }
}
 
Example #30
Source File: AesCbcWithIntegrity.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private static void applyOpenSSLFix() throws SecurityException {
    if (VERSION.SDK_INT >= 16 && VERSION.SDK_INT <= 18) {
        try {
            Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto").getMethod("RAND_seed", new Class[]{byte[].class}).invoke(null, new Object[]{generateSeed()});
            int bytesRead = ((Integer) Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto").getMethod("RAND_load_file", new Class[]{String.class, Long.TYPE}).invoke(null, new Object[]{"/dev/urandom", Integer.valueOf(1024)})).intValue();
            if (bytesRead != 1024) {
                throw new IOException("Unexpected number of bytes read from Linux PRNG: " + bytesRead);
            }
        } catch (Exception e) {
            throw new SecurityException("Failed to seed OpenSSL PRNG", e);
        }
    }
}