mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
add account switcher in search bar
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
7095d383e8
commit
2b44a295a4
@ -150,6 +150,10 @@ android {
|
||||
htmlOutput file("$project.buildDir/reports/lint/lint.html")
|
||||
disable 'MissingTranslation'
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
|
@ -50,6 +50,7 @@ import com.nextcloud.talk.controllers.CallNotificationController
|
||||
import com.nextcloud.talk.controllers.ConversationsListController
|
||||
import com.nextcloud.talk.controllers.LockedController
|
||||
import com.nextcloud.talk.controllers.ServerSelectionController
|
||||
import com.nextcloud.talk.controllers.SettingsController
|
||||
import com.nextcloud.talk.controllers.WebViewLoginController
|
||||
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
||||
import com.nextcloud.talk.models.json.conversations.RoomOverall
|
||||
@ -192,6 +193,32 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
handleActionFromContact(intent)
|
||||
}
|
||||
|
||||
fun resetConversationsList() {
|
||||
if (userUtils.anyUserExists()) {
|
||||
router!!.setRoot(
|
||||
RouterTransaction.with(ConversationsListController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun openSettings() {
|
||||
router!!.pushController(
|
||||
RouterTransaction.with(SettingsController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
}
|
||||
|
||||
fun addAccount() {
|
||||
router!!.pushController(
|
||||
RouterTransaction.with(ServerSelectionController())
|
||||
.pushChangeHandler(VerticalChangeHandler())
|
||||
.popChangeHandler(VerticalChangeHandler())
|
||||
)
|
||||
}
|
||||
|
||||
private fun handleActionFromContact(intent: Intent) {
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
|
||||
|
@ -79,6 +79,7 @@ import com.nextcloud.talk.jobs.DeleteConversationWorker;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
import com.nextcloud.talk.ui.dialog.ChooseAccountDialogFragment;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.ConductorRemapping;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
@ -108,6 +109,7 @@ import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.work.Data;
|
||||
@ -565,11 +567,15 @@ public class ConversationsListController extends BaseController implements Searc
|
||||
|
||||
if (activity.settingsButton != null) {
|
||||
activity.settingsButton.setOnClickListener(v -> {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add("userAvatar.transitionTag");
|
||||
getRouter().pushController((RouterTransaction.with(new SettingsController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler())));
|
||||
if (getResources() != null && getResources().getBoolean(R.bool.multiaccount_support)) {
|
||||
DialogFragment newFragment = ChooseAccountDialogFragment.newInstance();
|
||||
newFragment.show(((MainActivity) getActivity()).getSupportFragmentManager(),
|
||||
"ChooseAccountDialogFragment");
|
||||
} else {
|
||||
getRouter().pushController((RouterTransaction.with(new SettingsController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler())));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -160,12 +160,8 @@ public class SettingsController extends BaseController {
|
||||
MaterialStandardPreference settingsMessageSound;
|
||||
@BindView(R.id.settings_remove_account)
|
||||
MaterialStandardPreference removeAccountButton;
|
||||
@BindView(R.id.settings_switch)
|
||||
MaterialStandardPreference switchAccountButton;
|
||||
@BindView(R.id.settings_reauthorize)
|
||||
MaterialStandardPreference reauthorizeButton;
|
||||
@BindView(R.id.settings_add_account)
|
||||
MaterialStandardPreference addAccountButton;
|
||||
@BindView(R.id.message_view)
|
||||
MaterialPreferenceCategory messageView;
|
||||
@BindView(R.id.settings_client_cert)
|
||||
@ -321,22 +317,6 @@ public class SettingsController extends BaseController {
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
});
|
||||
|
||||
if (getResources().getBoolean(R.bool.multiaccount_support)) {
|
||||
addAccountButton.addPreferenceClickListener(view15 -> {
|
||||
getRouter().pushController(RouterTransaction.with(new
|
||||
ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler()));
|
||||
});
|
||||
} else {
|
||||
addAccountButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
switchAccountButton.addPreferenceClickListener(view16 -> {
|
||||
getRouter().pushController(RouterTransaction.with(new
|
||||
SwitchAccountController()).pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler()));
|
||||
});
|
||||
|
||||
if (userUtils.getCurrentUser().isPhoneBookIntegrationAvailable()) {
|
||||
phoneBookIntegrationPreference.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
@ -379,12 +359,8 @@ public class SettingsController extends BaseController {
|
||||
}
|
||||
|
||||
private void showLovelyDialog(int dialogId, Bundle savedInstanceState) {
|
||||
switch (dialogId) {
|
||||
case ID_REMOVE_ACCOUNT_WARNING_DIALOG:
|
||||
showRemoveAccountWarning(savedInstanceState);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (dialogId == ID_REMOVE_ACCOUNT_WARNING_DIALOG) {
|
||||
showRemoveAccountWarning(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,11 +608,6 @@ public class SettingsController extends BaseController {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (userUtils.getUsers().size() <= 1) {
|
||||
switchAccountButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (ApplicationWideMessageHolder.getInstance().getMessageType() != null) {
|
||||
switch (ApplicationWideMessageHolder.getInstance().getMessageType()) {
|
||||
case ACCOUNT_UPDATED_NOT_ADDED:
|
||||
|
@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Parts related to account import were either copied from or inspired by the great work done by David Luhmer at:
|
||||
* https://github.com/nextcloud/ownCloud-Account-Importer
|
||||
*/
|
||||
|
||||
package com.nextcloud.talk.ui.dialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.facebook.drawee.interfaces.DraweeController;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.nextcloud.talk.R;
|
||||
import com.nextcloud.talk.activities.MainActivity;
|
||||
import com.nextcloud.talk.adapters.items.AdvancedUserItem;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.databinding.DialogChooseAccountBinding;
|
||||
import com.nextcloud.talk.models.database.User;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.net.CookieManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import autodagger.AutoInjector;
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class ChooseAccountDialogFragment extends DialogFragment {
|
||||
private static final String TAG = ChooseAccountDialogFragment.class.getSimpleName();
|
||||
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
||||
@Inject
|
||||
CookieManager cookieManager;
|
||||
|
||||
private DialogChooseAccountBinding binding;
|
||||
private View dialogView;
|
||||
|
||||
private FlexibleAdapter<AdvancedUserItem> adapter;
|
||||
private final List<AdvancedUserItem> userItems = new ArrayList<>();
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@NotNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
binding = DialogChooseAccountBinding.inflate(LayoutInflater.from(requireContext()));
|
||||
dialogView = binding.getRoot();
|
||||
|
||||
return new MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NotNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||
|
||||
// Defining user picture
|
||||
binding.currentAccount.userIcon.setTag("");
|
||||
|
||||
// Defining user texts, accounts, etc.
|
||||
User user = userUtils.getCurrentUser();
|
||||
if (user != null) {
|
||||
binding.currentAccount.userName.setText(user.getDisplayName());
|
||||
binding.currentAccount.ticker.setVisibility(View.GONE);
|
||||
binding.currentAccount.account.setText((Uri.parse(user.getBaseUrl()).getHost()));
|
||||
|
||||
if (user.getBaseUrl() != null &&
|
||||
(user.getBaseUrl().startsWith("http://") || user.getBaseUrl().startsWith("https://"))) {
|
||||
binding.currentAccount.userIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
||||
.setOldController(binding.currentAccount.userIcon.getController())
|
||||
.setAutoPlayAnimations(true)
|
||||
.setImageRequest(DisplayUtils.getImageRequestForUrl(
|
||||
ApiUtils.getUrlForAvatarWithName(user.getBaseUrl(), user.getUserId(), R.dimen.avatar_size),
|
||||
null))
|
||||
.build();
|
||||
binding.currentAccount.userIcon.setController(draweeController);
|
||||
|
||||
} else {
|
||||
binding.currentAccount.userIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
// Creating listeners for quick-actions
|
||||
binding.currentAccount.getRoot().setOnClickListener(v -> dismiss());
|
||||
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
binding.addAccount.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
((MainActivity) getActivity()).addAccount();
|
||||
});
|
||||
binding.manageSettings.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
((MainActivity) getActivity()).openSettings();
|
||||
});
|
||||
}
|
||||
|
||||
if (adapter == null) {
|
||||
adapter = new FlexibleAdapter<>(userItems, getActivity(), false);
|
||||
|
||||
UserEntity userEntity;
|
||||
Participant participant;
|
||||
|
||||
for (Object userEntityObject : userUtils.getUsers()) {
|
||||
userEntity = (UserEntity) userEntityObject;
|
||||
if (!userEntity.getCurrent()) {
|
||||
String userId;
|
||||
if (userEntity.getUserId() != null) {
|
||||
userId = userEntity.getUserId();
|
||||
} else {
|
||||
userId = userEntity.getUsername();
|
||||
}
|
||||
|
||||
participant = new Participant();
|
||||
participant.setActorType(Participant.ActorType.USERS);
|
||||
participant.setActorId(userId);
|
||||
participant.setDisplayName(userEntity.getDisplayName());
|
||||
userItems.add(new AdvancedUserItem(participant, userEntity, null));
|
||||
}
|
||||
}
|
||||
|
||||
adapter.addListener(onSwitchItemClickListener);
|
||||
adapter.updateDataSet(userItems, false);
|
||||
}
|
||||
|
||||
prepareViews();
|
||||
}
|
||||
|
||||
private void prepareViews() {
|
||||
if (getActivity() != null) {
|
||||
LinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
|
||||
binding.accountsList.setLayoutManager(layoutManager);
|
||||
}
|
||||
binding.accountsList.setHasFixedSize(true);
|
||||
binding.accountsList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public static ChooseAccountDialogFragment newInstance() {
|
||||
return new ChooseAccountDialogFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return dialogView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
|
||||
private final FlexibleAdapter.OnItemClickListener onSwitchItemClickListener =
|
||||
new FlexibleAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (userItems.size() > position) {
|
||||
UserEntity userEntity = (userItems.get(position)).getEntity();
|
||||
userUtils.createOrUpdateUser(null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
null, userEntity.getId(),
|
||||
null,
|
||||
null,
|
||||
null)
|
||||
.subscribe(new Observer<UserEntity>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
// unused at the moment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull UserEntity userEntity) {
|
||||
cookieManager.getCookieStore().removeAll();
|
||||
userUtils.disableAllUsersWithoutId(userEntity.getId());
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(
|
||||
() -> ((MainActivity) getActivity()).resetConversationsList());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NotNull Throwable e) {
|
||||
Log.w(TAG, "Error updating user", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
// DONE
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
26
app/src/main/res/drawable/ic_check_circle.xml
Normal file
26
app/src/main/res/drawable/ic_check_circle.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
@author Google LLC
|
||||
Copyright (C) 2020 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#4995FB"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" />
|
||||
</vector>
|
25
app/src/main/res/drawable/ic_settings.xml
Normal file
25
app/src/main/res/drawable/ic_settings.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Nextcloud Talk application
|
||||
|
||||
Copyright (C) 2020 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/>.
|
||||
|
||||
Icon provided by Android Material Library in Apache License 2.0
|
||||
-->
|
||||
<vector android:height="24dp" android:tint="#666666"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
|
||||
</vector>
|
138
app/src/main/res/layout/account_item.xml
Normal file
138
app/src/main/res/layout/account_item.xml
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Nextcloud TAlk application
|
||||
|
||||
Copyright (C) 2016 Andy Scherzinger
|
||||
Copyright (C) 2016 Nextcloud
|
||||
Copyright (C) 2016 ownCloud
|
||||
Copyright (C) 2020 Infomaniak Network SA
|
||||
|
||||
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.card.MaterialCardView 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:layout_margin="4dp"
|
||||
android:orientation="horizontal"
|
||||
app:cardBackgroundColor="@color/transparent"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/avatar_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true">
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="@dimen/small_item_height"
|
||||
android:layout_height="@dimen/small_item_height"
|
||||
android:layout_gravity="top|start"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:contentDescription="@string/avatar"
|
||||
android:src="@drawable/ic_user"
|
||||
app:roundAsCircle="true"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ticker"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:background="@drawable/round_bgnd"
|
||||
android:src="@drawable/ic_check_circle"
|
||||
tools:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_toEndOf="@id/avatar_container"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_half_margin"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="@dimen/standard_double_margin"
|
||||
android:ellipsize="end"
|
||||
android:gravity="bottom"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/conversation_item_header"
|
||||
android:textSize="@dimen/two_line_primary_text_size"
|
||||
tools:text="Firstname Lastname" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_half_margin"
|
||||
android:layout_marginEnd="@dimen/standard_double_margin"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="top"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:visibility="gone"
|
||||
tools:text="☁️ My custom status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_half_margin"
|
||||
android:layout_marginEnd="@dimen/standard_double_margin"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="top"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/textColorMaxContrast"
|
||||
android:textSize="14sp"
|
||||
tools:text="https://server.com/nextcloud" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_menu"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/nc_account_chooser_active_user"
|
||||
android:focusable="true"
|
||||
android:paddingStart="@dimen/standard_half_padding"
|
||||
android:paddingEnd="10dp"
|
||||
android:src="@drawable/ic_check_circle"
|
||||
app:tint="@color/colorPrimary" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
@ -122,19 +122,11 @@
|
||||
apc:roundAsCircle="true"
|
||||
tools:src="@tools:sample/avatars[0]" />
|
||||
|
||||
<com.yarolegovich.mp.MaterialStandardPreference
|
||||
android:id="@+id/settings_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/server_age_warning_text_card"
|
||||
android:tag="switchAccountButton"
|
||||
apc:mp_title="@string/nc_settings_switch_account" />
|
||||
|
||||
<com.yarolegovich.mp.MaterialStandardPreference
|
||||
android:id="@+id/settings_reauthorize"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/settings_switch"
|
||||
android:layout_below="@id/server_age_warning_text_card"
|
||||
apc:mp_title="@string/nc_settings_reauthorize" />
|
||||
|
||||
<com.yarolegovich.mp.MaterialStandardPreference
|
||||
@ -151,13 +143,6 @@
|
||||
android:layout_below="@id/settings_client_cert"
|
||||
apc:mp_title="@string/nc_settings_remove_account" />
|
||||
|
||||
<com.yarolegovich.mp.MaterialStandardPreference
|
||||
android:id="@+id/settings_add_account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/settings_remove_account"
|
||||
apc:mp_title="@string/nc_settings_add_account" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</com.yarolegovich.mp.MaterialPreferenceCategory>
|
||||
|
99
app/src/main/res/layout/dialog_choose_account.xml
Normal file
99
app/src/main/res/layout/dialog_choose_account.xml
Normal file
@ -0,0 +1,99 @@
|
||||
<!--
|
||||
Nextcloud Talk application
|
||||
|
||||
Copyright (C) 2020 Infomaniak Network SA
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
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/>.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/current_account"
|
||||
layout="@layout/account_item"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_line"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/controller_chat_separator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/current_account" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/accounts_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/add_account"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/separator_line" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/add_account"
|
||||
style="@style/Nextcloud.Material.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:text="@string/nc_account_chooser_add_account"
|
||||
android:textAlignment="textStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/fontAppbar"
|
||||
app:icon="@drawable/ic_account_plus"
|
||||
app:iconGravity="start"
|
||||
app:iconPadding="22dp"
|
||||
app:iconTint="@color/fontAppbar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/manage_settings"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/manage_settings"
|
||||
style="@style/Nextcloud.Material.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:text="@string/nc_settings"
|
||||
android:textAlignment="textStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/fontAppbar"
|
||||
app:icon="@drawable/ic_settings"
|
||||
app:iconGravity="start"
|
||||
app:iconPadding="20dp"
|
||||
app:iconTint="@color/fontAppbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -162,6 +162,8 @@
|
||||
<string name="nc_license_summary">GNU General Public License, Version 3</string>
|
||||
|
||||
<string name="nc_select_an_account">Select an account</string>
|
||||
<string name="nc_account_chooser_add_account">Add account</string>
|
||||
<string name="nc_account_chooser_active_user">Active user</string>
|
||||
|
||||
<string name="nc_profile_personal_info_title">Personal Info</string>
|
||||
|
||||
|
@ -159,4 +159,9 @@
|
||||
<item name="android:statusBarColor">@color/colorPrimary</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Nextcloud.Material.TextButton" parent="Widget.MaterialComponents.Button.TextButton.Icon">
|
||||
<item name="android:typeface">sans</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user