Skip to content

Commit b2627fd

Browse files
author
benelliott
committed
Orientation settings changes will now take effect immediately.
1 parent 576c51f commit b2627fd

3 files changed

Lines changed: 16 additions & 22 deletions

File tree

100 Bytes
Binary file not shown.

SpectrogramAndroid/bin/classes.dex

268 Bytes
Binary file not shown.

SpectrogramAndroid/src/uk/co/benjaminelliott/spectrogramandroid/SpectroActivity.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import android.support.v4.app.FragmentManager;
1616
import android.support.v4.app.FragmentPagerAdapter;
1717
import android.support.v4.view.ViewPager;
18+
import android.util.Log;
1819
import android.view.Menu;
1920
import android.view.MenuItem;
2021

@@ -143,28 +144,21 @@ public boolean onOptionsItemSelected(MenuItem item) {
143144
@Override
144145
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
145146
//extract data from Intent URI and update values in spectrogram code accordingly
146-
// Log.d("SpectroActivity","Activity result");
147-
//
148-
// if (requestCode == PREF_REQUEST_CODE && resultCode == RESULT_OK) {
149-
// Log.d("SpectroActivity","Preference changed!");
150-
// String key = data.getStringExtra("PREF_KEY");
151-
// Log.d("SpectroActivity","Key: "+key);
152-
// if (key.equals(BitmapGenerator.PREF_COLOURMAP_KEY)) {
153-
// lssv.updateColourMap();
154-
// }
155-
//
156-
// else if (key.equals(PREF_PORTRAIT_KEY)) {
157-
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
158-
// boolean portrait = prefs.getBoolean(PREF_PORTRAIT_KEY, false);
159-
// if (portrait) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
160-
// else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
161-
// }
162-
//
163-
// else if (key.equals(BitmapGenerator.PREF_CONTRAST_KEY)) {
164-
// lssv.updateContrast();
165-
// }
166-
//
167-
// }
147+
Log.d("SpectroActivity","Activity result");
148+
149+
if (requestCode == PREF_REQUEST_CODE && resultCode == RESULT_OK) {
150+
Log.d("SpectroActivity","Preference changed!");
151+
String key = data.getStringExtra("PREF_KEY");
152+
Log.d("SpectroActivity","Key: "+key);
153+
154+
if (key.equals(PREF_LANDSCAPE_KEY)) {
155+
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
156+
boolean landscape = prefs.getBoolean(PREF_LANDSCAPE_KEY, false);
157+
if (landscape) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
158+
else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
159+
}
160+
161+
}
168162
}
169163

170164
@Override

0 commit comments

Comments
 (0)