Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
android:allowBackup="true"
android:icon="@drawable/ic_2048"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
>
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:screenOrientation="portrait">
android:screenOrientation="fullSensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 1 addition & 1 deletion assets/2048
32 changes: 32 additions & 0 deletions src/com/uberspot/a2048/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.webkit.WebSettings;
import android.webkit.WebSettings.RenderPriority;
Expand All @@ -34,11 +41,36 @@ public class MainActivity extends Activity {
private static final long mTouchThreshold = 2000;
private Toast pressBackToast;

@RequiresApi(api = Build.VERSION_CODES.M)
@SuppressLint({"SetJavaScriptEnabled", "ShowToast", "ClickableViewAccessibility"})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// final WindowManager mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
//
// OrientationEventListener orientationEventListener = new OrientationEventListener(this,
// SensorManager.SENSOR_DELAY_NORMAL) {
// @Override
// public void onOrientationChanged(int orientation) {
// if (orientation == ORIENTATION_UNKNOWN) {
// return;
// }
// Display display = mWindowManager.getDefaultDisplay();
// int rotation = display.getRotation();
// if (rotation != mLastRotation) {
// // do something with your views
// mLastRotation = rotation;
// }
// }
// };
//
// if (orientationEventListener.canDetectOrientation()) {
// orientationEventListener.enable();
// }
//


// Don't show an action bar or title
requestWindowFeature(Window.FEATURE_NO_TITLE);

Expand Down