Fragments
This commit is contained in:
parent
9987670225
commit
388c40d912
@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsFragmentActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsFragmentActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsFragment"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsFragment"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsFragmentActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsFragmentActivity"/>
|
||||||
|
|
||||||
|
20
calculatorpp/res/drawable/second_pane_background.xml
Normal file
20
calculatorpp/res/drawable/second_pane_background.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2007 The Android Open Source Project
|
||||||
|
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/second_pane_background"/>
|
||||||
|
<corners android:radius="1dp" />
|
||||||
|
</shape>
|
@ -1,21 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
|
||||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
|
||||||
~ For more information, please, contact se.solovyev@gmail.com
|
|
||||||
~ or visit http://se.solovyev.org
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:orientation="vertical"
|
a:orientation="vertical"
|
||||||
a:id="@+id/ad_parent_view"
|
a:id="@+id/ad_parent_view"
|
||||||
a:layout_width="fill_parent"
|
style="?fragmentLayoutStyle"
|
||||||
a:layout_height="fill_parent">
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="match_parent">
|
||||||
|
|
||||||
<ListView
|
<TextView a:id="@+id/fragmentTitle"
|
||||||
a:layout_width="fill_parent"
|
a:layout_height="wrap_content"
|
||||||
a:layout_height="fill_parent"
|
a:layout_width="match_parent"
|
||||||
a:layout_weight="1"
|
style="?fragmentTitleStyle"/>
|
||||||
a:id="@android:id/list"/>
|
|
||||||
|
<ListView style="?fragmentListViewStyle"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -21,7 +21,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="default_second_pane_style">
|
<style name="default_second_pane_style">
|
||||||
<item name="android:background">@color/second_pane_background</item>
|
<item name="android:background">@drawable/second_pane_background</item>
|
||||||
<item name="android:layout_margin">5dp</item>
|
<item name="android:layout_margin">5dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -29,8 +29,9 @@ import org.solovyev.android.FontSizeAdjuster;
|
|||||||
import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity;
|
import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
|
import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
|
||||||
import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment;
|
import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment;
|
||||||
|
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
|
||||||
|
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
||||||
import org.solovyev.android.calculator.model.VarCategory;
|
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
import org.solovyev.android.prefs.Preference;
|
import org.solovyev.android.prefs.Preference;
|
||||||
import org.solovyev.android.view.ColorButton;
|
import org.solovyev.android.view.ColorButton;
|
||||||
@ -77,10 +78,10 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Font
|
|||||||
if (findViewById(R.id.main_second_pane) != null) {
|
if (findViewById(R.id.main_second_pane) != null) {
|
||||||
activityHelper.addTab(this, "history", CalculatorHistoryFragment.class, null, R.string.c_history, R.id.main_second_pane);
|
activityHelper.addTab(this, "history", CalculatorHistoryFragment.class, null, R.string.c_history, R.id.main_second_pane);
|
||||||
activityHelper.addTab(this, "saved_history", CalculatorSavedHistoryFragment.class, null, R.string.c_saved_history, R.id.main_second_pane);
|
activityHelper.addTab(this, "saved_history", CalculatorSavedHistoryFragment.class, null, R.string.c_saved_history, R.id.main_second_pane);
|
||||||
|
activityHelper.addTab(this, "vars", CalculatorVarsFragment.class, null, R.string.c_vars, R.id.main_second_pane);
|
||||||
|
activityHelper.addTab(this, "functions", CalculatorFunctionsFragment.class, null, R.string.c_functions, R.id.main_second_pane);
|
||||||
|
activityHelper.addTab(this, "operators", CalculatorOperatorsFragment.class, null, R.string.c_operators, R.id.main_second_pane);
|
||||||
|
|
||||||
for (VarCategory category : VarCategory.getCategoriesByTabOrder()) {
|
|
||||||
activityHelper.addTab(this, "vars_" + category.name(), CalculatorVarsFragment.class, CalculatorVarsFragment.createBundleFor(category.name()), category.getCaptionId(), R.id.main_second_pane);
|
|
||||||
}
|
|
||||||
activityHelper.restoreSavedTab(this);
|
activityHelper.restoreSavedTab(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import org.solovyev.android.calculator.about.CalculatorAboutTabActivity;
|
|||||||
import org.solovyev.android.calculator.help.CalculatorHelpTabActivity;
|
import org.solovyev.android.calculator.help.CalculatorHelpTabActivity;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryFragmentActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryFragmentActivity;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragmentActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragmentActivity;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragmentActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragmentActivity;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
||||||
@ -45,7 +45,7 @@ public class CalculatorActivityLauncher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showOperators(@NotNull final Context context) {
|
public static void showOperators(@NotNull final Context context) {
|
||||||
context.startActivity(new Intent(context, CalculatorOperatorsActivity.class));
|
context.startActivity(new Intent(context, CalculatorOperatorsFragment.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showVars(@NotNull final Context context) {
|
public static void showVars(@NotNull final Context context) {
|
||||||
|
@ -19,10 +19,12 @@ public class CalculatorFragmentHelperImpl implements CalculatorFragmentHelper {
|
|||||||
|
|
||||||
public void setPaneTitle(@NotNull Fragment fragment, int titleResId) {
|
public void setPaneTitle(@NotNull Fragment fragment, int titleResId) {
|
||||||
final TextView fragmentTitle = (TextView) fragment.getView().findViewById(R.id.fragmentTitle);
|
final TextView fragmentTitle = (TextView) fragment.getView().findViewById(R.id.fragmentTitle);
|
||||||
|
if (fragmentTitle != null) {
|
||||||
if (!isPane(fragment)) {
|
if (!isPane(fragment)) {
|
||||||
fragmentTitle.setVisibility(View.GONE);
|
fragmentTitle.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
fragmentTitle.setText(fragment.getString(titleResId).toUpperCase());
|
fragmentTitle.setText(fragment.getString(titleResId).toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isInCategory(@Nullable T t) {
|
protected boolean isInCategory(@Nullable T t) {
|
||||||
return t != null && EqualsTool.areEqual(getMathEntityCategory(t), category);
|
return t != null && (category == null || EqualsTool.areEqual(getMathEntityCategory(t), category));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
|||||||
* Date: 10/29/11
|
* Date: 10/29/11
|
||||||
* Time: 4:55 PM
|
* Time: 4:55 PM
|
||||||
*/
|
*/
|
||||||
public class CalculatorFunctionsActivity extends AbstractMathEntityListFragment<Function> {
|
public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<Function> {
|
||||||
|
|
||||||
public static final String CREATE_FUN_EXTRA_STRING = "org.solovyev.android.calculator.math.edit.CalculatorFunctionsTabActivity_create_fun";
|
public static final String CREATE_FUN_EXTRA_STRING = "org.solovyev.android.calculator.math.edit.CalculatorFunctionsTabActivity_create_fun";
|
||||||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
* Time: 1:53 PM
|
* Time: 1:53 PM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CalculatorOperatorsActivity extends AbstractMathEntityListFragment<Operator> {
|
public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<Operator> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getTitleResId() {
|
protected int getTitleResId() {
|
Loading…
Reference in New Issue
Block a user