Commit 60527e83 authored by Ricki Hirner's avatar Ricki Hirner

Collection info fragment

parent 54cc9b39
......@@ -253,6 +253,8 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
}
R.id.delete_collection ->
DeleteCollectionFragment.ConfirmDeleteCollectionFragment.newInstance(account, info).show(supportFragmentManager, null)
R.id.properties ->
CollectionInfoFragment.newInstance(info).show(supportFragmentManager, null)
}
true
}
......
/*
* Copyright © Ricki Hirner (bitfire web engineering).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*/
package at.bitfire.davdroid.ui
import android.annotation.SuppressLint
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import android.support.v7.app.AlertDialog
import at.bitfire.davdroid.R
import at.bitfire.davdroid.model.CollectionInfo
import kotlinx.android.synthetic.main.collection_properties.view.*
class CollectionInfoFragment : DialogFragment() {
companion object {
private const val ARGS_INFO = "info"
fun newInstance(info: CollectionInfo): CollectionInfoFragment {
val frag = CollectionInfoFragment()
val args = Bundle(1)
args.putParcelable(ARGS_INFO, info)
frag.arguments = args
return frag
}
}
@SuppressLint("InflateParams")
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val info = arguments!![ARGS_INFO] as CollectionInfo
val view = requireActivity().layoutInflater.inflate(R.layout.collection_properties, null)
view.url.text = info.url.toString()
return AlertDialog.Builder(requireActivity())
.setTitle(info.displayName)
.setView(view)
.create()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright © Ricki Hirner (bitfire web engineering).
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the GNU Public License v3.0
~ which accompanies this distribution, and is available at
~ http://www.gnu.org/licenses/gpl.html
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:text="@string/collection_properties_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="monospace" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
......@@ -16,4 +16,7 @@
<item android:id="@+id/delete_collection"
android:title="@string/delete_collection"/>
<item android:id="@+id/properties"
android:title="@string/collection_properties"/>
</menu>
\ No newline at end of file
......@@ -257,6 +257,8 @@
<string name="delete_collection_confirm_warning">This collection (%s) and all its data will be removed from the server.</string>
<string name="delete_collection_deleting_collection">Deleting collection</string>
<string name="collection_force_read_only">Force read-only</string>
<string name="collection_properties">Properties</string>
<string name="collection_properties_url">URL:</string>
<!-- ExceptionInfoFragment -->
<string name="exception">An error has occurred.</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment