workers popup menu
This commit is contained in:
parent
d68ad00358
commit
9fca91b847
|
|
@ -5,13 +5,18 @@ import static java.lang.Math.abs;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
|
||||
import com.example.dcav2gui.InstanceInterface;
|
||||
import com.example.dcav2gui.R;
|
||||
import com.example.dcav2gui.ui.exchanges.WorkerData;
|
||||
|
|
@ -120,6 +125,29 @@ public class WorkerCardAdapter{
|
|||
} else {
|
||||
workerStatusString.setText("");
|
||||
}
|
||||
|
||||
// Add long click listener to show the popup menu
|
||||
cardLayout.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
PopupMenu popupMenu = new PopupMenu(v.getContext(), v);
|
||||
MenuInflater inflater = new MenuInflater(v.getContext());
|
||||
inflater.inflate(R.menu.worker_popup_menu,popupMenu.getMenu());
|
||||
popupMenu.setOnMenuItemClickListener(new android.widget.PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
if (item.getItemId() == R.id.today_this_month_details) {
|
||||
// Handle the "Details..." option
|
||||
// For example, navigate to a details fragment
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popupMenu.show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static String formatSeconds(double seconds) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:longClickable="true">
|
||||
<LinearLayout
|
||||
android:id="@+id/workerCard"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Reference in New Issue