本文整理汇总了Java中com.android.internal.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.android.internal包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NumberPicker
import com.android.internal.R; //导入依赖的package包/类
public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
setOrientation(VERTICAL);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.number_picker, this, true);
mHandler = new Handler();
InputFilter inputFilter = new NumberPickerInputFilter();
mNumberInputFilter = new NumberRangeKeyListener();
mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
mIncrementButton.setOnClickListener(this);
mIncrementButton.setOnLongClickListener(this);
mIncrementButton.setNumberPicker(this);
mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement);
mDecrementButton.setOnClickListener(this);
mDecrementButton.setOnLongClickListener(this);
mDecrementButton.setNumberPicker(this);
mText = (EditText) findViewById(R.id.timepicker_input);
mText.setOnFocusChangeListener(this);
mText.setFilters(new InputFilter[] {inputFilter});
mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
if (!isEnabled()) {
setEnabled(false);
}
}
示例2: onLongClick
import com.android.internal.R; //导入依赖的package包/类
/**
* We start the long click here but rely on the {@link NumberPickerButton}
* to inform us when the long click has ended.
*/
public boolean onLongClick(View v) {
/* The text view may still have focus so clear it's focus which will
* trigger the on focus changed and any typed values to be pulled.
*/
mText.clearFocus();
if (R.id.increment == v.getId()) {
mIncrement = true;
mHandler.post(mRunnable);
} else if (R.id.decrement == v.getId()) {
mDecrement = true;
mHandler.post(mRunnable);
}
return true;
}
示例3: createIndicatorView
import com.android.internal.R; //导入依赖的package包/类
public View createIndicatorView() {
final Context context = getContext();
LayoutInflater inflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View tabIndicator = inflater.inflate(R.layout.tab_indicator,
mTabWidget, // tab widget is the parent
false); // no inflate params
final TextView tv = (TextView) tabIndicator.findViewById(android.R.id.title);
tv.setText(mLabel);
// if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
// if (context.getApplicationInfo().targetSdkVersion <= 4) { // Donut apps get old color scheme
if ( Integer.parseInt(Build.VERSION.SDK) <= 4) { // Donut apps get old color scheme
// tabIndicator.setBackgroundResource(R.drawable.tab_indicator_v4);
tv.setTextColor(context.getResources().getColorStateList(R.color.tab_indicator_text_v4));
}
return tabIndicator;
}
示例4: dump
import com.android.internal.R; //导入依赖的package包/类
public static String dump(int[] states) {
StringBuilder sb = new StringBuilder();
int count = states.length;
for (int i = 0; i < count; i++) {
switch (states[i]) {
case android.R.attr.state_window_focused:
sb.append("W ");
break;
case android.R.attr.state_pressed:
sb.append("P ");
break;
case android.R.attr.state_selected:
sb.append("S ");
break;
case android.R.attr.state_focused:
sb.append("F ");
break;
case android.R.attr.state_enabled:
sb.append("E ");
break;
case android.R.attr.state_checked:
sb.append("C ");
break;
case android.R.attr.state_activated:
sb.append("A ");
break;
}
}
return sb.toString();
}
示例5: dump
import com.android.internal.R; //导入依赖的package包/类
public static String dump(int[] states) {
StringBuilder sb = new StringBuilder();
int count = states.length;
for (int i = 0; i < count; i++) {
switch (states[i]) {
case R.attr.state_window_focused:
sb.append("W ");
break;
case R.attr.state_pressed:
sb.append("P ");
break;
case R.attr.state_selected:
sb.append("S ");
break;
case R.attr.state_focused:
sb.append("F ");
break;
case R.attr.state_enabled:
sb.append("E ");
break;
}
}
return sb.toString();
}
示例6: getVerticalScrollFactor
import com.android.internal.R; //导入依赖的package包/类
/**
* Gets a scale factor that determines the distance the view should scroll
* vertically in response to {@link MotionEvent#ACTION_SCROLL}.
* @return The vertical scroll scale factor.
* @hide
*/
protected float getVerticalScrollFactor() {
if (mVerticalScrollFactor == 0) {
TypedValue outValue = new TypedValue();
if (!mContext.getTheme().resolveAttribute(
com.android.internal.R.attr.listPreferredItemHeight, outValue, true)) {
throw new IllegalStateException(
"Expected theme to define listPreferredItemHeight.");
}
mVerticalScrollFactor = outValue.getDimension(
mContext.getResources().getDisplayMetrics());
}
return mVerticalScrollFactor;
}
示例7: onClick
import com.android.internal.R; //导入依赖的package包/类
public void onClick(View v) {
validateInput(mText);
if (!mText.hasFocus()) mText.requestFocus();
// now perform the increment/decrement
if (R.id.increment == v.getId()) {
changeCurrent(mCurrent + 1);
} else if (R.id.decrement == v.getId()) {
changeCurrent(mCurrent - 1);
}
}
示例8: LockPatternView
import com.android.internal.R; //导入依赖的package包/类
public LockPatternView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView);
final String aspect = a.getString(R.styleable.LockPatternView_aspect);
if ("square".equals(aspect)) {
mAspect = ASPECT_SQUARE;
} else if ("lock_width".equals(aspect)) {
mAspect = ASPECT_LOCK_WIDTH;
} else if ("lock_height".equals(aspect)) {
mAspect = ASPECT_LOCK_HEIGHT;
} else {
mAspect = ASPECT_SQUARE;
}
setClickable(true);
mPathPaint.setAntiAlias(true);
mPathPaint.setDither(true);
mRegularColor = getResources().getColor(R.color.lock_pattern_view_regular_color);
mErrorColor = getResources().getColor(R.color.lock_pattern_view_error_color);
mSuccessColor = getResources().getColor(R.color.lock_pattern_view_success_color);
mRegularColor = a.getColor(R.styleable.LockPatternView_regularColor, mRegularColor);
mErrorColor = a.getColor(R.styleable.LockPatternView_errorColor, mErrorColor);
mSuccessColor = a.getColor(R.styleable.LockPatternView_successColor, mSuccessColor);
int pathColor = a.getColor(R.styleable.LockPatternView_pathColor, mRegularColor);
mPathPaint.setColor(pathColor);
mPathPaint.setStyle(Paint.Style.STROKE);
mPathPaint.setStrokeJoin(Paint.Join.ROUND);
mPathPaint.setStrokeCap(Paint.Cap.ROUND);
mPathWidth = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_line_width);
mPathPaint.setStrokeWidth(mPathWidth);
mDotSize = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_size);
mDotSizeActivated = getResources().getDimensionPixelSize(
R.dimen.lock_pattern_dot_size_activated);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mCellStates = new CellState[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
mCellStates[i][j] = new CellState();
mCellStates[i][j].size = mDotSize;
}
}
mFastOutSlowInInterpolator =
AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
mLinearOutSlowInInterpolator =
AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
}
示例9: notifyCellAdded
import com.android.internal.R; //导入依赖的package包/类
private void notifyCellAdded() {
sendAccessEvent(R.string.lockscreen_access_pattern_cell_added);
if (mOnPatternListener != null) {
mOnPatternListener.onPatternCellAdded(mPattern);
}
}
示例10: notifyPatternStarted
import com.android.internal.R; //导入依赖的package包/类
private void notifyPatternStarted() {
sendAccessEvent(R.string.lockscreen_access_pattern_start);
if (mOnPatternListener != null) {
mOnPatternListener.onPatternStart();
}
}
示例11: notifyPatternDetected
import com.android.internal.R; //导入依赖的package包/类
private void notifyPatternDetected() {
sendAccessEvent(R.string.lockscreen_access_pattern_detected);
if (mOnPatternListener != null) {
mOnPatternListener.onPatternDetected(mPattern);
}
}
示例12: notifyPatternCleared
import com.android.internal.R; //导入依赖的package包/类
private void notifyPatternCleared() {
sendAccessEvent(R.string.lockscreen_access_pattern_cleared);
if (mOnPatternListener != null) {
mOnPatternListener.onPatternCleared();
}
}
示例13: initializeScrollbars
import com.android.internal.R; //导入依赖的package包/类
/**
* <p>
* Initializes the scrollbars from a given set of styled attributes. This
* method should be called by subclasses that need scrollbars and when an
* instance of these subclasses is created programmatically rather than
* being inflated from XML. This method is automatically called when the XML
* is inflated.
* </p>
*
* @param a the styled attributes set to initialize the scrollbars from
*/
protected void initializeScrollbars(TypedArray a) {
initScrollCache();
final ScrollabilityCache scrollabilityCache = mScrollCache;
if (scrollabilityCache.scrollBar == null) {
scrollabilityCache.scrollBar = new ScrollBarDrawable();
}
final boolean fadeScrollbars = a.getBoolean(R.styleable.View_fadeScrollbars, true);
if (!fadeScrollbars) {
scrollabilityCache.state = ScrollabilityCache.ON;
}
scrollabilityCache.fadeScrollBars = fadeScrollbars;
scrollabilityCache.scrollBarFadeDuration = a.getInt(
R.styleable.View_scrollbarFadeDuration, ViewConfiguration
.getScrollBarFadeDuration());
scrollabilityCache.scrollBarDefaultDelayBeforeFade = a.getInt(
R.styleable.View_scrollbarDefaultDelayBeforeFade,
ViewConfiguration.getScrollDefaultDelay());
scrollabilityCache.scrollBarSize = a.getDimensionPixelSize(
com.android.internal.R.styleable.View_scrollbarSize,
ViewConfiguration.get(mContext).getScaledScrollBarSize());
Drawable track = a.getDrawable(R.styleable.View_scrollbarTrackHorizontal);
scrollabilityCache.scrollBar.setHorizontalTrackDrawable(track);
Drawable thumb = a.getDrawable(R.styleable.View_scrollbarThumbHorizontal);
if (thumb != null) {
scrollabilityCache.scrollBar.setHorizontalThumbDrawable(thumb);
}
boolean alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawHorizontalTrack,
false);
if (alwaysDraw) {
scrollabilityCache.scrollBar.setAlwaysDrawHorizontalTrack(true);
}
track = a.getDrawable(R.styleable.View_scrollbarTrackVertical);
scrollabilityCache.scrollBar.setVerticalTrackDrawable(track);
thumb = a.getDrawable(R.styleable.View_scrollbarThumbVertical);
if (thumb != null) {
scrollabilityCache.scrollBar.setVerticalThumbDrawable(thumb);
}
alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawVerticalTrack,
false);
if (alwaysDraw) {
scrollabilityCache.scrollBar.setAlwaysDrawVerticalTrack(true);
}
// Apply layout direction to the new Drawables if needed
final int layoutDirection = getLayoutDirection();
if (track != null) {
track.setLayoutDirection(layoutDirection);
}
if (thumb != null) {
thumb.setLayoutDirection(layoutDirection);
}
// Re-apply user/background padding so that scrollbar(s) get added
resolvePadding();
}
示例14: VerticalGallery
import com.android.internal.R; //导入依赖的package包/类
public VerticalGallery(Context context, AttributeSet attrs) {
this(context, attrs, android.R.attr.galleryStyle);
}
示例15: setup
import com.android.internal.R; //导入依赖的package包/类
/**
* <p>Call setup() before adding tabs if loading TabHost using findViewById(). <i><b>However</i></b>: You do
* not need to call setup() after getTabHost() in {@link android.app.TabActivity TabActivity}.
* Example:</p>
<pre>mTabHost = (TabHost)findViewById(R.id.tabhost);
mTabHost.setup();
mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
*/
public void setup() {
mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
if (mTabWidget == null) {
throw new RuntimeException(
"Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs'");
}
// KeyListener to attach to all tabs. Detects non-navigation keys
// and relays them to the tab content.
mTabKeyListener = new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_ENTER:
return false;
}
mTabContent.requestFocus(View.FOCUS_FORWARD);
return mTabContent.dispatchKeyEvent(event);
}
};
mTabWidget.setTabSelectionListener(new TabWidget.OnTabSelectionChanged() {
public void onTabSelectionChanged(int tabIndex, boolean clicked) {
setCurrentTab(tabIndex);
if (clicked) {
mTabContent.requestFocus(View.FOCUS_FORWARD);
}
}
});
mTabContent = (FrameLayout) findViewById(android.R.id.tabcontent);
if (mTabContent == null) {
throw new RuntimeException(
"Your TabHost must have a FrameLayout whose id attribute is 'android.R.id.tabcontent'");
}
}