Add "change orientation" menu command.
Unfortunately software-keyboard is disabled on master for some reason, so we can't use the R key hack any longer... Change-Id: Ide73e11742e5de70fec45009eee20a1a74fcbfd1
This commit is contained in:
parent
c263810b08
commit
533e0f5beb
|
@ -31,4 +31,8 @@
|
||||||
android:title="@string/account_settings_action"
|
android:title="@string/account_settings_action"
|
||||||
android:icon="@android:drawable/ic_menu_preferences"
|
android:icon="@android:drawable/ic_menu_preferences"
|
||||||
/>
|
/>
|
||||||
|
<!-- STOPSHIP: Dev version only. Remove this. -->
|
||||||
|
<item android:id="@+id/change_orientation"
|
||||||
|
android:title="@string/menu_change_orientation"
|
||||||
|
/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -719,5 +719,7 @@
|
||||||
<string name="activity_label_2pane">Email 2 Pane</string>
|
<string name="activity_label_2pane">Email 2 Pane</string>
|
||||||
<!-- Do Not Translate. STOPSHIP: Dev version only. Remove this. -->
|
<!-- Do Not Translate. STOPSHIP: Dev version only. Remove this. -->
|
||||||
<string name="activity_label_1pane">Email 1 Pane</string>
|
<string name="activity_label_1pane">Email 1 Pane</string>
|
||||||
|
<!-- Do Not Translate. STOPSHIP: Dev version only. Remove this. -->
|
||||||
|
<string name="menu_change_orientation">Change orientation</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.android.email.provider.EmailContent.MessageColumns;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
@ -843,4 +844,15 @@ public class Utility {
|
||||||
lv.onRestoreInstanceState(mState);
|
lv.onRestoreInstanceState(mState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* STOPSHIP Remove this method
|
||||||
|
* Toggle between portrait and landscape. Developement use only.
|
||||||
|
*/
|
||||||
|
public static void changeOrientation(Activity activity) {
|
||||||
|
activity.setRequestedOrientation(
|
||||||
|
(activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
|
||||||
|
? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||||
|
: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package com.android.email.activity;
|
||||||
|
|
||||||
import com.android.email.Email;
|
import com.android.email.Email;
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
|
import com.android.email.Utility;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -26,7 +27,6 @@ import android.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Loader;
|
import android.content.Loader;
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -433,6 +433,10 @@ public class MessageListXL extends Activity implements View.OnClickListener,
|
||||||
case R.id.account_settings:
|
case R.id.account_settings:
|
||||||
// TODO Implement this
|
// TODO Implement this
|
||||||
return true;
|
return true;
|
||||||
|
// STOPSHIP remove this
|
||||||
|
case R.id.change_orientation:
|
||||||
|
Utility.changeOrientation(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -452,10 +456,7 @@ public class MessageListXL extends Activity implements View.OnClickListener,
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_R) {
|
if (keyCode == KeyEvent.KEYCODE_R) {
|
||||||
setRequestedOrientation(
|
Utility.changeOrientation(this);
|
||||||
(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
|
|
||||||
? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
|
||||||
: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
|
Loading…
Reference in New Issue