Remove unused classes

This commit is contained in:
serso 2016-01-31 10:37:42 +01:00
parent 030a93cce5
commit 5f4d545511
10 changed files with 6 additions and 509 deletions

View File

@ -125,10 +125,6 @@
android:label="@string/cpp_purchase_title" android:label="@string/cpp_purchase_title"
android:theme="@style/Cpp.Theme.Material.Dialog" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity
android:name=".CalculatorDialogActivity"
android:theme="@style/Cpp.Theme.Material.Dialog" />
<!-- todo serso: strings--> <!-- todo serso: strings-->
<activity <activity
android:name=".matrix.CalculatorMatrixActivity" android:name=".matrix.CalculatorMatrixActivity"

View File

@ -287,18 +287,6 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}); });
} }
break; break;
case show_message_dialog:
final DialogData dialogData = (DialogData) data;
if (dialogData != null) {
App.getUiThreadExecutor().execute(new Runnable() {
@Override
public void run() {
CalculatorDialogActivity.showDialog(context, dialogData);
}
});
}
break;
} }
} }
} }

View File

@ -1,151 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v7.app.ActionBarActivity;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.solovyev.android.Android;
import org.solovyev.android.fragments.FragmentUtils;
import org.solovyev.common.msg.MessageType;
import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 1/20/13
* Time: 12:50 PM
*/
public class CalculatorDialogActivity extends ActionBarActivity {
@Nonnull
private static final String TAG = CalculatorDialogActivity.class.getSimpleName();
@Nonnull
private static final String DIALOG_DATA_EXTRA = "dialog_data";
public static void showDialog(@Nonnull Context context, @Nonnull DialogData dialogData) {
final Intent intent = new Intent();
intent.setClass(context, CalculatorDialogActivity.class);
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
@Nullable
private static DialogData readDialogData(@Nullable Intent in) {
if (in != null) {
final Parcelable parcelable = in.getParcelableExtra(DIALOG_DATA_EXTRA);
if (parcelable instanceof DialogData) {
return (DialogData) parcelable;
}
}
return null;
}
@Nullable
private static DialogData readDialogData(@Nullable Bundle in) {
if (in != null) {
final Parcelable parcelable = in.getParcelable(DIALOG_DATA_EXTRA);
if (parcelable instanceof DialogData) {
return (DialogData) parcelable;
}
}
return null;
}
@Override
protected void onCreate(@Nullable Bundle in) {
super.onCreate(in);
final DialogData dialogData = readDialogData(getIntent());
if (dialogData == null) {
this.finish();
} else {
setContentView(R.layout.cpp_dialog);
final String title = dialogData.getTitle();
if (!Strings.isEmpty(title)) {
setTitle(title);
}
final Bundle args = new Bundle();
args.putParcelable(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
FragmentUtils.createFragment(this, CalculatorDialogFragment.class, R.id.dialog_layout, "dialog", args);
}
}
public static class CalculatorDialogFragment extends CalculatorFragment {
public CalculatorDialogFragment() {
super(CalculatorFragmentType.dialog);
}
@Override
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final DialogData dialogData = readDialogData(getArguments());
if (dialogData != null) {
final TextView messageTextView = (TextView) root.findViewById(R.id.cpp_dialog_message_textview);
messageTextView.setMovementMethod(ScrollingMovementMethod.getInstance());
messageTextView.setText(dialogData.getMessage());
if (dialogData.getMessageLevel() == MessageType.error || dialogData.getMessageLevel() == MessageType.warning) {
final Button copyButton = (Button) root.findViewById(R.id.cpp_copy_button);
copyButton.setVisibility(View.VISIBLE);
copyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Locator.getInstance().getClipboard().setText(dialogData.getMessage());
Locator.getInstance().getNotifier().showMessage(CalculatorMessage.newInfoMessage(CalculatorMessages.text_copied));
}
});
}
}
root.findViewById(R.id.cpp_ok_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().finish();
}
});
}
}
}

View File

