Java Code Examples for android.content.res.Configuration

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project and-bible, under directory /AndBible/src/net/bible/android/.

Source file: BibleApplication.java

  18 
vote

/** 
 * Allow user interface locale override by changing Settings
 */
private void allowLocaleOverride(){
  Configuration config=getBaseContext().getResources().getConfiguration();
  String lang=CommonUtils.getLocalePref();
  if (!"".equals(lang) && !config.locale.getLanguage().equals(lang)) {
    overrideLocale=new Locale(lang);
    Locale.setDefault(overrideLocale);
    config.locale=overrideLocale;
    getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
  }
}
 

Example 2

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/deprecated/.

Source file: LanguageSwitcherProxy.java

  18 
vote

public static void init(LatinIME service,SharedPreferences prefs){
  if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED)   return;
  final Configuration conf=service.getResources().getConfiguration();
  sInstance.mLanguageSwitcher=new LanguageSwitcher(service);
  sInstance.mLanguageSwitcher.loadLocales(prefs,conf.locale);
  sInstance.mPrefs=prefs;
  sInstance.mService=service;
  prefs.registerOnSharedPreferenceChangeListener(sInstance);
}
 

Example 3

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: LocalePicker.java

  18 
vote

@Override protected void onListItemClick(ListView l,View v,int position,long id){
  try {
    IActivityManager am=ActivityManagerNative.getDefault();
    Configuration config=am.getConfiguration();
    Loc loc=mLocales[position];
    config.locale=loc.locale;
    config.userSetLocale=true;
    am.updateConfiguration(config);
    BackupManager.dataChanged("com.android.providers.settings");
  }
 catch (  RemoteException e) {
  }
  finish();
}
 

Example 4

From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/.

Source file: AppDetailsActivity.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Configuration config=getResources().getConfiguration();
  if (config.orientation == Configuration.ORIENTATION_LANDSCAPE && (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
    finish();
    return;
  }
  setContentView(R.layout.activity_app_details);
  if (savedInstanceState == null) {
    Fragment fragment=Fragment.instantiate(this,AppDetailsFragment.class.getName(),getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(R.id.container,fragment).commit();
  }
}
 

Example 5

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/deprecated/.

Source file: LanguageSwitcherProxy.java

  18 
vote

public static void init(LatinIME service,SharedPreferences prefs){
  if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED)   return;
  final Configuration conf=service.getResources().getConfiguration();
  sInstance.mLanguageSwitcher=new LanguageSwitcher(service);
  sInstance.mLanguageSwitcher.loadLocales(prefs,conf.locale);
  sInstance.mPrefs=prefs;
  sInstance.mService=service;
  prefs.registerOnSharedPreferenceChangeListener(sInstance);
}
 

Example 6

From project andstatus, under directory /src/org/andstatus/app/.

Source file: TimelineActivity.java

  18 
vote

/** 
 * Check to see if the system has a hardware keyboard.
 * @return
 */
protected boolean hasHardwareKeyboard(){
  Configuration c=getResources().getConfiguration();
switch (c.keyboard) {
case Configuration.KEYBOARD_12KEY:
case Configuration.KEYBOARD_QWERTY:
    return true;
default :
  return false;
}
}
 

Example 7

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: TimelineActivity.java

  18 
vote

/** 
 * Check to see if the system has a hardware keyboard.
 * @return
 */
protected boolean hasHardwareKeyboard(){
  Configuration c=getResources().getConfiguration();
switch (c.keyboard) {
case Configuration.KEYBOARD_12KEY:
case Configuration.KEYBOARD_QWERTY:
    return true;
default :
  return false;
}
}
 

Example 8

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: BaseActivity.java

  18 
vote

public static void setLanguage(Context context,String language){
  Locale locale;
  if (language == null || language.equals("")) {
    locale=Locale.getDefault();
  }
 else {
    locale=new Locale(language);
  }
  Configuration config=new Configuration();
  config.locale=locale;
  context.getResources().updateConfiguration(config,context.getResources().getDisplayMetrics());
}
 

