Commit f7476393 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora
Browse files

Fix warning about resource IDs becoming non-final soon

parent 6208e0ba
......@@ -110,14 +110,15 @@ public class ComposeSendActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_clear_compose:
clear();
return true;
case R.id.menu_send_compose:
sendComposed();
default:
return super.onOptionsItemSelected(item);
int id = item.getItemId();
if (id == R.id.menu_clear_compose) {
clear();
return true;
} else if (id == R.id.menu_send_compose) {
sendComposed();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
}
......@@ -183,24 +183,23 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_right_click:
sendRightClick();
return true;
case R.id.menu_middle_click:
sendMiddleClick();
return true;
case R.id.menu_show_keyboard:
showKeyboard();
return true;
case R.id.menu_open_compose_send:
Intent intent = new Intent(this, ComposeSendActivity.class);
intent.putExtra("org.kde.kdeconnect.Plugins.MousePadPlugin.deviceId",deviceId);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
int id = item.getItemId();
if (id == R.id.menu_right_click) {
sendRightClick();
return true;
} else if (id == R.id.menu_middle_click) {
sendMiddleClick();
return true;
} else if (id == R.id.menu_show_keyboard) {
showKeyboard();
return true;
} else if (id == R.id.menu_open_compose_send) {
Intent intent = new Intent(this, ComposeSendActivity.class);
intent.putExtra("org.kde.kdeconnect.Plugins.MousePadPlugin.deviceId", deviceId);
startActivity(intent);
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
......
......@@ -112,15 +112,15 @@ public class PresenterActivity extends AppCompatActivity implements SensorEventL
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.fullscreen:
plugin.sendFullscreen();
return true;
case R.id.exit_presentation:
plugin.sendEsc();
return true;
default:
return super.onContextItemSelected(item);
int id = item.getItemId();
if (id == R.id.fullscreen) {
plugin.sendFullscreen();
return true;
} else if (id == R.id.exit_presentation) {
plugin.sendEsc();
return true;
} else {
return super.onContextItemSelected(item);
}
}
......
......@@ -129,6 +129,7 @@ public class RunCommandActivity extends AppCompatActivity {
cm.setText(url);
Toast toast = Toast.makeText(this, R.string.clipboard_toast, Toast.LENGTH_SHORT);
toast.show();
return true;
}
return false;
}
......
......@@ -465,29 +465,28 @@ public class SftpSettingsFragment
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.delete:
for (int count = preferenceCategory.getPreferenceCount(), i = count - 1; i >= 0; i--) {
StoragePreference preference = (StoragePreference) preferenceCategory.getPreference(i);
if (preference.checkbox.isChecked()) {
SftpPlugin.StorageInfo info = storageInfoList.remove(i);
if (Build.VERSION.SDK_INT >= 21) {
try {
// This throws when trying to release a URI we don't have access to
requireContext().getContentResolver().releasePersistableUriPermission(info.uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
} catch (SecurityException e) {
// Usually safe to ignore, but who knows?
Log.e("SFTP Settings", "Exception", e);
}
if (item.getItemId() == R.id.delete) {
for (int count = preferenceCategory.getPreferenceCount(), i = count - 1; i >= 0; i--) {
StoragePreference preference = (StoragePreference) preferenceCategory.getPreference(i);
if (preference.checkbox.isChecked()) {
SftpPlugin.StorageInfo info = storageInfoList.remove(i);
if (Build.VERSION.SDK_INT >= 21) {
try {
// This throws when trying to release a URI we don't have access to
requireContext().getContentResolver().releasePersistableUriPermission(info.uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
} catch (SecurityException e) {
// Usually safe to ignore, but who knows?
Log.e("SFTP Settings", "Exception", e);
}
}
}
}
handleChangedStorageInfoList();
return true;
default:
return false;
handleChangedStorageInfoList();
return true;
} else {
return false;
}
}
......
......@@ -41,14 +41,12 @@ public class ShareActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
updateComputerListAction();
break;
default:
break;
if (item.getItemId() == R.id.menu_refresh) {
updateComputerListAction();
return true;
} else {
return super.onOptionsItemSelected(item);
}
return true;
}
private void updateComputerListAction() {
......
......@@ -303,21 +303,19 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
updateComputerListAction();
break;
case R.id.menu_custom_device_list:
startActivity(new Intent(mActivity, CustomDevicesActivity.class));
break;
case R.id.menu_trusted_networks:
startActivity(new Intent(mActivity, TrustedNetworksActivity.class));
break;
default:
break;
int id = item.getItemId();
if (id == R.id.menu_refresh) {
updateComputerListAction();
return true;
} else if (id == R.id.menu_custom_device_list) {
startActivity(new Intent(mActivity, CustomDevicesActivity.class));
return true;
} else if (id == R.id.menu_trusted_networks) {
startActivity(new Intent(mActivity, TrustedNetworksActivity.class));
return true;
} else {
return super.onOptionsItemSelected(item);
}
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment