mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
make text preview dark/light aware, overall improvement of preview screens
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
a092f30d56
commit
cd5f083a49
@ -4,7 +4,7 @@
|
|||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Dariusz Olszewski
|
* @author Dariusz Olszewski
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2021 Dariusz Olszewski
|
* Copyright (C) 2021 Dariusz Olszewski
|
||||||
*
|
*
|
||||||
@ -54,7 +54,10 @@ class FullScreenImageActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == R.id.share) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
|
onBackPressed()
|
||||||
|
true
|
||||||
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
this,
|
this,
|
||||||
BuildConfig.APPLICATION_ID,
|
BuildConfig.APPLICATION_ID,
|
||||||
@ -82,7 +85,6 @@ class FullScreenImageActivity : AppCompatActivity() {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
setSupportActionBar(binding.imageviewToolbar)
|
setSupportActionBar(binding.imageviewToolbar)
|
||||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
|
||||||
|
|
||||||
binding.photoView.setOnPhotoTapListener { view, x, y ->
|
binding.photoView.setOnPhotoTapListener { view, x, y ->
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
@ -102,6 +104,9 @@ class FullScreenImageActivity : AppCompatActivity() {
|
|||||||
val fileName = intent.getStringExtra("FILE_NAME")
|
val fileName = intent.getStringExtra("FILE_NAME")
|
||||||
val isGif = intent.getBooleanExtra("IS_GIF", false)
|
val isGif = intent.getBooleanExtra("IS_GIF", false)
|
||||||
|
|
||||||
|
supportActionBar?.title = fileName
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
|
||||||
path = applicationContext.cacheDir.absolutePath + "/" + fileName
|
path = applicationContext.cacheDir.absolutePath + "/" + fileName
|
||||||
if (isGif) {
|
if (isGif) {
|
||||||
binding.photoView.visibility = View.INVISIBLE
|
binding.photoView.visibility = View.INVISIBLE
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -53,7 +53,10 @@ class FullScreenMediaActivity : AppCompatActivity(), Player.EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == R.id.share) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
|
onBackPressed()
|
||||||
|
true
|
||||||
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
this,
|
this,
|
||||||
BuildConfig.APPLICATION_ID,
|
BuildConfig.APPLICATION_ID,
|
||||||
@ -86,7 +89,8 @@ class FullScreenMediaActivity : AppCompatActivity(), Player.EventListener {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
setSupportActionBar(binding.mediaviewToolbar)
|
setSupportActionBar(binding.mediaviewToolbar)
|
||||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
supportActionBar?.title = fileName
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -28,11 +28,13 @@ import android.view.Menu
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import com.nextcloud.talk.BuildConfig
|
import com.nextcloud.talk.BuildConfig
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.databinding.ActivityFullScreenTextBinding
|
import com.nextcloud.talk.databinding.ActivityFullScreenTextBinding
|
||||||
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
import io.noties.markwon.Markwon
|
import io.noties.markwon.Markwon
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -48,7 +50,10 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == R.id.share) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
|
onBackPressed()
|
||||||
|
true
|
||||||
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
this,
|
this,
|
||||||
BuildConfig.APPLICATION_ID,
|
BuildConfig.APPLICATION_ID,
|
||||||
@ -76,7 +81,6 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
setSupportActionBar(binding.textviewToolbar)
|
setSupportActionBar(binding.textviewToolbar)
|
||||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
|
||||||
|
|
||||||
val fileName = intent.getStringExtra("FILE_NAME")
|
val fileName = intent.getStringExtra("FILE_NAME")
|
||||||
val isMarkdown = intent.getBooleanExtra("IS_MARKDOWN", false)
|
val isMarkdown = intent.getBooleanExtra("IS_MARKDOWN", false)
|
||||||
@ -89,6 +93,21 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
} else {
|
} else {
|
||||||
binding.textView.text = text
|
binding.textView.text = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supportActionBar?.title = fileName
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
|
||||||
|
if (resources != null) {
|
||||||
|
DisplayUtils.applyColorToStatusBar(
|
||||||
|
this,
|
||||||
|
ResourcesCompat.getColor(resources, R.color.appbar, null)
|
||||||
|
)
|
||||||
|
|
||||||
|
DisplayUtils.applyColorToNavigationBar(
|
||||||
|
this.window,
|
||||||
|
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readFile(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
|
private fun readFile(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
~
|
~
|
||||||
~ @author Marcel Hibbe
|
~ @author Marcel Hibbe
|
||||||
~ @author Dariusz Olszewski
|
~ @author Dariusz Olszewski
|
||||||
|
~ @author Andy Scherzinger
|
||||||
|
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
~ Copyright (C) 2021 Dariusz Olszewski
|
~ Copyright (C) 2021 Dariusz Olszewski
|
||||||
~
|
~
|
||||||
@ -20,24 +22,22 @@
|
|||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/image_wrapper_view"
|
android:id="@+id/image_wrapper_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/black"
|
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".activities.FullScreenImageActivity">
|
tools:context=".activities.FullScreenImageActivity">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/imageview_toolbar"
|
android:id="@+id/imageview_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
|
||||||
|
|
||||||
<com.github.chrisbanes.photoview.PhotoView
|
<com.github.chrisbanes.photoview.PhotoView
|
||||||
android:id="@+id/photo_view"
|
android:id="@+id/photo_view"
|
||||||
@ -49,7 +49,6 @@
|
|||||||
android:id="@+id/gif_view"
|
android:id="@+id/gif_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible" />
|
||||||
/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
~ Nextcloud Talk application
|
~ Nextcloud Talk application
|
||||||
~
|
~
|
||||||
~ @author Marcel Hibbe
|
~ @author Marcel Hibbe
|
||||||
|
~ @author Andy Scherzinger
|
||||||
|
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
~
|
~
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
@ -23,7 +25,6 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/black"
|
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".activities.FullScreenMediaActivity">
|
tools:context=".activities.FullScreenMediaActivity">
|
||||||
|
|
||||||
@ -33,7 +34,7 @@
|
|||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
|
||||||
|
|
||||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||||
android:id="@+id/player_view"
|
android:id="@+id/player_view"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
~ Nextcloud Talk application
|
~ Nextcloud Talk application
|
||||||
~
|
~
|
||||||
~ @author Marcel Hibbe
|
~ @author Marcel Hibbe
|
||||||
|
~ @author Andy Scherzinger
|
||||||
|
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
~
|
~
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
@ -18,27 +20,47 @@
|
|||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:orientation="vertical"
|
||||||
|
android:background="@color/bg_default"
|
||||||
tools:context=".activities.FullScreenTextViewerActivity">
|
tools:context=".activities.FullScreenTextViewerActivity">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipChildren="true"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:windowContentOverlay="@null">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/textview_toolbar"
|
android:id="@+id/textview_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:elevation="4dp"
|
android:theme="@style/appActionBarPopupMenu"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Light"
|
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
app:navigationIconTint="@color/fontAppbar"
|
||||||
|
app:popupTheme="@style/appActionBarPopupMenu"
|
||||||
|
app:titleTextColor="@color/fontAppbar"
|
||||||
|
tools:title="Text File Preview" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_view"
|
android:id="@+id/text_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:padding="@dimen/standard_padding"
|
||||||
tools:text="Lorem Ipsum"/>
|
tools:text="Lorem Ipsum" />
|
||||||
|
|
||||||
</FrameLayout>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -138,6 +138,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FullScreenImageTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="FullScreenImageTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowBackground">@color/black</item>
|
||||||
<item name="android:navigationBarColor">@color/black</item>
|
<item name="android:navigationBarColor">@color/black</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowActionBar">true</item>
|
<item name="android:windowActionBar">true</item>
|
||||||
@ -146,6 +147,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FullScreenMediaTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="FullScreenMediaTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowBackground">@color/black</item>
|
||||||
<item name="android:navigationBarColor">@color/black</item>
|
<item name="android:navigationBarColor">@color/black</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowActionBar">true</item>
|
<item name="android:windowActionBar">true</item>
|
||||||
@ -153,8 +155,8 @@
|
|||||||
<item name="android:windowContentOverlay">@null</item>
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FullScreenTextTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="FullScreenTextTheme" parent="AppTheme">
|
||||||
<item name="android:navigationBarColor">@color/black</item>
|
<item name="android:navigationBarColor">@color/bg_default</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Launch screen -->
|
<!-- Launch screen -->
|
||||||
|
Loading…
Reference in New Issue
Block a user