Classes moved
This commit is contained in:
parent
d1e4ca91c6
commit
1a644efd1b
@ -30,6 +30,12 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.UiThreadExecutor;
|
import org.solovyev.android.UiThreadExecutor;
|
||||||
@ -303,4 +309,18 @@ public final class App {
|
|||||||
public static ScreenMetrics getScreenMetrics() {
|
public static ScreenMetrics getScreenMetrics() {
|
||||||
return screenMetrics;
|
return screenMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showDialog(@Nonnull DialogFragment dialogFragment,
|
||||||
|
@Nonnull String fragmentTag,
|
||||||
|
@Nonnull FragmentManager fm) {
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
|
||||||
|
Fragment prev = fm.findFragmentByTag(fragmentTag);
|
||||||
|
if (prev != null) {
|
||||||
|
ft.remove(prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create and show the dialog.
|
||||||
|
dialogFragment.show(ft, fragmentTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ import org.solovyev.android.calculator.math.edit.CalculatorFunctionsActivity;
|
|||||||
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
|
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
|
||||||
import org.solovyev.android.calculator.math.edit.MathEntityRemover;
|
import org.solovyev.android.calculator.math.edit.MathEntityRemover;
|
||||||
import org.solovyev.android.calculator.model.AFunction;
|
import org.solovyev.android.calculator.model.AFunction;
|
||||||
import org.solovyev.android.sherlock.AndroidSherlockUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -210,7 +209,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
|
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
|
||||||
AndroidSherlockUtils.showDialog(create(input), "function-editor", fm);
|
App.showDialog(create(input), "function-editor", fm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Input implements Parcelable {
|
public static class Input implements Parcelable {
|
||||||
|
@ -37,7 +37,6 @@ import jscl.math.function.IConstant;
|
|||||||
import org.solovyev.android.Views;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.model.Var;
|
import org.solovyev.android.calculator.model.Var;
|
||||||
import org.solovyev.android.sherlock.AndroidSherlockUtils;
|
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -257,7 +256,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
|
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
|
||||||
AndroidSherlockUtils.showDialog(create(input), "constant-editor", fm);
|
App.showDialog(create(input), "constant-editor", fm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Input {
|
public static class Input {
|
||||||
|
@ -1,63 +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.sherlock;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 8/13/12
|
|
||||||
* Time: 2:04 AM
|
|
||||||
*/
|
|
||||||
public final class AndroidSherlockUtils {
|
|
||||||
|
|
||||||
private AndroidSherlockUtils() {
|
|
||||||
throw new AssertionError("Not intended for instantiation!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
public static MenuInflater getSupportMenuInflater(@Nonnull Activity activity) {
|
|
||||||
return activity.getMenuInflater();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showDialog(@Nonnull DialogFragment dialogFragment,
|
|
||||||
@Nonnull String fragmentTag,
|
|
||||||
@Nonnull FragmentManager fm) {
|
|
||||||
final FragmentTransaction ft = fm.beginTransaction();
|
|
||||||
|
|
||||||
Fragment prev = fm.findFragmentByTag(fragmentTag);
|
|
||||||
if (prev != null) {
|
|
||||||
ft.remove(prev);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and show the dialog.
|
|
||||||
dialogFragment.show(ft, fragmentTag);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package org.solovyev.android.sherlock;
|
|
||||||
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class Fragments extends org.solovyev.android.Fragments {
|
|
||||||
|
|
||||||
private Fragments() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showDialog(@Nonnull DialogFragment dialogFragment,
|
|
||||||
@Nonnull String fragmentTag,
|
|
||||||
@Nonnull FragmentManager fm) {
|
|
||||||
showDialog(dialogFragment, fragmentTag, fm, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showDialog(DialogFragment dialogFragment, String fragmentTag, FragmentManager fm, boolean useExisting) {
|
|
||||||
Fragment prev = fm.findFragmentByTag(fragmentTag);
|
|
||||||
if (prev != null) {
|
|
||||||
if (!useExisting) {
|
|
||||||
final FragmentTransaction ft = fm.beginTransaction();
|
|
||||||
ft.remove(prev);
|
|
||||||
ft.addToBackStack(null);
|
|
||||||
|
|
||||||
// Create and show the dialog.
|
|
||||||
dialogFragment.show(ft, fragmentTag);
|
|
||||||
fm.executePendingTransactions();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final FragmentTransaction ft = fm.beginTransaction();
|
|
||||||
|
|
||||||
ft.addToBackStack(null);
|
|
||||||
|
|
||||||
// Create and show the dialog.
|
|
||||||
dialogFragment.show(ft, fragmentTag);
|
|
||||||
fm.executePendingTransactions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user