Coder Social home page Coder Social logo

Comments (19)

grote avatar grote commented on June 4, 2024

The way this should be implemented is to always remember the latest (transport) product selection in the SharedPreferences.

from transportr.

grote avatar grote commented on June 4, 2024

Implementation notes:

The preferences should be by transport network. In order to not have products * networks new preferences, a new preference should only be created when a user deselects products. By default all products are activated. If there is no preference, then the product is active in this network.

Also consider issue #106 for the implementation.

from transportr.

lu-x avatar lu-x commented on June 4, 2024

I'd like to work on this one, because it affects me almost every time i use Transportr.
Unfortunately, i can't build Transportr in Android Studio because of some dependency issue :/

from transportr.

grote avatar grote commented on June 4, 2024

Did you follow the instructions from Building From Source? If yes, what is the error you are getting?

from transportr.

lu-x avatar lu-x commented on June 4, 2024

Yes, i get:

Error:A problem occurred configuring root project 'Transportr'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':_debugCompile'.
      > Could not resolve com.github.orangegangsters:swipy:1.2.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.orangegangsters:swipy:1.2.2.
            > Could not get resource 'https://jcenter.bintray.com/com/github/orangegangsters/swipy/1.2.2/swipy-1.2.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/orangegangsters/swipy/1.2.2/swipy-1.2.2.pom'.
                  > peer not authenticated
      > Could not resolve de.cketti.library.changelog:ckchangelog:1.2.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve de.cketti.library.changelog:ckchangelog:1.2.2.
            > Could not get resource 'https://jcenter.bintray.com/de/cketti/library/changelog/ckchangelog/1.2.2/ckchangelog-1.2.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/de/cketti/library/changelog/ckchangelog/1.2.2/ckchangelog-1.2.2.pom'.
                  > peer not authenticated
      > Could not resolve org.apmem.tools:layouts:1.10.
        Required by:
            :Transportr:unspecified
         > Could not resolve org.apmem.tools:layouts:1.10.
            > Could not get resource 'https://jcenter.bintray.com/org/apmem/tools/layouts/1.10/layouts-1.10.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/apmem/tools/layouts/1.10/layouts-1.10.pom'.
                  > peer not authenticated
      > Could not resolve com.mikepenz:materialdrawer:5.1.6.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.mikepenz:materialdrawer:5.1.6.
            > Could not get resource 'https://jcenter.bintray.com/com/mikepenz/materialdrawer/5.1.6/materialdrawer-5.1.6.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/mikepenz/materialdrawer/5.1.6/materialdrawer-5.1.6.pom'.
                  > peer not authenticated
      > Could not resolve com.mikepenz:aboutlibraries:5.6.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.mikepenz:aboutlibraries:5.6.2.
            > Could not get resource 'https://jcenter.bintray.com/com/mikepenz/aboutlibraries/5.6.2/aboutlibraries-5.6.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/mikepenz/aboutlibraries/5.6.2/aboutlibraries-5.6.2.pom'.
                  > peer not authenticated
      > Could not resolve com.github.MKergall.osmbonuspack:OSMBonusPack:v5.7.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.MKergall.osmbonuspack:OSMBonusPack:v5.7.
            > Could not get resource 'https://jcenter.bintray.com/com/github/MKergall/osmbonuspack/OSMBonusPack/v5.7/OSMBonusPack-v5.7.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/MKergall/osmbonuspack/OSMBonusPack/v5.7/OSMBonusPack-v5.7.pom'.
                  > peer not authenticated
      > Could not resolve org.slf4j:slf4j-api:1.7.14.
        Required by:
            :Transportr:unspecified
         > Could not resolve org.slf4j:slf4j-api:1.7.14.
            > Could not get resource 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.14/slf4j-api-1.7.14.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.14/slf4j-api-1.7.14.pom'.
                  > peer not authenticated
      > Could not resolve com.github.tony19:logback-android-classic:1.1.1-4.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.tony19:logback-android-classic:1.1.1-4.
            > Could not get resource 'https://jcenter.bintray.com/com/github/tony19/logback-android-classic/1.1.1-4/logback-android-classic-1.1.1-4.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/tony19/logback-android-classic/1.1.1-4/logback-android-classic-1.1.1-4.pom'.
                  > peer not authenticated
      > Could not resolve com.github.tony19:logback-android-core:1.1.1-4.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.tony19:logback-android-core:1.1.1-4.
            > Could not get resource 'https://jcenter.bintray.com/com/github/tony19/logback-android-core/1.1.1-4/logback-android-core-1.1.1-4.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/tony19/logback-android-core/1.1.1-4/logback-android-core-1.1.1-4.pom'.
                  > peer not authenticated
      > Could not resolve com.google.guava:guava:18.0.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve com.google.guava:guava:18.0.
            > Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
                  > peer not authenticated
      > Could not resolve org.slf4j:slf4j-api:1.7.14.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve org.slf4j:slf4j-api:1.7.14.
            > Could not get resource 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.14/slf4j-api-1.7.14.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.14/slf4j-api-1.7.14.pom'.
                  > peer not authenticated
      > Could not resolve com.google.code.findbugs:jsr305:3.0.0.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve com.google.code.findbugs:jsr305:3.0.0.
            > Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.pom'.
                  > peer not authenticated
      > Could not resolve org.json:json:20090211.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve org.json:json:20090211.
            > Could not get resource 'https://jcenter.bintray.com/org/json/json/20090211/json-20090211.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/json/json/20090211/json-20090211.pom'.
                  > peer not authenticated
   > Could not resolve all dependencies for configuration ':compile'.
      > Could not resolve com.github.orangegangsters:swipy:1.2.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.orangegangsters:swipy:1.2.2.
            > Could not get resource 'https://jcenter.bintray.com/com/github/orangegangsters/swipy/1.2.2/swipy-1.2.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/orangegangsters/swipy/1.2.2/swipy-1.2.2.pom'.
                  > peer not authenticated
      > Could not resolve de.cketti.library.changelog:ckchangelog:1.2.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve de.cketti.library.changelog:ckchangelog:1.2.2.
            > Could not get resource 'https://jcenter.bintray.com/de/cketti/library/changelog/ckchangelog/1.2.2/ckchangelog-1.2.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/de/cketti/library/changelog/ckchangelog/1.2.2/ckchangelog-1.2.2.pom'.
                  > peer not authenticated
      > Could not resolve org.apmem.tools:layouts:1.10.
        Required by:
            :Transportr:unspecified
         > Could not resolve org.apmem.tools:layouts:1.10.
            > Could not get resource 'https://jcenter.bintray.com/org/apmem/tools/layouts/1.10/layouts-1.10.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/apmem/tools/layouts/1.10/layouts-1.10.pom'.
                  > peer not authenticated
      > Could not resolve com.mikepenz:materialdrawer:5.1.6.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.mikepenz:materialdrawer:5.1.6.
            > Could not get resource 'https://jcenter.bintray.com/com/mikepenz/materialdrawer/5.1.6/materialdrawer-5.1.6.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/mikepenz/materialdrawer/5.1.6/materialdrawer-5.1.6.pom'.
                  > peer not authenticated
      > Could not resolve com.mikepenz:aboutlibraries:5.6.2.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.mikepenz:aboutlibraries:5.6.2.
            > Could not get resource 'https://jcenter.bintray.com/com/mikepenz/aboutlibraries/5.6.2/aboutlibraries-5.6.2.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/mikepenz/aboutlibraries/5.6.2/aboutlibraries-5.6.2.pom'.
                  > peer not authenticated
      > Could not resolve com.github.MKergall.osmbonuspack:OSMBonusPack:v5.7.
        Required by:
            :Transportr:unspecified
         > Could not resolve com.github.MKergall.osmbonuspack:OSMBonusPack:v5.7.
            > Could not get resource 'https://jcenter.bintray.com/com/github/MKergall/osmbonuspack/OSMBonusPack/v5.7/OSMBonusPack-v5.7.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/github/MKergall/osmbonuspack/OSMBonusPack/v5.7/OSMBonusPack-v5.7.pom'.
                  > peer not authenticated
      > Could not resolve com.google.guava:guava:18.0.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve com.google.guava:guava:18.0.
            > Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
                  > peer not authenticated
      > Could not resolve org.slf4j:slf4j-api:1.7.12.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve org.slf4j:slf4j-api:1.7.12.
            > Could not get resource 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom'.
                  > peer not authenticated
      > Could not resolve com.google.code.findbugs:jsr305:3.0.0.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve com.google.code.findbugs:jsr305:3.0.0.
            > Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.pom'.
                  > peer not authenticated
      > Could not resolve org.json:json:20090211.
        Required by:
            :Transportr:unspecified > Transportr.sublibs.public-transport-enabler:enabler:unspecified
         > Could not resolve org.json:json:20090211.
            > Could not get resource 'https://jcenter.bintray.com/org/json/json/20090211/json-20090211.pom'.
               > Could not GET 'https://jcenter.bintray.com/org/json/json/20090211/json-20090211.pom'.
                  > peer not authenticated

from transportr.

grote avatar grote commented on June 4, 2024

What gradle version are you using? gradle --version If you are on 2.10, try at least 2.11.

from transportr.

lu-x avatar lu-x commented on June 4, 2024

It was 2.10.
I now changed distributionUrl in gradle-wrapper.properties to https\://services.gradle.org/distributions/gradle-2.13-all.zip

Now i get:
Error:Cause: unable to find valid certification path to requested target

from transportr.

grote avatar grote commented on June 4, 2024

Welcome to the beautiful world of Android ;)

Sounds like you are using gradle wrapper. Don't you have gradle installed on your system? I usually prefer to use my own gradle.

Otherwise, you need to search around and try various things. I haven't had this problem myself, so maybe one of those helps:

from transportr.

DJaeger avatar DJaeger commented on June 4, 2024

Any news?

from transportr.

lu-x avatar lu-x commented on June 4, 2024

I finally accomplished to be able to build Transportr in Android Studio with the help of this post: http://stackoverflow.com/a/33421921.
However, i'll need some time to get into the code;)

from transportr.

grote avatar grote commented on June 4, 2024

Awesome, let me know if you have any questions and please make sure to read the implementation notes above.

from transportr.

lu-x avatar lu-x commented on June 4, 2024

This is my roadmap:

  • in the ProductDialogFragment: check, if at least one product is not selected, when ok is clicked.
  • if this is the case -> remember the ones, which are not selected
  • get the current transport network
  • check if there's already a preference for this network
  • create/update the shared preference with all the products, which were selected
  • when resuming to the main activity: check if there's a preference file. If there's one, only use the products of the preference

