Git Product home page Git Product logo

agera's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agera's Issues

How does the updateable know that himself was removed from obserable, or make others konw that

Thanks firstly, agera is amzing, but I think there is a flaw:
when we do something like network, we always cancel the behavior under some circumstances, we need a callback like onCancel, I know that the onDeactivation method may tell us all the updateable was removed, but if I use RepositoryCompiler to get a Repository, I can not know that because the onDeactivation is protected, is there anyway to achieve this?

##

时好时坏

Can't use compiled repositories in kotlin

EDIT: Here's the kotlin issue in Youtrack
Hi,
I tried using complied repositories in kotlin, first manually, by writing the code myself in a new kotlin class, but with no success. I then tried to convert the CalculatorActivityFinal.java file to to kotlin with the IDE option (cmd+option+shift+K) (requires the IntelliJ/Android Studio Kotlin plugin), and the generated code couldn't compile either, displaying the same error.
This seems to be related to how kotlin handles generics type safety.

Here's what I see after converting code to kotlin (all the errors are in onStart()):
screen shot 2016-11-09 at 08 26 23
Note that the code above was generated after converting all lambdas to anonymous classes.
The main problematic line is the repository compilation:

mResultRepository = Repositories.repositoryWithInitialValue(Result.absent<String>()).observe(mValue1Repo, mValue2Repo, mOperationSelector).onUpdatesPerLoop().goTo(CalculatorExecutor.EXECUTOR).attemptTransform(Function<com.google.android.agera.Result<kotlin.String>, com.google.android.agera.Result<com.google.android.agera.Result<kotlin.String>>> { input1 -> CalculatorOperations.keepCpuBusy(input1) }).orEnd(Function<kotlin.Throwable, com.google.android.agera.Result<kotlin.String>> { failure -> Result.failure<String>(failure) }).getFrom(mValue1Repo).mergeIn(mValue2Repo, Merger<kotlin.Int, kotlin.Int, android.support.v4.util.Pair<kotlin.Int, kotlin.Int>> { a, b -> Pair.create(a, b) }).attemptMergeIn(mOperationSelector, Merger<android.support.v4.util.Pair<kotlin.Int, kotlin.Int>, com.google.android.agera.Result<kotlin.Int>, com.google.android.agera.Result<kotlin.Int>> { operands, operation -> CalculatorOperations.attemptOperation(operands, operation) }).orEnd(Function<kotlin.Throwable, com.google.android.agera.Result<kotlin.String>> { failure -> Result.failure<String>(failure) }).thenTransform(Function<kotlin.Int, com.google.android.agera.Result<kotlin.String>> { input -> Result.present(input.toString()) }).onConcurrentUpdate(RepositoryConfig.SEND_INTERRUPT).compile()

Before trying with anonymous classes, I tried converting the codes with lambdas, which did not work too as you can see in the following screenshot:
screen shot 2016-11-09 at 10 27 54

I think it's absolutely impossible to compile an agera repository in kotlin with agera 1.1.0 and kotlin 1.0.5, so I'm asking how agera, or kotlin may be edited to support such cases

Exception when Response is Empty

I'm making a DELETE request to a server and when it success it returns empty string
but in Agera ,the response must not be an empty string because the responseBody will be null so it throws an exception here

  @NonNull
  public static <T> Result<T> success(@NonNull final T value) {
    return new Result<>(checkNotNull(value), null);
  }

is there any workaround for this case ?

Loaders example

Hi,
Loaders is the recommended way to make loading on Android data lifecycle aware and avoid reloading it when configuration changes. Could you give an example on how to use a compiled repository in a loader please? Or maybe we can talk on how to make it right here, and I do a pull request for a sample following the discussion?

[Question] WorkerHandler doesn't extend Handler

I have cloned this repository and, when I try to compile it, I have an error telling me that WorkerHandler doesn't extend Handler.
I have looked into it a little bit and I found out my problem comes from the keyword "final" before the argument "message" in the "handleMessage" method.
One of the errors I have in Android Studio is :

Error:(113, 5) error: method does not override or implement a method from a supertype

If I remove the final keyword, it compiles just fine.

I thought this might have something to do with Java 8 so I install Java 7 and update my alternative to use Java 7 but I have the same error.

Here is a link to a pastebin with the result of my gradle assemble command from a freshly cloned copy : http://pastebin.com/Bss5XuwR

I have asked around me for other people to try to compile and they manage to do it just fine.

I'm running on Ubuntu 15.04 and I have tried with the following java version :

  • 1.7.0_79
  • 1.8.0_66
  • 1.8.0_91

I'm sorry if this is a stupid question but I would really like to understand why it's happening.

[Question] A problem about using repository

Hi,when I was reading chapter "Activation lifecycle and event chain",I know that observable can register two or more updatables,so I tried to register two updatables onto a sample observable which just notify these two updatables.And when I change my code to let the second updatable do a delay registration using handler.postDelay(Runnable r, long delayMillis),it also works and the second updatable receive the event later.
But when I using repository to do the same thing,the second updatable cannot receive the event when I tried to make it delay.I read the source code of agera and found that BaseObservable's function addUpdatable(final Updatable updatable) will send message MSG_FIRST_ADDED when the variable size just equals 1,it means if someone register two updatables and make the second one delay,it cannot receive the events.(But if we register it immediately after registering the first one,it works because using handler send message MSG_FIRST_ADDED is a time consuming operation)
So is there any workaround?

Compilation problems

Hey,
I have checked out master branch and compilation attempt finishes with following error:

Error:A problem occurred configuring project ':extensions:rvdatabinding'.

Could not find support-v4.jar (com.android.support:support-v4:24.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/24.1.1/support-v4-24.1.1.jar

Change of settings.gradle from
gradle.ext.buildToolsVersion = '24.0.0'
gradle.ext.supportLibraryVersion = '24.1.1'
to
gradle.ext.buildToolsVersion = '24.0.2'
gradle.ext.supportLibraryVersion = '24.2.0'

fixes compilation error but when I try to run testapp I have following error:

AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;","sources":[{}],"original":"UNEXPECTED TOP-LEVEL EXCEPTION:\ncom.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;\n\tat com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)\n\tat com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)\n\tat com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)\n\tat com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)\n\tat com.android.dx.merge.DexMerger.merge(DexMerger.java:188)\n\tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)\n\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)\n\tat com.android.dx.command.dexer.Main.run(Main.java:277)\n\tat com.android.dx.command.dexer.Main.main(Main.java:245)\n\tat com.android.dx.command.Main.main(Main.java:106)\n","tool":"Dex"}

:testapp:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':testapp:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 2

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 44.702 secs

Could not find dependency "com.google.android.agera:agera:1.4.0"

Summary:

I get the following error message while building the project - Could not find dependency "com.google.android.agera:agera:1.4.0. The SDK Manager already has all the updates installed and there are no pending updates. Also, Android Studio is currently running on the latest stable build.

Steps to reproduce the issue:

  1. Open Android Studio
  2. Add the follwoing dependency to your project.
    implementation 'com.google.android.agera:agera:1.4.0'
  3. Build the project

Expected Behavior:

The project should build without any errors.

Observed Behavior:

The project build fails with the following error message - Could not find dependency "com.google.android.agera:agera:1.4.0"

Android Studio Version:

Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Screenshot:

agera-dependency-issue

crash bug

SqlDatabaseFunctions class should add catch IllegalStateException when do merge operator. this will happen "java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed." thx.

[Question] How to do disable the update event when Repository.addUpdatable.

When Repository.addUpdatable(), will trigger update event.
How to disable the update event when addUpdatable().

 @Override
  protected void observableActivated() {
    eventSource.addUpdatable(this);
    maybeStartFlow();
  }

  @Override
  protected void observableDeactivated() {
    eventSource.removeUpdatable(this);
    maybeCancelFlow(deactivationConfig, false);
  }

translation of wiki for Korean

hi. I'm GDE of South Korea.
recently, I saw this repository. I was interested in Reactive Android.
so I decided that I would translate to Korean.

this link is output of translation.
: https://github.com/ZeroBrain/agera-wiki-kr/wiki

I worked with some GDGs for translation.

I appreciate that I can do that.

Thank you so much for great job that making agera.

Use gradle wrapper

Would be nice to use a gradle wrapper for all projects in this repo to avoid build issues with incompatible gradle version.

What is the main function of eventSources

I know there is a function observe() in RepositoryCompilerStates.It notes that Specifies the event source of the compiled repository. But I have no idea about how to use it.
I was using Agera to do some works during the past few mouths,like develop an AgeraBus just like RxBus or EventBus,and build an App based on Agera,but I've never using observe() function.
I just using Agera like:
.repositoryWithInitialValue(def) .observe() .onUpdatesPerLoop() .goTo(Executors.newSingleThreadExecutor()) .getFrom(.....) .thenTransform(.......) .compile();
I read the source code of this part and I got the point is eventSource will update the repository when observableActivated called:
@Override protected void observableActivated() { eventSource.addUpdatable(this); maybeStartFlow(); }
But is it useful?Adding an eventSource will just let the repository process the data twice,but the data is same so repository will not trigger the updatable to do updating.I cannot find any circumstance to use this function.

Query

1.about Http part, lack to cookie manage.
2.seems agera directives both a specific purpose,such as getFrom.. getTranster...
in Rxjava, has doOnNext..., just encapsulate Runnable. if add this kind of method in agera?

in additation to, If add some https config in http part, such as sslsocketFactory,Hostname verfy etc.

Crash when trying to remove not added updatable

When trying to remove updateable which was not added app crashes with following stacktrace

Caused by: java.lang.IllegalStateException: Updatable not added, cannot remove. at com.google.android.agera.BaseObservable.remove(BaseObservable.java:146) at com.google.android.agera.BaseObservable.removeUpdatable(BaseObservable.java:94) at com.google.android.agera.Repositories$SimpleRepository.removeUpdatable(Repositories.java:94) at pl.fzymek.weatherprojector.viewmodel.SelectCityViewModel.shutdown(SelectCityViewModel.java:88) at pl.fzymek.weatherprojector.presentation.select.SelectCityActivity.onDestroy(SelectCityActivity.java:35)

Maybe it should just do nothing like ArrayList#remove(Object)

[Question] Usages of non main thread to register an Updatable to a BaseObservable?

Hi,
I know BaseObservable checks for the calling thread to be a Looper thread, but I'm wondering if there are real use cases where this thread would not be the main one since using a Looper Thread properly outside an IntentService is not trivial, and using IntentServices with Agera doesn't seem obvious to me.

If anyone using BaseObservable outside of the main thread, please reply here, and explain why.

Thanks!

demo crash on huawei honor 6.0

[ 04-25 10:02:40.358 3009: 3009 E/ ]
process stopped due to unexpected signal 13
04-25 10:02:40.358 18767-18767/com.google.android.agera.testapp D/HwCust: Create obj success use class android.widget.HwCustTextViewImpl
04-25 10:02:40.372 18767-18767/com.google.android.agera.testapp I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
04-25 10:02:40.372 18767-18767/com.google.android.agera.testapp D/HwCust: Create obj success use class android.widget.HwCustTextViewImpl
04-25 10:02:40.400 18767-18793/com.google.android.agera.testapp I/System: core_booster, getBoosterConfig = true
04-25 10:02:40.435 18767-18767/com.google.android.agera.testapp D/StrictMode: StrictMode policy violation; ~duration=7 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=327711 violation=2
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1275)
at libcore.io.BlockGuardOs.access(BlockGuardOs.java:67)
at java.io.File.doAccess(File.java:284)
at java.io.File.exists(File.java:364)
at huawei.android.hwutil.ZipFileCache.openZipFile(ZipFileCache.java:145)
at huawei.android.hwutil.ZipFileCache.(ZipFileCache.java:73)
at huawei.android.hwutil.ZipFileCache.getAndCheckCachedZipFile(ZipFileCache.java:81)
at android.content.res.HwResources.getThemeDrawable(HwResources.java:710)
at android.content.res.HwResources.loadDrawable(HwResources.java:652)
at android.content.res.TypedArray.getDrawable(TypedArray.java:912)
at android.view.View.(View.java:3999)
at android.widget.ImageView.(ImageView.java:145)
at android.widget.ImageButton.(ImageButton.java:84)
at android.widget.ImageButton.(ImageButton.java:80)
at android.widget.ActionMenuPresenter$OverflowMenuButton.(ActionMenuPresenter.java:862)
at android.widget.ActionMenuPresenter.initForMenu(ActionMenuPresenter.java:170)
at com.android.internal.view.menu.MenuBuilder.addMenuPresenter(MenuBuilder.java:229)
at android.widget.Toolbar.setMenu(Toolbar.java:404)
at com.android.internal.widget.ToolbarWidgetWrapper.setMenu(ToolbarWidgetWrapper.java:391)
at com.android.internal.widget.ActionBarOverlayLayout.setMenu(ActionBarOverlayLayout.java:795)
at com.android.internal.policy.PhoneWindow.preparePanel(PhoneWindow.java:586)
at com.android.internal.policy.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:970)
at com.android.internal.policy.PhoneWindow$1.run(PhoneWindow.java:285)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
04-25 10:02:40.436 18767-18767/com.google.android.agera.testapp D/AndroidRuntime: Shutting down VM
04-25 10:02:40.436 18767-18767/com.google.android.agera.testapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.android.agera.testapp, PID: 18767
android.os.StrictMode$StrictModeViolation: policy=327711 violation=2
at android.os.StrictMode.executeDeathPenalty(StrictMode.java:1522)
at android.os.StrictMode.access$1300(StrictMode.java:122)
at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolation(StrictMode.java:1515)
at android.os.StrictMode$AndroidBlockGuardPolicy$1.run(StrictMode.java:1397)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
04-25 10:02:40.749 18767-18767/com.google.android.agera.testapp I/Process: Sending signal. PID: 18767 SIG: 9

Question: what's the relation to RxJava?

This looks like a very interesting proposition.

My question - it's quite an elephant in the room, I should think - is what's the relation between this library and RxJava?

Isn't it RxJava reinvented? Is it supposed to be more light-weight? Complementary? Or just inspired?

Nowhere do your docs seem to even acknowledge RxJava's existence (I'll stand corrected if I overlooked something), even though you're clearly adopting the same paradigm.

I'd be very grateful if you were willing to shed some light on this (disclaimer: I'm not affiliated with RxJava nor its creators; just another Android dev on the lookout for the new shiny thing).

Slow signal delivery from off-main thread

This code snippet takes significantly more time to run through than a similar RxJava sequence when n is 10.000+ (i7 4790, Windows 7 x64, Studio 2.0, HAXM on).

I have no experience with the platform or the intentions of this library, but my guess is that the mandatory hopping in the underlying Agera infrastructure creates excessive amounts of tasks/messages, basically for each update() signal.

Given only the base types, I'd reduce the overhead by coalescing the update signals into a simple number of calls that have to be done on the other side of the boundary:

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.NonNull;

import com.google.android.agera.Observable;
import com.google.android.agera.Updatable;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Signals the update() coming from an upstream Observable on the specified Looper.
 */
public final class UpdateOn implements Observable {

    final Observable source;

    final Looper looper;

    final Map<Updatable, UpdateOnUpdatable> map;

    public UpdateOn(Observable source, Looper looper) {
        this.source = source;
        this.looper = looper;
        this.map = new HashMap<>();
    }


    @Override
    public void addUpdatable(@NonNull Updatable updatable) {
        UpdateOnUpdatable u;
        synchronized (this) {
            if (map.containsKey(updatable)) {
                throw new IllegalStateException("Updatable already added");
            }

            u = new UpdateOnUpdatable(updatable, looper);
            map.put(updatable, u);
        }
        source.addUpdatable(u);
    }

    @Override
    public void removeUpdatable(@NonNull Updatable updatable) {
        UpdateOnUpdatable u;
        synchronized (this) {
            u = map.remove(updatable);
            if (u == null) {
                throw new IllegalStateException("Updatable already removed");
            }
        }
        u.cancelled = true;
        source.removeUpdatable(u);
    }

    static final class UpdateOnUpdatable implements Updatable, Handler.Callback {
        final Updatable actual;

        final Handler handler;

        final AtomicLong count;

        volatile boolean cancelled;

        UpdateOnUpdatable(Updatable actual, Looper looper) {
            this.actual = actual;
            this.count = new AtomicLong();
            this.handler = new Handler(looper, this);
        }

        @Override
        public void update() {
            if (count.getAndIncrement() == 0) {
                Message msg = handler.obtainMessage();
                handler.dispatchMessage(msg);
            }
        }

        @Override
        public boolean handleMessage(Message msg) {
            long c = count.get();

            for (;;) {
                for (long i = 0; i < c; i++) {
                    if (cancelled) {
                        break;
                    }
                    actual.update();
                }

                c = count.addAndGet(-c);
                if (c == 0L) {
                    break;
                }
            }

            return false;
        }
    }
}

