diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-03-15 15:44:56 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-03-15 15:49:01 -0700 |
commit | 1e75c69339da2fbf2c5c5fbeb891243badae7ff8 (patch) | |
tree | 81268169bbff6836bfbbd4e9866a1374f597a624 /tensorflow/examples | |
parent | 6c62e650252ab32f83637a8de6720e73ffeca226 (diff) |
Automated g4 rollback of changelist 189231636
PiperOrigin-RevId: 189258641
Diffstat (limited to 'tensorflow/examples')
3 files changed, 1 insertions, 70 deletions
diff --git a/tensorflow/examples/android/AndroidManifest.xml b/tensorflow/examples/android/AndroidManifest.xml index 5c47ce6b67..bb75431a1f 100644 --- a/tensorflow/examples/android/AndroidManifest.xml +++ b/tensorflow/examples/android/AndroidManifest.xml @@ -40,7 +40,6 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> - <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> @@ -50,7 +49,6 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> - <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> @@ -60,7 +58,6 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> - <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> @@ -70,7 +67,6 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> - <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> </application> diff --git a/tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java b/tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java index 429138abe5..8bd4abb154 100644 --- a/tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java +++ b/tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java @@ -351,10 +351,6 @@ public abstract class CameraActivity extends Activity protected void setFragment() { String cameraId = chooseCamera(); - if (cameraId == null) { - Toast.makeText(this, "No Camera Detected", Toast.LENGTH_SHORT).show(); - finish(); - } Fragment fragment; if (useCamera2API) { @@ -420,8 +416,7 @@ public abstract class CameraActivity extends Activity @Override public boolean onKeyDown(final int keyCode, final KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP - || keyCode == KeyEvent.KEYCODE_BUTTON_L1 || keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { + if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { debug = !debug; requestRender(); onSetDebug(debug); diff --git a/tensorflow/examples/android/src/org/tensorflow/demo/StylizeActivity.java b/tensorflow/examples/android/src/org/tensorflow/demo/StylizeActivity.java index 33ec65e9f7..6a66ec3927 100644 --- a/tensorflow/examples/android/src/org/tensorflow/demo/StylizeActivity.java +++ b/tensorflow/examples/android/src/org/tensorflow/demo/StylizeActivity.java @@ -16,10 +16,8 @@ package org.tensorflow.demo; -import android.app.UiModeManager; import android.content.Context; import android.content.res.AssetManager; -import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; @@ -33,11 +31,9 @@ import android.graphics.Typeface; import android.media.ImageReader.OnImageAvailableListener; import android.os.Bundle; import android.os.SystemClock; -import android.util.DisplayMetrics; import android.util.Size; import android.util.TypedValue; import android.view.Display; -import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; @@ -47,7 +43,6 @@ import android.widget.BaseAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.ImageView; -import android.widget.RelativeLayout; import android.widget.Toast; import java.io.IOException; import java.io.InputStream; @@ -386,27 +381,6 @@ public class StylizeActivity extends CameraActivity implements OnImageAvailableL grid = (GridView) findViewById(R.id.grid_layout); grid.setAdapter(adapter); grid.setOnTouchListener(gridTouchAdapter); - - // Change UI on Android TV - UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); - if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { - DisplayMetrics displayMetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - int styleSelectorHeight = displayMetrics.heightPixels; - int styleSelectorWidth = displayMetrics.widthPixels - styleSelectorHeight; - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(styleSelectorWidth, ViewGroup.LayoutParams.MATCH_PARENT); - - // Calculate number of style in a row, so all the style can show up without scrolling - int numOfStylePerRow = 3; - while (styleSelectorWidth / numOfStylePerRow * Math.ceil((float) (adapter.getCount() - 2) / numOfStylePerRow) > styleSelectorHeight) { - numOfStylePerRow++; - } - grid.setNumColumns(numOfStylePerRow); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - grid.setLayoutParams(layoutParams); - adapter.buttons.clear(); - } - setStyle(adapter.items[0], 1.0f); } @@ -628,38 +602,4 @@ public class StylizeActivity extends CameraActivity implements OnImageAvailableL borderedText.drawLines(canvas, 10, canvas.getHeight() - 10, lines); } - - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - int moveOffset = 0; - switch (keyCode) { - case KeyEvent.KEYCODE_DPAD_LEFT: - moveOffset = -1; - break; - case KeyEvent.KEYCODE_DPAD_RIGHT: - moveOffset = 1; - break; - case KeyEvent.KEYCODE_DPAD_UP: - moveOffset = -1 * grid.getNumColumns(); - break; - case KeyEvent.KEYCODE_DPAD_DOWN: - moveOffset = grid.getNumColumns(); - break; - default: - return super.onKeyDown(keyCode, event); - } - - // get the highest selected style - int currentSelect = 0; - float highestValue = 0; - for (int i = 0; i < adapter.getCount(); i++) { - if (adapter.items[i].value > highestValue) { - currentSelect = i; - highestValue = adapter.items[i].value; - } - } - setStyle(adapter.items[(currentSelect + moveOffset + adapter.getCount()) % adapter.getCount()], 1); - - return true; - } } |