Example 9

From project BazaarUtils, under directory /src/com/congenialmobile/utils/.

Source file: MultiLanguageApplication.java

  18 
vote

public void onSomeConfigurationChanged(Configuration newConfig){
  if (!newConfig.locale.equals(systemLocale)) {
    systemLocale=newConfig.locale;
    setLangForContextWrapper(this);
  }
 else {
    Locale.setDefault(currentLocale);
    Configuration config=new Configuration();
    config.locale=currentLocale;
    getBaseContext().getResources().updateConfiguration(config,null);
  }
}
 

Example 10

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/misc/.

Source file: PublicUtils.java

  18 
vote

public static void setupLocale(Context context,SharedPreferences sharedPreferences){
  if (!sharedPreferences.getString(Constants.SP_BL_LANG,"").equals("")) {
    Locale locale=new Locale(sharedPreferences.getString(Constants.SP_BL_LANG,"en"));
    Locale.setDefault(locale);
    Configuration config=new Configuration();
    config.locale=locale;
    context.getResources().updateConfiguration(config,context.getResources().getDisplayMetrics());
  }
}
 

Example 11

From project CHMI, under directory /src/org/kaldax/app/chmi/.

Source file: AppConfigurationActivity.java

  18 
vote

private void applyLocale(){
  Locale locale=new Locale(chmiConfigBundlel._locale);
  Locale.setDefault(locale);
  Configuration config=new Configuration();
  config.locale=locale;
  getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
}
 

Example 12

From project cornerstone, under directory /frameworks/base/core/java/android/app/.

Source file: ActivityManagerNative.java

  18 
vote

public Configuration getConfiguration() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_CONFIGURATION_TRANSACTION,data,reply,0);
  reply.readException();
  Configuration res=Configuration.CREATOR.createFromParcel(reply);
  reply.recycle();
  data.recycle();
  return res;
}
 

Example 13

From project android_packages_apps_TouchWiz30Launcher, under directory /src/com/sec/android/app/twlauncher/.

Source file: Launcher.java

  17 
vote

private void checkForLocaleChange(){
  LocaleConfiguration localeconfiguration=new LocaleConfiguration();
  readConfiguration(this,localeconfiguration);
  Configuration configuration=getResources().getConfiguration();
  String s=localeconfiguration.locale;
  String s1=configuration.locale.toString();
  int i=localeconfiguration.mcc;
  int j=configuration.mcc;
  int k=localeconfiguration.mnc;
  int l=configuration.mnc;
  boolean flag;
  if (!s1.equals(s) || j != i || l != k)   flag=true;
 else   flag=false;
  mLocaleChanged=flag;
  if (mLocaleChanged) {
    localeconfiguration.locale=s1;
    localeconfiguration.mcc=j;
    localeconfiguration.mnc=l;
    writeConfiguration(this,localeconfiguration);
    mIconCache.flush();
  }
}
 

Example 14

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/util/.

Source file: ErrorReporter.java

  17 
vote

private static void appendReport(final StringBuilder report,final Context context){
  try {
    final PackageManager pm=context.getPackageManager();
    final PackageInfo pi=pm.getPackageInfo(context.getPackageName(),0);
    final Resources res=context.getResources();
    final Configuration config=res.getConfiguration();
    final ActivityManager activityManager=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
    report.append("Date: " + new Date() + "\n");
    report.append("Version: " + pi.versionName + " ("+ pi.versionCode+ ")\n");
    report.append("Package: " + pi.packageName + "\n");
    report.append("Phone Model: " + android.os.Build.MODEL + "\n");
    report.append("Android Version: " + android.os.Build.VERSION.RELEASE + "\n");
    report.append("Board: " + android.os.Build.BOARD + "\n");
    report.append("Brand: " + android.os.Build.BRAND + "\n");
    report.append("Device: " + android.os.Build.DEVICE + "\n");
    report.append("Display: " + android.os.Build.DISPLAY + "\n");
    report.append("Finger Print: " + android.os.Build.FINGERPRINT + "\n");
    report.append("Host: " + android.os.Build.HOST + "\n");
    report.append("ID: " + android.os.Build.ID + "\n");
    report.append("Model: " + android.os.Build.MODEL + "\n");
    report.append("Product: " + android.os.Build.PRODUCT + "\n");
    report.append("Tags: " + android.os.Build.TAGS + "\n");
    report.append("Time: " + android.os.Build.TIME + "\n");
    report.append("Type: " + android.os.Build.TYPE + "\n");
    report.append("User: " + android.os.Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size " + (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) + " long "+ (config.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK)+ "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append("Memory Class: " + activityManager.getMemoryClass() + "\n");
    report.append("Databases:");
    for (    final String db : context.databaseList())     report.append(" " + db);
    report.append("\n\n\n");
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
  }
}
 

Example 15

From project Cafe, under directory /testservice/src/com/baidu/cafe/remote/.

Source file: SystemLib.java

  17 
vote

/** 
 * change system language
 * @param language : language expected to change
 */
public void changeLanguage(String language){
  IActivityManager am=ActivityManagerNative.getDefault();
  Configuration config;
  try {
    config=am.getConfiguration();
    if ("zh".equals(language)) {
      config.locale=Locale.CHINA;
    }
 else {
      config.locale=Locale.US;
    }
    config.userSetLocale=true;
    am.updateConfiguration(config);
    BackupManager.dataChanged("com.android.providers.settings");
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
}
 

Example 16

From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/screen/results/tablet/.

Source file: CineShowTimeResultsTabletActivity.java

  17 
vote

@Override protected void initContentView(){
  Log.i(getTAG(),"initContentView");
  fragmentResult=(CineShowTimeResultsFragment)getSupportFragmentManager().findFragmentById(R.id.fragmentResults);
  Fragment recycleFragment=getSupportFragmentManager().findFragmentById(R.id.fragmentInfo);
  if (recycleFragment == null) {
    fragmentFrame=new CineShowTimeFrameFragment();
    getSupportFragmentManager().beginTransaction().add(R.id.fragmentInfo,fragmentFrame).commit();
  }
 else   if (recycleFragment.getClass() == CineShowTimeFrameFragment.class) {
    fragmentFrame=(CineShowTimeFrameFragment)getSupportFragmentManager().findFragmentById(R.id.fragmentInfo);
  }
  Configuration conf=getResources().getConfiguration();
  portraitMode=conf.orientation == Configuration.ORIENTATION_PORTRAIT;
  if (portraitMode) {
    infoLayout=(LinearLayout)findViewById(R.id.fragmentInfo);
    fragmentResult.setNonExpendable(true);
    showtimeList=(ListView)findViewById(R.id.showtimesResults);
    showtimeList.setOnItemClickListener(this);
    adapter=new CineShowTimeShowTimesListAdapter(this);
    if ((movieList != null) && (movieList.size() > 0) && (theater != null)) {
      adapter.setShowTimesList(movieList,theater);
      getModelActivity().getGroupExpanded().add(getModelActivity().getNearResp().getTheaterList().indexOf(theater));
    }
    showtimeList.setAdapter(adapter);
  }
}
 

Example 17

From project creamed_glacier_app_settings, under directory /src/com/android/settings/inputmethod/.

Source file: InputMethodAndLanguageSettings.java

  17 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.xml.language_settings);
  try {
    mDefaultInputMethodSelectorVisibility=Integer.valueOf(getString(R.string.input_method_selector_visibility_default_value));
  }
 catch (  NumberFormatException e) {
  }
  if (getActivity().getAssets().getLocales().length == 1) {
    getPreferenceScreen().removePreference(findPreference(KEY_PHONE_LANGUAGE));
  }
 else {
    mLanguagePref=findPreference(KEY_PHONE_LANGUAGE);
  }
  if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
    mShowInputMethodSelectorPref=(ListPreference)findPreference(KEY_INPUT_METHOD_SELECTOR);
    mShowInputMethodSelectorPref.setOnPreferenceChangeListener(this);
    updateInputMethodSelectorSummary(loadInputMethodSelectorVisibility());
  }
  new VoiceInputOutputSettings(this).onCreate();
  final Configuration config=getResources().getConfiguration();
  mHaveHardKeyboard=(config.keyboard == Configuration.KEYBOARD_QWERTY);
  mIsOnlyImeSettings=Settings.ACTION_INPUT_METHOD_SETTINGS.equals(getActivity().getIntent().getAction());
  getActivity().getIntent().setAction(null);
  mImm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  mImis=mImm.getInputMethodList();
  createImePreferenceHierarchy((PreferenceGroup)findPreference("keyboard_settings_category"));
  final Intent intent=new Intent(Intent.ACTION_MAIN);
  intent.setClass(getActivity(),SpellCheckersSettingsActivity.class);
  final SpellCheckersPreference scp=((SpellCheckersPreference)findPreference("spellcheckers_settings"));
  if (scp != null) {
    scp.setFragmentIntent(this,intent);
  }
  mHandler=new Handler();
  mSettingsObserver=new SettingsObserver(mHandler,getActivity());
}
 

