Git Product home page Git Product logo

roboguice-sherlock's Introduction

roboguice-sherlock Build Status

RoboGuice classes for use with ActionBarSherlock

Both RoboGuice and ActionBarSherlock require custom base classes for Activities and Fragments, and as Java doesn't permit diamond-inheritance, or the traits of Scala, this project provides custom RoboGuice classes that extend the corresponding ones from ActionBarSherlock.

JakeWharton provided the first example of how to do this with a RoboSherlockActivity: it's a simple drudge process of taking the source for the RoboGuice class and changing the activity/fragment named in the extends declaration to the corresponding ActionBarSherlock class - there are no further complications I've encountered so far.

All classes in this project have the same name as the RoboGuice ones, with 'Sherlock' inserted after the 'Robo', ie Robo**Sherlock**ListFragment. The package is also changed to com.github.rtyley.android.sherlock.roboguice.**.

Download releases from Maven:

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.rtyley%22%20AND%20a%3A%22roboguice-sherlock%22

Used in...

The open-source Gaug.es web analytics app by GitHub.

roboguice-sherlock's People

Contributors

jakewharton avatar luciofm avatar rfc1459 avatar rtyley avatar zhen9ao avatar

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

roboguice-sherlock's Issues

classNotFoundException

Hi
I'm trying to use RoboSherlockFragmentActivity, but when my app starts it send me a force close. and the classNotFoundException.
But when i use SherlockFragmentActivity it works very well.

Can't use in IntelliJ IDEA

After add the following dependency:

<dependency>
    <groupId>com.github.rtyley</groupId>
    <artifactId>roboguice-sherlock</artifactId>
    <version>1.3</version>
</dependency>

Intellj complains a lot about can't find symbols of ActionbarSherlock methods.

Is there a wiki about how to make this lib work with Intellj? Thanks

@ContentView can't work with requestWindowFeature()

Set @ContentView(R.layout.xx) before the Activity, and call requestWindowFeature() to get some ActionbarSherlock feature, then the app crashes with the following exception:

Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

Cant build due to test failure on method shouldAllowBackgroundThreadsToFinishUsingContextAfterOnDestroy

Full stack trace below

Test set: com.github.rtyley.android.sherlock.roboguice.activity.SherlockActivityInjectionTest

Tests run: 13, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.578 sec <<< FAILURE!
shouldAllowBackgroundThreadsToFinishUsingContextAfterOnDestroy(com.github.rtyley.android.sherlock.roboguice.activity.SherlockActivityInjectionTest) Time elapsed: 0.04 sec <<< ERROR!
java.lang.NegativeArraySizeException
at com.github.rtyley.android.sherlock.roboguice.activity.SherlockActivityInjectionTest.shouldAllowBackgroundThreadsToFinishUsingContextAfterOnDestroy(SherlockActivityInjectionTest.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at com.xtremelabs.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:292)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)

Unable to use no_aop guice classifier

I'm getting the below "warning" when launching my app with the roboguice-sherlock dependency. After a bit of research (https://groups.google.com/forum/#!topic/google-guice/rCfmJR4Ru68) it appears to be due to the built-in AOP support in roboguice 3.0. Normally, you can specify <classifier>no_aop</classifier> on the guice dependency in the pom to get around this - when not using actionbarsherlock API's. It would be nice to be able to work with the same classified dependency to eliminate this warning.

07-02 15:41:37.444: WARN/nalizableReferenceQueue(364): Could not load Finalizer in its own class loader. Loading Finalizer in the current class loader instead. As a result, you will not be able to garbage collect this class loader. To support reclaiming this class loader, either resolve the underlying issue, or move Google Collections to your system class path.
        java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class
        at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.getBaseUrl(FinalizableReferenceQueue.java:269)
        at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.loadFinalizer(FinalizableReferenceQueue.java:253)
        at com.google.inject.internal.util.$FinalizableReferenceQueue.loadFinalizer(FinalizableReferenceQueue.java:175)
        at com.google.inject.internal.util.$FinalizableReferenceQueue.<clinit>(FinalizableReferenceQueue.java:100)
        at com.google.inject.internal.util.$MapMaker$QueueHolder.<clinit>(MapMaker.java:787)
        at com.google.inject.internal.util.$MapMaker$WeakEntry.<init>(MapMaker.java:946)
        at com.google.inject.internal.util.$MapMaker$Strength$1.newEntry(MapMaker.java:312)
        at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(MapMaker.java:498)
        at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(MapMaker.java:419)
        at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2029)
        at com.google.inject.internal.Annotations$AnnotationChecker.hasAnnotations(Annotations.java:116)
        at com.google.inject.internal.Annotations.isBindingAnnotation(Annotations.java:180)
        at com.google.inject.Key.ensureIsBindingAnnotation(Key.java:366)
        at com.google.inject.Key.strategyFor(Key.java:338)
        at com.google.inject.Key.get(Key.java:272)
        at com.google.inject.internal.AbstractBindingBuilder.annotatedWithInternal(AbstractBindingBuilder.java:82)
        at com.google.inject.internal.ConstantBindingBuilderImpl.annotatedWith(ConstantBindingBuilderImpl.java:49)
        at roboguice.config.DefaultRoboModule.configure(DefaultRoboModule.java:117)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
        at com.google.inject.spi.Elements.getElements(Elements.java:101)
        at com.google.inject.spi.Elements.getElements(Elements.java:78)
        at roboguice.RoboGuice.setBaseApplicationInjector(RoboGuice.java:83)
        at roboguice.RoboGuice.setBaseApplicationInjector(RoboGuice.java:139)
        at roboguice.RoboGuice.getBaseApplicationInjector(RoboGuice.java:59)
        at roboguice.RoboGuice.getInjector(RoboGuice.java:149)
        at com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockActivity.onCreate(RoboSherlockActivity.java:59)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
        at android.app.ActivityThread.access$2300(ActivityThread.java:125)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:123)
        at android.app.ActivityThread.main(ActivityThread.java:4627)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:521)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
        at dalvik.system.NativeStart.main(Native Method)

ActionBarSherlock 4.1.0 has been released

ActionBarSherlock 4.1.0 has been released. You should probably bump the dependency version in your pom.xml, and test against it to make sure everything still works okay.

Thanks!

@InjectPreference not working with RoboSherlockPreferenceActivity

Hi,

I was trying to inject a preference with @InjectPreference in a RoboSherlockPreferenceActivity and it was not working, an EmptyStackException was thrown internally on Roboguice code. So, I decided to try with RoboPreferenceActivity (without ABS), and @InjectPreferences was working fine. Checking code of RoboSherlockPreferenceActivity.setPreferenceScreen() against RoboPreferenceActivity.setPreferenceScreen() I noticed some differences.

Using these lines (exactly the ones in RoboPreferenceActivity):

@Override
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
    super.setPreferenceScreen(preferenceScreen);

    // Lines added 
    final ContextScope scope = RoboGuice.getInjector(this).getInstance(ContextScope.class);
    synchronized (ContextScope.class) {
        scope.enter(this);
        try {
            preferenceListener.injectPreferenceViews();
        } finally {
            scope.exit(this);
        }
    }
}

instead of these:

@Override
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
    super.setPreferenceScreen(preferenceScreen);
    preferenceListener.injectPreferenceViews();
}

Makes @InjectPreference to work fine.

Thanks a lot for all your work guys!!

Cheers,

Jordi.

P.S.: This is happening in 1.4 version and in last 1.5-SNAPSHOT. Currently using ABS 4.1.0 and RoboGuice 2.0.

Unclear license

Hi Roberto!

Thank you for this wonderful little helper. Could you please state / clarify the code's license somewhere?

Thanks!

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.