about screen

This commit is contained in:
Öppen 2020-08-18 21:21:43 +01:00
parent 78c528dc38
commit 171d7276b0
8 changed files with 189 additions and 6 deletions

View File

@ -154,6 +154,7 @@ class GeminiDatasource: Datasource{
val processed = GemtextHelper.findCodeBlocks(lines)
RuntimeCache.put(uri, header, processed)
onUpdate(TvaState.ResponseGemtext(uri, header, processed))
}

View File

@ -18,8 +18,9 @@ import oppen.tva.databinding.ActivityTvaBinding
import oppen.tva.io.GeminiResponse
import oppen.tva.io.TvaState
import oppen.tva.io.history.CacheInterface
import oppen.tva.ui.about.AboutDialog
import oppen.tva.ui.overflow.OverflowPopup
import oppen.tva.ui.set_home.SetHome
import oppen.tva.ui.set_home.SetHomeDialog
import oppen.tva.ui.tabs.NewTabPopup
import oppen.tva.ui.tabs.TabsDialog
import oppen.visibleRetainingSpace
@ -90,11 +91,9 @@ class TvaActivity : AppCompatActivity() {
startActivity(Intent.createChooser(this, null))
}
}
R.id.overflow_menu_about -> {
}
R.id.overflow_menu_about -> AboutDialog.show(this)
R.id.overflow_menu_set_home -> {
SetHome.show(this, binding.addressEdit.text.toString()){
SetHomeDialog.show(this, binding.addressEdit.text.toString()){
showAlert("Home capsule updated")
}
}

View File

@ -0,0 +1,41 @@
package oppen.tva.ui.about
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_about.view.*
import oppen.tva.BuildConfig
import oppen.tva.R
object AboutDialog {
fun show(context: Context){
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_about, null)
dialog.setContentView(view)
view.close_tab_dialog.setOnClickListener {
dialog.dismiss()
}
view.version_label.text = BuildConfig.VERSION_NAME;
view.gnu_license_button.setOnClickListener {
context.startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse("https://www.gnu.org/licenses/gpl-3.0.html")
})
}
view.oppenlab_button.setOnClickListener {
context.startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse("https://oppenlab.net")
})
}
dialog.show()
}
}

View File

@ -6,7 +6,7 @@ import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_set_home.view.*
import oppen.tva.R
object SetHome {
object SetHomeDialog {
fun show(context: Context, currentAddress: String, onUpdate: () -> Unit){
val prefs = context.getSharedPreferences("oppen.tva.ui.set_home", Context.MODE_PRIVATE)

View File

@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="50dp"
android:height="50dp"
android:viewportWidth="50"
android:viewportHeight="50">
<path
android:pathData="M25,25m-25,0a25,25 0,1 1,50 0a25,25 0,1 1,-50 0"
android:fillColor="#1D1D1D"/>
<path
android:pathData="M24.9301,16.7963C24.9301,12.3185 22.2502,9.6044 18.6269,9.6044C14.99,9.6044 12.3169,12.3185 12.3169,16.7963C12.3169,21.2673 14.99,23.9882 18.6269,23.9882C22.2502,23.9882 24.9301,21.2742 24.9301,16.7963ZM22.8382,16.7963C22.8382,20.2077 21.0334,22.0604 18.6269,22.0604C16.2137,22.0604 14.4157,20.2077 14.4157,16.7963C14.4157,13.3849 16.2137,11.5323 18.6269,11.5323C21.0334,11.5323 22.8382,13.3849 22.8382,16.7963ZM16.617,8.1482C17.3007,8.1482 17.8203,7.5945 17.8203,6.9587C17.8203,6.2819 17.3007,5.7623 16.617,5.7623C15.9744,5.7623 15.407,6.2819 15.407,6.9587C15.407,7.5945 15.9744,8.1482 16.617,8.1482ZM20.6369,8.1482C21.3205,8.1482 21.8401,7.5945 21.8401,6.9587C21.8401,6.2819 21.3205,5.7623 20.6369,5.7623C19.9942,5.7623 19.4268,6.2819 19.4268,6.9587C19.4268,7.5945 19.9942,8.1482 20.6369,8.1482Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M29.0077,23.7968H37.4643V21.9783H31.1202V9.7958H29.0077V23.7968Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M14.4856,40.6417L15.7708,36.9364H21.24L22.5184,40.6417H24.7607L19.7223,26.6407H17.2817L12.2433,40.6417H14.4856ZM16.3861,35.1589L18.4507,29.1839H18.5601L20.6247,35.1589H16.3861Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M28.7612,40.6417H34.1278C37.3819,40.6417 38.8518,39.0215 38.8518,36.8749C38.8518,34.7077 37.3341,33.484 35.9463,33.4088V33.2721C37.2315,32.9439 38.3048,32.0689 38.3048,30.3187C38.3048,28.2473 36.8692,26.6407 33.8885,26.6407H28.7612V40.6417ZM30.8737,38.8301V34.3454H33.9979C35.6933,34.3454 36.753,35.4392 36.753,36.7723C36.753,37.9482 35.9531,38.8301 33.9227,38.8301H30.8737ZM30.8737,32.6978V28.4387H33.7586C35.4335,28.4387 36.2334,29.3206 36.2334,30.4828C36.2334,31.8364 35.1259,32.6978 33.7039,32.6978H30.8737Z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/default_margin_big"
android:paddingRight="@dimen/default_margin_big"
android:paddingBottom="@dimen/default_margin_big"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginTop="@dimen/default_margin_big"
android:src="@drawable/vector_olab"/>
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="@dimen/default_margin"
android:layout_marginTop="@dimen/default_margin_big"
android:src="@drawable/vector_app_icon" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin_big"
android:text="@string/about_body"/>
<TextView
android:id="@+id/version_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="1.0.0 alpha delta"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
android:text="@string/copyright"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/oppenlab_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Öppenlab.net"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin_big"
android:paddingBottom="@dimen/default_margin_big"
android:text="@string/home_icon_attribution" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
android:text="@string/about_lic"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/gnu_license_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gnu_link"/>
<!-- OppenLab -->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="default_margin">8dp</dimen>
<dimen name="default_margin_big">16dp</dimen>
<dimen name="button_margin">12dp</dimen>
<dimen name="default_text_size">16sp</dimen>
<dimen name="code_text_size">14sp</dimen>

View File

@ -8,4 +8,12 @@
<string name="gemini_address">Gemini address</string>
<string name="share">Share</string>
<string name="set_home">Set home</string>
<string name="home_icon_attribution">Home icon by Creative Stall from the Noun Project</string>
<string name="about_body">Två: Gemini protocol client from Öppenlab</string>
<string name="gnu_link">GPL v3</string>
<string name="copyright">Copyright © 2020 Öppenlab</string>
<string name="about_lic">GNU General Public License, version 3\n
\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.\n
\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n
\nYou should have received a copy of the GNU General Public License along with this program. If not, see www.gnu.org/licenses</string>
</resources>