mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-26 07:58:52 +01:00
fix Oreo-only crash by not setting screen orientation
This may hurt Oreo users in some other way, but I'm not taking the time right now to figure out what's special about DwnldActivity that it crashes when setting screen orientation on Oreo. It's only 5% of my users anyway.
This commit is contained in:
parent
f1123bebfc
commit
fab7a7befe
2 changed files with 22 additions and 13 deletions
|
@ -31,11 +31,10 @@ public class DwnldActivity extends XWActivity {
|
|||
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
||||
requestWindowFeature( Window.FEATURE_LEFT_ICON );
|
||||
getWindow().setFeatureDrawableResource( Window.FEATURE_LEFT_ICON,
|
||||
R.drawable.icon48x48 );
|
||||
R.drawable.icon48x48 );
|
||||
|
||||
DwnldDelegate dlgt =
|
||||
new DwnldDelegate( this, savedInstanceState );
|
||||
|
||||
super.onCreate( savedInstanceState, dlgt );
|
||||
super.onCreate( savedInstanceState, dlgt, false );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
|
||||
/*
|
||||
* Copyright 2014-2016 by Eric House (xwords@eehouse.org). All rights
|
||||
* Copyright 2014 - 2021 by Eric House (xwords@eehouse.org). All rights
|
||||
* reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -24,6 +24,7 @@ import android.app.Activity;
|
|||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.ContextMenu;
|
||||
|
@ -47,6 +48,12 @@ public class XWActivity extends FragmentActivity
|
|||
private DelegateBase m_dlgt;
|
||||
|
||||
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
|
||||
{
|
||||
onCreate( savedInstanceState, dlgt, true );
|
||||
}
|
||||
|
||||
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt,
|
||||
boolean setOrientation )
|
||||
{
|
||||
if ( BuildConfig.LOG_LIFECYLE ) {
|
||||
Log.i( TAG, "%s.onCreate(this=%H,sis=%s)", getClass().getSimpleName(),
|
||||
|
@ -57,15 +64,18 @@ public class XWActivity extends FragmentActivity
|
|||
m_dlgt = dlgt;
|
||||
Assert.assertTrue( getApplicationContext() == XWApp.getContext() );
|
||||
|
||||
int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
if ( XWPrefs.getIsTablet( this ) ) {
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
||||
} else {
|
||||
Assert.assertTrueNR( 9 <= Integer.valueOf( android.os.Build.VERSION.SDK ) );
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
}
|
||||
if ( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED != orientation ) {
|
||||
setRequestedOrientation( orientation );
|
||||
// Looks like there's an Oreo-only bug
|
||||
if ( setOrientation && Build.VERSION_CODES.O != Build.VERSION.SDK_INT ) {
|
||||
int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
if ( XWPrefs.getIsTablet( this ) ) {
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
||||
} else {
|
||||
Assert.assertTrueNR( 9 <= Integer.valueOf( Build.VERSION.SDK ) );
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
}
|
||||
if ( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED != orientation ) {
|
||||
setRequestedOrientation( orientation );
|
||||
}
|
||||
}
|
||||
|
||||
int layoutID = m_dlgt.getLayoutID();
|
||||
|
|
Loading…
Add table
Reference in a new issue