from transportr.

lu-x avatar lu-x commented on June 4, 2024

First question: How do i check, if items in the Fragment are selected or not?

from transportr.

grote avatar grote commented on June 4, 2024

My original idea was to use one boolean preference per product per network, but you might be able to transform the products into a StringSet and use putStringSet instead. In order to distinguish between networks, you would probably need to create one preferences file per network and use the networkId as name similar to here: https://github.com/grote/Transportr/blob/master/src/de/grobox/liberario/Preferences.java#L40

get the current transport network

You should be able to use the static method Preferences.getTransportNetwork().

check if there's already a preference for this network

You can just call getStringSet() with a default value of null that you can check for.

when resuming to the main activity: check if there's a preference file. If there's one, only use the products of the preference

You would probably make the same call to getStringSet(). You could probably just add to methods to the Preferences class: getProducts() and setProducts() or something like that.

How do i check, if items in the Fragment are selected or not?

You might be able to hook in here: https://github.com/grote/Transportr/blob/master/src/de/grobox/liberario/fragments/ProductDialogFragment.java#L110
Just make sure you store new preferences asynchronously.
Also once the user selects all products, it is maybe best to just delete the shared preferences again, or at least clear the product related ones in case we want to add more network specific settings in the future.

from transportr.

lu-x avatar lu-x commented on June 4, 2024

Thank you for your detailed explanations. Nice to see, that some of my thoughts matches with yours;)

How do i check, if items in the Fragment are selected or not?

You might be able to hook in here: https://github.com/grote/Transportr/blob/master/src/de/grobox/liberario/fragments/ProductDialogFragment.java#L110

But how do i get the information, if all products are selected? Can i get the full number of products of the current network and compare it to the size of the EnumSet products?

from transportr.

grote avatar grote commented on June 4, 2024

Can i get the full number of products of the current network and compare it to the size of the EnumSet products?

Yes for example, but every network potentially has all products even they do not actually exist in it. There's something like Product.ALL you can call and compare.

from transportr.

grote avatar grote commented on June 4, 2024

Maybe it even makes sense to add the two methods not to the Preferences class, but to the TransportNetwork class.

from transportr.

lu-x avatar lu-x commented on June 4, 2024

Can i just open a WIP pull request? I think i'll need some further advise. Sorry 🙈

from transportr.

grote avatar grote commented on June 4, 2024

Sure, why not?

from transportr.

Related Issues (20)

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.