Java Code Examples for android.os.Build.VERSION

The following are top voted examples for showing how to use android.os.Build.VERSION. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: letv   File: NotificationCompat.java   Source Code and License 6 votes vote down vote up
public Builder extend(Builder builder) {
    if (VERSION.SDK_INT >= 21) {
        Bundle carExtensions = new Bundle();
        if (this.mLargeIcon != null) {
            carExtensions.putParcelable(EXTRA_LARGE_ICON, this.mLargeIcon);
        }
        if (this.mColor != 0) {
            carExtensions.putInt(EXTRA_COLOR, this.mColor);
        }
        if (this.mUnreadConversation != null) {
            carExtensions.putBundle(EXTRA_CONVERSATION, NotificationCompat.IMPL.getBundleForUnreadConversation(this.mUnreadConversation));
        }
        builder.getExtras().putBundle(EXTRA_CAR_EXTENDER, carExtensions);
    }
    return builder;
}
 
Example 2
Project: GitHub   File: RequestManagerRetriever.java   Source Code and License 6 votes vote down vote up
private void findAllFragmentsWithViews(
    android.app.FragmentManager fragmentManager, ArrayMap<View, android.app.Fragment> result) {
  int index = 0;
  while (true) {
    tempBundle.putInt(FRAGMENT_INDEX_KEY, index++);
    android.app.Fragment fragment = null;
    try {
      fragment = fragmentManager.getFragment(tempBundle, FRAGMENT_MANAGER_GET_FRAGMENT_KEY);
    } catch (Exception e) {
      // This generates log spam from FragmentManager anyway.
    }
    if (fragment == null) {
      break;
    }
    if (fragment.getView() != null) {
      result.put(fragment.getView(), fragment);
      if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
        findAllFragmentsWithViews(fragment.getChildFragmentManager(), result);
      }
    }
  }
}
 
Example 3
Project: boohee_v5.6   File: SystemBarHelper.java   Source Code and License 6 votes vote down vote up
public static void tintStatusBar(Window window, @ColorInt int statusBarColor, @FloatRange
        (from = 0.0d, to = 1.0d) float alpha) {
    if (VERSION.SDK_INT >= 19) {
        if (VERSION.SDK_INT >= 21) {
            window.clearFlags(67108864);
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(0);
        } else {
            window.addFlags(67108864);
        }
        ViewGroup decorView = (ViewGroup) window.getDecorView();
        View rootView = ((ViewGroup) window.getDecorView().findViewById(16908290)).getChildAt
                (0);
        if (rootView != null) {
            ViewCompat.setFitsSystemWindows(rootView, true);
        }
        setStatusBar(decorView, statusBarColor, true);
        setTranslucentView(decorView, alpha);
    }
}
 
Example 4
Project: boohee_v5.6   File: MQConversationActivity.java   Source Code and License 6 votes vote down vote up
public void onTextChanged(CharSequence s, int start, int before, int count) {
    if (TextUtils.isEmpty(s)) {
        if (VERSION.SDK_INT >= 21) {
            MQConversationActivity.this.mSendTextBtn.setElevation(0.0f);
        }
        MQConversationActivity.this.mSendTextBtn.setImageResource(R.drawable
                .mq_ic_send_icon_grey);
        MQConversationActivity.this.mSendTextBtn.setBackgroundResource(R.drawable
                .mq_shape_send_back_normal);
        return;
    }
    MQConversationActivity.this.inputting(s.toString());
    if (VERSION.SDK_INT >= 21) {
        MQConversationActivity.this.mSendTextBtn.setElevation((float) MQUtils.dip2px
                (MQConversationActivity.this, IPhotoView.DEFAULT_MAX_SCALE));
    }
    MQConversationActivity.this.mSendTextBtn.setImageResource(R.drawable
            .mq_ic_send_icon_white);
    MQConversationActivity.this.mSendTextBtn.setBackgroundResource(R.drawable
            .mq_shape_send_back_pressed);
}
 
Example 5
Project: boohee_v5.6   File: DayPickerView.java   Source Code and License 6 votes vote down vote up
private CalendarDay findAccessibilityFocus() {
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child instanceof MonthView) {
            CalendarDay focus = ((MonthView) child).getAccessibilityFocus();
            if (focus != null) {
                if (VERSION.SDK_INT != 17) {
                    return focus;
                }
                ((MonthView) child).clearAccessibilityFocus();
                return focus;
            }
        }
    }
    return null;
}
 