Example 18

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 19

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 20

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 21

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 22

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 23

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/views/.

Source file: CameraSurface.java

  15 
vote

private void setCameraParameters(){
  this.mParameters=this.mCameraDevice.getParameters();
  List<Integer> frameRates=this.mParameters.getSupportedPreviewFrameRates();
  if (frameRates != null) {
    Integer max=Collections.max(frameRates);
    this.mParameters.setPreviewFrameRate(max);
  }
  double ratio=(double)8 / 3;
  Display display=this.mActivity.getWindowManager().getDefaultDisplay();
  if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)   ratio=(double)display.getWidth() / display.getHeight();
 else   ratio=(double)display.getHeight() / display.getWidth();
  int optPicWidth=(int)this.getResources().getDimension(R.dimen.camera_pic_size);
  int optPicHeight=(int)(optPicWidth / ratio);
  Size optPicSize=this.getOptimalSize(this.mParameters.getSupportedPictureSizes(),optPicWidth,optPicHeight);
  Size optPreviewSize=this.getOptimalSize(this.mParameters.getSupportedPreviewSizes(),optPicSize.width,optPicSize.height);
  this.mParameters.setPictureSize(optPicSize.width,optPicSize.height);
  this.mParameters.setPreviewSize(optPreviewSize.width,optPreviewSize.height);
  this.mParameters.setPictureFormat(ImageFormat.JPEG);
  this.mParameters.setJpegQuality(JPEGQUALITY);
  if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    this.mParameters.setRotation(0);
  }
 else {
    this.mParameters.setRotation(90);
  }
  String focusmode=GSSettings.getShouldAutoFocus() ? ENABLEDAUTOFOCUSSETTING : DISABLEDAUTOFOCUSSETTING;
  if (this.isSupported(focusmode,this.mParameters.getSupportedFocusModes()))   this.mParameters.setFocusMode(focusmode);
  this.mCameraDevice.setParameters(this.mParameters);
}
 

Example 24

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  mHaveFullHwKeyboard=checkHaveFullHwKeyboard(newConfig);
  EmulatorView v=(EmulatorView)mViewFlipper.getCurrentView();
  if (v != null) {
    v.updateSize(false);
  }
  if (mWinListAdapter != null) {
    mWinListAdapter.notifyDataSetChanged();
  }
}
 

Example 25

From project android-viewflow, under directory /viewflow/src/org/taptwo/android/widget/.

Source file: ViewFlow.java

  15 
vote

public void onConfigurationChanged(Configuration newConfig){
  if (newConfig.orientation != mLastOrientation) {
    mLastOrientation=newConfig.orientation;
    getViewTreeObserver().addOnGlobalLayoutListener(orientationChangeListener);
  }
}
 

