Use toolbar instead of action bar in main activity

This commit is contained in:
serso 2016-02-21 13:25:14 +01:00
parent e30e8ca2fe
commit 96b4290260
24 changed files with 179 additions and 271 deletions

View File

@ -63,6 +63,7 @@ dependencies {
compile 'org.solovyev:common-msg:1.0.7' compile 'org.solovyev:common-msg:1.0.7'
compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1' compile 'com.android.support:design:23.1.1'
compile('ch.acra:acra:4.7.0') { compile('ch.acra:acra:4.7.0') {
exclude group: 'org.json' exclude group: 'org.json'

View File

@ -12,7 +12,6 @@ print 'Screenshot will be located in ' + outFolder + ' with name ' + outFilename
apk = '/home/serso/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25/calculatorpp.apk' apk = '/home/serso/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25/calculatorpp.apk'
package = 'org.solovyev.android.calculator' package = 'org.solovyev.android.calculator'
activity = 'org.solovyev.android.calculator.CalculatorActivity' activity = 'org.solovyev.android.calculator.CalculatorActivity'
mobileActivity = 'org.solovyev.android.calculator.CalculatorActivityMobile'
operatorsActivity = 'org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity' operatorsActivity = 'org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity'
deviceName = 'emulator-5580' deviceName = 'emulator-5580'
@ -56,18 +55,6 @@ if device:
#outFilename = outFilename + '_' + str(time.time()) #outFilename = outFilename + '_' + str(time.time())
takeScreenshot(outFolder, outFilename + '_operators'); takeScreenshot(outFolder, outFilename + '_operators');
runComponent = package + '/' + mobileActivity
print 'Starting activity ' + runComponent + '...'
device.startActivity(component=runComponent)
# sleep while application will be loaded
MonkeyRunner.sleep(4);
print 'Taking screenshot...'
#outFilename = outFilename + '_' + str(time.time())
takeScreenshot(outFolder, outFilename + '_mobile');
print '#########' print '#########'
print 'Finished!' print 'Finished!'
print '#########' print '#########'

View File

@ -56,13 +56,6 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<activity
android:name=".CalculatorActivityMobile"
android:clearTaskOnLaunch="true"
android:label="@string/c_app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name=".preferences.PreferencesActivity" android:name=".preferences.PreferencesActivity"
android:label="@string/c_app_settings" /> android:label="@string/c_app_settings" />

View File

@ -22,26 +22,28 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.res.Resources;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBar; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.*; import android.view.*;
import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import org.solovyev.android.Activities; import org.solovyev.android.Activities;
import org.solovyev.android.Android; import org.solovyev.android.Android;
import org.solovyev.android.calculator.converter.ConverterFragment;
import org.solovyev.android.calculator.history.History; import org.solovyev.android.calculator.history.History;
import org.solovyev.android.calculator.keyboard.PartialKeyboardUi; import org.solovyev.android.calculator.keyboard.PartialKeyboardUi;
import org.solovyev.android.calculator.wizard.CalculatorWizards; import org.solovyev.android.calculator.wizard.CalculatorWizards;
import org.solovyev.android.fragments.FragmentUtils;
import org.solovyev.android.prefs.Preference; import org.solovyev.android.prefs.Preference;
import org.solovyev.android.wizard.Wizard; import org.solovyev.android.wizard.Wizard;
import org.solovyev.android.wizard.Wizards; import org.solovyev.android.wizard.Wizards;
@ -51,14 +53,14 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import static android.os.Build.VERSION_CODES.GINGERBREAD_MR1; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static org.solovyev.android.calculator.Preferences.Gui.preventScreenFromFading; import static org.solovyev.android.calculator.Preferences.Gui.preventScreenFromFading;
import static org.solovyev.android.calculator.release.ReleaseNotes.hasReleaseNotes; import static org.solovyev.android.calculator.release.ReleaseNotes.hasReleaseNotes;
import static org.solovyev.android.wizard.WizardUi.*; import static org.solovyev.android.wizard.WizardUi.*;
public class CalculatorActivity extends BaseActivity implements SharedPreferences.OnSharedPreferenceChangeListener { public class CalculatorActivity extends BaseActivity implements SharedPreferences.OnSharedPreferenceChangeListener, Toolbar.OnMenuItemClickListener {
@Nonnull @Nonnull
public static final String TAG = CalculatorActivity.class.getSimpleName(); public static final String TAG = CalculatorActivity.class.getSimpleName();
@ -77,6 +79,10 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
@Nullable @Nullable
@Bind(R.id.partial_keyboard) @Bind(R.id.partial_keyboard)
View partialKeyboard; View partialKeyboard;
@Bind(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.editor)
FrameLayout editor;
private boolean useBackAsPrev; private boolean useBackAsPrev;
public CalculatorActivity() { public CalculatorActivity() {
@ -154,36 +160,37 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
ui.setLayoutId(R.layout.main_calculator); ui.setLayoutId(R.layout.activity_main);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
final ActionBar actionBar = getSupportActionBar();
if (Build.VERSION.SDK_INT <= GINGERBREAD_MR1 || (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH && hasPermanentMenuKey())) {
actionBar.hide();
} else {
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
ButterKnife.bind(this); ButterKnife.bind(this);
FragmentUtils.createFragment(this, EditorFragment.class, R.id.editor, "editor"); if (savedInstanceState == null) {
FragmentUtils.createFragment(this, DisplayFragment.class, R.id.display, "display"); final FragmentManager fm = getSupportFragmentManager();
FragmentUtils.createFragment(this, KeyboardFragment.class, R.id.keyboard, "keyboard"); final FragmentTransaction t = fm.beginTransaction();
t.add(R.id.editor, new EditorFragment(), "editor");
t.add(R.id.display, new DisplayFragment(), "display");
t.add(R.id.keyboard, new KeyboardFragment(), "keyboard");
t.commit();
}
if (partialKeyboard != null) { if (partialKeyboard != null) {
partialKeyboardUi.onCreateView(this, partialKeyboard); partialKeyboardUi.onCreateView(this, partialKeyboard);
} }
this.useBackAsPrev = Preferences.Gui.usePrevAsBack.getPreference(preferences); toolbar.inflateMenu(R.menu.main);
toolbar.setOnMenuItemClickListener(this);
useBackAsPrev = Preferences.Gui.usePrevAsBack.getPreference(preferences);
if (savedInstanceState == null) { if (savedInstanceState == null) {
firstTimeInit(preferences, this); firstTimeInit(preferences, this);
} }
toggleOrientationChange(preferences); toggleOrientationChange();
prepareCardAndToolbar();
preferences.registerOnSharedPreferenceChangeListener(this); preferences.registerOnSharedPreferenceChangeListener(this);
preferredPreferences.check(this, false); preferredPreferences.check(this, false);
if (App.isMonkeyRunner(this)) { if (App.isMonkeyRunner(this)) {
@ -199,11 +206,6 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
component.inject(this); component.inject(this);
} }
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private boolean hasPermanentMenuKey() {
return ViewConfiguration.get(this).hasPermanentMenuKey();
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
@ -255,16 +257,60 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
} }
if (Preferences.Gui.autoOrientation.getKey().equals(key)) { if (Preferences.Gui.autoOrientation.getKey().equals(key)) {
toggleOrientationChange(preferences); toggleOrientationChange();
} }
} }
private void toggleOrientationChange(@Nullable SharedPreferences preferences) { private void toggleOrientationChange() {
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(this) : preferences;
if (Preferences.Gui.autoOrientation.getPreference(preferences)) { if (Preferences.Gui.autoOrientation.getPreference(preferences)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); setRequestedOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
} else { } else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT);
} }
} }
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_settings:
launcher.showSettings();
return true;
case R.id.menu_history:
launcher.showHistory();
return true;
case R.id.menu_plotter:
Locator.getInstance().getPlotter().plot();
return true;
case R.id.menu_conversion_tool:
ConverterFragment.show(this);
return true;
case R.id.menu_about:
launcher.showAbout();
return true;
}
return false;
}
private void prepareCardAndToolbar() {
if (!(editor instanceof CardView)) {
return;
}
final CardView card = (CardView) editor;
final Resources resources = getResources();
final int cardTopMargin = resources.getDimensionPixelSize(R.dimen.cpp_card_margin);
final int preLollipopCardTopPadding = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? card.getPaddingTop() : 0;
{
final ViewGroup.LayoutParams lp = toolbar.getLayoutParams();
lp.height += cardTopMargin + preLollipopCardTopPadding;
toolbar.setLayoutParams(lp);
// center icons in toolbar
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + cardTopMargin / 2 + preLollipopCardTopPadding, toolbar.getPaddingRight(), toolbar.getPaddingBottom() + cardTopMargin / 2);
}
final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) card.getLayoutParams();
final int actionWidth = resources.getDimensionPixelSize(R.dimen.abc_action_button_min_width_overflow_material) + 2 * resources.getDimensionPixelSize(R.dimen.abc_action_bar_overflow_padding_start_material);
lp.leftMargin = actionWidth + 2 * toolbar.getPaddingLeft();
lp.rightMargin = actionWidth + 2 * toolbar.getPaddingRight();
card.setLayoutParams(lp);
}
} }