Example 6
Project: boohee_v5.6   File: CheckView.java   Source Code and License 6 votes vote down vote up
public void attachToWindow() {
    if (getParent() == null) {
        this.mLp = new LayoutParams();
        if (VERSION.SDK_INT >= 19) {
            this.mLp.type = 2005;
        } else {
            this.mLp.type = 2002;
        }
        this.mLp.format = 1;
        this.mLp.flags = 40;
        this.mLp.gravity = 8388659;
        this.mLp.width = -1;
        this.mLp.height = -2;
        this.mLp.x = 0;
        this.mLp.y = 0;
        this.mWindowManager.addView(this, this.mLp);
    }
}
 
Example 7
Project: boohee_v5.6   File: SwitchCompat.java   Source Code and License 6 votes vote down vote up
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(ACCESSIBILITY_EVENT_CLASS_NAME);
        CharSequence switchText = isChecked() ? this.mTextOn : this.mTextOff;
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
                return;
            }
            StringBuilder newText = new StringBuilder();
            newText.append(oldText).append(' ').append(switchText);
            info.setText(newText);
        }
    }
}
 
Example 8
Project: homunculus   File: Widget.java   Source Code and License 6 votes vote down vote up
/**
 * Generate a value suitable for use in {@link android.view.View#setId(int)}.
 * This value will not collide with ID values generated at build time by aapt for R.id.
 *
 * @return a generated ID value
 */
public static int generateViewId() {
    if (VERSION.SDK_INT >= 17) {
        return android.view.View.generateViewId();
    } else {
        for (; ; ) {
            final int result = sNextGeneratedId.get();
            // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
            int newValue = result + 1;
            if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
            if (sNextGeneratedId.compareAndSet(result, newValue)) {
                return result;
            }
        }
    }
}
 
Example 9
Project: letv   File: ViewPropertyAnimatorCompat.java   Source Code and License 6 votes vote down vote up
public void onAnimationEnd(View view) {
    if (this.mVpa.mOldLayerType >= 0) {
        ViewCompat.setLayerType(view, this.mVpa.mOldLayerType, null);
        this.mVpa.mOldLayerType = -1;
    }
    if (VERSION.SDK_INT >= 16 || !this.mAnimEndCalled) {
        if (this.mVpa.mEndAction != null) {
            Runnable endAction = this.mVpa.mEndAction;
            this.mVpa.mEndAction = null;
            endAction.run();
        }
        ViewPropertyAnimatorListener listenerTag = view.getTag(ViewPropertyAnimatorCompat.LISTENER_TAG_ID);
        ViewPropertyAnimatorListener listener = null;
        if (listenerTag instanceof ViewPropertyAnimatorListener) {
            listener = listenerTag;
        }
        if (listener != null) {
            listener.onAnimationEnd(view);
        }
        this.mAnimEndCalled = true;
    }
}
 
Example 10
Project: boohee_v5.6   File: f.java   Source Code and License 6 votes vote down vote up
public static synchronized String c(Context context) {
    String str;
    synchronized (f.class) {
        if (c != null) {
            str = c;
        } else {
            String string;
            try {
                string = Secure.getString(context.getContentResolver(), "android_id");
            } catch (Throwable th) {
                b.a(th);
                string = null;
            }
            c = d.b(string + (VERSION.SDK_INT > 8 ? Build.SERIAL : null));
            str = c;
        }
    }
    return str;
}
 
Example 11
Project: DroidPlugin   File: PackageParserApi21.java   Source Code and License 6 votes vote down vote up
private void initClasses() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    sPackageParserClass = Class.forName("android.content.pm.PackageParser");
    sActivityClass = Class.forName("android.content.pm.PackageParser$Activity");
    sServiceClass = Class.forName("android.content.pm.PackageParser$Service");
    sProviderClass = Class.forName("android.content.pm.PackageParser$Provider");
    sInstrumentationClass = Class.forName("android.content.pm.PackageParser$Instrumentation");
    sPermissionClass = Class.forName("android.content.pm.PackageParser$Permission");
    sPermissionGroupClass = Class.forName("android.content.pm.PackageParser$PermissionGroup");
    try {
        sArraySetClass = Class.forName("android.util.ArraySet");
    } catch (ClassNotFoundException e) {
    }

    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
        sPackageUserStateClass = Class.forName("android.content.pm.PackageUserState");
        mDefaultPackageUserState = sPackageUserStateClass.newInstance();
        mUserId = UserHandleCompat.getCallingUserId();
    }
}
 
Example 12
Project: PeSanKita-android   File: Util.java   Source Code and License 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.getMemoryClass() <= 64;
}
 
Example 13
Project: Cable-Android   File: TransferControlView.java   Source Code and License 6 votes vote down vote up
public TransferControlView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  inflate(context, R.layout.transfer_controls_view, this);

  final Drawable background = ContextCompat.getDrawable(context, R.drawable.transfer_controls_background);
  if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
    background.setColorFilter(0x66ffffff, Mode.MULTIPLY);
  }
  setLongClickable(false);
  ViewUtil.setBackground(this, background);
  setVisibility(GONE);

  this.progressWheel   = ViewUtil.findById(this, R.id.progress_wheel);
  this.downloadDetails = ViewUtil.findById(this, R.id.download_details);
  this.contractedWidth = getResources().getDimensionPixelSize(R.dimen.transfer_controls_contracted_width);
  this.expandedWidth   = getResources().getDimensionPixelSize(R.dimen.transfer_controls_expanded_width);
}
 
Example 14
Project: boohee_v5.6   File: HttpUtils.java   Source Code and License 6 votes vote down vote up
private static int a(Context context) {
    int i = -1;
    if (VERSION.SDK_INT >= 11) {
        Object property = System.getProperty("http.proxyPort");
        if (TextUtils.isEmpty(property)) {
            return i;
        }
        try {
            return Integer.parseInt(property);
        } catch (NumberFormatException e) {
            return i;
        }
    } else if (context == null) {
        return Proxy.getDefaultPort();
    } else {
        i = Proxy.getPort(context);
        if (i < 0) {
            return Proxy.getDefaultPort();
        }
        return i;
    }
}
 
Example 15
Project: boohee_v5.6   File: NotificationCompat.java   Source Code and License 6 votes vote down vote up
public Builder extend(Builder builder) {
    if (VERSION.SDK_INT >= 21) {
        Bundle carExtensions = new Bundle();
        if (this.mLargeIcon != null) {
            carExtensions.putParcelable(EXTRA_LARGE_ICON, this.mLargeIcon);
        }
        if (this.mColor != 0) {
            carExtensions.putInt(EXTRA_COLOR, this.mColor);
        }
        if (this.mUnreadConversation != null) {
            carExtensions.putBundle(EXTRA_CONVERSATION, NotificationCompat.IMPL.getBundleForUnreadConversation(this.mUnreadConversation));
        }
        builder.getExtras().putBundle(EXTRA_CAR_EXTENDER, carExtensions);
    }
    return builder;
}
 
Example 16
Project: letv   File: FlurryAgent.java   Source Code and License 6 votes vote down vote up
@Deprecated
public static void onEvent(String str, Map<String, String> map) {
    if (VERSION.SDK_INT < 10) {
        ib.b(a, "Device SDK Version older than 10");
    } else if (str == null) {
        ib.b(a, "String eventId passed to onEvent was null.");
    } else if (map == null) {
        ib.b(a, "Parameters Map passed to onEvent was null.");
    } else {
        try {
            fu.a().c(str, map);
        } catch (Throwable th) {
            ib.a(a, "", th);
        }
    }
}
 
Example 17
Project: letv   File: Util.java   Source Code and License 6 votes vote down vote up
public static Bundle composeHaboCgiReportParams(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9) {
    Bundle bundle = new Bundle();
    bundle.putString(Constants.PARAM_PLATFORM, "1");
    bundle.putString("result", str);
    bundle.putString("code", str2);
    bundle.putString("tmcost", str3);
    bundle.putString("rate", str4);
    bundle.putString("cmd", str5);
    bundle.putString("uin", str6);
    bundle.putString("appid", str7);
    bundle.putString("share_type", str8);
    bundle.putString("detail", str9);
    bundle.putString("os_ver", VERSION.RELEASE);
    bundle.putString("network", a.a(Global.getContext()));
    bundle.putString("apn", a.b(Global.getContext()));
    bundle.putString("model_name", Build.MODEL);
    bundle.putString("sdk_ver", Constants.SDK_VERSION);
    bundle.putString(ShareRequestParam.REQ_PARAM_PACKAGENAME, Global.getPackageName());
    bundle.putString("app_ver", getAppVersionName(Global.getContext(), Global.getPackageName()));
    return bundle;
}
 
Example 18
Project: boohee_v5.6   File: BitmapUtil.java   Source Code and License 6 votes vote down vote up
@SuppressLint({"NewApi"})
public static Bitmap takeScreenShot(Activity pActivity) {
    View view = pActivity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bitmap = view.getDrawingCache();
    Rect frame = new Rect();
    view.getWindowVisibleDisplayFrame(frame);
    int stautsHeight = frame.top;
    Point size = new Point();
    Display display = pActivity.getWindowManager().getDefaultDisplay();
    if (VERSION.SDK_INT < 13) {
        size.set(display.getWidth(), display.getHeight());
    } else {
        pActivity.getWindowManager().getDefaultDisplay().getSize(size);
    }
    return Bitmap.createBitmap(bitmap, 0, stautsHeight, size.x, size.y - stautsHeight);
}
 
Example 19
Project: Cable-Android   File: ViewUtil.java   Source Code and License 6 votes vote down vote up
public static float getX(final @NonNull View v) {
  if (VERSION.SDK_INT >= 11) {
    return ViewCompat.getX(v);
  } else {
    return ((LayoutParams)v.getLayoutParams()).leftMargin;
  }
}
 
Example 20
Project: boohee_v5.6   File: AppCompatDelegateImplV7.java   Source Code and License 6 votes vote down vote up
public View createView(View parent, String name, @NonNull Context context, @NonNull AttributeSet attrs) {
    boolean isPre21;
    boolean inheritContext;
    if (VERSION.SDK_INT < 21) {
        isPre21 = true;
    } else {
        isPre21 = false;
    }
    if (this.mAppCompatViewInflater == null) {
        this.mAppCompatViewInflater = new AppCompatViewInflater();
    }
    if (isPre21 && shouldInheritContext((ViewParent) parent)) {
        inheritContext = true;
    } else {
        inheritContext = false;
    }
    return this.mAppCompatViewInflater.createView(parent, name, context, attrs, inheritContext, isPre21, true, isPre21);
}
 
Example 21
Project: CXJPadProject   File: TouchImageView.java   Source Code and License 5 votes vote down vote up
@TargetApi(VERSION_CODES.JELLY_BEAN)
private void compatPostOnAnimation(Runnable runnable) {
    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        postOnAnimation(runnable);
    }
    else {
        postDelayed(runnable, 1000/60);
    }
}
 
Example 22
Project: letv   File: PreferenceStoreImpl.java   Source Code and License 5 votes vote down vote up
@TargetApi(9)
public boolean save(Editor editor) {
    if (VERSION.SDK_INT < 9) {
        return editor.commit();
    }
    editor.apply();
    return true;
}
 
Example 23
Project: boohee_v5.6   File: ResourcesCompat.java   Source Code and License 5 votes vote down vote up
@Nullable
public static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id, int density, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawableForDensity(res, id, density, theme);
    }
    if (VERSION.SDK_INT >= 15) {
        return ResourcesCompatIcsMr1.getDrawableForDensity(res, id, density);
    }
    return res.getDrawable(id);
}
 
Example 24
Project: letv   File: FlurryAgent.java   Source Code and License 5 votes vote down vote up
public static void setVersionName(String str) {
    if (VERSION.SDK_INT < 10) {
        ib.b(a, "Device SDK Version older than 10");
    } else if (str == null) {
        ib.b(a, "String versionName passed to setVersionName was null.");
    } else {
        je.a().a("VersionName", (Object) str);
    }
}
 
Example 25
Project: q-mail   File: MailService.java   Source Code and License 5 votes vote down vote up
private void startForegroundWithNotification(String content) {
    if (VERSION.SDK_INT >= VERSION_CODES.O)
        startForeground(FOREGROUND_SERVICE_NOTIFICATION_ID,
                new NotificationCompat.Builder(this, "sync")
                        .setTicker(content)
                        .setSmallIcon(R.drawable.icon)
                        .setColor(getResources().getColor(R.color.light_black))
                        .setContentTitle(content)
                        .setContentText(content)
                        .setWhen(System.currentTimeMillis())
                        .setCategory(NotificationCompat.CATEGORY_SERVICE)
                        .build());

}
 
Example 26
Project: BlueBorne   File: bluebourne.java   Source Code and License 5 votes vote down vote up
public static String getSecurityPatchDateString() {
    if (VERSION.SDK_INT >= 23) {
        return VERSION.SECURITY_PATCH;
    }
    Matcher matcher = Pattern.compile(DATE_PATTERN).matcher(SystemUtils.getSystemProp(SECURITY_PATCH));
    if (matcher.find()) {
        return matcher.group();
    }
    return null;
}
 
Example 27
Project: letv   File: MediaDescriptionCompat.java   Source Code and License 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    if (VERSION.SDK_INT < 21) {
        dest.writeString(this.mMediaId);
        TextUtils.writeToParcel(this.mTitle, dest, flags);
        TextUtils.writeToParcel(this.mSubtitle, dest, flags);
        TextUtils.writeToParcel(this.mDescription, dest, flags);
        dest.writeParcelable(this.mIcon, flags);
        dest.writeParcelable(this.mIconUri, flags);
        dest.writeBundle(this.mExtras);
        dest.writeParcelable(this.mMediaUri, flags);
        return;
    }
    MediaDescriptionCompatApi21.writeToParcel(getMediaDescription(), dest, flags);
}
 
Example 28
Project: letv   File: ActivityCompat.java   Source Code and License 5 votes vote down vote up
public static void finishAffinity(Activity activity) {
    if (VERSION.SDK_INT >= 16) {
        ActivityCompatJB.finishAffinity(activity);
    } else {
        activity.finish();
    }
}
 
Example 29
Project: CommentView   File: ViewUtils.java   Source Code and License 5 votes vote down vote up
public static void setViewBackground(View view, Drawable drawable) {
    if (view != null) {
        if (VERSION.SDK_INT < 16) {
            view.setBackgroundDrawable(drawable);
        } else {
            view.setBackground(drawable);
        }
    }
}
 
Example 30
Project: letv   File: ChannelDetailFragment.java   Source Code and License 5 votes vote down vote up
private void initFooterSearchView(ArrayList<String> arrayList) {
    try {
        this.mFootSearchView.setList(this.mChannelHomeBean.searchWords);
        if (this.mPullView != null && ((ExpandableListView) this.mPullView.getRefreshableView()).getFooterViewsCount() >= 1 && VERSION.SDK_INT >= 14) {
            ((ExpandableListView) this.mPullView.getRefreshableView()).removeFooterView(this.mFootSearchView);
        }
        ((ExpandableListView) this.mPullView.getRefreshableView()).addFooterView(this.mFootSearchView);
    } catch (Exception e) {
        this.mFootSearchView.setVisibility(8);
        e.printStackTrace();
    }
}
 
Example 31
Project: letv   File: MediaSessionCompat.java   Source Code and License 5 votes vote down vote up
public void setMetadata(MediaMetadataCompat metadata) {
    Bundle bundle = null;
    if (VERSION.SDK_INT >= 14 && metadata != null) {
        metadata = cloneMetadataIfNeeded(metadata);
    }
    synchronized (this.mLock) {
        this.mMetadata = metadata;
    }
    sendMetadata(metadata);
    if (!this.mIsActive) {
        return;
    }
    Object obj;
    if (VERSION.SDK_INT >= 19) {
        obj = this.mRccObj;
        if (metadata != null) {
            bundle = metadata.getBundle();
        }
        MediaSessionCompatApi19.setMetadata(obj, bundle, this.mState == null ? 0 : this.mState.getActions());
    } else if (VERSION.SDK_INT >= 14) {
        obj = this.mRccObj;
        if (metadata != null) {
            bundle = metadata.getBundle();
        }
        MediaSessionCompatApi14.setMetadata(obj, bundle);
    }
}
 
Example 32
Project: boohee_v5.6   File: DragScaleImageView.java   Source Code and License 5 votes vote down vote up
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    if (VERSION.SDK_INT >= 11 && this.oriLeft != 0) {
        setLeft(this.oriLeft);
        setRight(this.oriRight);
        setTop(this.oriTop);
        setBottom(this.oriBottom);
    }
}
 
Example 33
Project: boohee_v5.6   File: KPSwitchRootLayoutHandler.java   Source Code and License 5 votes vote down vote up
@TargetApi(16)
public void handleBeforeMeasure(int width, int height) {
    if (this.mIsTranslucentStatus && VERSION.SDK_INT >= 16 && this.mTargetRootView.getFitsSystemWindows()) {
        Rect rect = new Rect();
        this.mTargetRootView.getWindowVisibleDisplayFrame(rect);
        height = rect.bottom - rect.top;
    }
    Log.d(TAG, "onMeasure, width: " + width + " height: " + height);
    if (height >= 0) {
        if (this.mOldHeight < 0) {
            this.mOldHeight = height;
            return;
        }
        int offset = this.mOldHeight - height;
        if (offset == 0) {
            Log.d(TAG, "" + offset + " == 0 break;");
        } else if (Math.abs(offset) == this.mStatusBarHeight) {
            Log.w(TAG, String.format("offset just equal statusBar height %d", new Object[]{Integer.valueOf(offset)}));
        } else {
            this.mOldHeight = height;
            IPanelConflictLayout panel = getPanelLayout(this.mTargetRootView);
            if (panel == null) {
                Log.w(TAG, "can't find the valid panel conflict layout, give up!");
            } else if (offset > 0) {
                panel.handleHide();
            } else if (panel.isKeyboardShowing() && panel.isVisible()) {
                panel.handleShow();
            }
        }
    }
}
 
Example 34
Project: ultrasonic   File: ViewCompat.java   Source Code and License 5 votes vote down vote up
public static void postOnAnimation(View view, Runnable runnable) {
	if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
		SDK16.postOnAnimation(view, runnable);
	} else {
		view.postDelayed(runnable, 16);
	}
}
 
Example 35
Project: letv   File: BundleCompat.java   Source Code and License 5 votes vote down vote up
public static void putBinder(Bundle bundle, String key, IBinder binder) {
    if (VERSION.SDK_INT >= 18) {
        BundleCompatJellybeanMR2.putBinder(bundle, key, binder);
    } else {
        BundleCompatDonut.putBinder(bundle, key, binder);
    }
}
 
Example 36
Project: ultrasonic   File: PullToRefreshExpandableListView.java   Source Code and License 5 votes vote down vote up
@Override
protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
	final ExpandableListView lv;
	if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
		lv = new InternalExpandableListViewSDK9(context, attrs);
	} else {
		lv = new InternalExpandableListView(context, attrs);
	}

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 37
Project: SetupWizardLibCompat   File: Illustration.java   Source Code and License 5 votes vote down vote up
@Override
public void onDraw(Canvas canvas) {
    if (mBackground != null) {
        // Draw the background filling parts not covered by the illustration
        canvas.save();
        canvas.translate(0, mIllustrationBounds.height());
        // Scale the background so its size matches the foreground
        canvas.scale(mScale, mScale, 0, 0);
        if (VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN_MR1 &&
                shouldMirrorDrawable(mBackground, getLayoutDirection())) {
            // Flip the illustration for RTL layouts
            canvas.scale(-1, 1);
            canvas.translate(-mBackground.getBounds().width(), 0);
        }
        mBackground.draw(canvas);
        canvas.restore();
    }
    if (mIllustration != null) {
        canvas.save();
        if (VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN_MR1 &&
                shouldMirrorDrawable(mIllustration, getLayoutDirection())) {
            // Flip the illustration for RTL layouts
            canvas.scale(-1, 1);
            canvas.translate(-mIllustrationBounds.width(), 0);
        }
        // Draw the illustration
        mIllustration.draw(canvas);
        canvas.restore();
    }
    super.onDraw(canvas);
}
 
Example 38
Project: letv   File: l.java   Source Code and License 5 votes vote down vote up
public final void run() {
    int i = 0;
    try {
        long currentTimeMillis = System.currentTimeMillis() / 1000;
        long s = a.s();
        new StringBuilder(z[2]).append(currentTimeMillis).append(z[0]).append(s);
        z.b();
        if (-1 == s || Math.abs(currentTimeMillis - s) > this.a) {
            List t = cn.jpush.android.util.a.t(this.b.getApplicationContext());
            a.b(currentTimeMillis);
            int size = t != null ? t.size() : 0;
            while (i < size) {
                Intent intent = new Intent();
                intent.setComponent((ComponentName) t.get(i));
                if (VERSION.SDK_INT >= 12) {
                    intent.setFlags(32);
                }
                this.b.startService(intent);
                i++;
            }
            return;
        }
        new StringBuilder(z[1]).append(currentTimeMillis - s);
        z.a();
    } catch (SecurityException e) {
        z.d(z[4], z[3]);
        e.printStackTrace();
    }
}
 
Example 39
Project: boohee_v5.6   File: TextToSpeechICS.java   Source Code and License 5 votes vote down vote up
static TextToSpeech construct(Context context, OnInitListener onInitListener, String engineName) {
    if (VERSION.SDK_INT >= 14) {
        return new TextToSpeech(context, onInitListener, engineName);
    }
    if (engineName == null) {
        return new TextToSpeech(context, onInitListener);
    }
    Log.w(TAG, "Can't specify tts engine on this device");
    return new TextToSpeech(context, onInitListener);
}
 
Example 40
Project: boohee_v5.6   File: H5PayActivity.java   Source Code and License 5 votes vote down vote up
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                Object string2 = extras.getString("cookie");
                if (!TextUtils.isEmpty(string2)) {
                    CookieSyncManager.createInstance(getApplicationContext()).sync();
                    CookieManager.getInstance().setCookie(string, string2);
                    CookieSyncManager.getInstance().sync();
                }
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.a, new Object[]{"accessibility"});
                        method.invoke(this.a, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 41
Project: yyox   File: Compat.java   Source Code and License 5 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 42
Project: letv   File: SDKUtils.java   Source Code and License 5 votes vote down vote up
public static Long getFreeSpaceSize(StatFs statFs) {
    long freeSpaceSize = 0;
    try {
        if (VERSION.SDK_INT >= 18) {
            freeSpaceSize = statFs.getFreeBlocksLong() * statFs.getBlockSizeLong();
        } else {
            freeSpaceSize = ((long) statFs.getFreeBlocks()) * ((long) statFs.getBlockSize());
        }
    } catch (Throwable e) {
        LOG.w(TAG, "getScreenHeightWidth failed(Throwable): " + e.getMessage());
    }
    return Long.valueOf(freeSpaceSize);
}
 
Example 43
Project: letv   File: ResourcesCompat.java   Source Code and License 5 votes vote down vote up
@Nullable
public static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id, int density, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawableForDensity(res, id, density, theme);
    }
    if (VERSION.SDK_INT >= 15) {
        return ResourcesCompatIcsMr1.getDrawableForDensity(res, id, density);
    }
    return res.getDrawable(id);
}
 
Example 44
Project: letv   File: MediaSessionCompat.java   Source Code and License 5 votes vote down vote up
public Object getQueueItem() {
    if (this.mItem != null || VERSION.SDK_INT < 21) {
        return this.mItem;
    }
    this.mItem = android.support.v4.media.session.MediaSessionCompatApi21.QueueItem.createItem(this.mDescription.getMediaDescription(), this.mId);
    return this.mItem;
}
 
Example 45
Project: CustomAndroidOneSheeld   File: PullToRefreshBase.java   Source Code and License 5 votes vote down vote up
private void determineYPositionOfGoogleStyleViewLayout() {
	if ( VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH ) { 
		mYPositionOfGoogleStyleViewLayout = 0;
	} else {
		mYPositionOfGoogleStyleViewLayout = mStatusBarHeight;
	}
}
 
Example 46
Project: PeSanKita-android   File: IncomingLollipopMmsConnection.java   Source Code and License 5 votes vote down vote up
@TargetApi(VERSION_CODES.LOLLIPOP)
@Override
public synchronized void onResult(Context context, Intent intent) {
  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP_MR1) {
    Log.w(TAG, "HTTP status: " + intent.getIntExtra(SmsManager.EXTRA_MMS_HTTP_STATUS, -1));
  }
  Log.w(TAG, "code: " + getResultCode() + ", result string: " + getResultData());
}
 
Example 47
Project: boohee_v5.6   File: m.java   Source Code and License 5 votes vote down vote up
private m() {
    int i = 0;
    if (VERSION.SDK_INT > 11) {
        i = 4;
    }
    E = i;
}
 
Example 48
Project: CustomAndroidOneSheeld   File: PullToRefreshBase.java   Source Code and License 5 votes vote down vote up
/**
 * NOTE : This method must be called after initStatusBarSize() and initActionBarSize() have already been called. Also, mGoogleStyleProgressLayout should be initialized before calling this method. 
 */
private void determineYPositionOfGoogleStyleProgressLayout() {
	if ( VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH ) { 
		mYPositionOfGoogleStyleProgressLayout = mStatusBarHeight + 1;
	} else {
		mYPositionOfGoogleStyleProgressLayout = mActionBarHeight + mGoogleStyleProgressLayout.getHeight() + 1;
	}		
}
 
Example 49
Project: chat-sdk-android-push-firebase   File: TouchImageView.java   Source Code and License 5 votes vote down vote up
public CompatScroller(Context context) {
	if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
		isPreGingerbread = true;
		scroller = new Scroller(context);
		
	} else {
		isPreGingerbread = false;
		overScroller = new OverScroller(context);
	}
}
 
Example 50
Project: ImageMagnifier   File: TouchImageView.java   Source Code and License 5 votes vote down vote up
@TargetApi(16)
private void compatPostOnAnimation(Runnable runnable) {
    if (VERSION.SDK_INT >= 16) {
        postOnAnimation(runnable);
    } else {
        postDelayed(runnable, 16);
    }
}
 
Example 51
Project: CXJPadProject   File: TouchImageView.java   Source Code and License 5 votes vote down vote up
public CompatScroller(Context context) {
    if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
        isPreGingerbread = true;
        scroller = new Scroller(context);
    }
    else {
        isPreGingerbread = false;
        overScroller = new OverScroller(context);
    }
}
 
Example 52
Project: boohee_v5.6   File: e.java   Source Code and License 5 votes vote down vote up
private e(Context context) {
    this.b = "2.0.3";
    this.L = VERSION.SDK_INT;
    this.M = Build.MODEL;
    this.ab = Build.MANUFACTURER;
    this.bq = Locale.getDefault().getLanguage();
    this.aQ = 0;
    this.aR = null;
    this.aS = null;
    this.cB = null;
    this.cC = null;
    this.cD = null;
    this.cE = null;
    this.cF = null;
    this.cB = context.getApplicationContext();
    this.cA = l.x(this.cB);
    this.a = l.D(this.cB);
    this.br = c.e(this.cB);
    this.bs = l.C(this.cB);
    this.bt = TimeZone.getDefault().getID();
    Context context2 = this.cB;
    this.aQ = l.au();
    this.al = l.H(this.cB);
    this.aR = this.cB.getPackageName();
    if (this.L >= 14) {
        this.cC = l.M(this.cB);
    }
    context2 = this.cB;
    this.cD = l.az().toString();
    this.cE = l.L(this.cB);
    this.cF = l.ax();
    this.aS = l.R(this.cB);
}
 
Example 53
Project: boohee_v5.6   File: DrawableWrapperLollipop.java   Source Code and License 5 votes vote down vote up
protected boolean isCompatTintEnabled() {
    if (VERSION.SDK_INT != 21) {
        return false;
    }
    Drawable drawable = this.mDrawable;
    if ((drawable instanceof GradientDrawable) || (drawable instanceof DrawableContainer) || (drawable instanceof InsetDrawable)) {
        return true;
    }
    return false;
}
 
Example 54
Project: letv   File: AbsHListView.java   Source Code and License 5 votes vote down vote up
@TargetApi(14)
protected boolean performButtonActionOnTouchDown(MotionEvent event) {
    if (VERSION.SDK_INT < 14 || (event.getButtonState() & 2) == 0 || !showContextMenu(event.getX(), event.getY(), event.getMetaState())) {
        return false;
    }
    return true;
}
 
Example 55
Project: letv   File: BasePlayFragment.java   Source Code and License 5 votes vote down vote up
public void pause() {
    if (this.mVideoView != null) {
        this.mVideoView.pause();
    }
    if (VERSION.SDK_INT > 8) {
        IRVideo.getInstance().videoPause();
    }
    if (this.mPlayFragmentListener != null) {
        this.mPlayFragmentListener.callAdsInterface(2, true);
    }
}
 
Example 56
Project: letv   File: AndroidDisplayer.java   Source Code and License 5 votes vote down vote up
@SuppressLint({"NewApi"})
private static final int getMaximumBitmapHeight(Canvas c) {
    if (VERSION.SDK_INT >= 14) {
        return c.getMaximumBitmapHeight();
    }
    return c.getHeight();
}
 
Example 57
Project: boohee_v5.6   File: MQSoundPoolManager.java   Source Code and License 5 votes vote down vote up
private MQSoundPoolManager(Context context) {
    this.mContext = context;
    if (VERSION.SDK_INT >= 21) {
        this.mSoundPool = new Builder().setMaxStreams(1).build();
    } else {
        this.mSoundPool = new SoundPool(1, 3, 0);
    }
    this.mAudioManager = (AudioManager) context.getSystemService("audio");
    this.mSoundSourceMap = new HashMap();
}
 
Example 58
Project: PicShow-zhaipin   File: Compat.java   Source Code and License 5 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 59
Project: letv   File: ResourcesCompat.java   Source Code and License 5 votes vote down vote up
@ColorInt
public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColor(res, id, theme);
    }
    return res.getColor(id);
}
 
Example 60
Project: boohee_v5.6   File: ContextCompat.java   Source Code and License 5 votes vote down vote up
public static boolean startActivities(Context context, Intent[] intents, Bundle options) {
    int version = VERSION.SDK_INT;
    if (version >= 16) {
        ContextCompatJellybean.startActivities(context, intents, options);
        return true;
    } else if (version < 11) {
        return false;
    } else {
        ContextCompatHoneycomb.startActivities(context, intents);
        return true;
    }
}