Skip to content
emermeladaPublic

About

Android App for artists to share, learn and get inspiration.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

ArtCenter — Android app

Native Android client for ArtCenter, a social platform where artists publish their work, tag it by technique, and browse a catalogue of artistic disciplines. Built with Kotlin and Jetpack Compose, it consumes a REST API over JWT-authenticated HTTP.

The backend it talks to lives in emermelada/artcenter_api.

Final project for the Higher Vocational Degree in Cross-Platform Application Development (DAM) at U-tad, June 2025.

Sign-up, feed, post detail, profile and comments

Stack

Area Choice
Language Kotlin
UI Jetpack Compose + Material 3
Architecture MVVM (one ViewModel per screen, StateFlow + sealed UiState)
Navigation Navigation Compose, two graphs split by Activity
Dependency injection Hilt
Networking Retrofit 2.11 + OkHttp, Gson and Scalars converters
Images Coil
Local storage DataStore Preferences
Concurrency Kotlin coroutines
SDK minSdk 26, targetSdk 34, compileSdk 35

Features

  • Sign-up and login against the API, with client-side validation (matching passwords, valid e-mail, password strength indicator).
  • User and administrator roles. The role travels inside the token and changes what each screen offers — an administrator does not publish, they moderate.
  • Paginated feed with progressive loading as you scroll.
  • Posts with technique tags, picked from a searchable dropdown when creating them.
  • Likes and saves, both as toggles, resolved server-side in the same query that returns the feed.
  • Comments, with deletion for your own.
  • Post search: a single query field matched server-side against title, description, tag and author.
  • Profile management: avatar, username, and two tabs — your own posts and the ones you saved.
  • Category and subcategory administration: full CRUD over the discipline catalogue, restricted to administrator accounts.

The administration panel is a separate section of the same app rather than a separate build. MainScaffold reads the role from the session and swaps the available destinations, so the categories screen an administrator sees is the catalogue every user browses, plus the edit controls.

Creating a category writes name and description; subcategories carry a longer record — description, characteristics, requirements and tutorials — which is what the catalogue screens render as collapsible sections.

Administrator creating a new category

Screenshots


Login. Entry point of the auth graph. Failed credentials and validation errors surface under the fields.

Feed. Two-column grid of posts, each labelled with its technique tag. New pages load as you reach the bottom.

Post detail. Full-size image, publication date, like counter, save state and access to the comment thread.

Profile. Editable avatar and username, with tabs switching between your own posts and your saved ones.

Category management. The same catalogue a regular user browses, with edit affordances and creation buttons added for administrators.

Subcategory editing. Long-form record — description, characteristics, requirements and tutorials — that feeds the public catalogue view.

Architecture

com.emermelada.artcenter
├── data
│   ├── model          Data classes grouped by domain (auth, publications, categories,
│   │                  subcategories, comments, tags, profile) + a generic Result<T>
│   ├── remote         Retrofit interfaces (AuthApiService, ArtCenterApiService)
│   │                  and RetroFitInstance, which builds both clients
│   └── repositories   One repository per domain; the only layer that touches remote
├── di                 Hilt modules
├── ui
│   ├── activities     AuthActivity and MainActivity
│   ├── components     Reusable Composables (PublicationItem, dialogs, scaffold)
│   ├── navigation     Destinations, AuthNavGraph, AppNavGraph
│   ├── screens        One package per screen: Screen + ViewModel
│   ├── theme          Colours, typography, shapes
│   └── UiState        Sealed class: Idle / Loading / Success / Error
└── utils              SessionManager

How a request flows. A Composable calls a method on its ViewModel. The ViewModel sets UiState.Loading, launches a coroutine in viewModelScope and calls the injected repository. The repository calls the corresponding Retrofit interface and wraps the response into Result<T>, mapping HTTP errors into a message instead of letting exceptions escape. Back in the ViewModel, the result updates a StateFlow and the UiState; the Composable collects both and recomposes.

Authentication. RetroFitInstance builds two OkHttp clients: one without authentication, used by AuthApiService for login and sign-up, and one with an interceptor that reads the token from SessionManager and attaches it as Authorization: Bearer … to every call. SessionManager is an in-memory singleton holding the token and role for the lifetime of the process; PreferencesRepository mirrors them into DataStore. MainActivity checks the token on launch and hands off to AuthActivity when there is none, which is why the two Activities are separate: the token has to exist before the authenticated client is ever used.

Getting started

Requirements: Android Studio (Ladybug or newer), JDK 17, and a running instance of artcenter_api.

  1. Clone the repository and open it in Android Studio. Let Gradle sync — the wrapper pulls everything it needs.

  2. Point the app at your API. The base URL is a constant in app/src/main/java/com/emermelada/artcenter/data/remote/RetroFitInstance.kt:

    private const val BASE_URL = "/api/"

    The committed value is a placeholder and Retrofit will reject it — baseUrl() requires an absolute URL. Replace it with the address of your API instance, keeping the trailing slash:

    // Android emulator reaching a server on the host machine
    private const val BASE_URL = "http://10.0.2.2:5000/api/"
    
    // Physical device on the same network
    private const val BASE_URL = "http://192.168.1.42:5000/api/"
  3. Plain http:// addresses work out of the box: the manifest already declares android:usesCleartextTraffic="true", which is what lets the app reach a local development server. Tighten this to a network security configuration listing only your host before shipping anything real.

  4. Run the app on an emulator or device with API 26 or higher. Create an account from the sign-up screen; to reach the administration panel you need an account flagged as administrator in the API's database.

Technical decisions

Pagination as scroll, not as a button. The API returns the feed in pages of twenty. The obvious client-side reading of that is a "load more" button, but it makes the boundary between pages visible to the user, which is exactly what should stay invisible. FeedScreen instead observes the grid state with snapshotFlow on layoutInfo.visibleItemsInfo, and asks the ViewModel for the next page when the last visible item approaches the end of the list. The ViewModel guards against re-entering while a request is in flight and against requesting past the last page, because snapshotFlow emits far more often than pages need loading. Getting that guard right took longer than the scroll detection itself.

One publication component instead of three. The same post card appears in the feed, in the profile and in search results, and in each place it offers a different context menu: a stranger's post can be liked and saved, your own can also be deleted, and an administrator can delete any of them. The first version had a copy per screen, which meant a change to the card was three changes. PublicationItem now takes userRole and isOwner and decides its own menu from them. The screens pass what they know and stop caring about permissions — the rule lives in one place, and adding a role would be one more branch rather than three more files.

Two Retrofit clients rather than one with conditional headers. Login and sign-up are the only calls that must go out without a token, and an interceptor that sometimes attaches a header is an interceptor that can attach a stale one. Separating the clients makes it structurally impossible to send an expired token to the login endpoint, at the cost of one extra object.

Role in the token, not in the client. The app never decides what a user may do; it reads the role the API put in the JWT and adapts the UI to it. Hiding a button is a convenience, not a permission — every restricted action is rejected server-side as well.

Project status

Functionally complete and working against a local instance of the API. The backend is not deployed yet, so the app has no public server to point at: the base URL has to be set by hand as described above. Everything shown in the recordings runs against a local Flask server and a local MySQL database.

License

MIT. See LICENSE.

About

Android App for artists to share, learn and get inspiration.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages