expand button
This commit is contained in:
parent
961300c910
commit
23d5441b99
@ -357,7 +357,7 @@
|
||||
<string name="cpp_plot_empty_function_error">Unable to plot empty function!</string>
|
||||
<string name="cpp_plot_too_many_variables">Unable to plot: too many variables!</string>
|
||||
<string name="cpp_plot_range">Graph range</string>
|
||||
<string name="cpp_plot_fullscreen">Fullscreen plot</string>
|
||||
<string name="cpp_fullscreen">Fullscreen</string>
|
||||
<string name="cpp_plot_range_x_min">X Min</string>
|
||||
<string name="cpp_plot_range_x_max">X Max</string>
|
||||
<string name="cpp_plot_range_y_min">Y Min</string>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<menu xmlns:a="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
a:id="@+id/functions_menu_add_function"
|
||||
a:id="@+id/menu_functions_add_function"
|
||||
a:title="@string/c_add"
|
||||
a:icon="@drawable/kb_plus"
|
||||
a:showAsAction="always"/>
|
||||
|
@ -9,13 +9,19 @@
|
||||
<menu xmlns:a="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
a:id="@+id/history_menu_toggle_datetime"
|
||||
a:id="@+id/menu_history_fullscreen"
|
||||
a:title="@string/cpp_fullscreen"
|
||||
a:icon="@drawable/kb_expand"
|
||||
a:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
a:id="@+id/menu_history_toggle_datetime"
|
||||
a:icon="@drawable/kb_clock"
|
||||
a:title="@string/c_toggle_datetime"
|
||||
a:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
a:id="@+id/history_menu_clear_history"
|
||||
a:id="@+id/menu_history_clear_history"
|
||||
a:icon="@drawable/kb_remove"
|
||||
a:title="@string/c_clear_history"
|
||||
a:showAsAction="always"/>
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<item
|
||||
a:id="@+id/menu_plot_fullscreen"
|
||||
a:title="@string/cpp_plot_fullscreen"
|
||||
a:title="@string/cpp_fullscreen"
|
||||
a:icon="@drawable/kb_expand"
|
||||
a:showAsAction="always" />
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<menu xmlns:a="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
a:id="@+id/var_menu_add_var"
|
||||
a:id="@+id/menu_vars_add_var"
|
||||
a:title="@string/c_add"
|
||||
a:icon="@drawable/kb_plus"
|
||||
a:showAsAction="always"/>
|
||||
|
@ -7,6 +7,7 @@
|
||||
package org.solovyev.android.calculator.history;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
@ -90,7 +91,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
@Nonnull
|
||||
private CalculatorFragmentHelper fragmentHelper;
|
||||
|
||||
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromResource(R.menu.history_menu, HistoryMenu.class, SherlockMenuHelper.getInstance());
|
||||
private final ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromResource(R.menu.history_menu, HistoryMenu.class, SherlockMenuHelper.getInstance(), new HistoryMenuFilter());
|
||||
|
||||
@Nonnull
|
||||
private final SharedPreferences.OnSharedPreferenceChangeListener preferencesListener = new HistoryOnPreferenceChangeListener();
|
||||
@ -346,20 +347,27 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
|
||||
private static enum HistoryMenu implements IdentifiableMenuItem<MenuItem> {
|
||||
|
||||
clear_history(R.id.history_menu_clear_history) {
|
||||
clear_history(R.id.menu_history_clear_history) {
|
||||
@Override
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
Locator.getInstance().getCalculator().fireCalculatorEvent(clear_history_requested, null);
|
||||
}
|
||||
},
|
||||
|
||||
toggle_datetime(R.id.history_menu_toggle_datetime) {
|
||||
toggle_datetime(R.id.menu_history_toggle_datetime) {
|
||||
@Override
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CalculatorApplication.getInstance());
|
||||
final Boolean showDatetime = CalculatorPreferences.History.showDatetime.getPreference(preferences);
|
||||
CalculatorPreferences.History.showDatetime.putPreference(preferences, !showDatetime);
|
||||
}
|
||||
},
|
||||
|
||||
fullscreen(R.id.menu_history_fullscreen) {
|
||||
@Override
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
context.startActivity(new Intent(context, CalculatorHistoryActivity.class));
|
||||
}
|
||||
};
|
||||
|
||||
private final int itemId;
|
||||
@ -375,6 +383,24 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
}
|
||||
}
|
||||
|
||||
private class HistoryMenuFilter implements JPredicate<AMenuItem<MenuItem>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(@Nullable AMenuItem<MenuItem> menuItem) {
|
||||
boolean result = false;
|
||||
|
||||
if (menuItem instanceof IdentifiableMenuItem<?>) {
|
||||
switch (((IdentifiableMenuItem) menuItem).getItemId()) {
|
||||
case R.id.menu_history_fullscreen:
|
||||
result = !fragmentHelper.isPane(AbstractCalculatorHistoryFragment.this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
|
@ -6,17 +6,33 @@
|
||||
|
||||
package org.solovyev.android.calculator.math.edit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
import org.solovyev.android.calculator.*;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.CalculatorApplication;
|
||||
import org.solovyev.android.calculator.CalculatorEventData;
|
||||
import org.solovyev.android.calculator.CalculatorEventListener;
|
||||
import org.solovyev.android.calculator.CalculatorEventType;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentHelper;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.CalculatorMathRegistry;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
import org.solovyev.android.menu.ContextMenuBuilder;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
@ -27,11 +43,7 @@ import org.solovyev.common.filter.Filter;
|
||||
import org.solovyev.common.math.MathEntity;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
|
||||
import static org.solovyev.android.calculator.CalculatorEventType.show_wiki_description;
|
||||
|
||||
@ -318,31 +330,6 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
static void createTab(@Nonnull Context context,
|
||||
@Nonnull TabHost tabHost,
|
||||
@Nonnull String tabId,
|
||||
@Nonnull String categoryId,
|
||||
int tabCaptionId,
|
||||
@Nonnull Class<? extends Activity> activityClass,
|
||||
@Nullable Intent parentIntent) {
|
||||
|
||||
TabHost.TabSpec spec;
|
||||
|
||||
final Intent intent;
|
||||
if (parentIntent != null) {
|
||||
intent = new Intent(parentIntent);
|
||||
} else {
|
||||
intent = new Intent();
|
||||
}
|
||||
intent.setClass(context, activityClass);
|
||||
intent.putExtra(MATH_ENTITY_CATEGORY_EXTRA_STRING, categoryId);
|
||||
|
||||
// Initialize a TabSpec for each tab and add it to the TabHost
|
||||
spec = tabHost.newTabSpec(tabId).setIndicator(context.getString(tabCaptionId)).setContent(intent);
|
||||
|
||||
tabHost.addTab(spec);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Bundle createBundleFor(@Nonnull String categoryId) {
|
||||
final Bundle result = new Bundle(1);
|
||||
|
@ -200,7 +200,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
|
||||
boolean result;
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.functions_menu_add_function:
|
||||
case R.id.menu_functions_add_function:
|
||||
FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newInstance(), this.getActivity().getSupportFragmentManager());
|
||||
result = true;
|
||||
break;
|
||||
|
@ -146,7 +146,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
boolean result;
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.var_menu_add_var:
|
||||
case R.id.menu_vars_add_var:
|
||||
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newInstance(), this.getActivity().getSupportFragmentManager());
|
||||
result = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user