private void showMorePopup(
      View v, final GithubComment comment, final boolean canEdit, final boolean canDelete) {
    PopupMenu menu = new PopupMenu(context, v);
    menu.inflate(R.menu.comment_popup);

    menu.getMenu().findItem(R.id.m_edit).setEnabled(canEdit);
    menu.getMenu().findItem(R.id.m_delete).setEnabled(canDelete);

    menu.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem menuItem) {
            switch (menuItem.getItemId()) {
              case R.id.m_edit:
                if (editCommentListener != null) {
                  editCommentListener.onEditComment(comment);
                }
                break;
              case R.id.m_delete:
                if (deleteCommentListener != null) {
                  deleteCommentListener.onDeleteComment(comment);
                }
                break;
            }
            return false;
          }
        });

    menu.show();
  }
 private void showFilterPopup(View v) {
   PopupMenu popup = new PopupMenu(getContext(), v);
   // Inflate the menu from xml
   popup.getMenuInflater().inflate(R.menu.popup_filter, popup.getMenu());
   // Setup menu item selection
   popup.setOnMenuItemClickListener(
       new PopupMenu.OnMenuItemClickListener() {
         public boolean onMenuItemClick(MenuItem item) {
           switch (item.getItemId()) {
             case R.id.profile:
               Intent intent = new Intent(getContext(), MyProfile.class);
               startActivity(intent);
               return true;
             case R.id.logout:
               Toast.makeText(getContext(), "LogOut", Toast.LENGTH_SHORT).show();
               return true;
             default:
               return false;
           }
         }
       });
   // Handle dismissal with: popup.setOnDismissListener(...);
   // Show the menu
   popup.show();
 }
  @Override
  public void call(final Subscriber<? super MenuItem> subscriber) {
    verifyMainThread();

    PopupMenu.OnMenuItemClickListener listener =
        new PopupMenu.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            if (!subscriber.isUnsubscribed()) {
              subscriber.onNext(item);
            }
            return true;
          }
        };

    view.setOnMenuItemClickListener(listener);

    subscriber.add(
        new MainThreadSubscription() {
          @Override
          protected void onUnsubscribe() {
            view.setOnMenuItemClickListener(null);
          }
        });
  }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.instanceMore:
       final PopupMenu menu = new PopupMenu(context, v, Gravity.END);
       String[] options = context.getResources().getStringArray(R.array.queue_options_playlist);
       for (int i = 0; i < options.length; i++) {
         menu.getMenu().add(Menu.NONE, i, i, options[i]);
       }
       menu.setOnMenuItemClickListener(
           new PopupMenu.OnMenuItemClickListener() {
             @Override
             public boolean onMenuItemClick(MenuItem menuItem) {
               switch (menuItem.getItemId()) {
                 case 0: // Queue this playlist next
                   PlayerController.queueNext(Library.getPlaylistEntries(context, reference));
                   return true;
                 case 1: // Queue this playlist last
                   PlayerController.queueLast(Library.getPlaylistEntries(context, reference));
                   return true;
                 case 2: // Delete this playlist
                   Library.removePlaylist(itemView, reference);
                   return true;
               }
               return false;
             }
           });
       menu.show();
       break;
     default:
       Navigate.to(context, PlaylistActivity.class, PlaylistActivity.PLAYLIST_EXTRA, reference);
       break;
   }
 }
 @Override
 public void onClick(View v) {
   if ((v.getId() == editProfileImageText.getId()) || (v.getId() == profileImage.getId())) {
     popupMenu = new PopupMenu(getActivity(), v);
     popupMenu
         .getMenuInflater()
         .inflate(R.menu.edit_profile_edit_picture_dropdown, popupMenu.getMenu());
     popupMenu.setOnMenuItemClickListener(
         new OnMenuItemClickListener() {
           @Override
           public boolean onMenuItemClick(MenuItem item) {
             if (item.getTitle().toString().equalsIgnoreCase("From Camera")) {
               /* TODO */
             } else if (item.getTitle().toString().equalsIgnoreCase("From Gallery")) {
               /* TODO */
             }
             popupMenu.dismiss();
             return true;
           }
         });
     popupMenu.show();
   } else if (v.getId() == submitButton.getId()) {
     if (IsValid()) {
       PostToServer();
     }
   }
 }
 @Override
 public void itemClicked(View v, final int position) {
   clickedPosition = position;
   if (v instanceof RelativeLayout) {
     String videoUrl = videoList.get(position).player;
     UrlHelper.playVideo(getActivity(), videoUrl);
   } else if (v instanceof ImageButton) {
     PopupMenu popupMenu = new PopupMenu(getActivity(), v);
     if (isMy) {
       popupMenu.inflate(R.menu.popup_menu_my_video);
     } else {
       popupMenu.inflate(R.menu.popup_menu_video);
     }
     popupMenu.setOnMenuItemClickListener(
         item -> {
           switch (item.getItemId()) {
             case R.id.add:
               AdditionRequests.addVideo(getActivity(), videoList.get(position));
               return true;
             case R.id.add_to_album:
               AdditionRequests.addVideoToAlbum(getFragmentManager(), videoList.get(position));
               return true;
             case R.id.delete:
               showDeleteDialog();
               return true;
             default:
               return false;
           }
         });
     popupMenu.show();
   }
 }
    protected void showPopup(final Experiment experiment, View v) {
      PopupMenu popup = new PopupMenu(MyExperimentsActivity.this, v);
      final Menu menu = popup.getMenu();
      popup.getMenuInflater().inflate(R.menu.experiment_popup, menu);

      if (!userCanEditAtLeastOneSchedule(experiment)) {
        menu.removeItem(R.id.editSchedule);
      }
      popup.show();
      popup.setOnMenuItemClickListener(
          new PopupMenu.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {

              switch (item.getItemId()) {
                case R.id.editSchedule:
                  launchScheduleDetailScreen(experiment);
                  break;
                case R.id.emailResearcher:
                  emailResearcher(experiment);
                  break;
                case R.id.stopExperiment:
                  deleteExperiment(experiment);
                  break;
                default:
                  break;
              }

              return true;
            }
          });
    }
  public void showMenu(View v) {
    PopupMenu popup = new PopupMenu(getActivity(), v);

    // This activity implements OnMenuItemClickListener
    popup.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            return false;
          }
        });
    popup.inflate(R.menu.share_menu);
    popup.show();
  }