@ -116,11 +116,6 @@ public enum CalculatorEventType {
show_create_matrix_dialog, show_create_matrix_dialog,
show_create_function_dialog, show_create_function_dialog,
/**
* {@link DialogData}
*/
show_message_dialog,
plot_graph, plot_graph,
/** /**

View File

@ -62,8 +62,6 @@ public enum CalculatorFragmentType {
purchase_dialog(PurchaseDialogActivity.PurchaseDialogFragment.class, R.layout.cpp_purchase_dialog_fragment, R.string.cpp_purchase_title), purchase_dialog(PurchaseDialogActivity.PurchaseDialogFragment.class, R.layout.cpp_purchase_dialog_fragment, R.string.cpp_purchase_title),
dialog(CalculatorDialogActivity.CalculatorDialogFragment.class, R.layout.cpp_dialog_fragment, R.string.cpp_message),
about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about), about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about),
// todo serso: strings // todo serso: strings

View File

@ -1,45 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import org.solovyev.common.msg.MessageLevel;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 1/20/13
* Time: 12:47 PM
*/
public interface DialogData {
@Nonnull
String getMessage();
@Nonnull
MessageLevel getMessageLevel();
@Nullable
String getTitle();
}

View File

@ -1,71 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageLevel;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 1/20/13
* Time: 12:45 PM
*/
public class MessageDialogData implements DialogData {
@Nonnull
private Message message;
@Nullable
private String title;
private MessageDialogData(@Nonnull Message message, @Nullable String title) {
this.message = message;
this.title = title;
}
@Nonnull
public static DialogData newInstance(@Nonnull Message message, @Nullable String title) {
return new MessageDialogData(message, title);
}
@Override
@Nonnull
public String getMessage() {
return message.getLocalizedMessage();
}
@Nonnull
@Override
public MessageLevel getMessageLevel() {
return message.getMessageLevel();
}
@Override
@Nullable
public String getTitle() {
return title;
}
}

View File

@ -1,130 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import org.solovyev.common.msg.MessageLevel;
import org.solovyev.common.msg.MessageType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 1/20/13
* Time: 1:04 PM
*/
public final class ParcelableDialogData implements DialogData, Parcelable {
/*
**********************************************************************
*
* STATIC
*
**********************************************************************
*/
public final static Creator<ParcelableDialogData> CREATOR = new Creator<ParcelableDialogData>() {
@Override
public ParcelableDialogData createFromParcel(@Nonnull Parcel in) {
return fromParcel(in);
}
@Override
public ParcelableDialogData[] newArray(int size) {
return new ParcelableDialogData[size];
}
};
/*
**********************************************************************
*
* FIELDS
*
**********************************************************************
*/
@Nonnull
private DialogData nestedData;
/*
**********************************************************************
*
* CONSTRUCTORS
*
**********************************************************************
*/
public ParcelableDialogData(@Nonnull DialogData nestedData) {
this.nestedData = nestedData;
}
@Nonnull
public static ParcelableDialogData wrap(@Nonnull DialogData nestedData) {
if (nestedData instanceof ParcelableDialogData) {
return ((ParcelableDialogData) nestedData);
} else {
return new ParcelableDialogData(nestedData);
}
}
@Nonnull
public static ParcelableDialogData fromParcel(@Nonnull Parcel in) {
final String message = in.readString();
final MessageType messageType = CalculatorMessages.toMessageType(in.readInt());
final String title = in.readString();
return wrap(StringDialogData.newInstance(message, messageType, title));
}
@Nonnull
@Override
public String getMessage() {
return nestedData.getMessage();
}
@Nonnull
@Override
public MessageLevel getMessageLevel() {
return nestedData.getMessageLevel();
}
@Nullable
@Override
public String getTitle() {
return nestedData.getTitle();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeString(this.getMessage());
out.writeInt(this.getMessageLevel().getMessageLevel());
out.writeString(this.getTitle());
}
}

View File

@ -1,74 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import org.solovyev.common.msg.MessageType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 1/20/13
* Time: 1:01 PM
*/
public class StringDialogData implements DialogData {
@Nonnull
private final String message;
@Nonnull
private final MessageType messageType;
@Nullable
private final String title;
private StringDialogData(@Nonnull String message, @Nonnull MessageType messageType, @Nullable String title) {
this.message = message;
this.messageType = messageType;
this.title = title;
}
@Nonnull
public static DialogData newInstance(@Nonnull String message, @Nonnull MessageType messageType, @Nullable String title) {
return new StringDialogData(message, messageType, title);
}
@Nonnull
@Override
public String getMessage() {
return message;
}
@Nonnull
@Override
public MessageType getMessageLevel() {
return messageType;
}
@Nullable
@Override
public String getTitle() {
return title;
}
}

View File

@ -23,9 +23,8 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.content.Context; import android.content.Context;
import com.squareup.otto.Bus; import com.squareup.otto.Bus;
import jscl.JsclMathEngine;
import org.junit.Assert; import org.junit.Assert;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.robolectric.fakes.RoboSharedPreferences; import org.robolectric.fakes.RoboSharedPreferences;
@ -36,12 +35,9 @@ import org.solovyev.android.calculator.operators.OperatorsRegistry;
import org.solovyev.android.calculator.operators.PostfixFunctionsRegistry; import org.solovyev.android.calculator.operators.PostfixFunctionsRegistry;
import org.solovyev.android.calculator.plot.CalculatorPlotter; import org.solovyev.android.calculator.plot.CalculatorPlotter;
import java.io.ByteArrayInputStream; import javax.annotation.Nonnull;
import java.io.ByteArrayOutputStream; import javax.annotation.Nullable;
import java.io.IOException; import java.io.*;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -49,11 +45,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import jscl.JsclMathEngine;
/** /**
* User: serso * User: serso
* Date: 10/7/12 * Date: 10/7/12
@ -105,8 +96,8 @@ public class CalculatorTestUtils {
final VariablesRegistry variablesRegistry = new VariablesRegistry(jsclEngine); final VariablesRegistry variablesRegistry = new VariablesRegistry(jsclEngine);
final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine); final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine);
final OperatorsRegistry operatorsRegistry = new OperatorsRegistry(jsclEngine.getOperatorsRegistry()); final OperatorsRegistry operatorsRegistry = new OperatorsRegistry(jsclEngine);
final PostfixFunctionsRegistry postfixFunctionsRegistry = new PostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry()); final PostfixFunctionsRegistry postfixFunctionsRegistry = new PostfixFunctionsRegistry(jsclEngine);
return new Engine(jsclEngine, variablesRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry); return new Engine(jsclEngine, variablesRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry);
} }