[Android] Editext for time selection

Geoffrey Métais git at videolan.org
Mon Feb 23 19:15:42 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 23 19:15:17 2015 +0100| [6ec4d1de7bbd6ed8ab7390064e64a6ef8be9a626] | committer: Geoffrey Métais

Editext for time selection

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=6ec4d1de7bbd6ed8ab7390064e64a6ef8be9a626
---

 vlc-android/res/layout/jump_to_time.xml            |   18 +++++++++++++-----
 .../videolan/vlc/gui/dialogs/AudioDelayDialog.java |    3 +--
 .../videolan/vlc/gui/dialogs/JumpToTimeDialog.java |    2 +-
 .../videolan/vlc/gui/dialogs/PickTimeFragment.java |   20 +++++++++++---------
 .../videolan/vlc/gui/dialogs/SubsDelayDialog.java  |    3 +--
 vlc-android/tv/AndroidManifest.xml                 |    3 ++-
 6 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/vlc-android/res/layout/jump_to_time.xml b/vlc-android/res/layout/jump_to_time.xml
index b3bc6c5..8e9eae1 100644
--- a/vlc-android/res/layout/jump_to_time.xml
+++ b/vlc-android/res/layout/jump_to_time.xml
@@ -38,7 +38,7 @@
                 android:layout_height="wrap_content"
                 android:layout_marginBottom="5dp"
                 android:src="@android:drawable/arrow_up_float"/>
-            <TextView
+            <EditText
                 android:id="@+id/jump_hours"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
@@ -47,6 +47,8 @@
                 android:text="00"
                 android:textSize="20sp"
                 android:focusable="true"
+                android:background="@android:color/transparent"
+                android:inputType="number"
                 android:nextFocusRight="@+id/jump_minutes"
                 android:nextFocusLeft="@+id/jump_sign"/>
             <ImageView
@@ -80,16 +82,18 @@
                 android:layout_marginBottom="5dp"
                 android:focusable="true"
                 android:src="@android:drawable/arrow_up_float"/>
-            <TextView
+            <EditText
                 android:id="@+id/jump_minutes"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_margin="5dp"
                 android:nextFocusLeft="@+id/jump_hours"
                 android:nextFocusRight="@+id/jump_seconds"
+                android:inputType="number"
                 android:maxLength="2"
                 android:text="00"
                 android:textSize="20sp"
+                android:background="@android:color/transparent"
                 android:focusable="true"/>
             <ImageView
                 android:id="@+id/jump_minutes_down"
@@ -122,7 +126,7 @@
                 android:layout_height="wrap_content"
                 android:focusable="true"
                 android:src="@android:drawable/arrow_up_float"/>
-            <TextView
+            <EditText
                 android:id="@+id/jump_seconds"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
@@ -133,9 +137,11 @@
                 android:text="00"
                 android:textSize="20sp"
                 android:textColor="@color/darkorange"
+                android:background="@android:color/transparent"
+                android:inputType="number"
                 android:focusable="true">
                     <requestFocus />
-            </TextView>
+            </EditText>
             <ImageView
                 android:id="@+id/jump_seconds_down"
                 android:layout_width="match_parent"
@@ -168,7 +174,7 @@
                 android:layout_marginBottom="5dp"
                 android:focusable="true"
                 android:src="@android:drawable/arrow_up_float"/>
-            <TextView
+            <EditText
                 android:id="@+id/jump_millis"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
@@ -177,6 +183,8 @@
                 android:nextFocusRight="@+id/jump_go"
                 android:maxLength="3"
                 android:text="000"