(Note, however, that Agera seems to send other types of messages through the looper/handler such as first/last updatable and my suggestion above might starve or be unfair towards those messages.)

[Question] Some problem about error handling

Hi,sorry to bother you guys again.
I know we can use Result & Attempt to do a better error handling in agera.
But I found a problem is agera is weak of handling unchecked exception,like RuntimeExeception.
When I try this:

private Supplier<Result<Integer>> safeStrSupplier = new Supplier<Result<Integer>>() {
        @NonNull
        @Override
        public Result<Integer> get() {

            throw new RuntimeException("exception!!!");
        }
    };
safeRepository = Repositories.repositoryWithInitialValue(Result.<Integer>absent())
                .observe()
                .onUpdatesPerLoop()
                .attemptGetFrom(safeStrSupplier).orSkip()
                .....

The work flow will not skip but throw the exception.It means we cannot catch the exception unless we use try-catch block,does it?

Build failure on Ubuntu

Description

I tried to build the project on Ubuntu (14.04.3 LTS, x86-64) and encountered the below compile error.

$ ./gradlew clean assembleRelease
Incremental java compilation is an incubating feature.
:agera:clean
:testapp:clean UP-TO-DATE
:extensions:content:clean UP-TO-DATE
:extensions:database:clean UP-TO-DATE
:extensions:net:clean UP-TO-DATE
:extensions:rvadapter:clean UP-TO-DATE
:agera:preBuild UP-TO-DATE
:agera:preReleaseBuild UP-TO-DATE
:agera:compileReleaseNdk UP-TO-DATE
:agera:compileLint
:agera:copyReleaseLint UP-TO-DATE
:agera:checkReleaseManifest
:agera:prepareReleaseDependencies
:agera:compileReleaseAidl
:agera:compileReleaseRenderscript
:agera:generateReleaseBuildConfig
:agera:mergeReleaseShaders
:agera:compileReleaseShaders
:agera:generateReleaseAssets
:agera:mergeReleaseAssets
:agera:generateReleaseResValues UP-TO-DATE
:agera:generateReleaseResources
:agera:packageReleaseResources
:agera:processReleaseManifest
:agera:processReleaseResources
:agera:generateReleaseSources
:agera:incrementalReleaseJavaCompilationSafeguard
:agera:compileReleaseJavaWithJavac
:agera:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/hiroshi/git/github.com/google/agera/agera/src/main/java/com/google/android/agera/Common.java:106: error: cannot find symbol
  static final class WorkerHandler extends Handler {
                                           ^
  symbol:   class Handler
  location: class Common
...

Environment

OS: Ubuntu 14.04.3 LTS, x86-64
Java: Oracle Java 64-bit 1.8.0_66-b17
Android Studio: 2.1

Solution

A bit strangely, when I changed the order of import statements in com.google.android.agera.Common as below, the compile error was gone:

diff --git a/agera/src/main/java/com/google/android/agera/Common.java b/agera/src/main/java/com/google/android/agera/Common.java
index 8bad1a8..47627bd 100644
--- a/agera/src/main/java/com/google/android/agera/Common.java
+++ b/agera/src/main/java/com/google/android/agera/Common.java
@@ -18,10 +18,10 @@ package com.google.android.agera;
 import static com.google.android.agera.Preconditions.checkNotNull;
 import static com.google.android.agera.Result.failure;

+import android.os.Handler;
 import com.google.android.agera.BaseObservable.Worker;
 import com.google.android.agera.Observables.LowPassFilterObservable;

-import android.os.Handler;
 import android.os.Message;
 import android.support.annotation.NonNull;

I'm afraid it might be related to com.google.android.agera.Common and com.google.android.agera.BaseObservable has a cyclic package dependency. Though I believe the Java specification allows that, it might cause a bug or an unexpected behaviour of Java compiler.

For your information, I tried Oracle Java 7 and OpendJDK 7 but the result was same.

Thanks.

About IdentityMultimap query.

capture
according abrove code from agera.
method: addKeyValuePair
purpose: will additation key-pair that same key and different value.
result: we can see the key has exist, so the 'size' will add 1, and because value is no exist, so 'hasValue' still is false, and due to (!hasValue) so the key-pair should be added to array's tail. but result return "size == 0",so return false, actually the key-pair had added to array's tail, right? if yes,I want to know why return false even if had added successfuly?

Thanks
Agera's fans

agera and screen rotation

Hi

How I can handle screen rotation with agera repository?
For example, I create repository in activity onCreate(), do addUpdatable() in onResume() or onStart(), and repository start getting data from network very slowly on worker thread.
Then activity recreated after screen rotation and, how I understand, new repository will be created in onCreate() and another one request will be executed. But here I want get result from first repository.
Maybe I must only save created repository in global variable?

Thanks!

A typo in one of the wiki pages?

In one of the wiki pages, Incrementally-Agerifying-legacy-code, there seems to be a typing mistake. In the sample code of Exposing synchronous operations as repositories, did you mean Repositories.repositoryWithInitialValue(Result<ResponseBlob>.absent()) rather than the expression Repositories.repositoryWithInitialValue(Result.<ResponseBlob>absent()) ?

Sample doesn't build, is this project dead?

Just picked up this library and started trying out the codelabs at https://codelabs.developers.google.com/codelabs/android-agera/#13

The project does not build in (nearly) current Android Studio 3.2.1 with gradle warnings, such as:

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

and build failures such as

Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  W/ResourceType(11468): For resource 0x0101053d, entry index(1341) is beyond type entryCount(1320)
  W/ResourceType(11468): For resource 0x0101053e, entry index(1342) is beyond type entryCount(1320)
  W/ResourceType(11468): For resource 0x0101053b, entry index(1339) is beyond type entryCount(1320)
  W/ResourceType(11468): For resource 0x0101053c, entry index(1340) is beyond type entryCount(1320)
  D:\src\samples\android-agera\app\src\main\res\layout\step2.xml:18: error: attribute orientation (aka com.example.android.codelabs.agera:orientation) not found.

Just want to make sure there is some life here before devoting my time to reviving that is only mostly dead.

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

Artifacts Found

  • gradle/wrapper/gradle-wrapper.jar
  • samples/BasicSample/gradle/wrapper/gradle-wrapper.jar
  • samples/BasicSampleWithoutCallbacks/gradle/wrapper/gradle-wrapper.jar

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Why HTTPUrlConnection and not okhttp or even retrofit ?

It looks like there are more cutting edge alternatives than HTTPUrlConnection for network.

It seems to me that it would be more valuable at some point for Google to properly package volley + retrofit support and make it the official network layer of Android than adding one more library not linked with the rest and the best practices on the platform..

Otherwise, that's an interesting project.

Fine grained updates for RecyclerView Adapter

Hi!

Agera RecyclerView Adapter always calls notifyDataSetChanged(), regardless of what changed, which is bad according to RecyclerView guys (you can ask @yigit or his teammates), and I think so too, as it makes the adapter invalidate everything even if just one item was added.

Fine grained data changes notifications such as notifyItemChanged(int position) or notifyItemRemoved(int position) are better for user experience (can have comprehensible animations following the changed that occurred), and performance.

I'm not an Agera expert yet, but I would like to get advice, or better, a sample on how such an Adapter could work with Agera and if it could be integrated in the rvadapter official Agera extension.

Thanks!

what is this

why the f**** you, GOOGLE< a TITAN and AN EXAMPLE TO ALL OTHER, make a library without a description, without some more solid documentation ??? you you even publish this without taking a little time to talk more about it, give examples etc. etc.

WHAT THE F**** can I understand from you bitmap example

WHY you took the time to create a LOGO for this, and not take time to write some documentation ?????????????????????????????

(gradle4.4.1, agera1.4.0) when I run proguard, I got these warnings:

Warning: com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateRecord: can't find referenced class com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateAction
Warning: com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateRecord: can't find referenced class com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateAction
Warning: com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateRecorder: can't find referenced class com.google.android.agera.rvadapter.RepositoryAdapter$ListUpdateAction

I have to add "-dontwarn com.google.android.agera.**" into my proguard file to avoid it.

[Query]: About switch work-thread

Hi guys,
I'm coming again.,I'm a young developer,please forgive me for always disturbing you.
In Agera,I know switch work-thread used Executor to submit a task to execute to on the target thread(actually is Executor). but I have a confused that how to switch to main-Thread.
Of course,if I can provider a main-thread's Executor and then the rest of flows will runing on main-thread. but I don't know how to get/create main-thread's Executor.
Could you give some suggestions?

Thanks
Agera's fens

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.