Loading res/layout/gesture_preference.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ </LinearLayout> <LinearLayout android:id="@+id/gesture_animation_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/gestures_setting_background_color" Loading @@ -58,7 +59,6 @@ android:orientation="horizontal"> <com.android.settings.widget.AspectRatioFrameLayout android:id="@+id/gesture_animation_frame" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" Loading src/com/android/settings/gestures/GesturePreference.java +10 −10 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public final class GesturePreference extends SwitchPreference implements public GesturePreference(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; setLayoutResource(R.layout.gesture_preference); TypedArray attributes = context.getTheme().obtainStyledAttributes( attrs, R.styleable.GesturePreference, Loading @@ -70,7 +69,8 @@ public final class GesturePreference extends SwitchPreference implements .appendPath(String.valueOf(animation)) .build(); mMediaPlayer = MediaPlayer.create(mContext, mVideoPath); if (mMediaPlayer != null) { if (mMediaPlayer != null && mMediaPlayer.getDuration() > 0) { setLayoutResource(R.layout.gesture_preference); mMediaPlayer.setOnSeekCompleteListener(new MediaPlayer.OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mp) { Loading @@ -84,9 +84,8 @@ public final class GesturePreference extends SwitchPreference implements mediaPlayer.setLooping(true); } }); } mAnimationAvailable = true; } } catch (Exception e) { Log.w(TAG, "Animation resource not found. Will not show animation."); } finally { Loading @@ -97,16 +96,15 @@ public final class GesturePreference extends SwitchPreference implements @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video); final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image); final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button); final View animationFrame = holder.findViewById(R.id.gesture_animation_frame); if (!mAnimationAvailable) { animationFrame.setVisibility(View.GONE); return; } final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video); final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image); final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button); video.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Loading Loading @@ -182,8 +180,10 @@ public final class GesturePreference extends SwitchPreference implements } void loadPreview(LoaderManager manager, int id) { if (mAnimationAvailable) { Loader<Bitmap> loader = manager.initLoader(id, Bundle.EMPTY, this); } } void onViewVisible() { if (mVideoReady && mMediaPlayer != null && !mMediaPlayer.isPlaying()) { Loading Loading
res/layout/gesture_preference.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ </LinearLayout> <LinearLayout android:id="@+id/gesture_animation_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/gestures_setting_background_color" Loading @@ -58,7 +59,6 @@ android:orientation="horizontal"> <com.android.settings.widget.AspectRatioFrameLayout android:id="@+id/gesture_animation_frame" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" Loading
src/com/android/settings/gestures/GesturePreference.java +10 −10 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public final class GesturePreference extends SwitchPreference implements public GesturePreference(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; setLayoutResource(R.layout.gesture_preference); TypedArray attributes = context.getTheme().obtainStyledAttributes( attrs, R.styleable.GesturePreference, Loading @@ -70,7 +69,8 @@ public final class GesturePreference extends SwitchPreference implements .appendPath(String.valueOf(animation)) .build(); mMediaPlayer = MediaPlayer.create(mContext, mVideoPath); if (mMediaPlayer != null) { if (mMediaPlayer != null && mMediaPlayer.getDuration() > 0) { setLayoutResource(R.layout.gesture_preference); mMediaPlayer.setOnSeekCompleteListener(new MediaPlayer.OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mp) { Loading @@ -84,9 +84,8 @@ public final class GesturePreference extends SwitchPreference implements mediaPlayer.setLooping(true); } }); } mAnimationAvailable = true; } } catch (Exception e) { Log.w(TAG, "Animation resource not found. Will not show animation."); } finally { Loading @@ -97,16 +96,15 @@ public final class GesturePreference extends SwitchPreference implements @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video); final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image); final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button); final View animationFrame = holder.findViewById(R.id.gesture_animation_frame); if (!mAnimationAvailable) { animationFrame.setVisibility(View.GONE); return; } final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video); final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image); final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button); video.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Loading Loading @@ -182,8 +180,10 @@ public final class GesturePreference extends SwitchPreference implements } void loadPreview(LoaderManager manager, int id) { if (mAnimationAvailable) { Loader<Bitmap> loader = manager.initLoader(id, Bundle.EMPTY, this); } } void onViewVisible() { if (mVideoReady && mMediaPlayer != null && !mMediaPlayer.isPlaying()) { Loading