+                android:background="@android:color/transparent"
+                android:inputType="number"
                 android:textSize="20sp"
                 android:focusable="true"/>
             <ImageView
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioDelayDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioDelayDialog.java
index 38965f0..b3491ef 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioDelayDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioDelayDialog.java
@@ -43,12 +43,11 @@ public class AudioDelayDialog extends PickTimeFragment {
         mMillis.setOnFocusChangeListener(this);
         mMillis.setOnEditorActionListener(this);
 
-        mMinutes.setNextFocusLeftId(R.id.jump_sign);
+        mMinutes.setNextFocusLeftId(R.id.jump_go);
         mActionButton.setNextFocusLeftId(R.id.jump_millis);
         mSign.setNextFocusRightId(R.id.jump_minutes);
 
         mSign.setVisibility(View.VISIBLE);
-        mSign.setOnClickListener(this);
 
         mActionButton.setText(android.R.string.cancel);
         long delay = mLibVLC.getAudioDelay();
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
index 3ecfb7f..bbd07f3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
@@ -52,7 +52,7 @@ public class JumpToTimeDialog extends PickTimeFragment {
             view.findViewById(R.id.jump_hours_text).setVisibility(View.GONE);
             view.findViewById(R.id.jump_hours_container).setVisibility(View.GONE);
         }
-        mMinutes.setNextFocusLeftId(R.id.jump_minutes);
+        mMinutes.setNextFocusLeftId(R.id.jump_go);
         mSeconds.setNextFocusRightId(R.id.jump_go);
         initTime(mLibVLC.getTime()*1000);
         return view;
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
index 3cf52be..ae782ce 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
@@ -21,6 +21,7 @@
  */
 package org.videolan.vlc.gui.dialogs;
 
+import android.content.Context;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
@@ -29,11 +30,14 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
+import android.widget.EditText;
 import android.widget.TextView;
 
 import org.videolan.libvlc.LibVLC;
 import org.videolan.vlc.R;
+import org.videolan.vlc.util.AndroidDevices;
 
 public abstract class PickTimeFragment extends DialogFragment implements DialogInterface.OnKeyListener, View.OnClickListener, View.OnFocusChangeListener, TextView.OnEditorActionListener {
 
@@ -51,7 +55,8 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
     protected static long HOURS_IN_MICROS = 60*MINUTES_IN_MICROS;
 
     protected LibVLC mLibVLC = null;
-    protected TextView mHours, mMinutes, mSeconds, mMillis, mSign;
+    protected EditText mHours, mMinutes, mSeconds, mMillis;
+    protected TextView mSign;
     protected Button mActionButton;
     protected long max = -1;
 
@@ -64,10 +69,10 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
             Bundle savedInstanceState) {
         View view = inflater.inflate(R.layout.jump_to_time, container);
         ((TextView)view.findViewById(R.id.jump_dialog_title)).setText(getTitle());
-        mHours = (TextView) view.findViewById(R.id.jump_hours);
-        mMinutes = (TextView) view.findViewById(R.id.jump_minutes);
-        mSeconds = (TextView) view.findViewById(R.id.jump_seconds);
-        mMillis = (TextView) view.findViewById(R.id.jump_millis);
+        mHours = (EditText) view.findViewById(R.id.jump_hours);
+        mMinutes = (EditText) view.findViewById(R.id.jump_minutes);
+        mSeconds = (EditText) view.findViewById(R.id.jump_seconds);
+        mMillis = (EditText) view.findViewById(R.id.jump_millis);
         mActionButton = (Button) view.findViewById(R.id.jump_go);
         mSign = (TextView) view.findViewById(R.id.jump_sign);
 
@@ -78,6 +83,7 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
         mSeconds.setOnEditorActionListener(this);
 
         mActionButton.setOnClickListener(this);
+        mActionButton.setOnFocusChangeListener(this);
 
         mTextColor = mMinutes.getCurrentTextColor();
 
@@ -107,10 +113,6 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
             case KeyEvent.KEYCODE_DPAD_DOWN:
                 updateViews(keyCode);
                 return true;
-            case KeyEvent.KEYCODE_DPAD_CENTER:
-            case KeyEvent.KEYCODE_ENTER:
-            case KeyEvent.KEYCODE_NUMPAD_ENTER:
-                executeAction();
         }
         return false;
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SubsDelayDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/SubsDelayDialog.java
index 129c1f4..360fe24 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SubsDelayDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SubsDelayDialog.java
@@ -51,9 +51,8 @@ public class SubsDelayDialog extends PickTimeFragment {
 
         mActionButton.setText(android.R.string.cancel);
 
-        mMinutes.setNextFocusLeftId(R.id.jump_sign);
+        mMinutes.setNextFocusLeftId(R.id.jump_go);
         mActionButton.setNextFocusLeftId(R.id.jump_millis);
-        mSign.setNextFocusRightId(R.id.jump_minutes);
 
         long delay = mLibVLC.getSpuDelay();
         if (delay != 0f)
diff --git a/vlc-android/tv/AndroidManifest.xml b/vlc-android/tv/AndroidManifest.xml
index 3ddc1e7..c0ceee4 100644
--- a/vlc-android/tv/AndroidManifest.xml
+++ b/vlc-android/tv/AndroidManifest.xml
@@ -243,7 +243,8 @@
         <activity
             android:name=".gui.video.VideoPlayerActivity"
             tools:node="replace"
-            android:configChanges="orientation|screenSize"
+            android:configChanges="orientation|screenSize|keyboard"
+            android:windowSoftInputMode="adjustPan"
             android:theme="@style/Theme.VLC.Player" >
 
             <!-- This filter captures protocols without type info -->



More information about the Android mailing list