-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Since Android 8 it's not possible to listen to implicit broadcasts anymore when the reciever is declared in the AndroidManifest.xml. In a previous commit we disabled sending out broadcasts to other apps. This caused some trouble. For new we hard code 3rd party receiver package names in a resource array. This is supposed to be changed later on, see #824.
- Loading branch information
Showing
6 changed files
with
129 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
opentasks-provider/src/main/java/org/dmfs/provider/tasks/utils/ResourceArray.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2019 dmfs GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dmfs.provider.tasks.utils; | ||
|
||
import android.content.Context; | ||
|
||
import org.dmfs.iterators.elementary.Seq; | ||
|
||
import java.util.Iterator; | ||
|
||
|
||
/** | ||
* An {@link Iterable} of a string array resource. | ||
* | ||
* @author Marten Gajda | ||
*/ | ||
public final class ResourceArray implements Iterable<String> | ||
{ | ||
private final Context mContext; | ||
private final int mResource; | ||
|
||
|
||
public ResourceArray(Context context, int resource) | ||
{ | ||
mContext = context; | ||
mResource = resource; | ||
} | ||
|
||
|
||
@Override | ||
public Iterator<String> iterator() | ||
{ | ||
return new Seq<>(mContext.getResources().getStringArray(mResource)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
opentasks-provider/src/main/java/org/dmfs/provider/tasks/utils/With.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2019 dmfs GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dmfs.provider.tasks.utils; | ||
|
||
import org.dmfs.jems.procedure.Procedure; | ||
import org.dmfs.jems.single.Single; | ||
|
||
|
||
/** | ||
* Experiemental Procedure which calls another procedure with a given value. | ||
* <p> | ||
* TODO move to jems if this works out well | ||
* | ||
* @author Marten Gajda | ||
*/ | ||
@Deprecated | ||
public final class With<T> implements Procedure<Procedure<T>> | ||
{ | ||
private final Single<T> mValue; | ||
|
||
|
||
public With(T value) | ||
{ | ||
this(() -> value); | ||
} | ||
|
||
|
||
public With(Single<T> value) | ||
{ | ||
mValue = value; | ||
} | ||
|
||
|
||
@Override | ||
public void process(Procedure<T> delegate) | ||
{ | ||
delegate.process(mValue.value()); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
opentasks-provider/src/main/res/values/opentasks_provider_changed_receivers.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string-array name="opentasks_provider_changed_receivers"> | ||
<item>org.andstatus.todoagenda</item> | ||
</string-array> | ||
</resources> |