-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Unpublished <[email protected]>
- Loading branch information
1 parent
c230bad
commit 60e5d85
Showing
15 changed files
with
132 additions
and
150 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
News-Android-App/src/main/java/com/bumptech/glide/samples/svg/SvgDecoder.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
News-Android-App/src/main/java/com/bumptech/glide/samples/svg/SvgDecoder.kt
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,44 @@ | ||
package com.bumptech.glide.samples.svg | ||
|
||
import com.bumptech.glide.load.Options | ||
import com.bumptech.glide.load.ResourceDecoder | ||
import com.bumptech.glide.load.engine.Resource | ||
import com.bumptech.glide.load.resource.SimpleResource | ||
import com.bumptech.glide.request.target.Target | ||
import com.caverock.androidsvg.SVG | ||
import com.caverock.androidsvg.SVGParseException | ||
import java.io.IOException | ||
import java.io.InputStream | ||
|
||
/** | ||
* Decodes an SVG internal representation from an [InputStream]. | ||
*/ | ||
class SvgDecoder : ResourceDecoder<InputStream, SVG> { | ||
override fun handles( | ||
source: InputStream, | ||
options: Options, | ||
): Boolean { | ||
return true | ||
} | ||
|
||
@Throws(IOException::class) | ||
override fun decode( | ||
source: InputStream, | ||
width: Int, | ||
height: Int, | ||
options: Options, | ||
): Resource<SVG>? { | ||
return try { | ||
val svg = SVG.getFromInputStream(source) | ||
if (width != Target.SIZE_ORIGINAL) { | ||
svg.documentWidth = width.toFloat() | ||
} | ||
if (height != Target.SIZE_ORIGINAL) { | ||
svg.documentHeight = height.toFloat() | ||
} | ||
SimpleResource(svg) | ||
} catch (ex: SVGParseException) { | ||
throw IOException("Cannot load SVG from stream", ex) | ||
} | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
News-Android-App/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
News-Android-App/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.kt
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,24 @@ | ||
package com.bumptech.glide.samples.svg | ||
|
||
import android.graphics.Picture | ||
import android.graphics.drawable.PictureDrawable | ||
import com.bumptech.glide.load.Options | ||
import com.bumptech.glide.load.engine.Resource | ||
import com.bumptech.glide.load.resource.SimpleResource | ||
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder | ||
import com.caverock.androidsvg.SVG | ||
|
||
/** | ||
* Convert the [SVG]'s internal representation to an Android-compatible one ([Picture]). | ||
*/ | ||
class SvgDrawableTranscoder : ResourceTranscoder<SVG, PictureDrawable> { | ||
override fun transcode( | ||
toTranscode: Resource<SVG>, | ||
options: Options, | ||
): Resource<PictureDrawable> { | ||
val svg = toTranscode.get() | ||
val picture = svg.renderToPicture() | ||
val drawable = PictureDrawable(picture) | ||
return SimpleResource(drawable) | ||
} | ||
} |
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
5 changes: 0 additions & 5 deletions
5
...oid-App/src/main/java/de/luhmer/owncloudnewsreader/events/podcast/PodcastFeedClicked.java
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...droid-App/src/main/java/de/luhmer/owncloudnewsreader/events/podcast/PodcastFeedClicked.kt
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,3 @@ | ||
package de.luhmer.owncloudnewsreader.events.podcast | ||
|
||
class PodcastFeedClicked(val position: Int) |
7 changes: 0 additions & 7 deletions
7
...d-App/src/main/java/de/luhmer/owncloudnewsreader/events/podcast/StartDownloadPodcast.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...oid-App/src/main/java/de/luhmer/owncloudnewsreader/events/podcast/StartDownloadPodcast.kt
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,5 @@ | ||
package de.luhmer.owncloudnewsreader.events.podcast | ||
|
||
import de.luhmer.owncloudnewsreader.model.PodcastItem | ||
|
||
class StartDownloadPodcast(val podcast: PodcastItem) |
27 changes: 0 additions & 27 deletions
27
...App/src/main/java/de/luhmer/owncloudnewsreader/services/OwnCloudAuthenticatorService.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...d-App/src/main/java/de/luhmer/owncloudnewsreader/services/OwnCloudAuthenticatorService.kt
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,24 @@ | ||
package de.luhmer.owncloudnewsreader.services | ||
|
||
import android.app.Service | ||
import android.content.Intent | ||
import android.os.IBinder | ||
import de.luhmer.owncloudnewsreader.authentication.OwnCloudAccountAuthenticator | ||
|
||
class OwnCloudAuthenticatorService : Service() { | ||
// Instance field that stores the authenticator object | ||
private var mAuthenticator: OwnCloudAccountAuthenticator? = null | ||
|
||
override fun onCreate() { | ||
// Create a new authenticator object | ||
mAuthenticator = OwnCloudAccountAuthenticator(this) | ||
} | ||
|
||
/* | ||
* When the system binds to this Service to make the RPC call | ||
* return the authenticator's IBinder. | ||
*/ | ||
override fun onBind(intent: Intent): IBinder? { | ||
return mAuthenticator?.iBinder | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/view/ChangeLogFileListView.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/view/ChangeLogFileListView.kt
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,29 @@ | ||
package de.luhmer.owncloudnewsreader.view | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import it.gmariotti.changelibs.library.view.ChangeLogListView | ||
|
||
/** | ||
* Thin wrapper around changeloglib to load local xml files by path | ||
* after the view has already been instantiated. | ||
*/ | ||
class ChangeLogFileListView | ||
@JvmOverloads | ||
constructor( | ||
context: Context?, | ||
attrs: AttributeSet? = null, | ||
defStyle: Int = 0, | ||
) : ChangeLogListView(context, attrs, defStyle) { | ||
/** | ||
* @param path local xml path staring with "file://" | ||
*/ | ||
fun loadFile(path: String) { | ||
mChangeLogFileResourceUrl = path | ||
super.initAdapter() | ||
} | ||
|
||
override fun initAdapter() { | ||
// do nothing yet - will be called in loadFile() | ||
} | ||
} |