This commit is contained in:
Sergey Solovyev 2012-11-26 00:00:30 +04:00
parent 642c7eb076
commit 184e090b65
23 changed files with 191 additions and 72 deletions

View File

@ -7,12 +7,17 @@
<uses-permission android:name="com.android.vending.BILLING"/> <uses-permission android:name="com.android.vending.BILLING"/>
<!--TODO: REMOVE IN PRODUCTION--> <!--TODO: REMOVE IN PRODUCTION-->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> <!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
<!-- for onscreen --> <!-- for onscreen -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<supports-screens android:smallScreens="true" />
<supports-screens android:normalScreens="true" />
<supports-screens android:largeScreens="true" />
<supports-screens android:xlargeScreens="true" />
<supports-screens android:anyDensity="true" />
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/> <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
@ -27,6 +32,8 @@
</activity> </activity>
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivityMobile" android:windowSoftInputMode="adjustPan"/>
<!-- settings must use action bar icon--> <!-- settings must use action bar icon-->
<activity android:icon="@drawable/ab_icon" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/> <activity android:icon="@drawable/ab_icon" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/>

View File

@ -2,7 +2,7 @@
declare -a densities=("160" "213" "240" "320") declare -a densities=("160" "213" "240" "320")
declare -a resolutions=("320x480" "480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768") declare -a resolutions=("480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768")
declare -a targets=("android-16") declare -a targets=("android-16")
for target in ${targets[@]} for target in ${targets[@]}

View File

@ -12,6 +12,8 @@ print 'Screenshot will be located in ' + outFolder + ' with name ' + outFilename
apk = '/home/serso/projects/java/android/calculatorpp/calculatorpp/target/calculatorpp.apk' apk = '/home/serso/projects/java/android/calculatorpp/calculatorpp/target/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'
deviceName = 'emulator-5580' deviceName = 'emulator-5580'
def takeScreenshot (folder, filename): def takeScreenshot (folder, filename):
@ -36,13 +38,35 @@ if device:
device.startActivity(component=runComponent) device.startActivity(component=runComponent)
# sleep while application will be loaded # sleep while application will be loaded
MonkeyRunner.sleep(3); MonkeyRunner.sleep(15);
print 'Taking screenshot...' print 'Taking screenshot...'
#outFilename = outFilename + '_' + str(time.time()) #outFilename = outFilename + '_' + str(time.time())
takeScreenshot(outFolder, outFilename); takeScreenshot(outFolder, outFilename);
print 'Changing orientation...' runComponent = package + '/' + operatorsActivity
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 + '_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!'

View File

@ -1,7 +1,28 @@
#!/bin/bash #!/bin/bash
declare -a densities=("160" "213" "240" "320") predefined=0
declare -a resolutions=("320x480" "480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768")
# first predefined
if [ $predefined -eq 1 ]
then
declare -a names=("AVD_Galaxy_Tab" "AVD_Nexus_S_by_Google" "AVD_Nexus_One_by_Google" "AVD_Nexus_7_by_Google" "AVD_Galaxy_Nexus_by_Google")
for name in ${names[@]}
do
$ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name &
sleep 50
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
sleep 3
done
fi
# then all others
#declare -a densities=("160" "213" "240" "320")
declare -a densities=("213" "240" "320")
#declare -a resolutions=("480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768")
declare -a resolutions=("480x640")
declare -a targets=("android-16") declare -a targets=("android-16")
for target in ${targets[@]} for target in ${targets[@]}
@ -17,9 +38,11 @@ do
name="$name$target" name="$name$target"
$ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name & $ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name &
sleep 5
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name $ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill $ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
sleep 3
done done
done done
done done

View File

@ -29,7 +29,7 @@
a:layout_height="0dp" a:layout_height="0dp"
a:layout_width="match_parent" a:layout_width="match_parent"
style="?cpp_pane_style" style="?cpp_pane_style"
a:layout_weight="4"/> a:layout_weight="3"/>
<LinearLayout a:id="@+id/displayContainer" <LinearLayout a:id="@+id/displayContainer"
a:layout_height="0dp" a:layout_height="0dp"

View File

@ -0,0 +1,10 @@
<resources>
<dimen name="cpp_editor_text_size">20sp</dimen>
<dimen name="cpp_editor_text_size_mobile">40sp</dimen>
<dimen name="cpp_display_text_size">20sp</dimen>
<dimen name="cpp_display_text_size_mobile">40sp</dimen>
<dimen name="cpp_keyboard_button_text_size">24dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">25dp</dimen>
</resources>

View File

@ -1,16 +1,10 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">14sp</dimen> <dimen name="cpp_editor_text_size">25sp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen> <dimen name="cpp_editor_text_size_mobile">45sp</dimen>
<dimen name="cpp_editor_text_size">20sp</dimen> <dimen name="cpp_display_text_size">20sp</dimen>
<dimen name="cpp_editor_text_size_mobile">35sp</dimen>
<dimen name="cpp_display_text_size">25sp</dimen>
<dimen name="cpp_display_text_size_mobile">35sp</dimen> <dimen name="cpp_display_text_size_mobile">35sp</dimen>
<dimen name="cpp_keyboard_button_text_size">30dp</dimen> <dimen name="cpp_keyboard_button_text_size">35dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">30dp</dimen> <dimen name="cpp_keyboard_button_text_size_mobile">45dp</dimen>
<dimen name="cpp_math_entity_text_size">18sp</dimen>
<dimen name="cpp_math_entity_description_text_size">14sp</dimen>
</resources> </resources>

View File

@ -0,0 +1,10 @@
<resources>
<dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_editor_text_size_mobile">40sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_display_text_size_mobile">35sp</dimen>
<dimen name="cpp_keyboard_button_text_size">33dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">30dp</dimen>
</resources>

View File

@ -1,15 +1,7 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">20sp</dimen> <dimen name="cpp_fragment_text_size">17sp</dimen>
<dimen name="cpp_fragment_title_text_size">30sp</dimen> <dimen name="cpp_fragment_title_text_size">25sp</dimen>
<dimen name="cpp_editor_text_size">25sp</dimen> <dimen name="cpp_math_entity_text_size">20sp</dimen>
<dimen name="cpp_display_text_size">25sp</dimen> <dimen name="cpp_math_entity_description_text_size">17sp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">35dp</dimen>
<dimen name="cpp_display_text_size_mobile">35sp</dimen>
<dimen name="cpp_editor_text_size_mobile">35sp</dimen>
<dimen name="cpp_keyboard_button_text_size">40dp</dimen>
<dimen name="cpp_math_entity_text_size">25sp</dimen>
<dimen name="cpp_math_entity_description_text_size">20sp</dimen>
</resources> </resources>

View File

@ -1,16 +1,4 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">14sp</dimen> <dimen name="cpp_keyboard_button_text_size">30dp</dimen>
<dimen name="cpp_fragment_title_text_size">22sp</dimen> <dimen name="cpp_keyboard_button_text_size_mobile">20dp</dimen>
<dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_editor_text_size_mobile">30sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_display_text_size_mobile">30sp</dimen>
<dimen name="cpp_keyboard_button_text_size">28dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">28dp</dimen>
<dimen name="cpp_math_entity_text_size">18sp</dimen>
<dimen name="cpp_math_entity_description_text_size">14sp</dimen>
</resources> </resources>

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="cpp_keyboard_button_text_size">24dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">25dp</dimen>
</resources>

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="cpp_keyboard_button_text_size">25dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">25dp</dimen>
</resources>

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="cpp_keyboard_button_text_size">32dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">15dp</dimen>
</resources>

View File

@ -0,0 +1,13 @@
<resources>
<dimen name="cpp_fragment_text_size">15sp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen>
<dimen name="cpp_math_entity_text_size">20sp</dimen>
<dimen name="cpp_math_entity_description_text_size">15sp</dimen>
<dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_editor_text_size_mobile">30sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_display_text_size_mobile">30sp</dimen>
</resources>

View File

@ -1,15 +1,4 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">10sp</dimen> <dimen name="cpp_keyboard_button_text_size">22dp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen> <dimen name="cpp_keyboard_button_text_size_mobile">14dp</dimen>
<dimen name="cpp_editor_text_size">15sp</dimen>
<dimen name="cpp_display_text_size">15sp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">15dp</dimen>
<dimen name="cpp_display_text_size_mobile">20sp</dimen>
<dimen name="cpp_editor_text_size_mobile">20sp</dimen>
<dimen name="cpp_keyboard_button_text_size">15dp</dimen>
<dimen name="cpp_math_entity_text_size">15sp</dimen>
<dimen name="cpp_math_entity_description_text_size">10sp</dimen>
</resources> </resources>

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="cpp_keyboard_button_text_size">20dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">10dp</dimen>
</resources>

View File

@ -0,0 +1,13 @@
<resources>
<dimen name="cpp_fragment_text_size">15sp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen>
<dimen name="cpp_math_entity_text_size">16sp</dimen>
<dimen name="cpp_math_entity_description_text_size">12sp</dimen>
<dimen name="cpp_editor_text_size">20sp</dimen>
<dimen name="cpp_editor_text_size_mobile">20sp</dimen>
<dimen name="cpp_display_text_size">20sp</dimen>
<dimen name="cpp_display_text_size_mobile">20sp</dimen>
</resources>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_keyboard_button_text_size">40dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">75dp</dimen>
</resources>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="cpp_editor_text_size">40sp</dimen>
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_keyboard_button_text_size">35dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">65dp</dimen>
</resources>

View File

@ -1,15 +1,7 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">20sp</dimen> <dimen name="cpp_fragment_text_size">30sp</dimen>
<dimen name="cpp_fragment_title_text_size">30sp</dimen> <dimen name="cpp_fragment_title_text_size">40sp</dimen>
<dimen name="cpp_editor_text_size">30sp</dimen> <dimen name="cpp_math_entity_text_size">40sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen> <dimen name="cpp_math_entity_description_text_size">30sp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">75dp</dimen>
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
<dimen name="cpp_keyboard_button_text_size">40dp</dimen>
<dimen name="cpp_math_entity_text_size">30sp</dimen>
<dimen name="cpp_math_entity_description_text_size">20sp</dimen>
</resources> </resources>

View File

@ -263,7 +263,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
final DisplayMetrics dm = new DisplayMetrics(); final DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm); activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
helperTextView.setTextSize(AndroidUtils.toPixels(dm, 10)); helperTextView.setTextSize(15);
helperTextView.setTextColor(Color.WHITE); helperTextView.setTextColor(Color.WHITE);
final Configuration c = activity.getResources().getConfiguration(); final Configuration c = activity.getResources().getConfiguration();

View File

@ -0,0 +1,26 @@
package org.solovyev.android.calculator;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.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);
CalculatorPreferences.Gui.layout.putPreference(prefs, CalculatorPreferences.Gui.Layout.main_calculator_mobile);
super.onCreate(savedInstanceState);
if ( !CalculatorApplication.isMonkeyRunner(this) ) {
this.finish();
}
}
}

View File

@ -40,7 +40,7 @@ public final class CalculatorButtons {
@NotNull View root) { @NotNull View root) {
if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) { if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) {
final float textSize = root.getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile); final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor<DragButton>() { AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor<DragButton>() {
@Override @Override