View File

@ -1,49 +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.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 11/25/12
* Time: 2:34 PM
*/
public class CalculatorActivityMobile extends CalculatorActivity {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Preferences.Gui.layout.putPreference(prefs, Preferences.Gui.Layout.main_calculator_mobile);
super.onCreate(savedInstanceState);
if (!App.isMonkeyRunner(this)) {
this.finish();
}
}
}

View File

@ -22,17 +22,10 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.solovyev.android.calculator.converter.ConverterFragment;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -43,10 +36,6 @@ public class EditorFragment extends BaseFragment {
@Inject @Inject
Editor editor; Editor editor;
@Inject
SharedPreferences preferences;
@Inject
ActivityLauncher launcher;
@Bind(R.id.calculator_editor) @Bind(R.id.calculator_editor)
EditorView editorView; EditorView editorView;
@ -54,12 +43,6 @@ public class EditorFragment extends BaseFragment {
super(R.layout.cpp_app_editor); super(R.layout.cpp_app_editor);
} }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override @Override
protected void inject(@Nonnull AppComponent component) { protected void inject(@Nonnull AppComponent component) {
super.inject(component); super.inject(component);
@ -79,31 +62,4 @@ public class EditorFragment extends BaseFragment {
editor.clearView(editorView); editor.clearView(editorView);
super.onDestroyView(); super.onDestroyView();
} }
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.main, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_settings:
launcher.showSettings();
return true;
case R.id.menu_history:
launcher.showHistory();
return true;
case R.id.menu_plotter:
Locator.getInstance().getPlotter().plot();
return true;
case R.id.menu_conversion_tool:
ConverterFragment.show(getActivity());
return true;
case R.id.menu_about:
launcher.showAbout();
return true;
}
return false;
}
} }

View File

@ -288,20 +288,22 @@ public final class Preferences {
public enum Theme { public enum Theme {
default_theme(R.style.Cpp_Theme_Gray), default_theme(R.style.Cpp_Theme_Gray, R.style.Cpp_Theme_Gray_NoActionBar),
violet_theme(R.style.Cpp_Theme_Violet), violet_theme(R.style.Cpp_Theme_Violet, R.style.Cpp_Theme_Violet_NoActionBar),
light_blue_theme(R.style.Cpp_Theme_Blue), light_blue_theme(R.style.Cpp_Theme_Blue, R.style.Cpp_Theme_Blue_NoActionBar),
metro_blue_theme(R.style.Cpp_Theme_Metro_Blue), metro_blue_theme(R.style.Cpp_Theme_Metro_Blue, R.style.Cpp_Theme_Metro_Blue_NoActionBar),
metro_purple_theme(R.style.Cpp_Theme_Metro_Purple), metro_purple_theme(R.style.Cpp_Theme_Metro_Purple, R.style.Cpp_Theme_Metro_Purple_NoActionBar),
metro_green_theme(R.style.Cpp_Theme_Metro_Green), metro_green_theme(R.style.Cpp_Theme_Metro_Green, R.style.Cpp_Theme_Metro_Green_NoActionBar),
material_theme(R.style.Cpp_Theme_Material), material_theme(R.style.Cpp_Theme_Material, R.style.Cpp_Theme_Material_NoActionBar),
material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert); material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Material_Light_NoActionBar, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert);
private static final SparseArray<TextColor> textColors = new SparseArray<>(); private static final SparseArray<TextColor> textColors = new SparseArray<>();
@StyleRes @StyleRes
public final int theme; public final int theme;
@StyleRes @StyleRes
public final int mainTheme;
@StyleRes
public final int wizardTheme; public final int wizardTheme;
@StyleRes @StyleRes
public final int dialogTheme; public final int dialogTheme;
@ -309,12 +311,13 @@ public final class Preferences {
public final int alertDialogTheme; public final int alertDialogTheme;
public final boolean light; public final boolean light;
Theme(@StyleRes int theme) { Theme(@StyleRes int theme, int mainTheme) {
this(theme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Material_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert); this(theme, mainTheme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Material_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert);
} }
Theme(@StyleRes int theme, @StyleRes int wizardTheme, @StyleRes int dialogTheme, @StyleRes int alertDialogTheme) { Theme(@StyleRes int theme, int mainTheme, @StyleRes int wizardTheme, @StyleRes int dialogTheme, @StyleRes int alertDialogTheme) {
this.theme = theme; this.theme = theme;
this.mainTheme = mainTheme;
this.wizardTheme = wizardTheme; this.wizardTheme = wizardTheme;
this.dialogTheme = dialogTheme; this.dialogTheme = dialogTheme;
this.alertDialogTheme = alertDialogTheme; this.alertDialogTheme = alertDialogTheme;
@ -322,6 +325,9 @@ public final class Preferences {
} }
public int getThemeFor(@Nullable Context context) { public int getThemeFor(@Nullable Context context) {
if (context instanceof CalculatorActivity) {
return wizardTheme;
}
if (context instanceof WizardActivity) { if (context instanceof WizardActivity) {
return wizardTheme; return wizardTheme;
} }

View File

@ -1,72 +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.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 9/25/12
* Time: 9:29 PM
*/
public class FragmentUtils {
public static void createFragment(@Nonnull FragmentActivity activity,
@Nonnull Class<? extends Fragment> fragmentClass,
int parentViewId,
@Nonnull String tag) {
createFragment(activity, fragmentClass, parentViewId, tag, null);
}
public static void createFragment(@Nonnull FragmentActivity activity,
@Nonnull Class<? extends Fragment> fragmentClass,
int parentViewId,
@Nonnull String tag,
@Nullable Bundle args) {
final FragmentManager fm = activity.getSupportFragmentManager();
Fragment messagesFragment = fm.findFragmentByTag(tag);
final FragmentTransaction ft = fm.beginTransaction();
try {
if (messagesFragment == null) {
messagesFragment = Fragment.instantiate(activity, fragmentClass.getName(), args);
ft.add(parentViewId, messagesFragment, tag);
} else {
if (messagesFragment.isDetached()) {
ft.attach(messagesFragment);
}
}
} finally {
ft.commit();
}
}
}

View File

@ -26,12 +26,7 @@
xmlns:a="http://schemas.android.com/apk/res/android" xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical"> a:orientation="vertical">
<LinearLayout <include layout="@layout/activity_main_editor_with_toolbar"/>
a:id="@+id/editor"
a:layout_width="match_parent"
a:layout_height="0dp"
a:layout_weight="2"
a:orientation="horizontal" />
<LinearLayout <LinearLayout
a:id="@+id/partial_keyboard" a:id="@+id/partial_keyboard"

View File

@ -23,19 +23,14 @@
--> -->
<LinearLayout <LinearLayout
xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/main" a:id="@+id/main"
style="@style/CppMain" style="@style/CppMain"
xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="match_parent" a:layout_height="match_parent"
a:orientation="vertical"> a:orientation="vertical">
<LinearLayout <include layout="@layout/activity_main_editor_with_toolbar"/>
a:id="@+id/editor"
a:layout_width="match_parent"
a:layout_height="0dp"
a:layout_weight="2"
a:orientation="horizontal" />
<LinearLayout <LinearLayout
a:id="@+id/partial_keyboard" a:id="@+id/partial_keyboard"

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="match_parent"
a:layout_height="0dp"
a:layout_weight="2">
<FrameLayout
a:id="@+id/editor"
a:layout_width="match_parent"
a:layout_height="match_parent" />
<android.support.v7.widget.Toolbar
a:id="@+id/toolbar"
a:layout_width="wrap_content"
a:layout_height="?actionBarSize"
a:layout_gravity="top|right" />
</FrameLayout>

View File

@ -21,21 +21,11 @@
~ Email: se.solovyev@gmail.com ~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<org.solovyev.android.calculator.EditorView a:id="@+id/calculator_editor"
<LinearLayout style="@style/CppText.Editor"
xmlns:a="http://schemas.android.com/apk/res/android" xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/main_fragment_layout" a:hint="@string/c_calc_editor_hint"
style="@style/CppFragment" a:padding="@dimen/cpp_editor_padding"
a:layout_width="match_parent" a:scrollbars="vertical"
a:layout_height="match_parent" a:singleLine="false"
a:padding="@dimen/cpp_editor_padding"> a:textIsSelectable="true" />
<org.solovyev.android.calculator.EditorView
a:id="@+id/calculator_editor"
style="@style/CppText.Editor"
a:hint="@string/c_calc_editor_hint"
a:scrollbars="vertical"
a:singleLine="false"
a:textIsSelectable="true" />
</LinearLayout>

View File

@ -33,5 +33,6 @@
<attr name="cpp_text_color" format="reference" /> <attr name="cpp_text_color" format="reference" />
<attr name="cpp_text_color_error" format="reference" /> <attr name="cpp_text_color_error" format="reference" />
<attr name="cpp_card_style" format="reference" />
</resources> </resources>

View File

@ -44,4 +44,5 @@
<dimen name="cpp_image_button_size">30dp</dimen> <dimen name="cpp_image_button_size">30dp</dimen>
<dimen name="cpp_image_button_padding">5dp</dimen> <dimen name="cpp_image_button_padding">5dp</dimen>
<dimen name="cpp_dialog_width_max">400dp</dimen> <dimen name="cpp_dialog_width_max">400dp</dimen>
<dimen name="cpp_card_margin">4dp</dimen>
</resources> </resources>

View File

@ -59,8 +59,8 @@
<style name="CppText.Editor"> <style name="CppText.Editor">
<item name="android:text">""</item> <item name="android:text">""</item>
<item name="android:gravity">left|top</item> <item name="android:gravity">left|top</item>
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">fill_parent</item> <item name="android:layout_height">match_parent</item>
<item name="android:textSize">@dimen/cpp_editor_text_size</item> <item name="android:textSize">@dimen/cpp_editor_text_size</item>
<item name="android:textColor">?attr/cpp_text_color</item> <item name="android:textColor">?attr/cpp_text_color</item>
<item name="android:inputType">textMultiLine|textNoSuggestions</item> <item name="android:inputType">textMultiLine|textNoSuggestions</item>

View File

@ -22,6 +22,11 @@
<resources> <resources>
<style name="Cpp.Theme.NoActionBar" parent="@style/Cpp.Theme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme" parent="@style/Theme.AppCompat"> <style name="Cpp.Theme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/cpp_metro_button</item> <item name="colorPrimary">@color/cpp_metro_button</item>
<item name="colorPrimaryDark">@color/cpp_metro_button_dark</item> <item name="colorPrimaryDark">@color/cpp_metro_button_dark</item>
@ -36,6 +41,7 @@
<item name="cpp_fab_bg">@color/grey_900</item> <item name="cpp_fab_bg">@color/grey_900</item>
<item name="cpp_text_color">@color/cpp_text</item> <item name="cpp_text_color">@color/cpp_text</item>
<item name="cpp_text_color_error">@color/cpp_text_error</item> <item name="cpp_text_color_error">@color/cpp_text_error</item>
<item name="cpp_card_style">@style/CardView.Dark</item>
<item name="android:listDivider">@drawable/divider_dark</item> <item name="android:listDivider">@drawable/divider_dark</item>
</style> </style>
@ -94,6 +100,7 @@
<item name="cpp_fab_bg">@color/cpp_material_light</item> <item name="cpp_fab_bg">@color/cpp_material_light</item>
<item name="cpp_text_color">@color/cpp_text_inverse</item> <item name="cpp_text_color">@color/cpp_text_inverse</item>
<item name="cpp_text_color_error">@color/cpp_text_inverse_error</item> <item name="cpp_text_color_error">@color/cpp_text_inverse_error</item>
<item name="cpp_card_style">@style/CardView.Light</item>
<item name="android:listDivider">@drawable/divider</item> <item name="android:listDivider">@drawable/divider</item>
</style> </style>

View File

@ -59,6 +59,11 @@
<item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item> <item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item>
</style> </style>
<style name="Cpp.Theme.Material.NoActionBar" parent="Cpp.Theme.Material">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Material" parent="Cpp.Theme"> <style name="Cpp.Theme.Material" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Digit</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Digit</item>

View File

@ -59,6 +59,11 @@
<item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item> <item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item>
</style> </style>
<style name="Cpp.Theme.Material.Light.NoActionBar" parent="Cpp.Theme.Material.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Material.Light" parent="Cpp.Theme.Light"> <style name="Cpp.Theme.Material.Light" parent="Cpp.Theme.Light">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item>

View File

@ -65,12 +65,15 @@
<item name="android:padding">@dimen/cpp_keyboard_simple_image_button_padding</item> <item name="android:padding">@dimen/cpp_keyboard_simple_image_button_padding</item>
</style> </style>
<style name="Cpp.Theme.Metro.Blue.NoActionBar" parent="Cpp.Theme.Metro.Blue">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Metro.Blue" parent="Cpp.Theme"> <style name="Cpp.Theme.Metro.Blue" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Metro.Blue.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Metro.Blue.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Metro.Blue.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Metro.Blue.Control</item>
<item name="cpp_button_style_control_image"> <item name="cpp_button_style_control_image">@style/CppKeyboardButton.Metro.Blue.Control.Image</item>
@style/CppKeyboardButton.Metro.Blue.Control.Image
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Metro.Blue.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Metro.Blue.Operation</item>
</style> </style>

View File

@ -26,6 +26,11 @@
<item name="android:background">@drawable/metro_button_green</item> <item name="android:background">@drawable/metro_button_green</item>
</style> </style>
<style name="Cpp.Theme.Metro.Green.NoActionBar" parent="Cpp.Theme.Metro.Green">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Metro.Green" parent="Cpp.Theme.Metro.Blue"> <style name="Cpp.Theme.Metro.Green" parent="Cpp.Theme.Metro.Blue">
<item name="cpp_button_style_operation">@style/metro_green_operation_button_style</item> <item name="cpp_button_style_operation">@style/metro_green_operation_button_style</item>
</style> </style>

View File

@ -26,6 +26,11 @@
<item name="android:background">@drawable/metro_button_purple</item> <item name="android:background">@drawable/metro_button_purple</item>
</style> </style>
<style name="Cpp.Theme.Metro.Purple.NoActionBar" parent="Cpp.Theme.Metro.Purple">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Metro.Purple" parent="Cpp.Theme.Metro.Blue"> <style name="Cpp.Theme.Metro.Purple" parent="Cpp.Theme.Metro.Blue">
<item name="cpp_button_style_operation">@style/metro_purple_operation_button_style</item> <item name="cpp_button_style_operation">@style/metro_purple_operation_button_style</item>
</style> </style>

View File

@ -36,11 +36,15 @@
<style name="CppKeyboardButton.Blue.Control.Image" parent="CppKeyboardButton.Blue.Control"/> <style name="CppKeyboardButton.Blue.Control.Image" parent="CppKeyboardButton.Blue.Control"/>
<style name="Cpp.Theme.Blue.NoActionBar" parent="Cpp.Theme.Blue">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Blue" parent="Cpp.Theme"> <style name="Cpp.Theme.Blue" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Blue.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Blue.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Blue.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Blue.Control</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Blue.Control.Image <item name="cpp_button_style_control_image">@style/CppKeyboardButton.Blue.Control.Image</item>
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Blue.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Blue.Operation</item>
</style> </style>

View File

@ -36,19 +36,22 @@
<style name="CppKeyboardButton.Gray.Control.Image" parent="CppKeyboardButton.Gray.Control"/> <style name="CppKeyboardButton.Gray.Control.Image" parent="CppKeyboardButton.Gray.Control"/>
<style name="Cpp.Theme.Gray.NoActionBar" parent="Cpp.Theme.Gray">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Gray" parent="Cpp.Theme"> <style name="Cpp.Theme.Gray" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Gray.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Gray.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Gray.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Gray.Control</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Gray.Control.Image <item name="cpp_button_style_control_image">@style/CppKeyboardButton.Gray.Control.Image</item>
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Gray.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Gray.Operation</item>
</style> </style>
<style name="Cpp.Theme.Dialog.Gray" parent="Cpp.Theme.Dialog"> <style name="Cpp.Theme.Dialog.Gray" parent="Cpp.Theme.Dialog">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Gray.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Gray.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Gray.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Gray.Control</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Gray.Control.Image <item name="cpp_button_style_control_image">@style/CppKeyboardButton.Gray.Control.Image</item>
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Gray.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Gray.Operation</item>
</style> </style>

View File

@ -36,11 +36,15 @@
<style name="CppKeyboardButton.Violet.Control.Image" parent="CppKeyboardButton.Violet.Control"/> <style name="CppKeyboardButton.Violet.Control.Image" parent="CppKeyboardButton.Violet.Control"/>
<style name="Cpp.Theme.Violet.NoActionBar" parent="Cpp.Theme.Violet">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Cpp.Theme.Violet" parent="Cpp.Theme"> <style name="Cpp.Theme.Violet" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Violet.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Violet.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Violet.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Violet.Control</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Violet.Control.Image <item name="cpp_button_style_control_image">@style/CppKeyboardButton.Violet.Control.Image</item>
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Violet.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Violet.Operation</item>
</style> </style>
</resources> </resources>