cpp-127: Text size in the buttons on tablet (Big buttons)
For some reason getDimension now returns dimension in pixels (?). Calling getDimensionPixelSize fixes the problem. Also optimized font size for large xhdpi tablets Fixes #127
This commit is contained in:
parent
31e31b9cbe
commit
123c745fa5
@ -64,12 +64,12 @@ public final class CalculatorButtons {
|
||||
@Nonnull View root) {
|
||||
if (!layout.isOptimized()) {
|
||||
|
||||
final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
|
||||
final float textSize = root.getContext().getResources().getDimensionPixelSize(R.dimen.cpp_keyboard_button_text_size_mobile);
|
||||
|
||||
Views.processViewsOfType(root, DragButton.class, new Views.ViewProcessor<DragButton>() {
|
||||
@Override
|
||||
public void process(@Nonnull DragButton button) {
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
26
android-app/src/main/res/values-large-xhdpi/dimens.xml
Normal file
26
android-app/src/main/res/values-large-xhdpi/dimens.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_keyboard_button_text_size">30dp</dimen>
|
||||
<dimen name="cpp_keyboard_button_text_size_mobile">40dp</dimen>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user