Exemple #9
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.instanceMore:
       final PopupMenu menu = new PopupMenu(context, v, Gravity.END);
       String[] options = context.getResources().getStringArray(R.array.queue_options_genre);
       for (int i = 0; i < options.length; i++) {
         menu.getMenu().add(Menu.NONE, i, i, options[i]);
       }
       menu.setOnMenuItemClickListener(this);
       menu.show();
       break;
     default:
       Navigate.to(context, GenreActivity.class, GenreActivity.GENRE_EXTRA, reference);
       break;
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.camera_list);
    mLayoutInflater = LayoutInflater.from(this);
    mCameraListView = (ListView) findViewById(R.id.cameraList);
    TextView titleView = (TextView) findViewById(R.id.title);
    titleView.setText(R.string.app_name);
    mMenuView = (ImageView) findViewById(R.id.menu);
    mMenuView.setVisibility(View.VISIBLE);
    mMenuView.setOnClickListener(this);
    mMenu = new PopupMenu(this, mMenuView);
    MenuInflater inflater = mMenu.getMenuInflater();
    inflater.inflate(R.menu.popup_menu, mMenu.getMenu());
    mMenu.setOnMenuItemClickListener(this);

    mViewer = Viewer.getViewer();
    mMyViewerHelper = MyViewerHelper.getInstance(getApplicationContext());
    mMyViewerHelper.addCameraStateListener(this);
    mCameraDefaulThumb = BitmapFactory.decodeResource(getResources(), R.drawable.avs_type_android);

    mCameraInfoManager = new CameraInfoManager(this);
    mCameraInfos = mMyViewerHelper.getAllCameraInfos();
    for (CameraInfo info : mCameraInfos) {
      addStreamer(info.getCid(), info.getCameraUser(), info.getCameraPwd());
    }
    mCameraListAdapter = new CameraListAdapter(this, mCameraInfos);
    mCameraListView.setAdapter(mCameraListAdapter);
    mCameraListView.setOnItemClickListener(this);

    mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());

    // update
    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.update(this);

    // admob ad
    RelativeLayout adContainer = (RelativeLayout) findViewById(R.id.adLayout);
    AdView ad = new AdView(this, AdSize.BANNER, AD_UNIT_ID);
    // .addTestDevice("703C305FC29B7ED91BD7625874CFDEBC")
    ad.loadAd(new AdRequest());
    adContainer.addView(ad);
  }
Exemple #11
0
 public void showPopUp(View v, Todo todo, int position) {
   PopupMenu popup = new PopupMenu(mContext, v);
   popup.setOnMenuItemClickListener(
       new PopupMenu.OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           switch (item.getItemId()) {
             case R.id.remove_todo:
               listener.onDeleteClick(todo, position);
               return true;
             case R.id.share_todo:
               listener.onShareClick(todo);
               return true;
             default:
               return false;
           }
         }
       });
   popup.inflate(R.menu.menu_popup_todo);
   popup.show();
 }
  @Override
  public void onClick(View v) {
    if (v == playPauseButton) {
      PlayerController.togglePlay();
    } else if (v == skipPrevButton) {
      PlayerController.previous();
    } else if (v == skipNextButton) {
      PlayerController.skip();
    } else if (v == moreInfoButton) {
      // Song info
      final Song nowPlaying = PlayerController.getNowPlaying();

      if (nowPlaying != null) {
        final PopupMenu menu = new PopupMenu(getContext(), v, Gravity.END);
        String[] options = getResources().getStringArray(R.array.now_playing_options);

        for (int i = 0; i < options.length; i++) {
          menu.getMenu().add(Menu.NONE, i, i, options[i]);
        }
        menu.setOnMenuItemClickListener(this);
        menu.show();
      }
    }
  }
  private static void showPopupMenu(final View v, final Object context) {

    if (ActivityFactory.getMainActivity().getCurrentUser() == null) return;

    id_menu = (int) context;
    PopupMenu popupMenu = new PopupMenu(v.getContext(), v);
    popupMenu.inflate(R.menu.menu_item);

    if (ActivityFactory.getMainActivity().getCurrentUser().getPost() == IUser.Posts.Адміністратар)
      popupMenu.getMenu().setGroupVisible(R.id.group_admin, true);
    else {
      // TODO:change admin menu

    }

    popupMenu.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            IItem iItem = ActivityFactory.getMainActivity().getItem(id_menu);
            IUser iUser = ActivityFactory.getMainActivity().getCurrentUser();
            switch (item.getItemId()) {
              case R.id.menu_item_change:
                {
                  if (iItem.getUserId() == iUser.getId()) {
                    Bundle args = new Bundle();
                    args.putInt(IItem.ITEM_PARAM, (int) v.getTag());
                    ActivityFactory.getMainActivity()
                        .openFragment(iMainActivity.Fragments.ItemAdd, true, args);
                  }
                  return true;
                }
              case R.id.menu_item_user_set:
                {
                  Bundle args = new Bundle();
                  args.putInt(IItem.ITEM_PARAM, iItem.getId());
                  ActivityFactory.getMainActivity()
                      .openFragment(iMainActivity.Fragments.Users, true, args);
                  return true;
                }
              case R.id.menu_item_status_set:
                {
                  ActivityFactory.getMainActivity().setTempItem(iItem);
                  ActivityFactory.getMainActivity()
                      .openFragment(iMainActivity.Fragments.Status, true);

                  return true;
                }
              default:
                return false;
            }
          }
        });

    popupMenu.setOnDismissListener(
        new PopupMenu.OnDismissListener() {

          @Override
          public void onDismiss(PopupMenu menu) {}
        });
    popupMenu.show();
  }
  protected void initialize(Context context, AttributeSet attrs) {
    View view = View.inflate(context, R.layout.view_calculator_output, this);
    mViewHolder = new ViewHolder(view);

    mViewHolder.textViewTransactionDate.setVisibility(View.GONE);
    mViewHolder.textViewCalculatorPrice.setText("");
    mViewHolder.textViewCalculatorProductName.setText("");
    mViewHolder.textViewCurrencyCode.setText(PreferenceHelper.DEFAULT_CURRENCY_CODE);
    mViewHolder.textViewIncomingOrOutgoing.setText("");
    mViewHolder.textViewCurrencyCode.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            FragmentActivity activity = (FragmentActivity) getContext();
            final ChooseCurrencyFragment fragment =
                ChooseCurrencyFragment.newInstance(getCurrencyCode());
            fragment.setOnFragmentDialogDismissListener(
                new OnFragmentDialogDismissListener<String>() {
                  @Override
                  public void onFragmentDialogDismiss(String result) {
                    setCurrencyCode(result);
                    ConfigurationManager.changeDefaultCurrencyCode(getContext(), result);
                  }
                });
            fragment.show(activity.getSupportFragmentManager(), ChooseCurrencyFragment.TAG);
          }
        });
    mViewHolder.textViewTransactionDate.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            EventBus.getDefault().post(new ShowDatePickerEvent(mCalculatorOutputInfo.date));
          }
        });

    mPopupMenu = new PopupMenu(getContext(), mViewHolder.textViewCalculatorProductName);
    mPopupMenu.getMenuInflater().inflate(R.menu.menu_product_name, mPopupMenu.getMenu());
    mPopupMenu.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            if (mCalculatorOutputInfo.product == null) {
              return true;
            }

            switch (item.getItemId()) {
              case R.id.menu_rename_product:
                AppCompatActivity activity = (AppCompatActivity) getContext();
                ProductRenameDialog.showDialog(
                    getContext(),
                    activity.getSupportFragmentManager(),
                    mCalculatorOutputInfo.product);

                return true;
              case R.id.menu_remove_product:
                DialogHelper.showConfirmDialog(
                    getContext(),
                    getContext().getString(R.string.confirm_remove_product),
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        long productId = mCalculatorOutputInfo.product.getId();
                        removeProductAsync(productId);
                      }
                    });

                return true;
              default:
                return false;
            }
          }
        });

    mViewHolder.textViewCalculatorProductName.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String text =
                ((TextView) mViewHolder.textViewCalculatorProductName.getCurrentView())
                    .getText()
                    .toString();
            if (TextUtils.isEmpty(text)) {
              return;
            }

            if (mPopupMenu != null) {
              mPopupMenu.show();
            }
          }
        });
  }
  @NonNull
  @Override
  public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
    final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
    final Context context = builder.getContext();
    mValidator = new TwidereValidator(context);
    final LayoutInflater inflater = LayoutInflater.from(context);
    @SuppressLint("InflateParams")
    final View view = inflater.inflate(R.layout.dialog_status_quote_retweet, null);
    final DummyStatusHolderAdapter adapter = new DummyStatusHolderAdapter(context);
    adapter.setShouldShowAccountsColor(true);
    final IStatusViewHolder holder =
        new StatusViewHolder(adapter, view.findViewById(R.id.item_content));
    final ParcelableStatus status = getStatus();

    assert status != null;

    builder.setView(view);
    builder.setTitle(R.string.retweet_quote_confirm_title);
    if (isMyRetweet(status)) {
      builder.setPositiveButton(R.string.cancel_retweet, this);
    } else if (!status.user_is_protected) {
      builder.setPositiveButton(R.string.retweet, this);
    }
    builder.setNeutralButton(R.string.quote, this);
    builder.setNegativeButton(android.R.string.cancel, null);

    holder.displayStatus(status, null, false, true);

    view.findViewById(R.id.item_menu).setVisibility(View.GONE);
    view.findViewById(R.id.action_buttons).setVisibility(View.GONE);
    view.findViewById(R.id.item_content).setFocusable(false);
    view.findViewById(R.id.comment_container)
        .setVisibility(status.user_is_protected ? View.GONE : View.VISIBLE);
    final ComposeMaterialEditText mEditComment =
        (ComposeMaterialEditText) view.findViewById(R.id.edit_comment);
    mEditComment.setAccountId(status.account_id);

    final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND);
    final EditTextEnterHandler enterHandler =
        EditTextEnterHandler.attach(
            mEditComment,
            new EditTextEnterHandler.EnterListener() {
              @Override
              public boolean shouldCallListener() {
                return true;
              }

              @Override
              public boolean onHitEnter() {
                final AsyncTwitterWrapper twitter = mTwitterWrapper;
                final ParcelableStatus status = getStatus();
                if (twitter == null || status == null) return false;
                retweetOrQuote(twitter, status);
                dismiss();
                return true;
              }
            },
            sendByEnter);
    enterHandler.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            updateTextCount(getDialog(), s, status);
          }

          @Override
          public void afterTextChanged(Editable s) {}
        });
    final View commentMenu = view.findViewById(R.id.comment_menu);

    mPopupMenu =
        new PopupMenu(context, commentMenu, Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle, 0);
    commentMenu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mPopupMenu.show();
          }
        });
    commentMenu.setOnTouchListener(mPopupMenu.getDragToOpenListener());
    mPopupMenu.inflate(R.menu.menu_dialog_comment);
    final Menu menu = mPopupMenu.getMenu();
    MenuUtils.setMenuItemAvailability(
        menu, R.id.quote_original_status, status.retweet_id > 0 || status.quoted_id > 0);
    mPopupMenu.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            if (item.isCheckable()) {
              item.setChecked(!item.isChecked());
              return true;
            }
            return false;
          }
        });

    final Dialog dialog = builder.create();
    dialog.setOnShowListener(
        new DialogInterface.OnShowListener() {
          @Override
          public void onShow(DialogInterface dialog) {
            updateTextCount(dialog, mEditComment.getText(), status);
          }
        });
    return dialog;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mGoogleApiClient =
        new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();

    locationRequest =
        LocationRequest.create()
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
            .setInterval(20000)
            .setFastestInterval(10000);

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    toID = getIntent().getExtras().getInt("toID");
    user = User.getInstance();
    friend = user.getFriendsHashMap().get(String.valueOf(toID));

    popupMenu = new PopupMenu(this, toolbar, Gravity.RIGHT);
    popupMenu.setOnMenuItemClickListener(this);
    popupMenu.inflate(R.menu.popup);

    ImageButton sendButton = (ImageButton) findViewById(R.id.chat_send);
    keyboard = (EditText) findViewById(R.id.chat_keyboard);
    scrollView = (ScrollView) findViewById(R.id.chat_scroll);
    messagesLayout = (LinearLayout) findViewById(R.id.chat_messages);
    userImage = (ImageView) findViewById(R.id.chat_user_image);
    userName = (TextView) findViewById(R.id.chat_user_name);
    ImageButton attachButton = (ImageButton) findViewById(R.id.chat_attach);

    sendButton.setOnClickListener(this);
    attachButton.setOnClickListener(this);

    changeToolBar();

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    String alarms = preferences.getString("message-notification-sound", "default ringtone");

    Uri uri = Uri.parse(alarms);
    ringtone = RingtoneManager.getRingtone(this, uri);

    if (!isStarted) {
      messages = new MessageList();
      LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
      isStarted = true;
      service = new Service();

      try {
        queue.put(service);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      PausableThreadPool executor = new PausableThreadPool(2, 2, 10, TimeUnit.SECONDS, queue);
      executor.execute(service);

      threadReceiver = new Thread(Receiver);
      threadReceiver.start();
    } else {
      while (threadReceiver.isAlive()) {
        threadReceiver.interrupt();
      }

      threadReceiver = new Thread(Receiver);
      threadReceiver.start();
    }

    loadDBMessages();

    try {
      scrollView.post(
          new Runnable() {
            @Override
            public void run() {
              scrollView.fullScroll(View.FOCUS_DOWN);
            }
          });
    } catch (Exception e) {
      e.printStackTrace();
    }

    loadImage();
  }
  @Override
  public void onClick(View v) {
    if (v.getId() == tv_fullname.getId() || v.getId() == tv_username.getId()) {
      // GOTO PROFILE WHEN NAME OR USERNAME IS CLICKED
      Intent i = new Intent(context, ProfileActivity.class);
      i.putExtra("UserId", userId);
      context.startActivity(i);
    } else if (v.getId() == R.id.pt_commentBtn) {
      Intent i = new Intent(context, CommentActivity.class);
      i.putExtra("PostId", postId);
      i.putExtra("FullName", tv_fullname.getText().toString());
      i.putExtra("isOwned", owned);
      context.startActivity(i);
      ((Activity) context).overridePendingTransition(R.animator.animate3, R.animator.animate2);
    } else if (v.getId() == R.id.pt_shareBtn) {
      Intent i = new Intent(context, ShareActivity.class);
      if (share_postId.equals("")) i.putExtra("PostId", postId);
      else i.putExtra("PostId", share_postId);
      i.putExtra("OwnerId", schoolId);
      context.startActivity(i);
      ((Activity) context).overridePendingTransition(R.animator.animate3, R.animator.animate2);
    } else if (v.getId() == upvote.getId()) {
      upvote.setVisibility(View.INVISIBLE);
      upvote2.setVisibility(View.VISIBLE);
      Intent intent = new Intent(context, UpvoteService.class);
      intent.putExtra("userId", schoolId);
      intent.putExtra("postId", postId);
      context.startService(intent);
    } else if (v.getId() == upvote2.getId()) {
      upvote2.setVisibility(View.INVISIBLE);
      upvote.setVisibility(View.VISIBLE);

      Intent intent = new Intent(context, UpvoteService.class);
      intent.putExtra("userId", schoolId);
      intent.putExtra("postId", postId);
      context.startService(intent);
    } else if (v.getId() == options.getId()) {
      // Creating the instance of PopupMenu
      PopupMenu popup = new PopupMenu(context, options);
      // Inflating the Popup using xml file
      if (owned) {
        popup.getMenuInflater().inflate(R.menu.menu_options, popup.getMenu());
      } else {
        popup.getMenuInflater().inflate(R.menu.menu_options2, popup.getMenu());
      }

      // registering popup with OnMenuItemClickListener
      popup.setOnMenuItemClickListener(
          new PopupMenu.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              if (item.getTitle().equals("Report")) {
                Intent i = new Intent(context, ReportActivity.class);
                i.putExtra("PostId", postId);
                i.putExtra("ReporterId", schoolId);
                i.putExtra("ReferenceTable", "post");
                context.startActivity(i);
              } else if (item.getTitle().equals("Edit")) {
                Intent i = new Intent(context, EditPostActivity.class);
                i.putExtra("PostId", postId);
                context.startActivity(i);
              } else {
                Intent i = new Intent(context, DeleteService.class);
                i.putExtra("PostId", postId);
                i.putExtra("Action", "post");
                context.startService(i);
              }
              return true;
            }
          });

      popup.show(); // showing popup menu
    } else if (v.getId() == fileCV.getId()) {
      Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(fileUrl));
      context.startActivity(browserIntent);

    } else if (v.getId() == share_file_name.getId()) {
      Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(shareFileUrl));
      context.startActivity(browserIntent);
    } else {
      // GOTO VIEW POST
      Intent i = new Intent(context, PostViewActivity.class);
      i.putExtra("PostId", postId);
      context.startActivity(i);
    }
  }