mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 11:32:00 +00:00
Progress in account switching
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
b0897aa5db
commit
af48bc9a50
@ -130,8 +130,8 @@ public class ApiHelper {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/signaling";
|
||||
}
|
||||
|
||||
public static String getUrlForUserProfile(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + "/cloud/user";
|
||||
public static String getUrlForUserProfile(String baseUrl, String username) {
|
||||
return baseUrl + ocsApiVersion + "/cloud/users/" + username;
|
||||
}
|
||||
|
||||
public static String getUrlPostfixForStatus() {
|
||||
|
@ -114,7 +114,7 @@ public class AccountVerificationController extends BaseController {
|
||||
R.string.nc_nextcloud_talk_app_installed), getResources().getString(R.string.nc_app_name)));
|
||||
|
||||
profileQueryDisposable = ncApi.getUserProfile(credentials,
|
||||
ApiHelper.getUrlForUserProfile(baseUrl))
|
||||
ApiHelper.getUrlForUserProfile(baseUrl, username))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(userProfileOverall -> {
|
||||
@ -126,6 +126,10 @@ public class AccountVerificationController extends BaseController {
|
||||
.getDisplayName())) {
|
||||
displayName = userProfileOverall.getOcs().getData()
|
||||
.getDisplayName();
|
||||
} else if (!TextUtils.isEmpty(userProfileOverall.getOcs().getData()
|
||||
.getDisplayNameAlt())) {
|
||||
displayName = userProfileOverall.getOcs().getData()
|
||||
.getDisplayNameAlt();
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(displayName)) {
|
||||
|
@ -80,7 +80,7 @@ import retrofit2.HttpException;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class ContactsController extends BaseController implements SearchView.OnQueryTextListener,
|
||||
ActionMode.Callback, FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemLongClickListener {
|
||||
ActionMode.Callback, FlexibleAdapter.OnItemClickListener {
|
||||
|
||||
public static final String TAG = "ContactsController";
|
||||
|
||||
@ -411,16 +411,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
if (count == 0) {
|
||||
actionMode.finish();
|
||||
} else {
|
||||
setContextTitle(count);
|
||||
//setContextTitle(count);
|
||||
}
|
||||
}
|
||||
|
||||
private void setContextTitle(int count) {
|
||||
actionMode.setTitle(String.valueOf(count) + " " + (count == 1 ?
|
||||
getResources().getString(R.string.one_contact_selected) :
|
||||
getResources().getString(R.string.more_contacts_selected)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
adapter.onSaveInstanceState(outState);
|
||||
@ -432,18 +426,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
if (adapter != null) {
|
||||
adapter.onRestoreInstanceState(savedInstanceState);
|
||||
if (adapter.getSelectedItemCount() > 0) {
|
||||
actionMode = getActivity().startActionMode(this);
|
||||
setContextTitle(adapter.getSelectedItemCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemLongClick(int position) {
|
||||
if (actionMode == null) {
|
||||
actionMode = getActivity().startActionMode(this);
|
||||
}
|
||||
toggleSelection(position);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ import cn.carbs.android.avatarimageview.library.AvatarImageView;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Credentials;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class SettingsController extends BaseController {
|
||||
@ -281,10 +280,9 @@ public class SettingsController extends BaseController {
|
||||
.centerInside()
|
||||
.into(avatarImageView);
|
||||
|
||||
|
||||
profileQueryDisposable = ncApi.getUserProfile(Credentials.basic(userEntity.getUsername(),
|
||||
profileQueryDisposable = ncApi.getUserProfile(ApiHelper.getCredentials(userEntity.getUsername(),
|
||||
userEntity.getToken()),
|
||||
ApiHelper.getUrlForUserProfile(userEntity.getBaseUrl()))
|
||||
ApiHelper.getUrlForUserProfile(userEntity.getBaseUrl(), userEntity.getUsername()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(userProfileOverall -> {
|
||||
|
@ -75,6 +75,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginStart="@dimen/margin_between_elements"
|
||||
android:background="@drawable/ic_more_horiz_black_24dp"/>
|
||||
android:background="@drawable/ic_more_horiz_black_24dp"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user