Example 26

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 27

From project Android_1, under directory /Fragments/simple/src/novoda/demo/fragments/list/activities/.

Source file: Details.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    finish();
    return;
  }
  if (savedInstanceState == null) {
    Detail details=new Detail();
    details.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,details).commit();
  }
}
 

Example 28

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/app/.

Source file: AbstractGalleryActivity.java

  15 
vote

@Override public void onConfigurationChanged(Configuration config){
  super.onConfigurationChanged(config);
  mStateManager.onConfigurationChange(config);
  invalidateOptionsMenu();
  toggleStatusBarByOrientation();
}
 

Example 29

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: Gallery.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (mGridLayer != null) {
    mGridLayer.markDirty(30);
  }
  if (mRenderView != null)   mRenderView.requestRender();
  Log.i(TAG,"onConfigurationChanged");
}
 

Example 30

From project android_packages_apps_Nfc, under directory /src/com/android/nfc/.

Source file: P2pEventManager.java

  15 
vote

@Override public void onP2pSendConfirmationRequested(){
  final int uiModeType=mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK;
  if (uiModeType == Configuration.UI_MODE_TYPE_APPLIANCE) {
    mCallback.onP2pSendConfirmed();
  }
 else {
    mSendUi.showPreSend();
  }
}
 

Example 31

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  15 
vote

/** 
 * Manually handle configuration changes. We specify android:configChanges="orientation|keyboardHidden|uiMode" in our manifest to make sure the system doesn't destroy and re-create us due to the above config changes.  Instead, this method will be called, and should manually rebuild the onscreen UI to keep it in sync with the current configuration.
 */
public void onConfigurationChanged(Configuration newConfig){
  if (DBG)   log("onConfigurationChanged: newConfig = " + newConfig);
  super.onConfigurationChanged(newConfig);
  boolean isKeyboardOpen=(newConfig.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO);
  if (DBG)   log("  - isKeyboardOpen = " + isKeyboardOpen);
  boolean isLandscape=(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
  if (DBG)   log("  - isLandscape = " + isLandscape);
  if (DBG)   log("  - uiMode = " + newConfig.uiMode);
}
 

Example 32

From project android_packages_wallpapers_basic, under directory /src/com/android/wallpaper/walkaround/.

Source file: WalkAroundWallpaper.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  if (mCamera != null) {
    if (mCamera.previewEnabled()) {
      boolean portrait=newConfig.orientation == Configuration.ORIENTATION_PORTRAIT;
      final Camera.Parameters params=mCamera.getParameters();
      params.set("orientation",portrait ? "portrait" : "landscape");
      mCamera.setParameters(params);
      if (mCamera.previewEnabled())       mCamera.stopPreview();
      mCamera.startPreview();
    }
  }
}
 

Example 33

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: Reviewer.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  Log.i(AnkiDroidApp.TAG,"onConfigurationChanged");
  mCardTemplate=mCardTemplate.replaceFirst("var availableWidth = \\d*;","var availableWidth = " + getAvailableWidthInCard() + ";");
  refreshCard();
  if (mPrefWhiteboard) {
    mWhiteboard.rotate();
  }
}
 

Example 34

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/.

Source file: AnySoftKeyboard.java

  15 
vote

@Override public boolean onEvaluateFullscreenMode(){
switch (mOrientation) {
case Configuration.ORIENTATION_LANDSCAPE:
    return mConfig.getUseFullScreenInputInLandscape();
default :
  return mConfig.getUseFullScreenInputInPortrait();
}
}
 

Example 35

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/.

Source file: TutorialPostSignup.java

  15 
vote

public TutorialPostSignup(Context context){
  super(context,R.style.ThemeBeintoo);
  mCurrent=this;
  mContext=context;
  setContentView(R.layout.tutorial_post_signup);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  LinearLayout beintooBar=(LinearLayout)findViewById(R.id.beintoobar);
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,DpiPxConverter.pixelToDpi(mContext,47),BDrawableGradient.BAR_GRADIENT));
  BeButton b=new BeButton(context);
  Button finish=(Button)findViewById(R.id.finishTutorial);
  int pixels=DpiPxConverter.pixelToDpi(context,50);
  finish.setShadowLayer(0.1f,0,-2.0f,Color.BLACK);
  finish.setBackgroundDrawable(b.setPressedBackg(new BDrawableGradient(0,(int)pixels,BDrawableGradient.BLU_BUTTON_GRADIENT),new BDrawableGradient(0,(int)pixels,BDrawableGradient.BLU_ROLL_BUTTON_GRADIENT),new BDrawableGradient(0,(int)pixels,BDrawableGradient.BLU_ROLL_BUTTON_GRADIENT)));
  ((TextView)findViewById(R.id.play)).setText(Html.fromHtml(context.getResources().getString(R.string.tutorial_play)));
  ((TextView)findViewById(R.id.earn)).setText(Html.fromHtml(context.getResources().getString(R.string.tutorial_earn)));
  ((TextView)findViewById(R.id.redeem)).setText(Html.fromHtml(context.getResources().getString(R.string.tutorial_redeem)));
  int padding=DpiPxConverter.pixelToDpi(context,10);
  ((LinearLayout)findViewById(R.id.actionsContainer)).setPadding(padding,padding,padding,0);
  if (context.getApplicationContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
    ((LinearLayout)findViewById(R.id.actionsContainer)).setOrientation(LinearLayout.VERTICAL);
    ((LinearLayout)findViewById(R.id.playContainer)).setOrientation(LinearLayout.HORIZONTAL);
    ((LinearLayout)findViewById(R.id.earnContainer)).setOrientation(LinearLayout.HORIZONTAL);
    ((LinearLayout)findViewById(R.id.redeemContainer)).setOrientation(LinearLayout.HORIZONTAL);
  }
  finish.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      BeintooHome beintooHome=new BeintooHome(getContext());
      beintooHome.show();
      mCurrent.dismiss();
    }
  }
);
}
 

Example 36

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: ReaderActivity.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  if (PreferenceHelper.restoreStateBoolean("DisableAutoScreenRotation")) {
    super.onConfigurationChanged(newConfig);
    this.setRequestedOrientation(Surface.ROTATION_0);
  }
 else {
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    super.onConfigurationChanged(newConfig);
  }
}
 

Example 37

From project BombusLime, under directory /src/org/bombusim/lime/activity/.

Source file: ChatActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstance){
  super.onCreate(savedInstance);
  getSupportActionBar().setDisplayShowHomeEnabled(false);
  getSupportActionBar().setCustomView(R.layout.contactbar_wrapper);
  getSupportActionBar().setDisplayShowCustomEnabled(true);
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    finish();
    return;
  }
  setContentView(R.layout.single_chat);
  if (savedInstance != null) {
    mChatJid=savedInstance.getString(ChatActivity.TO_JID);
    mChatRJid=savedInstance.getString(ChatActivity.MY_JID);
  }
 else {
    attachToChat(getIntent());
  }
}
 

Example 38

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 39

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: ConsoleActivity.java

  15 
vote

public void onServiceConnected(ComponentName className,IBinder service){
  bound=((TerminalManager.TerminalBinder)service).getService();
  bound.disconnectHandler=disconnectHandler;
  Log.d(TAG,String.format("Connected to TerminalManager and found bridges.size=%d",bound.bridges.size()));
  bound.setResizeAllowed(true);
  bound.hardKeyboardHidden=(getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES);
  if (bound.getFullScreen() == 0) {
    if (prefs.getBoolean(PreferenceConstants.FULLSCREEN,false))     setFullScreen(FULLSCREEN_ON);
 else     setFullScreen(FULLSCREEN_OFF);
  }
 else   if (fullScreen != bound.getFullScreen())   setFullScreen(bound.getFullScreen());
  flip.removeAllViews();
  final String requestedNickname=(requested != null) ? requested.getFragment() : null;
  int requestedIndex=-1;
  TerminalBridge requestedBridge=bound.getConnectedBridge(requestedNickname);
  if (requestedNickname != null && requestedBridge == null) {
    try {
      Log.d(TAG,String.format("We couldnt find an existing bridge with URI=%s (nickname=%s), so creating one now",requested.toString(),requestedNickname));
      requestedBridge=bound.openConnection(requested);
    }
 catch (    Exception e) {
      Log.e(TAG,"Problem while trying to create new requested bridge from URI",e);
    }
  }
  for (  TerminalBridge bridge : bound.bridges) {
    final int currentIndex=addNewTerminalView(bridge);
    if (bridge == requestedBridge) {
      requestedIndex=currentIndex;
      bound.defaultBridge=bridge;
    }
  }
  if (requestedIndex < 0) {
    requestedIndex=getFlipIndex(bound.defaultBridge);
    if (requestedIndex < 0)     requestedIndex=0;
  }
  setDisplayedTerminal(requestedIndex);
}
 

Example 40

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/.

Source file: ActionBarSherlock.java

  15 
vote

/** 
 * Notify action bar of a configuration change event. Should be dispatched after the call to the superclass implementation. <blockquote><pre>
 * @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mSherlock.dispatchConfigurationChanged(newConfig); } </pre></blockquote>
 * @param newConfig The new device configuration.
 */
public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (mActionBar != null) {
    mActionBar.onConfigurationChanged(newConfig);
  }
}
 

Example 41

From project cw-advandroid, under directory /Honeycomb/FeedFragments/src/com/commonsware/android/feedfrags/.

Source file: FeedsTabActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_nav);
  for (  final Feed feed : Feed.getFeeds()) {
    addNewFeed(feed);
  }
  ActionBar bar=getActionBar();
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  bar.setDisplayOptions(0,ActionBar.DISPLAY_SHOW_TITLE);
  bar.setDisplayHomeAsUpEnabled(true);
  int screenLayout=getResources().getConfiguration().screenLayout;
  if (((screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL) || ((screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL)) {
    bar.setDisplayShowHomeEnabled(false);
  }
  if (savedInstanceState != null) {
    cleanUpFragments();
  }
}
 

Example 42

From project cw-android, under directory /Fragments/EU4You_6/src/com/commonsware/android/eu4you6/.

Source file: EU4You.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  CountriesFragment countries=(CountriesFragment)getSupportFragmentManager().findFragmentById(R.id.countries);
  countries.setCountryListener(this);
  Fragment f=getSupportFragmentManager().findFragmentById(R.id.details);
  detailsInline=(f != null && (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE));
  if (detailsInline) {
    countries.enablePersistentSelection();
  }
 else   if (f != null) {
    f.getView().setVisibility(View.GONE);
  }
}
 

Example 43

From project cw-omnibus, under directory /ConfigChange/DIY/src/com/commonsware/android/rotation/diy/.

Source file: RotationDIYDemo.java

  15 
vote

@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  LinearLayout container=(LinearLayout)findViewById(R.id.container);
  if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
    container.setOrientation(LinearLayout.HORIZONTAL);
  }
 else {
    container.setOrientation(LinearLayout.VERTICAL);
  }
}
 

Example 44

From project daily-money, under directory /dailymoney/src/com/bottleworks/commons/util/.

Source file: GUIs.java

  15 
vote

static public void lockOrientation(Activity activity){
switch (activity.getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_PORTRAIT:
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  break;
case Configuration.ORIENTATION_LANDSCAPE:
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
}
}
 

Example 45

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchConfigurationChanged(Configuration newConfig){
  if (DEBUG)   Log.d(TAG,"[dispatchConfigurationChanged] newConfig: " + newConfig);
  if (aActionBar != null) {
    aActionBar.onConfigurationChanged(newConfig);
  }
}