001// SPDX-License-Identifier: GPL-3.0-or-later
002// Copyright © 2026 Aurélien Pierre
003
004package com.aurelienpierre.sioul;
005
006import android.app.Activity;
007import android.content.Intent;
008import android.os.Bundle;
009
010/**
011 * A line of the home screen's card tapped (HomeCard, HomeCardRows): the
012 * Porch or a message on it, Now on its step, the Agenda or an event in it,
013 * kept for Rust ({@link HomeCard#opened}; homecard.rs takes it when the window comes
014 * up), then Sioul brought up as by its icon. A window of its own, never shown,
015 * so that no intent naming a step, a message or an event stays with Sioul's
016 * window, to be given again when Android restores it. Not exported.
017 */
018public final class HomeCardOpener extends Activity
019{
020    @Override
021    protected void onCreate(Bundle state)
022    {
023        super.onCreate(state);
024        if (state == null)
025            HomeCard.opened(this, getIntent());
026        Intent sioul = getPackageManager().getLaunchIntentForPackage(getPackageName());
027        if (sioul != null)
028            startActivity(sioul.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED));
029        finish();
030    }
031}