Skip to content
Snippets Groups Projects
Commit f6975e69 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Implemented account setup, selection and editing

parent 7beb1463
Branches
Tags
No related merge requests found
Showing
with 444 additions and 82 deletions
package de.kuschku.quasseldroid_ng.util.helper
import android.content.SharedPreferences
fun SharedPreferences.editApply(f: SharedPreferences.Editor.() -> Unit) {
val editor = this.edit()
editor.f()
editor.apply()
}
fun SharedPreferences.editCommit(f: SharedPreferences.Editor.() -> Unit) {
val editor = this.edit()
editor.f()
editor.commit()
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000"
android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000"
android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000"
android:pathData="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000"
android:pathData="M13,18H14A1,1 0 0,1 15,19H22V21H15A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21H2V19H9A1,1 0 0,1 10,18H11V16H4A1,1 0 0,1 3,15V11A1,1 0 0,1 4,10H20A1,1 0 0,1 21,11V15A1,1 0 0,1 20,16H13V18M4,2H20A1,1 0 0,1 21,3V7A1,1 0 0,1 20,8H4A1,1 0 0,1 3,7V3A1,1 0 0,1 4,2M9,6H10V4H9V6M9,14H10V12H9V14M5,4V6H7V4H5M5,12V14H7V12H5Z" />
</vector>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
android:theme="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse" android:theme="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse"
tools:text="First, please choose which server your core is hosted on." /> tools:text="First, please choose which server your core is hosted on." />
<ScrollView <android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView" android:id="@+id/scrollView"
android:layout_width="400dp" android:layout_width="400dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -79,6 +79,6 @@ ...@@ -79,6 +79,6 @@
android:minHeight="400dp" android:minHeight="400dp"
app:cardElevation="4dp" /> app:cardElevation="4dp" />
</ScrollView> </android.support.v4.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -47,4 +47,4 @@ ...@@ -47,4 +47,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </android.support.v4.widget.NestedScrollView>
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:orientation="vertical" android:orientation="vertical"
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/labelConnectionHostname"> android:hint="@string/labelConnectionHostname"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/host" android:id="@+id/host"
...@@ -40,7 +42,8 @@ ...@@ -40,7 +42,8 @@
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/labelConnectionPort"> android:hint="@string/labelConnectionPort"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/port" android:id="@+id/port"
......
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<FrameLayout
android:layout_width="56dp"
android:layout_height="match_parent">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:tint="#757575"
app:srcCompat="@drawable/ic_pencil" />
</FrameLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/labelAccountName"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<FrameLayout
android:layout_width="56dp"
android:layout_height="match_parent">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:tint="#757575"
app:srcCompat="@drawable/ic_server_network" />
</FrameLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/labelConnectionHostname"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/host"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.v4.widget.Space
android:layout_width="56dp"
android:layout_height="match_parent" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/labelConnectionPort"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/port"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:numeric="integer"
android:text="@string/defaultConnectionPort" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<FrameLayout
android:layout_width="56dp"
android:layout_height="match_parent">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:tint="#757575"
app:srcCompat="@drawable/ic_account" />
</FrameLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/labelAccountUsername">
<android.support.design.widget.TextInputEditText
android:id="@+id/user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textVisiblePassword|textNoSuggestions"
app:errorEnabled="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.v4.widget.Space
android:layout_width="56dp"
android:layout_height="match_parent" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/labelAccountPassword">
<android.support.design.widget.TextInputEditText
android:id="@+id/pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:password="true"
app:errorEnabled="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="16dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:tint="#ffffff"
app:fabSize="normal"
app:srcCompat="@drawable/ic_save" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?><!--
~ QuasselDroid - Quassel client for Android
~ Copyright (C) 2016 Janne Koschinski
~ Copyright (C) 2016 Ken Børge Viktil
~ Copyright (C) 2016 Magnus Fjell
~ Copyright (C) 2016 Martin Sandsmark <martin.sandsmark@kde.org>
~
~ This 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 (at your option)
~ any later version.
~
~ This 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.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:orientation="vertical" android:orientation="vertical"
...@@ -28,7 +8,8 @@ ...@@ -28,7 +8,8 @@
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/labelAccountName"> android:hint="@string/labelAccountName"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/name" android:id="@+id/name"
......
<?xml version="1.0" encoding="utf-8"?><!--
~ QuasselDroid - Quassel client for Android
~ Copyright (C) 2016 Janne Koschinski
~ Copyright (C) 2016 Ken Børge Viktil
~ Copyright (C) 2016 Magnus Fjell
~ Copyright (C) 2016 Martin Sandsmark <martin.sandsmark@kde.org>
~
~ This 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 (at your option)
~ any later version.
~
~ This 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.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:orientation="vertical" android:orientation="vertical"
...@@ -34,7 +14,8 @@ ...@@ -34,7 +14,8 @@
android:id="@+id/user" android:id="@+id/user"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textVisiblePassword|textNoSuggestions" /> android:inputType="textVisiblePassword|textNoSuggestions"
app:errorEnabled="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
...@@ -46,7 +27,8 @@ ...@@ -46,7 +27,8 @@
android:id="@+id/pass" android:id="@+id/pass"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textPassword" /> android:inputType="textPassword"
app:errorEnabled="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
</LinearLayout> </LinearLayout>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/account_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" 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">
<LinearLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> app:collapsedTitleTextAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse"
app:contentScrim="?colorPrimary"
app:expandedTitleGravity="top"
app:expandedTitleMarginBottom="0dp"
app:expandedTitleMarginEnd="48dp"
app:expandedTitleMarginStart="32dp"
app:expandedTitleMarginTop="24dp"
app:expandedTitleTextAppearance="@style/TextAppearance.AppCompat.Title.Inverse"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:orientation="vertical" android:orientation="vertical"
android:padding="32dp"> app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="1">
<TextView <android.support.v4.widget.Space
android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="21sp"
android:layout_marginBottom="8dp" android:layout_marginTop="24dp" />
android:textSize="28sp"
android:theme="@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse"
tools:text="Connection" />
<TextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginEnd="48dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="48dp"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:textSize="16sp" android:textSize="16sp"
android:theme="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse" android:theme="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse"
tools:text="First, please choose which server your core is hosted on." /> tools:text="First, please choose which server your core is hosted on." />
</LinearLayout> </LinearLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin"
app:titleMarginEnd="48dp"
app:titleMarginStart="16dp" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/content_host" android:id="@+id/content_host"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout> </android.support.design.widget.CoordinatorLayout>
</ScrollView>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="false"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<LinearLayout
android:layout_width="48dp"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/account_select"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:clickable="false" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_weight="1"
android:gravity="center_vertical|start"
android:orientation="vertical">
<TextView
android:id="@+id/account_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|start"
android:lines="1"
android:singleLine="true"
android:textSize="14sp"
tools:text="Remote" />
<TextView
android:id="@+id/account_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:gravity="center_vertical|start"
android:lines="1"
android:singleLine="true"
android:textSize="14sp"
tools:text="testUser on localhost" />
</LinearLayout>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/account_edit"
style="?attr/buttonStyleSmall"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:tint="#757575"
app:srcCompat="@drawable/ic_pencil" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="false"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<LinearLayout
android:layout_width="48dp"
android:layout_height="match_parent">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:tint="#727272"
app:srcCompat="@drawable/ic_add" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_weight="1"
android:gravity="center_vertical|start"
android:orientation="vertical">
<TextView
android:id="@+id/account_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|start"
android:lines="1"
android:singleLine="true"
android:text="New Account"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/delete"
android:icon="@drawable/ic_delete"
android:title="Delete"
app:iconTint="#fff"
app:showAsAction="ifRoom" />
</menu>
...@@ -3,6 +3,4 @@ ...@@ -3,6 +3,4 @@
<color name="colorPrimary">#0a70c0</color> <color name="colorPrimary">#0a70c0</color>
<color name="colorPrimaryDark">#105a94</color> <color name="colorPrimaryDark">#105a94</color>
<color name="colorAccent">#ffaf3b</color> <color name="colorAccent">#ffaf3b</color>
<attr name="backgroundSetup">?attr/color</attr>
</resources> </resources>
<resources> <resources>
<!-- Account Selection -->
<string name="slideAccountSelectTitle">Select Account</string>
<string name="slideAccountSelectDescription">Please select an account from the list or add one</string>
<string name="userOnHost">%1$s on %2$s:%3$d</string>
<!-- Account Connection --> <!-- Account Connection -->
<string name="slideAccountConnectionTitle">Connection</string> <string name="slideAccountConnectionTitle">Connection</string>
<string name="slideAccountConnectionDescription">First, please choose which server your core is hosted on.</string> <string name="slideAccountConnectionDescription">First, please choose which server your core is hosted on.</string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment