// Path: serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java
// public abstract class AbstractPosterImageGalleryAdapter extends InjectingRecyclerViewAdapter implements
//     View.OnKeyListener {
// 
//   protected static List<VideoContentInfo> posterList = null;
//   protected Handler handler;
//   protected AbstractVideoOnItemClickListener onItemClickListener;
//   protected AbstractVideoOnItemSelectedListener onItemSelectedListener;
//   protected boolean triggerFocusSelection = true;
// 
//   private Animation scaleSmallAnimation;
//   private Animation scaleBigAnimation;
// 
//   public AbstractPosterImageGalleryAdapter() {
//     posterList = new ArrayList<>();
//   }
// 
//   @Override public int getItemCount() {
//     return posterList.size();
//   }
// 
//   public Object getItem(int position) {
//     if (position < posterList.size()) {
//       return posterList.get(position);
//     }
// 
//     return posterList.get(0);
//   }
// 
//   @Override public long getItemId(int position) {
//     return position;
//   }
// 
// 
//   public List<VideoContentInfo> getItems() {
//     return posterList;
//   }
// 
//   public AbstractVideoOnItemClickListener getOnItemClickListener() {
//     return onItemClickListener;
//   }
// 
//   public void setOnItemClickListener(AbstractVideoOnItemClickListener onItemClickListener) {
//     this.onItemClickListener = onItemClickListener;
//   }
// 
//   public AbstractVideoOnItemSelectedListener getOnItemSelectedListener() {
//     return onItemSelectedListener;
//   }
// 
//   public void setOnItemSelectedListener(AbstractVideoOnItemSelectedListener onItemSelectedListener) {
//     this.onItemSelectedListener = onItemSelectedListener;
//   }
// 
//   protected void zoomIn(View view) {
//     view.clearAnimation();
//     if (scaleSmallAnimation == null) {
//       scaleSmallAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.anim_scale_small);
//     }
//     view.startAnimation(scaleSmallAnimation);
//   }
// 
//   protected void zoomOut(View view) {
//     if (scaleBigAnimation == null) {
//       scaleBigAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.anim_scale_big);
//     }
//     view.startAnimation(scaleBigAnimation);
//   }
// 
//   public boolean onKey(View v, int keyCode, KeyEvent event) {
//     triggerFocusSelection = true;
// 
//     if (event.getAction() == KeyEvent.ACTION_UP  && isDirectionalPadKeyCode(keyCode)) {
//       v.setBackground(ContextCompat.getDrawable(v.getContext(), R.drawable.rounded_transparent_border));
//       return true;
//     }
// 
//     if (event.getRepeatCount() > 1 && isDirectionalPadKeyCode(keyCode)) {
//       triggerFocusSelection = false;
//     }
// 
//     return false;
//   }
// 
//   protected boolean isDirectionalPadKeyCode(int keyCode) {
//     return keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
//     keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
//     keyCode == KeyEvent.KEYCODE_DPAD_UP ||
//     keyCode == KeyEvent.KEYCODE_DPAD_DOWN;
//   }
// }


import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import us.nineworlds.serenity.R;
import us.nineworlds.serenity.core.menus.DialogMenuItem;
import us.nineworlds.serenity.ui.adapters.AbstractPosterImageGalleryAdapter;
import us.nineworlds.serenity.ui.listeners.GalleryVideoOnItemLongClickListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;
/**
 * The MIT License (MIT)
 * Copyright (c) 2012 David Carver
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * <p>
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * <p>
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package us.nineworlds.serenity.ui.browser.tv.episodes;


public class EpisodeBrowserOnLongClickListener extends GalleryVideoOnItemLongClickListener {

  public EpisodeBrowserOnLongClickListener(AbstractPosterImageGalleryAdapter adapter) {
    super(adapter);
  }

  @Override public boolean onItemLongClick() {
    context = (Activity) vciv.getContext();

    dialog = new Dialog(context);
    AlertDialog.Builder builder =
        new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.AppTheme));
    builder.setTitle(context.getString(R.string.video_options));

    ListView modeList = new ListView(context);
    modeList.setSelector(R.drawable.menu_item_selector);
    ArrayList<DialogMenuItem> options = addMenuOptions();

    ArrayAdapter<DialogMenuItem> modeAdapter =
        new ArrayAdapter<DialogMenuItem>(context, R.layout.simple_list_item, R.id.list_item_text,
// Path: serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java
// public abstract class AbstractPosterImageGalleryAdapter extends InjectingRecyclerViewAdapter implements
//     View.OnKeyListener {
// 
//   protected static List<VideoContentInfo> posterList = null;
//   protected Handler handler;
//   protected AbstractVideoOnItemClickListener onItemClickListener;
//   protected AbstractVideoOnItemSelectedListener onItemSelectedListener;
//   protected boolean triggerFocusSelection = true;
// 
//   private Animation scaleSmallAnimation;
//   private Animation scaleBigAnimation;
// 
//   public AbstractPosterImageGalleryAdapter() {
//     posterList = new ArrayList<>();
//   }
// 
//   @Override public int getItemCount() {
//     return posterList.size();
//   }
// 
//   public Object getItem(int position) {
//     if (position < posterList.size()) {
//       return posterList.get(position);
//     }
// 
//     return posterList.get(0);
//   }
// 
//   @Override public long getItemId(int position) {
//     return position;
//   }
// 
// 
//   public List<VideoContentInfo> getItems() {
//     return posterList;
//   }
// 
//   public AbstractVideoOnItemClickListener getOnItemClickListener() {
//     return onItemClickListener;
//   }
// 
//   public void setOnItemClickListener(AbstractVideoOnItemClickListener onItemClickListener) {
//     this.onItemClickListener = onItemClickListener;
//   }
// 
//   public AbstractVideoOnItemSelectedListener getOnItemSelectedListener() {
//     return onItemSelectedListener;
//   }
// 
//   public void setOnItemSelectedListener(AbstractVideoOnItemSelectedListener onItemSelectedListener) {
//     this.onItemSelectedListener = onItemSelectedListener;
//   }
// 
//   protected void zoomIn(View view) {
//     view.clearAnimation();
//     if (scaleSmallAnimation == null) {
//       scaleSmallAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.anim_scale_small);
//     }
//     view.startAnimation(scaleSmallAnimation);
//   }
// 
//   protected void zoomOut(View view) {
//     if (scaleBigAnimation == null) {
//       scaleBigAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.anim_scale_big);
//     }
//     view.startAnimation(scaleBigAnimation);
//   }
// 
//   public boolean onKey(View v, int keyCode, KeyEvent event) {
//     triggerFocusSelection = true;
// 
//     if (event.getAction() == KeyEvent.ACTION_UP  && isDirectionalPadKeyCode(keyCode)) {
//       v.setBackground(ContextCompat.getDrawable(v.getContext(), R.drawable.rounded_transparent_border));
//       return true;
//     }
// 
//     if (event.getRepeatCount() > 1 && isDirectionalPadKeyCode(keyCode)) {
//       triggerFocusSelection = false;
//     }
// 
//     return false;
//   }
// 
//   protected boolean isDirectionalPadKeyCode(int keyCode) {
//     return keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
//     keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
//     keyCode == KeyEvent.KEYCODE_DPAD_UP ||
//     keyCode == KeyEvent.KEYCODE_DPAD_DOWN;
//   }
// }


// Path: serenity-app/src/main/java/us/nineworlds/serenity/ui/browser/tv/episodes/EpisodeBrowserOnLongClickListener.java
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import us.nineworlds.serenity.R;
import us.nineworlds.serenity.core.menus.DialogMenuItem;
import us.nineworlds.serenity.ui.adapters.AbstractPosterImageGalleryAdapter;
import us.nineworlds.serenity.ui.listeners.GalleryVideoOnItemLongClickListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;

/**
 * The MIT License (MIT)
 * Copyright (c) 2012 David Carver
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * <p>
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * <p>
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package us.nineworlds.serenity.ui.browser.tv.episodes;


public class EpisodeBrowserOnLongClickListener extends GalleryVideoOnItemLongClickListener {

  public EpisodeBrowserOnLongClickListener(AbstractPosterImageGalleryAdapter adapter) {
    super(adapter);
  }

  @Override public boolean onItemLongClick() {
    context = (Activity) vciv.getContext();

    dialog = new Dialog(context);
    AlertDialog.Builder builder =
        new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.AppTheme));
    builder.setTitle(context.getString(R.string.video_options));

    ListView modeList = new ListView(context);
    modeList.setSelector(R.drawable.menu_item_selector);
    ArrayList<DialogMenuItem> options = addMenuOptions();

    ArrayAdapter<DialogMenuItem> modeAdapter =
        new ArrayAdapter<DialogMenuItem>(context, R.layout.simple_list_item, R.id.list_item_text,
            options);