summaryrefslogtreecommitdiff
path: root/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
blob: eb85418ea14d059fc177a2b0b23ae2e1ca8474db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.libreoffice.impressremote.util;

import android.content.Context;
import android.content.Intent;

import org.libreoffice.impressremote.activity.ComputerConnectionActivity;
import org.libreoffice.impressremote.activity.ComputerCreationActivity;
import org.libreoffice.impressremote.activity.LicensesActivity;
import org.libreoffice.impressremote.activity.SlideShowActivity;
import org.libreoffice.impressremote.communication.CommunicationService;
import org.libreoffice.impressremote.communication.Server;

public final class Intents {
    private Intents() {
    }

    public static final class Actions {
        private Actions() {
        }

        public static final String SERVERS_LIST_CHANGED = "SERVERS_LIST_CHANGED";

        public static final String PAIRING_SUCCESSFUL = "PAIRING_SUCCESSFUL";
        public static final String PAIRING_VALIDATION = "PAIRING_VALIDATION";

        public static final String CONNECTION_FAILED = "CONNECTION_FAILED";

        public static final String SLIDE_SHOW_RUNNING = "SLIDE_SHOW_RUNNING";
        public static final String SLIDE_SHOW_STOPPED = "SLIDE_SHOW_STOPPED";

        public static final String SLIDE_CHANGED = "SLIDE_CHANGED";
        public static final String SLIDE_PREVIEW = "SLIDE_PREVIEW";
        public static final String SLIDE_NOTES = "SLIDE_NOTES";

        public static final String TIMER_UPDATED = "TIMER_UPDATED";
        public static final String TIMER_STARTED = "TIMER_STARTED";
        public static final String TIMER_RESUMED = "TIMER_RESUMED";
        public static final String TIMER_CHANGED = "TIMER_CHANGED";
    }

    public static final class Extras {
        private Extras() {
        }

        public static final String PIN = "PIN";

        public static final String SERVER = "SERVER";
        public static final String SERVER_ADDRESS = "SERVER_ADDRESS";
        public static final String SERVER_NAME = "SERVER_NAME";

        public static final String SLIDE_INDEX = "SLIDE_INDEX";

        public static final String MINUTES = "MINUTES";
    }

    public static final class RequestCodes {
        private RequestCodes() {
        }

        public static final int CREATE_SERVER = 1;
    }

    public static Intent buildServersListChangedIntent() {
        return new Intent(Actions.SERVERS_LIST_CHANGED);
    }

    public static Intent buildPairingSuccessfulIntent() {
        return new Intent(Actions.PAIRING_SUCCESSFUL);
    }

    public static Intent buildPairingValidationIntent(String aPin) {
        Intent aIntent = new Intent(Actions.PAIRING_VALIDATION);
        aIntent.putExtra(Extras.PIN, aPin);

        return aIntent;
    }

    public static Intent buildConnectionFailedIntent() {
        return new Intent(Actions.CONNECTION_FAILED);
    }

    public static Intent buildSlideShowRunningIntent() {
        return new Intent(Actions.SLIDE_SHOW_RUNNING);
    }

    public static Intent buildSlideShowStoppedIntent() {
        return new Intent(Actions.SLIDE_SHOW_STOPPED);
    }

    public static Intent buildSlideChangedIntent(int aSlideIndex) {
        Intent aIntent = new Intent(Actions.SLIDE_CHANGED);
        aIntent.putExtra(Extras.SLIDE_INDEX, aSlideIndex);

        return aIntent;
    }

    public static Intent buildSlidePreviewIntent(int aSlideIndex) {
        Intent aIntent = new Intent(Actions.SLIDE_PREVIEW);
        aIntent.putExtra(Extras.SLIDE_INDEX, aSlideIndex);

        return aIntent;
    }

    public static Intent buildSlideNotesIntent(int aSlideIndex) {
        Intent aIntent = new Intent(Actions.SLIDE_NOTES);
        aIntent.putExtra(Extras.SLIDE_INDEX, aSlideIndex);

        return aIntent;
    }

    public static Intent buildComputerConnectionIntent(Context aContext, Server aServer) {
        Intent aIntent = new Intent(aContext, ComputerConnectionActivity.class);
        aIntent.putExtra(Extras.SERVER, aServer);

        return aIntent;
    }

    public static Intent buildComputerCreationIntent(Context aContext) {
        return new Intent(aContext, ComputerCreationActivity.class);
    }

    public static Intent buildComputerCreationResultIntent(String aAddress, String aName) {
        Intent aIntent = new Intent();
        aIntent.putExtra(Extras.SERVER_ADDRESS, aAddress);
        aIntent.putExtra(Extras.SERVER_NAME, aName);

        return aIntent;
    }

    public static Intent buildSlideShowIntent(Context aContext) {
        return new Intent(aContext, SlideShowActivity.class);
    }

    public static Intent buildLicensesIntent(Context aContext) {
        return new Intent(aContext, LicensesActivity.class);
    }

    public static Intent buildCommunicationServiceIntent(Context aContext) {
        return new Intent(aContext, CommunicationService.class);
    }

    public static Intent buildTimerUpdatedIntent() {
        return new Intent(Actions.TIMER_UPDATED);
    }

    public static Intent buildTimerStartedIntent(int aMinutesLength) {
        Intent aIntent = new Intent(Actions.TIMER_STARTED);
        aIntent.putExtra(Extras.MINUTES, aMinutesLength);

        return aIntent;
    }

    public static Intent buildTimerResumedIntent() {
        return new Intent(Actions.TIMER_RESUMED);
    }

    public static Intent buildTimerChangedIntent(int aMinutesLength) {
        Intent aIntent = new Intent(Actions.TIMER_CHANGED);
        aIntent.putExtra(Extras.MINUTES, aMinutesLength);

        return aIntent;
    }
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */