kopia lustrzana https://github.com/olgamiller/SSTVEncoder2
Avoided switch usage for Resource IDs
(because of a warning that Resource IDs will be/are non-final)pull/15/head
rodzic
817d8cb73f
commit
556a392816
|
@ -200,21 +200,18 @@ public class EditTextActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
switch (parent.getId()) {
|
int parentId = parent.getId();
|
||||||
case R.id.edit_text_size:
|
if (parentId == R.id.edit_text_size) {
|
||||||
mLabel.setTextSize(positionToTextSize(position));
|
mLabel.setTextSize(positionToTextSize(position));
|
||||||
break;
|
}
|
||||||
case R.id.edit_outline_size:
|
else if (parentId == R.id.edit_outline_size) {
|
||||||
mLabel.setOutlineSize(positionToOutlineSize(position));
|
mLabel.setOutlineSize(positionToOutlineSize(position));
|
||||||
break;
|
}
|
||||||
case R.id.edit_font_family:
|
else if (parentId == R.id.edit_font_family) {
|
||||||
String displayName = mFontFamilyNameList.get(position);
|
String displayName = mFontFamilyNameList.get(position);
|
||||||
mSelectedFontFamily = mFontFamilySet.getFontFamilyFromDisplayName(displayName);
|
mSelectedFontFamily = mFontFamilySet.getFontFamilyFromDisplayName(displayName);
|
||||||
mLabel.setFamilyName(mSelectedFontFamily.name);
|
mLabel.setFamilyName(mSelectedFontFamily.name);
|
||||||
updateBoldAndItalic();
|
updateBoldAndItalic();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,8 +255,8 @@ public class EditTextActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int id = item.getItemId();
|
||||||
case R.id.action_done:
|
if (id == R.id.action_done) {
|
||||||
done();
|
done();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,35 +325,33 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int id = item.getItemId();
|
||||||
case R.id.action_pick_picture:
|
if (id == R.id.action_pick_picture) {
|
||||||
dispatchPickPictureIntent();
|
dispatchPickPictureIntent();
|
||||||
return true;
|
}
|
||||||
case R.id.action_take_picture:
|
else if (id == R.id.action_take_picture) {
|
||||||
takePicture();
|
takePicture();
|
||||||
return true;
|
}
|
||||||
case R.id.action_save_wave:
|
else if (id == R.id.action_save_wave) {
|
||||||
if (needsRequestWritePermission())
|
if (needsRequestWritePermission())
|
||||||
requestWritePermission(REQUEST_SAVE_WAVE_PERMISSION);
|
requestWritePermission(REQUEST_SAVE_WAVE_PERMISSION);
|
||||||
else
|
else
|
||||||
save();
|
save();
|
||||||
return true;
|
}
|
||||||
case R.id.action_play:
|
else if (id == R.id.action_play) {
|
||||||
play();
|
play();
|
||||||
return true;
|
}
|
||||||
case R.id.action_stop:
|
else if (id == R.id.action_stop) {
|
||||||
mEncoder.stop();
|
mEncoder.stop();
|
||||||
return true;
|
}
|
||||||
case R.id.action_rotate:
|
else if (id == R.id.action_rotate) {
|
||||||
mCropView.rotateImage(90);
|
mCropView.rotateImage(90);
|
||||||
return true;
|
}
|
||||||
case R.id.action_modes:
|
else if (id != R.id.action_modes) {
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
String className = item.getIntent().getStringExtra(CLASS_NAME);
|
String className = item.getIntent().getStringExtra(CLASS_NAME);
|
||||||
setMode(className);
|
setMode(className);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMode(String modeClassName) {
|
private void setMode(String modeClassName) {
|
||||||
|
|
Ładowanie…
Reference in New Issue