Skip to content

Commit 0e27d68

Browse files
authored
Merge pull request #4 from HeyAlex/circle-ci-config
add circle ci config
2 parents f711a93 + c1812b0 commit 0e27d68

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

Diff for: .circleci/config.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: ~/code
5+
docker:
6+
- image: circleci/android:api-28
7+
environment:
8+
JVM_OPTS: -Xmx3200m
9+
steps:
10+
- checkout
11+
- restore_cache:
12+
key: jars-{{ checksum "build.gradle" }}--{{ checksum "widget-helper/build.gradle" }}--{{ checksum "example/build.gradle" }}
13+
- run:
14+
name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
15+
command: sudo chmod +x ./gradlew
16+
- run:
17+
name: Approve license for build tools
18+
command: (echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/tools/bin/sdkmanager --licenses
19+
20+
- run:
21+
name: Download Dependencies
22+
command: ./gradlew :widget-helper:androidDependencies
23+
- save_cache:
24+
paths:
25+
- ~/.gradle
26+
key: jars-{{ checksum "build.gradle" }}--{{ checksum "widget-helper/build.gradle" }}--{{ checksum "example/build.gradle" }}
27+
- run:
28+
name: Run Tests
29+
command: ./gradlew :widget-helper:lint test

Diff for: README.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# WidgetUpdateHelper
22

3-
This library helps managing the updating widgets. Just update all your widgets on background thread with `android.app.IntentService`, that provides that library.
3+
This library helps managing the updates of widgets. Just update all your widgets on background thread with `android.app.IntentService`, that provides that library.
4+
It's provide an easy and simple way to update app widgets.
45

5-
Please, have a look at the **example** project.
6+
[![CircleCI](https://circleci.com/gh/HeyAlex/WidgetUpdateHelper.svg?style=svg)](https://circleci.com/gh/HeyAlex/WidgetUpdateHelper)
67

7-
## Example
8+
## How to use WidgetUpdateHelper
89

910
**WidgetBuilder**
1011

@@ -18,6 +19,13 @@ public class SingleUpdater extends WidgetUpdater {
1819
//This callback will be running on background thread
1920
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
2021

22+
try {
23+
//DB or Internet requests
24+
Thread.sleep(10000);
25+
} catch (InterruptedException e) {
26+
e.printStackTrace();
27+
}
28+
2129
//make RemoteViews depends on dataBundle and update by widget ID
2230
RemoteViews remoteViews = new RemoteViews();
2331
for (int widgetId : ids) {
@@ -28,7 +36,7 @@ public class SingleUpdater extends WidgetUpdater {
2836
@RequiresApi(api = Build.VERSION_CODES.O)
2937
@Override
3038
public Notification makeNotification(@NonNull Context context) {
31-
//This callback will be running on background thread
39+
//This callback will be also running on background thread
3240

3341
//make custom notification if you need (WidgetUpdater already has default implementation)
3442

@@ -48,7 +56,7 @@ When creating your own widget you can use `RemoteViewsUpdater` annotation to lin
4856
public class ExampleSingleAppWidget extends AppWidgetProvider {
4957
@Override
5058
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
51-
// update widgets
59+
// trigger you WidgetUpdater by this call
5260
WidgetUpdateService.updateWidgets(context, this, bundle, appWidgetIds);
5361
}
5462

@@ -88,6 +96,8 @@ method public static void setTextViewPaintFlags(android.widget.RemoteViews, @IdR
8896
method public static void setTextViewTextSize(android.widget.RemoteViews, @IdRes int viewId, @DimenRes float size);
8997
```
9098

99+
Please, have a look at the **example** project, if you have problems with implementation
100+
91101
## Integration
92102
The library is published to the jitpack repository, your *project's* `build.gradle` must contain:
93103

@@ -110,7 +120,7 @@ dependencies {
110120

111121
### Why to use
112122
All updates are on background thread. So if you need to make RemoteViews depends on data from Database or Internet, that's what you need.
113-
Android O is also supported.
123+
Android P is also supported.
114124

115125
### License
116126
```Text

0 commit comments

Comments
 (0)