Merge pull request #6105 from nextcloud/newDesign-UserInfoActivity

New design (UI) - User info activity
This commit is contained in:
Tobias Kaminsky 2020-05-20 17:30:08 +02:00 committed by GitHub
commit db49ffd29c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 164 additions and 199 deletions

View file

@ -158,7 +158,11 @@ public abstract class FileActivity extends DrawerActivity
public void showFiles(boolean onDeviceOnly) {
// must be specialized in subclasses
MainApp.showOnlyFilesOnDevice(onDeviceOnly);
setupToolbar(!onDeviceOnly);
if (onDeviceOnly) {
setupToolbar();
} else {
setupHomeSearchToolbar();
}
}
/**

View file

@ -258,7 +258,7 @@ public class FileDisplayActivity extends FileActivity
setContentView(R.layout.files);
// setup toolbar
setupToolbar(true);
setupHomeSearchToolbar();
mMenuButton.setOnClickListener(v -> {
openDrawer();
@ -1251,16 +1251,16 @@ public class FileDisplayActivity extends FileActivity
if (menuItemId == -1) {
if (MainApp.isOnlyOnDevice()) {
setDrawerMenuItemChecked(R.id.nav_on_device);
setupToolbar(false);
setupToolbar();
} else {
setDrawerMenuItemChecked(R.id.nav_all_files);
setupToolbar(true);
setupHomeSearchToolbar();
}
} else {
if (menuItemId == R.id.nav_all_files) {
setupToolbar(true);
setupHomeSearchToolbar();
} else {
setupToolbar(false);
setupToolbar();
}
setDrawerMenuItemChecked(menuItemId);
}

View file

@ -76,7 +76,7 @@ public abstract class ToolbarActivity extends BaseActivity {
* Toolbar setup that must be called in implementer's {@link #onCreate} after {@link #setContentView} if they want
* to use the toolbar.
*/
protected void setupToolbar(boolean isHomeSearchToolbarShow) {
private void setupToolbar(boolean isHomeSearchToolbarShow) {
int fontColor = ThemeUtils.appBarPrimaryFontColor(this);
Toolbar toolbar = findViewById(R.id.toolbar);
@ -112,6 +112,10 @@ public abstract class ToolbarActivity extends BaseActivity {
setupToolbar(false);
}
public void setupHomeSearchToolbar() {
setupToolbar(true);
}
/**
* Updates title bar and home buttons (state and icon).
*/

View file

@ -99,11 +99,10 @@ public class UserInfoActivity extends FileActivity implements Injectable {
@BindView(R.id.empty_list_view_text) protected TextView emptyContentMessage;
@BindView(R.id.empty_list_view_headline) protected TextView emptyContentHeadline;
@BindView(R.id.empty_list_icon) protected ImageView emptyContentIcon;
@BindView(R.id.user_info_view) protected LinearLayout userInfoView;
@BindView(R.id.user_icon) protected ImageView avatar;
@BindView(R.id.userinfo_icon) protected ImageView avatar;
@BindView(R.id.userinfo_username) protected TextView userName;
@BindView(R.id.userinfo_username_full) protected TextView fullName;
@BindView(R.id.user_info_list) protected RecyclerView mUserInfoList;
@BindView(R.id.userinfo_fullName) protected TextView fullName;
@BindView(R.id.userinfo_list) protected RecyclerView mUserInfoList;
@BindView(R.id.empty_list_progress) protected ProgressBar multiListProgressBar;
@BindString(R.string.user_information_retrieval_error) protected String sorryMessage;
@ -142,7 +141,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
setContentView(R.layout.user_info_layout);
unbinder = ButterKnife.bind(this);
setupToolbar(false);
setupToolbar();
// set the back button from action bar
ActionBar actionBar = getSupportActionBar();
@ -151,7 +150,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setTitle("");
ThemeUtils.tintBackButton(actionBar, this);
}
mUserInfoList.setAdapter(new UserInfoAdapter(null, ThemeUtils.primaryColor(getAccount(), true, this)));
@ -223,7 +222,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
private void setHeaderImage() {
if (getStorageManager().getCapability(user.getAccountName()).getServerBackground() != null) {
ImageView backgroundImageView = findViewById(R.id.drawer_header_background);
ImageView backgroundImageView = findViewById(R.id.userinfo_background);
if (backgroundImageView != null) {
@ -282,7 +281,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
getString(R.string.userinfo_no_info_text), R.drawable.ic_user);
} else {
emptyContentContainer.setVisibility(View.GONE);
userInfoView.setVisibility(View.VISIBLE);
mUserInfoList.setVisibility(View.VISIBLE);
if (mUserInfoList.getAdapter() instanceof UserInfoAdapter) {
mUserInfoList.setAdapter(new UserInfoAdapter(createUserInfoDetails(userInfo), tint));

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Nextcloud Android client application
Copyright (C) 2017 Andy Scherzinger
Copyright (C) 2017 Nextcloud
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
License as published by the Free Software Foundation; either
version 3 of the License, or 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 AFFERO GENERAL PUBLIC LICENSE for more details.
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<com.google.android.material.appbar.AppBarLayout 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="@dimen/nav_drawer_header_height"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/drawer_header_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/drawer_header_background"
android:scaleType="centerCrop" />
<androidx.appcompat.widget.Toolbar
android:id="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/toolbar_user_information_layout_margin"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_marginBottom="@dimen/toolbar_user_information_layout_margin"
android:gravity="bottom"
android:orientation="horizontal"
android:weightSum="1">
<FrameLayout
android:id="@+id/avatar_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/user_icon"
android:layout_width="@dimen/nav_drawer_header_avatar"
android:layout_height="@dimen/nav_drawer_header_avatar"
android:contentDescription="@string/avatar"
android:src="@drawable/account_circle_white" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/standard_half_margin"
android:layout_marginRight="@dimen/standard_half_margin"
android:layout_toEndOf="@id/avatar_container"
android:orientation="vertical">
<TextView
android:id="@+id/userinfo_username_full"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:shadowColor="@color/drawer_shadow"
android:shadowDx="0.5"
android:shadowDy="0"
android:shadowRadius="2"
android:textColor="@color/white"
android:textSize="@dimen/drawer_header_text"
android:textStyle="bold"
tools:text="Max Mustermann" />
<TextView
android:id="@+id/userinfo_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:shadowColor="@color/drawer_shadow"
android:shadowDx="0.5"
android:shadowDy="0"
android:shadowRadius="2"
android:textColor="@color/white"
android:textSize="@dimen/drawer_header_subtext"
tools:text="max@127.0.0.1/nextcloud" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/info_box" />
</LinearLayout>
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Nextcloud Android client application
Copyright (C) 2018 Andy Scherzinger
@ -18,31 +17,37 @@
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_icon_list_horizontal_margin"
android:layout_marginTop="@dimen/standard_margin"
android:contentDescription="@string/account_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_phone" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="@dimen/standard_margin"
android:layout_toEndOf="@id/icon"
android:layout_marginStart="@dimen/standard_icon_list_horizontal_margin"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="?android:attr/textAppearanceListItem"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/icon"
app:layout_constraintTop_toTopOf="parent"
tools:text="+49 123 456 789 12" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Nextcloud Android client application
Copyright (C) 2017 Andy Scherzinger
@ -18,51 +17,91 @@
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_default">
<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="match_parent"
android:background="@color/bg_default"
android:orientation="vertical">
<include layout="@layout/toolbar_user_information" />
<include layout="@layout/toolbar_standard" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/nav_drawer_header_height">
<ImageView
android:id="@+id/userinfo_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_nc18"
android:contentDescription="@string/drawer_header_background"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/userinfo_icon"
android:layout_width="@dimen/nav_drawer_header_avatar"
android:layout_height="@dimen/nav_drawer_header_avatar"
android:layout_marginStart="@dimen/account_item_layout_user_image_left_start_margin"
android:layout_marginBottom="@dimen/account_item_layout_user_image_left_start_margin"
android:contentDescription="@string/avatar"
android:src="@drawable/account_circle_white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/userinfo_fullName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:lines="1"
android:shadowColor="@color/drawer_shadow"
android:shadowDx="0.5"
android:shadowDy="0"
android:shadowRadius="2"
android:textColor="@color/white"
android:textSize="@dimen/file_details_username_text_size"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/userinfo_icon"
app:layout_constraintTop_toTopOf="@id/userinfo_icon"
tools:text="John Doe" />
<TextView
android:id="@+id/userinfo_username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="2"
android:shadowColor="@color/drawer_shadow"
android:shadowDx="0.5"
android:shadowDy="0"
android:shadowRadius="2"
android:textColor="@color/white"
android:textSize="@dimen/drawer_header_subtext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/userinfo_fullName"
app:layout_constraintTop_toBottomOf="@id/userinfo_fullName"
tools:text="john@nextcloud.com" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/userinfo_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/standard_margin"
android:orientation="vertical"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<include layout="@layout/empty_list" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/user_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<androidx.cardview.widget.CardView
android:id="@+id/primary_user_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/standard_half_margin"
card_view:cardCornerRadius="3dp"
card_view:cardUseCompatPadding="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_info_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
card_view:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"></androidx.recyclerview.widget.RecyclerView>
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -22,4 +22,17 @@
<style name="Theme.ownCloud.Toolbar.Drawer">
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="Theme.ownCloud.Toolbar" parent="Theme.ownCloud.ToolbarBase">
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="Theme.ownCloud" parent="Theme.ownCloudBase">
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="FallbackThemingTheme" parent="FallbackThemingThemeBase21">
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
</resources>

View file

@ -18,16 +18,20 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- General ownCloud app style -->
<style name="Theme.ownCloud" parent="BaseTheme.ownCloud">
<style name="Theme.ownCloudBase" parent="BaseTheme.ownCloud">
<item name="android:actionModeBackground">@color/action_mode_background</item>
<item name="android:datePickerDialogTheme">@style/FallbackDatePickerDialogTheme</item>
</style>
<style name="FallbackThemingTheme" parent="FallbackThemingThemeBase">
<style name="Theme.ownCloud" parent="Theme.ownCloudBase" />
<style name="FallbackThemingThemeBase21" parent="FallbackThemingThemeBase">
<item name="android:actionModeBackground">@color/action_mode_background</item>
<item name="android:datePickerDialogTheme">@style/FallbackDatePickerDialogTheme</item>
</style>
<style name="FallbackThemingTheme" parent="FallbackThemingThemeBase21" />
<style name="FallbackDatePickerDialogTheme" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
<item name="colorPrimary">@color/bg_default</item>
<item name="android:textAllCaps">false</item>
@ -51,16 +55,18 @@
<item name="android:windowBackground">@color/bg_default</item>
</style>
<style name="Theme.ownCloud.Toolbar" parent="BaseTheme.ownCloud.Toolbar">
<style name="Theme.ownCloud.ToolbarBase" parent="BaseTheme.ownCloud.Toolbar">
<item name="android:actionModeBackground">@color/action_mode_background</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<style name="Theme.ownCloud.Toolbar" parent="Theme.ownCloud.ToolbarBase" />
<style name="Theme.ownCloud.Toolbar.DrawerBase" parent="Theme.ownCloud.Toolbar">
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="Theme.ownCloud.Toolbar.Drawer" parent="Theme.ownCloud.Toolbar.DrawerBase"/>
<style name="Theme.ownCloud.Toolbar.Drawer" parent="Theme.ownCloud.Toolbar.DrawerBase" />
<!-- Launch screen -->
<style name="Theme.ownCloud.Launcher">

View file

@ -24,4 +24,20 @@
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="Theme.ownCloud.Toolbar" parent="Theme.ownCloud.ToolbarBase">
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="Theme.ownCloud" parent="Theme.ownCloudBase">
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
<style name="FallbackThemingTheme" parent="FallbackThemingThemeBase21">
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/bg_default</item>
</style>
</resources>

View file

@ -139,7 +139,6 @@
<dimen name="synced_folders_item_type_layout_right_end_margin">24dp</dimen>
<dimen name="synced_folders_recycler_view_layout_margin">-3dp</dimen>
<dimen name="synced_folders_control_width">80dp</dimen>
<dimen name="toolbar_user_information_layout_margin">12dp</dimen>
<dimen name="bottom_sheet_text_size">16sp</dimen>
<dimen name="permission_dialog_text_size">18sp</dimen>
<dimen name="button_corner_radius">24dp</dimen>