Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
4508749d
Commit
4508749d
authored
Apr 27, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix alignment and padding on image view toolbar
parent
51e3aed7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
ImageAttachmentViewHolder.kt
...ket/android/chatroom/adapter/ImageAttachmentViewHolder.kt
+6
-6
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+0
-7
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/ImageAttachmentViewHolder.kt
View file @
4508749d
...
...
@@ -33,7 +33,6 @@ import com.facebook.imagepipeline.request.ImageRequest
import
com.facebook.imagepipeline.request.ImageRequestBuilder
import
com.stfalcon.frescoimageviewer.ImageViewer
import
kotlinx.android.synthetic.main.message_attachment.view.*
import
ru.whalemare.sheetmenu.extension.marginBottom
import
timber.log.Timber
import
java.io.File
...
...
@@ -63,17 +62,19 @@ class ImageAttachmentViewHolder(itemView: View,
file_name
.
text
=
data
.
attachmentTitle
image_attachment
.
setOnClickListener
{
view
->
// TODO - implement a proper image viewer with a proper Transition
// TODO - We should definitely write our own ImageViewer
var
imageViewer
:
ImageViewer
?
=
null
val
request
=
ImageRequestBuilder
.
newBuilderWithSource
(
Uri
.
parse
(
data
.
attachmentUrl
))
.
setLowestPermittedRequestLevel
(
ImageRequest
.
RequestLevel
.
DISK_CACHE
)
.
build
()
cacheKey
=
DefaultCacheKeyFactory
.
getInstance
()
.
getEncodedCacheKey
(
request
,
null
)
val
pad
=
context
.
resources
.
getDimensionPixelSize
(
R
.
dimen
.
viewer_toolbar_padding
)
val
lparams
=
AppBarLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
val
toolbar
=
Toolbar
(
itemView
.
context
,
null
,
R
.
style
.
Theme_AppCompat_Light_NoActionBar
).
also
{
val
toolbar
=
Toolbar
(
context
).
also
{
it
.
inflateMenu
(
R
.
menu
.
image_actions
)
it
.
overflowIcon
?.
setTint
(
Color
.
WHITE
)
it
.
setOnMenuItemClickListener
{
...
...
@@ -85,12 +86,12 @@ class ImageAttachmentViewHolder(itemView: View,
val
titleSize
=
context
.
resources
.
getDimensionPixelSize
(
R
.
dimen
.
viewer_toolbar_title
)
val
titleTextView
=
TextView
(
context
).
also
{
it
.
text
=
data
.
attachmentTitle
it
.
setTextColor
(
Color
.
WHITE
)
it
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
titleSize
.
toFloat
())
it
.
ellipsize
=
TextUtils
.
TruncateAt
.
END
it
.
setSingleLine
()
it
.
typeface
=
Typeface
.
DEFAULT_BOLD
it
.
setPadding
(
pad
)
}
...
...
@@ -98,14 +99,13 @@ class ImageAttachmentViewHolder(itemView: View,
val
backArrowView
=
ImageView
(
context
).
also
{
it
.
setImageResource
(
R
.
drawable
.
ic_arrow_back_white_24dp
)
it
.
setOnClickListener
{
imageViewer
?.
onDismiss
()
}
it
.
setPadding
(
pad
)
it
.
setPadding
(
0
,
pad
,
pad
,
pad
)
}
val
layoutParams
=
AppBarLayout
.
LayoutParams
(
AppBarLayout
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
AppBarLayout
.
LayoutParams
.
WRAP_CONTENT
)
layoutParams
.
gravity
=
Gravity
.
TOP
it
.
addView
(
backArrowView
,
layoutParams
)
it
.
addView
(
titleTextView
,
layoutParams
)
...
...
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
4508749d
...
...
@@ -48,10 +48,8 @@ import okhttp3.Interceptor
import
okhttp3.OkHttpClient
import
okhttp3.logging.HttpLoggingInterceptor
import
ru.noties.markwon.SpannableConfiguration
import
ru.noties.markwon.il.AsyncDrawableLoader
import
ru.noties.markwon.spans.SpannableTheme
import
timber.log.Timber
import
java.util.concurrent.Executors
import
java.util.concurrent.TimeUnit
import
javax.inject.Singleton
...
...
@@ -264,11 +262,6 @@ class AppModule {
fun
provideConfiguration
(
context
:
Application
,
client
:
OkHttpClient
):
SpannableConfiguration
{
val
res
=
context
.
resources
return
SpannableConfiguration
.
builder
(
context
)
.
asyncDrawableLoader
(
AsyncDrawableLoader
.
builder
()
.
client
(
client
)
.
executorService
(
Executors
.
newCachedThreadPool
())
.
resources
(
res
)
.
build
())
.
theme
(
SpannableTheme
.
builder
()
.
linkColor
(
res
.
getColor
(
R
.
color
.
colorAccent
))
.
build
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment