当前位置: 首页>>代码示例>>Java>>正文


Java VERSION类代码示例

本文整理汇总了Java中android.os.Build.VERSION的典型用法代码示例。如果您正苦于以下问题:Java VERSION类的具体用法?Java VERSION怎么用?Java VERSION使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VERSION类属于android.os.Build包,在下文中一共展示了VERSION类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extend

import android.os.Build.VERSION; //导入依赖的package包/类
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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:NotificationCompat.java

示例2: findAllFragmentsWithViews

import android.os.Build.VERSION; //导入依赖的package包/类
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);
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RequestManagerRetriever.java

示例3: tintStatusBar

import android.os.Build.VERSION; //导入依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:SystemBarHelper.java

示例4: onTextChanged

import android.os.Build.VERSION; //导入依赖的package包/类
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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:MQConversationActivity.java

示例5: findAccessibilityFocus

import android.os.Build.VERSION; //导入依赖的package包/类
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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:DayPickerView.java

示例6: attachToWindow

import android.os.Build.VERSION; //导入依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:CheckView.java

示例7: onInitializeAccessibilityNodeInfo

import android.os.Build.VERSION; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:SwitchCompat.java

示例8: generateViewId

import android.os.Build.VERSION; //导入依赖的package包/类
/**
 * 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;
            }
        }
    }
}
 
开发者ID:worldiety,项目名称:homunculus,代码行数:22,代码来源:Widget.java

示例9: onAnimationEnd

import android.os.Build.VERSION; //导入依赖的package包/类
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;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:ViewPropertyAnimatorCompat.java

示例10: c

import android.os.Build.VERSION; //导入依赖的package包/类
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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:f.java

示例11: initClasses

import android.os.Build.VERSION; //导入依赖的package包/类
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();
    }
}
 
开发者ID:amikey,项目名称:DroidPlugin,代码行数:20,代码来源:PackageParserApi21.java

示例12: isLowMemory

import android.os.Build.VERSION; //导入依赖的package包/类
@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;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:8,代码来源:Util.java

示例13: TransferControlView

import android.os.Build.VERSION; //导入依赖的package包/类
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);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:TransferControlView.java

示例14: a

import android.os.Build.VERSION; //导入依赖的package包/类
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;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:HttpUtils.java

示例15: onEvent

import android.os.Build.VERSION; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:FlurryAgent.java


注:本文中的android.os.Build.VERSION类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。