Skip to content

Commit

Permalink
fixed app orientation mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Oct 26, 2020
1 parent 8a0d72d commit eb9713e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
8 changes: 2 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".appintro.MyAppIntro"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
<activity android:name=".appintro.MyAppIntro" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="unspecified">
android:configChanges="orientation|screenSize|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MainActivity : AppCompatActivity() {
mySPR = getSharedPreferences(SHARED_PREFERENCE, 0)
editor = mySPR.edit()
editor.apply()
requestedOrientation = mySPR.getInt("orientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
requestedOrientation = mySPR.getInt("orientation", ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)

setContentView(R.layout.activity_main)
toolbar = findViewById(R.id.toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ class MainFragment : Fragment() {
return v
}

// if view is ready restore set orientation
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
activity?.requestedOrientation = mySPR.getInt("orientation", 0)
super.onViewCreated(view, savedInstanceState)
}

// restore last status
private fun statusRestoring() {
// restore chechbox status
Expand Down

0 comments on commit eb9713e

Please sign in to comment.