mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-07-01 21:00:40 +08:00
Move Open PCAP file to separate menu item
This feature is not used very often, so it's better to start the capture as the default action. Closes #418
This commit is contained in:
parent
014ee91ed2
commit
28aeae7317
@ -678,7 +678,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if(id == R.id.start_live_capture) {
|
||||
if(id == R.id.action_start) {
|
||||
mStartPressed = true;
|
||||
startCapture();
|
||||
return true;
|
||||
|
||||
@ -68,6 +68,7 @@ public class StatusFragment extends Fragment implements AppStateListener, MenuPr
|
||||
private Menu mMenu;
|
||||
private MenuItem mStartBtn;
|
||||
private MenuItem mStopBtn;
|
||||
private MenuItem mOpenPcap;
|
||||
private ImageView mFilterIcon;
|
||||
private MenuItem mMenuSettings;
|
||||
private TextView mInterfaceInfo;
|
||||
@ -166,6 +167,7 @@ public class StatusFragment extends Fragment implements AppStateListener, MenuPr
|
||||
mStartBtn = mMenu.findItem(R.id.action_start);
|
||||
mStopBtn = mMenu.findItem(R.id.action_stop);
|
||||
mMenuSettings = mMenu.findItem(R.id.action_settings);
|
||||
mOpenPcap = mMenu.findItem(R.id.open_pcap);
|
||||
refreshStatus();
|
||||
}
|
||||
|
||||
@ -312,11 +314,13 @@ public class StatusFragment extends Fragment implements AppStateListener, MenuPr
|
||||
mStopBtn.setEnabled(true);
|
||||
mStopBtn.setVisible(!CaptureService.isAlwaysOnVPN());
|
||||
mMenuSettings.setEnabled(false);
|
||||
mOpenPcap.setEnabled(false);
|
||||
} else { // ready || starting
|
||||
mStopBtn.setVisible(false);
|
||||
mStartBtn.setEnabled(true);
|
||||
mStartBtn.setVisible(!CaptureService.isAlwaysOnVPN());
|
||||
mMenuSettings.setEnabled(true);
|
||||
mOpenPcap.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,17 +7,7 @@
|
||||
android:title="@string/start_button"
|
||||
android:orderInCategory="10"
|
||||
android:icon="@drawable/ic_play_arrow"
|
||||
app:showAsAction="always">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/start_live_capture"
|
||||
android:title="@string/live_capture" />
|
||||
|
||||
<item
|
||||
android:id="@+id/open_pcap"
|
||||
android:title="@string/open_pcap_file" />
|
||||
</menu>
|
||||
</item>
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_stop"
|
||||
@ -33,4 +23,10 @@
|
||||
android:orderInCategory="30"
|
||||
android:icon="@drawable/ic_settings"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/open_pcap"
|
||||
android:title="@string/open_pcap_file"
|
||||
android:enabled="true"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user