This commit is contained in:
Mario Danic 2018-11-07 02:15:44 +01:00
parent 142ceb12e2
commit e3f43b63ea
14 changed files with 685 additions and 44 deletions

View file

@ -35,6 +35,7 @@ import com.nextcloud.talk.jobs.SignalingSettingsJob;
import com.nextcloud.talk.utils.ClosedInterfaceImpl;
import com.nextcloud.talk.utils.DeviceUtils;
import com.nextcloud.talk.utils.DisplayUtils;
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageModule;
import com.nextcloud.talk.utils.database.user.UserModule;
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
@ -64,6 +65,7 @@ import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
DatabaseModule.class,
RestModule.class,
UserModule.class,
ArbitraryStorageModule.class,
}
)
@ -168,6 +170,7 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Lif
.databaseModule(new DatabaseModule())
.restModule(new RestModule())
.userModule(new UserModule())
.arbitraryStorageModule(new ArbitraryStorageModule())
.build();
}

View file

@ -995,9 +995,9 @@ public class ChatController extends BaseController implements MessagesListAdapte
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(conversationUser));
bundle.putString(BundleKeys.KEY_BASE_URL, baseUrl);
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken);
/*getRouter().pushController((RouterTransaction.with(new ConversationInfoController(bundle))
getRouter().pushController((RouterTransaction.with(new ConversationInfoController(bundle))
.pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler())));*/
.popChangeHandler(new VerticalChangeHandler())));
return true;
default:
return super.onOptionsItemSelected(item);

View file

@ -0,0 +1,202 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.controllers;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import com.nextcloud.talk.R;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter;
import com.nextcloud.talk.models.json.rooms.Conversation;
import com.nextcloud.talk.models.json.rooms.RoomOverall;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.preferencestorage.DatabaseStorageModule;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.yarolegovich.mp.MaterialChoicePreference;
import com.yarolegovich.mp.MaterialPreferenceScreen;
import org.parceler.Parcels;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import autodagger.AutoInjector;
import butterknife.BindView;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
@AutoInjector(NextcloudTalkApplication.class)
public class ConversationInfoController extends BaseController {
private String baseUrl;
private String conversationToken;
private UserEntity conversationUser;
private String credentials;
@BindView(R.id.notification_settings)
MaterialPreferenceScreen materialPreferenceScreen;
@BindView(R.id.progressBar)
ProgressBar progressBar;
@BindView(R.id.conversation_info_message_notifications)
MaterialChoicePreference messageNotificationLevel;
@Inject
NcApi ncApi;
private Disposable roomDisposable;
private Conversation conversation;
ConversationInfoController(Bundle args) {
super(args);
setHasOptionsMenu(true);
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
conversationUser = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_USER_ENTITY));
conversationToken = args.getString(BundleKeys.KEY_ROOM_TOKEN);
baseUrl = args.getString(BundleKeys.KEY_BASE_URL);
credentials = ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken());
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getRouter().popCurrentController();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
return inflater.inflate(R.layout.conversation_info, container, false);
}
@Override
protected void onViewBound(@NonNull View view) {
super.onViewBound(view);
materialPreferenceScreen.setStorageModule(new DatabaseStorageModule(conversationUser, conversationToken));
if (conversation == null) {
fetchRoomInfo();
}
}
@Override
protected void onAttach(@NonNull View view) {
super.onAttach(view);
if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
protected String getTitle() {
return getResources().getString(R.string.nc_conversation_menu_conversation_info);
}
private void fetchRoomInfo() {
ncApi.getRoom(credentials, ApiUtils.getRoom(conversationUser.getBaseUrl(), conversationToken))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
roomDisposable = d;
}
@Override
public void onNext(RoomOverall roomOverall) {
conversation = roomOverall.getOcs().getData();
progressBar.setVisibility(View.GONE);
materialPreferenceScreen.setVisibility(View.VISIBLE);
if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) {
messageNotificationLevel.setEnabled(true);
messageNotificationLevel.setAlpha(1.0f);
if (!conversation.getNotificationLevel().equals(Conversation.NotificationLevel.DEFAULT)) {
String stringValue;
switch (new EnumNotificationLevelConverter().convertToInt(conversation.getNotificationLevel())) {
case 1:
stringValue = "always";
break;
case 2:
stringValue = "mention";
break;
case 3:
stringValue = "never";
break;
default:
stringValue = "mention";
break;
}
messageNotificationLevel.setValue(stringValue);
} else {
setProperNotificationValue(conversation);
}
} else {
messageNotificationLevel.setEnabled(false);
messageNotificationLevel.setAlpha(0.38f);
setProperNotificationValue(conversation);
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
roomDisposable.dispose();
}
});
}
private void setProperNotificationValue(Conversation conversation) {
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL)) {
// hack to see if we get mentioned always or just on mention
if (conversationUser.hasSpreedCapabilityWithName("mention-flag")) {
messageNotificationLevel.setValue("always");
} else {
messageNotificationLevel.setValue("mention");
}
} else {
messageNotificationLevel.setValue("mention");
}
}
}

View file

@ -49,7 +49,7 @@ public class DatabaseModule {
return new SqlCipherDatabaseSource(context, Models.DEFAULT,
context.getResources().getString(R.string.nc_app_name).toLowerCase()
.replace(" ", "_").trim() + ".sqlite",
context.getString(R.string.nc_talk_database_encryption_key), 5);
context.getString(R.string.nc_talk_database_encryption_key), 6);
}
@Provides

View file

@ -46,6 +46,7 @@ import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.RingtoneSettings;
import com.nextcloud.talk.models.SignatureVerification;
import com.nextcloud.talk.models.database.ArbitraryStorageEntity;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.chat.ChatUtils;
import com.nextcloud.talk.models.json.notifications.NotificationOverall;
@ -57,6 +58,7 @@ import com.nextcloud.talk.utils.DoNotDisturbUtils;
import com.nextcloud.talk.utils.NotificationUtils;
import com.nextcloud.talk.utils.PushUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
@ -93,6 +95,9 @@ public class NotificationWorker extends Worker {
@Inject
AppPreferences appPreferences;
@Inject
ArbitraryStorageUtils arbitraryStorageUtils;
@Inject
Retrofit retrofit;
@ -114,42 +119,53 @@ public class NotificationWorker extends Worker {
private void showNotificationForCallWithNoPing(Intent intent) {
UserEntity userEntity = signatureVerification.getUserEntity();
ncApi.getRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(),
intent.getExtras().getString(BundleKeys.KEY_ROOM_TOKEN)))
.blockingSubscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
ArbitraryStorageEntity arbitraryStorageEntity;
boolean muteCalls = false;
@Override
public void onNext(RoomOverall roomOverall) {
Conversation conversation = roomOverall.getOcs().getData();
if ((arbitraryStorageEntity = arbitraryStorageUtils.getStorageSetting(userEntity.getId(),
"mute_calls", intent.getExtras().getString(BundleKeys.KEY_ROOM_TOKEN))) != null) {
muteCalls = Boolean.parseBoolean(arbitraryStorageEntity.getValue());
}
if (!muteCalls) {
ncApi.getRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(),
intent.getExtras().getString(BundleKeys.KEY_ROOM_TOKEN)))
.blockingSubscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
intent.putExtra(BundleKeys.KEY_ROOM, Parcels.wrap(conversation));
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL) ||
(!TextUtils.isEmpty(conversation.getObjectType()) && "share:password".equals
(conversation.getObjectType()))) {
context.startActivity(intent);
} else {
if (conversation.getType().equals(Conversation.RoomType.ROOM_GROUP_CALL)) {
conversationType = "group";
} else {
conversationType = "public";
}
showNotification(intent);
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(RoomOverall roomOverall) {
Conversation conversation = roomOverall.getOcs().getData();
@Override
public void onComplete() {
intent.putExtra(BundleKeys.KEY_ROOM, Parcels.wrap(conversation));
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL) ||
(!TextUtils.isEmpty(conversation.getObjectType()) && "share:password".equals
(conversation.getObjectType()))) {
context.startActivity(intent);
} else {
if (conversation.getType().equals(Conversation.RoomType.ROOM_GROUP_CALL)) {
conversationType = "group";
} else {
conversationType = "public";
}
showNotification(intent);
}
}
}
});
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
}
private void showMessageNotificationWithObjectData(Intent intent) {

View file

@ -0,0 +1,42 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.models.database;
import android.os.Parcelable;
import java.io.Serializable;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Nullable;
import io.requery.Persistable;
@Entity
public interface ArbitraryStorage extends Parcelable, Persistable, Serializable {
@Key
long getAccountIdentifier();
String getKey();
String getObject();
String getValue();
}

View file

@ -0,0 +1,45 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.utils.database.arbitrarystorage;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.dagger.modules.DatabaseModule;
import javax.inject.Inject;
import autodagger.AutoInjector;
import dagger.Module;
import dagger.Provides;
import io.requery.Persistable;
import io.requery.reactivex.ReactiveEntityStore;
@Module(includes = DatabaseModule.class)
@AutoInjector(NextcloudTalkApplication.class)
public class ArbitraryStorageModule {
@Inject
public ArbitraryStorageModule() {
}
@Provides
public ArbitraryStorageUtils provideArbitraryStorageUtils(ReactiveEntityStore<Persistable> dataStore) {
return new ArbitraryStorageUtils(dataStore);
}
}

View file

@ -0,0 +1,69 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.utils.database.arbitrarystorage;
import android.text.TextUtils;
import com.nextcloud.talk.models.database.ArbitraryStorage;
import com.nextcloud.talk.models.database.ArbitraryStorageEntity;
import com.nextcloud.talk.models.database.User;
import com.nextcloud.talk.models.database.UserEntity;
import java.util.List;
import androidx.annotation.Nullable;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.requery.Persistable;
import io.requery.query.Result;
import io.requery.reactivex.ReactiveEntityStore;
public class ArbitraryStorageUtils {
private ReactiveEntityStore<Persistable> dataStore;
ArbitraryStorageUtils(ReactiveEntityStore<Persistable> dataStore) {
this.dataStore = dataStore;
}
public void storeStorageSetting(long accountIdentifier, String key, String value, String object) {
ArbitraryStorageEntity arbitraryStorageEntity = new ArbitraryStorageEntity();
arbitraryStorageEntity.setAccountIdentifier(accountIdentifier);
arbitraryStorageEntity.setKey(key);
arbitraryStorageEntity.setValue(value);
arbitraryStorageEntity.setObject(object);
dataStore.upsert(arbitraryStorageEntity)
.toObservable()
.subscribeOn(Schedulers.newThread())
.subscribe();
}
public ArbitraryStorageEntity getStorageSetting(long accountIdentifier, String key, @Nullable String object) {
Result findStorageQueryResult = dataStore.select(ArbitraryStorage.class)
.where(ArbitraryStorageEntity.ACCOUNT_IDENTIFIER.eq(accountIdentifier)
.and(ArbitraryStorageEntity.KEY.eq(key)).and(ArbitraryStorageEntity.OBJECT.eq(object)))
.limit(1).get();
return (ArbitraryStorageEntity) findStorageQueryResult.firstOrNull();
}
}

View file

@ -0,0 +1,42 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.utils.preferencestorage;
import android.content.Context;
import com.nextcloud.talk.models.database.UserEntity;
import com.yarolegovich.mp.io.StorageModule;
public class DatabaseStorageFactory implements StorageModule.Factory {
private UserEntity conversationUser;
private String conversationToken;
public DatabaseStorageFactory(UserEntity conversationUser, String conversationToken) {
this.conversationUser = conversationUser;
this.conversationToken = conversationToken;
}
@Override
public StorageModule create(Context context) {
return new DatabaseStorageModule(conversationUser, conversationToken);
}
}

View file

@ -0,0 +1,169 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 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/>.
*/
package com.nextcloud.talk.utils.preferencestorage;
import android.os.Bundle;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.database.ArbitraryStorageEntity;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.generic.GenericOverall;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
import com.yarolegovich.mp.io.StorageModule;
import java.util.Set;
import javax.inject.Inject;
import autodagger.AutoInjector;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
@AutoInjector(NextcloudTalkApplication.class)
public class DatabaseStorageModule implements StorageModule {
@Inject
ArbitraryStorageUtils arbitraryStorageUtils;
@Inject
NcApi ncApi;
private UserEntity conversationUser;
private String conversationToken;
private long accountIdentifier;
public DatabaseStorageModule(UserEntity conversationUser, String conversationToken) {
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
this.conversationUser = conversationUser;
this.accountIdentifier = conversationUser.getId();
this.conversationToken = conversationToken;
}
@Override
public void saveBoolean(String key, boolean value) {
arbitraryStorageUtils.storeStorageSetting(accountIdentifier, key, Boolean.toString(value), conversationToken);
}
@Override
public void saveString(String key, String value) {
if (!key.equals("message_notification_level")) {
arbitraryStorageUtils.storeStorageSetting(accountIdentifier, key, value, conversationToken);
} else {
int intValue;
switch (value) {
case "never":
intValue = 3;
break;
case "mention":
intValue = 2;
break;
case "always":
intValue = 1;
break;
default:
intValue = 0;
}
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken),
intValue)
.subscribeOn(Schedulers.newThread())
.subscribe(new Observer<GenericOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(GenericOverall genericOverall) {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
}
@Override
public void saveInt(String key, int value) {
arbitraryStorageUtils.storeStorageSetting(accountIdentifier, key, Integer.toString(value), conversationToken);
}
@Override
public void saveStringSet(String key, Set<String> value) {
}
@Override
public boolean getBoolean(String key, boolean defaultVal) {
ArbitraryStorageEntity valueFromDb = arbitraryStorageUtils.getStorageSetting(accountIdentifier, key, conversationToken);
if (valueFromDb == null) {
return defaultVal;
} else {
return Boolean.parseBoolean(valueFromDb.getValue());
}
}
@Override
public String getString(String key, String defaultVal) {
ArbitraryStorageEntity valueFromDb = arbitraryStorageUtils.getStorageSetting(accountIdentifier, key, conversationToken);
if (valueFromDb == null) {
return defaultVal;
} else {
return valueFromDb.getValue();
}
}
@Override
public int getInt(String key, int defaultVal) {
ArbitraryStorageEntity valueFromDb = arbitraryStorageUtils.getStorageSetting(accountIdentifier, key, conversationToken);
if (valueFromDb == null) {
return defaultVal;
} else {
return Integer.parseInt(valueFromDb.getValue());
}
}
@Override
public Set<String> getStringSet(String key, Set<String> defaultVal) {
return null;
}
@Override
public void onSaveInstanceState(Bundle outState) {
}
@Override
public void onRestoreInstanceState(Bundle savedState) {
}
}

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 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/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="@dimen/item_height"
android:layout_height="@dimen/item_height"
android:layout_centerInParent="true"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary"
android:indeterminateTintMode="src_in"/>
<include layout="@layout/notification_settings_item"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk application
~
~ @author Mario Danic
@ -20,10 +19,10 @@
-->
<com.yarolegovich.mp.MaterialPreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:apc="http://schemas.android.com/apk/res-auto"
android:id="@+id/settings_screen"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:apc="http://schemas.android.com/apk/res-auto"
android:id="@+id/notification_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yarolegovich.mp.MaterialPreferenceCategory
@ -38,6 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
apc:mp_entry_descriptions="@array/message_notification_levels"
apc:mp_entry_values="@array/message_notification_levels_entry_values"
apc:mp_key="message_notification_level"
apc:mp_show_value="onBottom"
apc:mp_title="@string/nc_plain_old_messages">
</com.yarolegovich.mp.MaterialChoicePreference>
@ -46,8 +47,10 @@
android:id="@+id/conversation_info_mute_calls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
apc:mp_title="@string/nc_mute_calls"
apc:mp_default_value="true"/>
apc:mp_key="mute_calls"
apc:mp_default_value="false"
apc:mp_summary="@string/nc_mute_calls_description"
apc:mp_title="@string/nc_mute_calls" />
</com.yarolegovich.mp.MaterialPreferenceCategory>

View file

@ -32,4 +32,11 @@
<item>@string/nc_notify_me_mention</item>
<item>@string/nc_notify_me_always</item>
</array>
<array name="message_notification_levels_entry_values">
<item>never</item>
<item>mention</item>
<item>always</item>
</array>
</resources>

View file

@ -154,13 +154,14 @@
<string name="nc_notification_channel_calls">Calls notification channel</string>
<string name="nc_notification_channel_messages">Messages notification channel</string>
<string name="nc_notification_channel_calls_description">Shows incoming calls</string>
<string name="nc_notification_channel_messages_description">Shows incoming messages</string>
<string name="nc_notification_channel_Cmessages_description">Shows incoming messages</string>
<string name="nc_notification_settings">Notification settings</string>
<string name="nc_plain_old_messages">Messages</string>
<string name="nc_notify_me_always">Always</string>
<string name="nc_notify_me_mention">When mentioned</string>
<string name="nc_notify_me_never">Never</string>
<string name="nc_notify_me_always">Always notify</string>
<string name="nc_notify_me_mention">Notify when mentioned</string>
<string name="nc_notify_me_never">Never notify</string>
<string name="nc_mute_calls">Mute calls</string>
<string name="nc_mute_calls_description">When muted, there will be no notification for incoming calls</string>
<!-- Bottom sheet menu -->
<string name="nc_failed_to_perform_operation">Sorry, something went wrong!</string>