private int getDefaultVerticalScrollbarPosition() { final Locale locale = Locale.getDefault(); final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale); switch (layoutDirection) { case View.LAYOUT_DIRECTION_RTL: return View.SCROLLBAR_POSITION_LEFT; case View.LAYOUT_DIRECTION_LTR: default: return View.SCROLLBAR_POSITION_RIGHT; } }
private static String getGmtOffsetString(Locale locale, TimeZone tz, Date now) { // Use SimpleDateFormat to format the GMT+00:00 string. SimpleDateFormat gmtFormatter = new SimpleDateFormat("ZZZZ"); gmtFormatter.setTimeZone(tz); String gmtString = gmtFormatter.format(now); // Ensure that the "GMT+" stays with the "00:00" even if the digits are RTL. BidiFormatter bidiFormatter = BidiFormatter.getInstance(); boolean isRtl = TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL; gmtString = bidiFormatter.unicodeWrap( gmtString, isRtl ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR); return gmtString; }
@Override protected void onCreate(Bundle icicle) { Log.d(this, "onCreate()... this = " + this); super.onCreate(icicle); // set this flag so this activity will stay in front of the keyguard // Have the WindowManager filter out touch events that are "too fat". int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES; getWindow().addFlags(flags); // Setup action bar for the conference call manager. requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.hide(); } // TODO(klp): Do we need to add this back when prox sensor is not available? // lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY; // Inflate everything in incall_screen.xml and add it to the screen. setContentView(R.layout.incall_screen); initializeInCall(); internalResolveIntent(getIntent()); mCurrentOrientation = getResources().getConfiguration().orientation; mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; final boolean isRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; if (mIsLandscape) { mSlideIn = AnimationUtils.loadAnimation( this, isRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right); mSlideOut = AnimationUtils.loadAnimation( this, isRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right); } else { mSlideIn = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_in_bottom); mSlideOut = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_out_bottom); } mSlideIn.setInterpolator(AnimUtils.EASE_IN); mSlideOut.setInterpolator(AnimUtils.EASE_OUT); mSlideOut.setAnimationListener(mSlideOutListener); if (icicle != null) { // If the dialpad was shown before, set variables indicating it should be shown and // populated with the previous DTMF text. The dialpad is actually shown and populated // in onResume() to ensure the hosting CallCardFragment has been inflated and is ready // to receive it. mShowDialpadRequested = icicle.getBoolean(SHOW_DIALPAD_EXTRA); mAnimateDialpadOnShow = false; mDtmfText = icicle.getString(DIALPAD_TEXT_EXTRA); } Log.d(this, "onCreate(): exit"); }