Unnecessary try/finally removed

This commit is contained in:
serso 2016-01-10 12:29:05 +01:00
parent bf24414690
commit 666c3730bc

View File

@ -31,14 +31,12 @@ import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.widget.EditText; import android.widget.EditText;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService; import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService;
import java.lang.reflect.Method;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.reflect.Method;
public class EditorView extends EditText { public class EditorView extends EditText {
@ -85,20 +83,16 @@ public class EditorView extends EditText {
public void setState(@Nonnull final EditorState state) { public void setState(@Nonnull final EditorState state) {
Check.isMainThread(); Check.isMainThread();
try { // we don't want to be notified about changes we make ourselves
// we don't want to be notified about changes we make ourselves reportChanges = false;
reportChanges = false; if (App.getTheme().light && getContext() instanceof CalculatorOnscreenService) {
if (App.getTheme().light && getContext() instanceof CalculatorOnscreenService) { // don't need formatting
// don't need formatting setText(state.getTextString());
setText(state.getTextString()); } else {
} else { setText(state.text, BufferType.EDITABLE);
setText(state.text, BufferType.EDITABLE);
}
final int selection = Editor.clamp(state.selection, length());
setSelection(selection);
} finally {
reportChanges = true;
} }
setSelection(Editor.clamp(state.selection, length()));
reportChanges = true;
} }
@Override @Override