Skip to content

About

Android temperature converter app using Java and Gradle; provides Celsius↔Fahrenheit conversions with two Activities, ViewBinding for layouts, intent factories for navigation, and resource driven UI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

CtoFConverter (Android)

Simple Android app to convert between Celsius and Fahrenheit. Two Activities let you convert in either direction using a shared Converters utility.

For sample I/O traces and additional information, visit the project page: https://www.rsiddiq.com/software-design.html

App at a Glance

  • Application ID: com.ctofconverter
  • Modules: :app
  • SDK: compile 34, target 34, min 34
  • Version: 1.0 (1)
  • Primary Activities: .FtoCActivity, .MainActivity
  • Core Logic: app/src/main/java/com/ctofconverter/Utils/Converters.java

Project Structure

CtoFConverter/
├── app/
│   ├── src/
│   │   ├── androidTest/
│   │   │   └── java/
│   │   │       └── com/
│   │   │           └── ctofconverter/
│   │   │               └── ExampleInstrumentedTest.java
│   │   ├── main/
│   │   │   ├── java/
│   │   │   │   └── com/
│   │   │   │       └── ctofconverter/
│   │   │   │           ├── Utils/
│   │   │   │           │   └── Converters.java
│   │   │   │           ├── FtoCActivity.java
│   │   │   │           └── MainActivity.java
│   │   │   ├── res/
│   │   │   │   ├── drawable/
│   │   │   │   │   ├── ic_launcher_background.xml
│   │   │   │   │   └── ic_launcher_foreground.xml
│   │   │   │   ├── layout/
│   │   │   │   │   ├── activity_fto_cactivity.xml
│   │   │   │   │   └── activity_main.xml
│   │   │   │   ├── mipmap-anydpi/
│   │   │   │   │   ├── ic_launcher.xml
│   │   │   │   │   └── ic_launcher_round.xml
│   │   │   │   ├── mipmap-hdpi/
│   │   │   │   │   ├── ic_launcher.webp
│   │   │   │   │   └── ic_launcher_round.webp
│   │   │   │   ├── mipmap-mdpi/
│   │   │   │   │   ├── ic_launcher.webp
│   │   │   │   │   └── ic_launcher_round.webp
│   │   │   │   ├── mipmap-xhdpi/
│   │   │   │   │   ├── ic_launcher.webp
│   │   │   │   │   └── ic_launcher_round.webp
│   │   │   │   ├── mipmap-xxhdpi/
│   │   │   │   │   ├── ic_launcher.webp
│   │   │   │   │   └── ic_launcher_round.webp
│   │   │   │   ├── mipmap-xxxhdpi/
│   │   │   │   │   ├── ic_launcher.webp
│   │   │   │   │   └── ic_launcher_round.webp
│   │   │   │   ├── values/
│   │   │   │   │   ├── colors.xml
│   │   │   │   │   ├── strings.xml
│   │   │   │   │   └── themes.xml
│   │   │   │   ├── values-night/
│   │   │   │   │   └── themes.xml
│   │   │   │   └── xml/
│   │   │   │       ├── backup_rules.xml
│   │   │   │       └── data_extraction_rules.xml
│   │   │   └── AndroidManifest.xml
│   │   └── test/
│   │       └── java/
│   │           └── com/
│   │               └── ctofconverter/
│   │                   └── ExampleUnitTest.java
│   ├── build.gradle
│   └── proguard-rules.pro
├── gradle/
│   ├── wrapper/
│   │   ├── gradle-wrapper.jar
│   │   └── gradle-wrapper.properties
│   └── libs.versions.toml
├── build.gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
├── README.md
└── settings.gradle

Build & Run

Option A — Android Studio (recommended)

  1. Open Android Studio and select Open → choose the CtoFConverter/ folder.
  2. Let Gradle sync and download dependencies.
  3. Select a device or emulator, then click Run ▶ to install app.

Option B — CLI

cd CtoFConverter
./gradlew assembleDebug         # build APK
./gradlew installDebug          # install on a connected device
./gradlew connectedAndroidTest  # run instrumentation tests (device/emulator required)

Features

  • Celsius → Fahrenheit and Fahrenheit → Celsius conversions
  • Intent factories to navigate between Activities while passing initial values
  • ViewBinding for safe view access
  • Toast hints and long-press listeners for quick interactions

Code Map

Conversion Logic

Converters.java:

public static double celsiusToFahrenheit(double celsius) {
    return (celsius * (9/5.0)) + 32;
}
public static double fahrenheitToCelsius(double fahrenheit) {
    return (fahrenheit - 32) * (5/9.0);
}

Activities

  • MainActivity — Celsius → Fahrenheit
    • Reads an optional initial value from the Intent ("CONVERTED_VALUE") and displays it
    • displayConvertedValue(View v) renders the formatted °F output
  • FtoCActivity — Fahrenheit → Celsius
    • Similar flow in reverse
    • displayConvertedValue(View v) renders the formatted °C output

Resources

  • Layouts: activity_main.xml, activity_fto_cactivity.xml
  • Strings: res/values/strings.xml (includes format strings: degrees_fahrenheit, degrees_celsius)

Usage Tips

  • Use the on-screen input field to enter a temperature and tap Convert.
  • Long-press actions in Activities provide quick feedback (Toast).
  • Use the intent factories to deep-link between screens with pre-filled values:
startActivity(FtoCActivity.FtoCIntentFactory(this, 212.0));
startActivity(MainActivity.MainActivityIntentFactory(this, 100.0));

Testing

  • Instrumented tests under app/src/androidTest/java/...
  • Run from Android Studio (Run → Run 'All Tests') or:
./gradlew connectedAndroidTest

About

Android temperature converter app using Java and Gradle; provides Celsius↔Fahrenheit conversions with two Activities, ViewBinding for layouts, intent factories for navigation, and resource driven UI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages