Application development

BitBoy OS supports two types of application development:

  • Native Android applications (APK)

    Android applications provide comprehensive system functionality access and optimized performance, suitable for complex games and tools;

  • HTML applications.

    HTML applications offer cross-platform compatibility and rapid development advantages, ideal for simple interfaces and lightweight applications. Developers can choose the appropriate development method based on project requirements and technology stack.

Design Guidelines

UI Design Principles

  • Adapt to 640x480 resolution

Color Guidelines

Typography

  • System Fonts

    系统字体

  • Recommended Font Sizes

    建议字号

Icon Design

  • Dimensions:

    48x48dp, 72x72dp, 96x96dp

  • Style:

    Flat, minimalist

[TODO: Add more design specifications and examples]

Physical Button Development

BitBoy OS Button Mapping Tools

BitBoy OS SDK provides two core classes for handling physical button mapping: KeyEventHelper and KeyEventActivity.

KeyEventHelper

For handling buttons in specific Views:

val keyEventHelper = KeyEventHelper(
    onPress = { code, view -> /* Handle press */ },
    onLongPress = { code, view -> /* Handle long press */ },
    KEY_A, KEY_X, KEY_Y
)
yourView.setOnKeyListener(keyEventHelper)

KeyEventActivity

Base class for global button handling:

class YourActivity : KeyEventActivity() {
    override fun onKeyA() { /* A button press */ }
    override fun onLongKeyA() { /* A button long press */ }
    // Other button methods...
}

Key Features

  • Supports press and long-press events

  • Predefined common button codes (A, B, X, Y, etc.)

  • Day/Night mode switching support

  • Customizable button responses

Key Mapping

Button
KeyCode
Description

A

KEY_A / KEY_GAME_A

Confirm / Start

B

KEY_B / KEY_GAME_B

Cancel / Back

X

KEY_X

Function 1

Y

KEY_Y

Function 2

Up

KeyEvent.KEYCODE_DPAD_UP

Up

Down

KeyEvent.KEYCODE_DPAD_DOWN

Down

Left

KeyEvent.KEYCODE_DPAD_LEFT

Left

Right

KeyEvent.KEYCODE_DPAD_RIGHT

Right

L

KEY_BACK_LEFT

Left shoulder button

R

KEY_BACK_RIGHT

Right shoulder button

Start

KEY_START

Start (same as A button)

Select

KEY_SELECT

Select

Center button

KEY_MID_F

Center button (same as B button)

Performance Optimization Tips

Graphics Optimization

  • Use hardware acceleration

  • Minimize transparency usage

  • Optimize drawing hierarchy

Memory Management

  • Use SparseArray instead of HashMap

  • Release unused resources promptly

  • Avoid memory leaks

Battery Optimization

  • Use JobScheduler for background tasks

  • Reduce network request frequency

  • Optimize Wake Lock usage

[TODO: Add more performance optimization tips and tool usage guides]

Debugging and Testing

Using BitBoy Emulator (in development):

  • Download link: [Emulator download link]

  • Configuration guide: [Configuration doc link]

Physical Device Debugging:

  • Enable developer options

  • Connect device using ADB

Performance Analysis Tools:

  • Using Android Profiler

  • BitBoy performance monitoring tools

Last updated