Show free size next to phone storage / sdcard selection dialog

This commit is contained in:
pelya
2010-07-29 19:20:20 +03:00
parent 0a7f600817
commit 4ee9954443
18 changed files with 60 additions and 35 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.schwardtnet.alienblaster"
android:versionCode="110004"
android:versionName="1.1.0.4"
package="net.sourceforge.jooleem"
android:versionCode="01404"
android:versionName="0.1.4.04"
>
<application android:label="@string/app_name"
android:icon="@drawable/icon"

View File

@@ -1,6 +1,6 @@
# The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := de_schwardtnet_alienblaster
SDL_JAVA_PACKAGE_PATH := net_sourceforge_jooleem
# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib
@@ -10,7 +10,7 @@ SDL_JAVA_PACKAGE_PATH := de_schwardtnet_alienblaster
# Typically /sdcard/alienblaster
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
# Your application will just set current directory there
SDL_CURDIR_PATH := de.schwardtnet.alienblaster
SDL_CURDIR_PATH := net.sourceforge.jooleem
# Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events,
@@ -23,7 +23,7 @@ SDL_TRACKBALL_KEYUP_DELAY := 1
# resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1
COMPILED_LIBRARIES := sdl_mixer sdl_image
COMPILED_LIBRARIES := sdl_mixer sdl_image sdl_ttf
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2

View File

@@ -5,6 +5,6 @@ APP_PROJECT_PATH := $(call my-dir)/..
# sdl_image depends on png and jpeg
# sdl_ttf depends on freetype
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_mixer sdl_image
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_mixer sdl_image sdl_ttf
APP_ABI := armeabi

View File

@@ -5,9 +5,12 @@ ScreenOrientation=h
AppDataDownloadUrl="http://sites.google.com/site/xpelyax/Home/jooleem_0.1.4_data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/jooleem_0.1.4_data.zip"
SdlVideoResize=y
NeedDepthBuffer=n
AppUsesMouse=y
AppNeedsArrowKeys=n
AppUsesJoystick=n
MultiABI=n
AppVersionCode=01403
AppVersionName="0.1.4.03"
AppVersionCode=01404
AppVersionName="0.1.4.04"
CompiledLibraries="sdl_mixer sdl_image sdl_ttf"
AppCflags='-finline-functions -O2'
ReadmeText='^You may press "Home" now - the data will be downloaded in background'

View File

@@ -138,4 +138,4 @@ void UIProgressBar::Draw(SDL_Surface *screen)
SDL_BlitSurface(m_flashingSurface, &m_clipRect, screen, &rect);
else
SDL_BlitSurface(m_normalSurface, &m_clipRect, screen, &rect);
}
}

View File

@@ -52,16 +52,19 @@ SDL_Surface* SurfaceManager::AddSurface(string ID, string fileName)
// Load the image:
SDL_Surface *surface = IMG_Load(fileName.c_str());
TRAP(surface == NULL, "SurfaceManager::AddSurface() - Could not open " << fileName);
SDL_Surface *surface2 = SDL_DisplayFormat(surface);
SDL_FreeSurface(surface);
surface = surface2;
TRAP(surface == NULL, "SurfaceManager::AddSurface() - Could not convert to HW surface " << fileName);
// Convert it to the framebuffer's display format:
SDL_Surface *converted = SDL_DisplayFormatAlpha(surface);
SDL_FreeSurface(surface);
//SDL_Surface *converted = SDL_DisplayFormatAlpha(surface);
//SDL_FreeSurface(surface);
m_map[ID] = converted;
m_map[ID] = surface;
return converted;
return surface;
}

View File

@@ -143,7 +143,7 @@ void Engine::Run()
m_stateStack.back()->Update(this);
// Redraw only if necessary:
if (m_redraw)
//if (m_redraw)
m_stateStack.back()->Draw(this);
m_redraw = false;
@@ -277,7 +277,7 @@ void Engine::InitSDL()
// Set the video mode:
if((m_screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, vidInfo->vfmt->BitsPerPixel,
SDL_HWSURFACE|SDL_HWPALETTE|0)) == 0) /* The code does not support SDL_DOUBLEBUF, I wonder how it worked before */
SDL_HWSURFACE|SDL_DOUBLEBUF)) == 0) /* The code does not support SDL_DOUBLEBUF, I wonder how it worked before */
{
ERR("Engine::InitSDL() - SDL_SetVideoMode failed (" << SDL_GetError() << ")");
}
@@ -306,6 +306,14 @@ void Engine::ShowLoadingScreen()
TRAP(surface == NULL, "Engine::ShowLoadingScreen() - File not found");
SDL_FillRect(m_screen, NULL, 0x000000);
SDL_Surface *surface2 = SDL_DisplayFormat(surface);
SDL_FreeSurface(surface);
surface = surface2;
SDL_BlitSurface(surface, NULL, m_screen, NULL);
SDL_Flip(m_screen);
SDL_BlitSurface(surface, NULL, m_screen, NULL);

View File

@@ -1 +1 @@
alienblaster
jooleem_0.1.4

View File

@@ -1 +1 @@
../sdl/sdl-1.3
../sdl/sdl-1.2

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Alien Blaster</string>
<string name="app_name">Jooleem</string>
</resources>

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;
import android.content.Context;

View File

@@ -18,7 +18,7 @@
fixed with a hammer and rasp to work with libSDL port */
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import java.io.Writer;
import java.util.ArrayList;

View File

@@ -1,14 +1,14 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;
import android.content.Context;
class Globals {
public static String ApplicationName = "AlienBlaster";
public static String ApplicationName = "Jooleem";
// Should be zip file
public static String DataDownloadUrl = "http://sites.google.com/site/xpelyax/Home/alienblaster110_data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/alienblaster110_data.zip"; // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
public static String DataDownloadUrl = "http://sites.google.com/site/xpelyax/Home/jooleem_0.1.4_data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/jooleem_0.1.4_data.zip"; // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
// Set DownloadToSdcard to true if your app data is bigger than 5 megabytes.
// It will download app data to /sdcard/alienblaster then,
@@ -23,12 +23,12 @@ class Globals {
public static boolean HorizontalOrientation = true;
// Readme text to be shown on download page
public static String ReadmeText = "^You can press \"Home\" now - the data will be downloaded in background^In game press \"Menu\" for secondary fire, \"Volume Up/Down\" to cycle weapons^If your phone doesnt have joystick or trackball the accelerometer will be used".replace("^","\n");
public static String ReadmeText = "^You may press \"Home\" now - the data will be downloaded in background".replace("^","\n");
public static boolean AppUsesMouse = false;
public static boolean AppUsesMouse = true;
// We have to use accelerometer as arrow keys
public static boolean AppNeedsArrowKeys = true;
public static boolean AppNeedsArrowKeys = false;
public static boolean AppUsesJoystick = false;
@@ -36,5 +36,5 @@ class Globals {
}
class LoadLibrary {
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); };
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); System.loadLibrary("sdl_ttf"); };
}

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import android.app.Activity;
import android.content.Context;
@@ -14,6 +14,8 @@ import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.os.Environment;
import android.os.StatFs;
class Settings
{
@@ -53,7 +55,16 @@ class Settings
"Unknown" ) );
*/
final CharSequence[] items = {"Phone storage", "SD card"};
long freeSdcard = 0;
long freePhone = 0;
try {
StatFs sdcard = new StatFs(Environment.getExternalStorageDirectory().getPath());
StatFs phone = new StatFs(Environment.getDataDirectory().getPath());
freeSdcard = sdcard.getAvailableBlocks() * sdcard.getBlockSize() / 1024 / 1024;
freePhone = phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024;
}catch(Exception e) {}
final CharSequence[] items = {"Phone storage - " + String.valueOf(freePhone) + " Mb free", "SD card - " + String.valueOf(freeSdcard) + " Mb free"};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Where to download application data");

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
package net.sourceforge.jooleem;
import javax.microedition.khronos.opengles.GL10;