Skip to content

Commit dcd3c53

Browse files
Merge branch 'main' into add-about
2 parents 90228f9 + cd8e02d commit dcd3c53

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,33 @@ This is an Android app with the following features:
1717
The app was originally developed in 2012 by [@rorist] from [FIXME Lausanne]. In
1818
2021, the app was transferred to the [SpaceAPI community repositories] and is
1919
now mainly being developed by members of [Coredump].
20+
You can join our [Matrix](https://matrix.org/) chat at `#spaceapi:matrix.coredump.ch`.
2021

2122
[@rorist]: https://github.com/rorist
2223
[FIXME Lausanne]: https://fixme.ch/
2324
[SpaceAPI community repositories]: https://github.com/spaceapi-community/
2425
[Coredump]: https://www.coredump.ch/
2526

27+
<a href="https://f-droid.org/packages/io.spaceapi.community.myhackerspace/"><img width="200" src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid"></a>
2628
<a href="https://play.google.com/store/apps/details?id=io.spaceapi.community.myhackerspace"><img width="200" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" alt="Get it on Google Play"></a>
27-
<a href="https://f-droid.org/repository/browse/?fdid=ch.fixme.status"><img width="200" src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid"></a>
29+
30+
## How it works
31+
32+
The app will get the list of hackspaces from [https://directory.spaceapi.io](https://directory.spaceapi.io).
33+
You can then choose the space by its name from a list.
34+
When the space is chosen, the associated data is retrieved from the space's
35+
SpaceAPI endpoint (which is registered in the SpaceAPI directory).
36+
If you would like to add your space to the directory, have a look at
37+
[the SpaceAPI website](https://spaceapi.io/provide-an-endpoint/).
38+
39+
### The Widget
40+
41+
The image for the widget is specified in the SpaceAPI endpoint JSON.
42+
Have a look at the [schema documentation](https://spaceapi.io/docs/) to make your
43+
widget more pretty!
44+
45+
1. `open.icon` - if present, the widget chooses the specific open/closed images
46+
2. `logo` - the widget chooses the logo of the hackspace to display
2847

2948
## How to Compile
3049

@@ -62,3 +81,5 @@ You can also build and directly install the file to your connected smartphone:
6281
To see other tasks that gradle offers, run
6382

6483
./gradlew tasks
84+
85+

app/src/main/java/io/spaceapi/community/myhackerspace/Widget.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import android.content.SharedPreferences.Editor;
1818
import android.graphics.Bitmap;
1919
import android.os.AsyncTask;
20+
import android.os.Build;
2021
import android.os.Handler;
2122
import android.os.Looper;
2223
import android.preference.PreferenceManager;
@@ -66,7 +67,7 @@ public void onDeleted(Context ctxt, int[] appWidgetIds) {
6667
for (int widgetId : appWidgetIds) {
6768
// Remove widget alarm
6869
PendingIntent pi = PendingIntent.getService(ctxt, widgetId,
69-
getIntent(ctxt, widgetId), 0);
70+
getIntent(ctxt, widgetId), getPendingIntentMutableFlag());
7071
AlarmManager am = (AlarmManager) ctxt
7172
.getSystemService(Context.ALARM_SERVICE);
7273
am.cancel(pi);
@@ -84,6 +85,10 @@ public void onDeleted(Context ctxt, int[] appWidgetIds) {
8485
}
8586
}
8687

88+
protected static int getPendingIntentMutableFlag() {
89+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_MUTABLE : 0;
90+
}
91+
8792
protected static Intent getIntent(Context ctxt, int widgetId) {
8893
Intent i = new Intent(ctxt, UpdateService.class);
8994
i.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
@@ -104,7 +109,7 @@ protected static void setAlarm(Context ctxt, Intent i, int widgetId,
104109
// Set alarm
105110
AlarmManager am = (AlarmManager) ctxt
106111
.getSystemService(Context.ALARM_SERVICE);
107-
PendingIntent pi = PendingIntent.getService(ctxt, widgetId, i, 0);
112+
PendingIntent pi = PendingIntent.getService(ctxt, widgetId, i, getPendingIntentMutableFlag());
108113
am.cancel(pi);
109114
am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
110115
delay, update_interval, pi);
@@ -188,7 +193,7 @@ protected static void updateWidget(final Context ctxt, int widgetId,
188193
Intent clickIntent = new Intent(ctxt, Main.class);
189194
clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
190195
PendingIntent pendingIntent = PendingIntent.getActivity(ctxt, widgetId,
191-
clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
196+
clickIntent, PendingIntent.FLAG_CANCEL_CURRENT + getPendingIntentMutableFlag());
192197
views.setOnClickPendingIntent(R.id.widget_image, pendingIntent);
193198
manager.updateAppWidget(widgetId, views);
194199
}

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88

99
dependencies {
1010
// Android gradle integration
11-
classpath 'com.android.tools.build:gradle:7.2.1'
11+
classpath 'com.android.tools.build:gradle:7.2.2'
1212

1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files

metadata/en-US/full_description.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
<p>View information about hacker- and makerspaces registered in the
1+
<p>View information about hackerspaces and makerspaces registered in the
22
<a href="https://spaceapi.io/">SpaceAPI</a> directory. This includes:</p>
33

44
<ul>
55
<li>Location and contact information</li>
66
<li>Opening status</li>
77
<li>Sensor values</li>
8+
<li>A widget displaying the current open/closed status on the Android home screen</li>
89
<li>...and much more!</li>
910
</ul>
1011

1112
<strong>History</strong>
1213

13-
<p>This app was originally developed in 2012 by @rorist from FIXME Lausanne. In
14-
2021, the app was transferred to the SpaceAPI community repositories and is now
14+
<p>This app was originally developed in 2012 by @rorist from the FIXME Lausanne hackspace.
15+
In 2021, the app was transferred to the SpaceAPI community repositories and is now
1516
mainly being developed by members of Coredump.</p>

0 commit comments

Comments
 (0)