diff --git a/app/src/main/java/com/zurichat/app/ui/activities/CreateDialog.kt b/app/src/main/java/com/zurichat/app/ui/activities/CreateDialog.kt index 196aa258..7ecf7c91 100644 --- a/app/src/main/java/com/zurichat/app/ui/activities/CreateDialog.kt +++ b/app/src/main/java/com/zurichat/app/ui/activities/CreateDialog.kt @@ -57,7 +57,7 @@ class CreateDialog(private val layoutInflaterr: LayoutInflater, //save to shared preferences val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val editor = preferences.edit() - editor.putString("name", java.lang.String.valueOf(name.text.toString())) + editor.putString(getString(R.string.name), java.lang.String.valueOf(name.text.toString())) editor.apply() } } @@ -89,7 +89,7 @@ class CreateDialog(private val layoutInflaterr: LayoutInflater, val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val editor = preferences.edit() - editor.putString("about", java.lang.String.valueOf(about.text.toString())) + editor.putString(getString(R.string.about), java.lang.String.valueOf(about.text.toString())) editor.apply() } } diff --git a/app/src/main/java/com/zurichat/app/ui/activities/DocumentSentActivity.java b/app/src/main/java/com/zurichat/app/ui/activities/DocumentSentActivity.java index 4b7a0d88..ea49a4ac 100644 --- a/app/src/main/java/com/zurichat/app/ui/activities/DocumentSentActivity.java +++ b/app/src/main/java/com/zurichat/app/ui/activities/DocumentSentActivity.java @@ -143,7 +143,7 @@ private void startrecord() { try { mediaRecorder.prepare(); mediaRecorder.start(); - Toast.makeText(DocumentSentActivity.this, "recording", Toast.LENGTH_SHORT).show(); + Toast.makeText(DocumentSentActivity.this, getString(R.string.recording), Toast.LENGTH_SHORT).show(); }catch (Exception e){ e.printStackTrace(); // Toast.makeText(MainActivity.this, "recording error", Toast.LENGTH_SHORT).show(); diff --git a/app/src/main/java/com/zurichat/app/ui/activities/MainActivity.kt b/app/src/main/java/com/zurichat/app/ui/activities/MainActivity.kt index 74491465..c872ff31 100644 --- a/app/src/main/java/com/zurichat/app/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/activities/MainActivity.kt @@ -66,9 +66,9 @@ class MainActivity : AppCompatActivity() { val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean -> //Shows Toast message if permission is granted or denied. if (isGranted) { - Toast.makeText(this, "Permission Granted!", Toast.LENGTH_LONG).show() + Toast.makeText(this, getString(R.string.permission_granted), Toast.LENGTH_LONG).show() } else { - Toast.makeText(this, "Permission Denied!", Toast.LENGTH_LONG).show() + Toast.makeText(this, getString(R.string.permission_denied), Toast.LENGTH_LONG).show() } } @@ -96,7 +96,7 @@ class MainActivity : AppCompatActivity() { val isConnected: Boolean = activeNetwork?.isConnectedOrConnecting == true if(!isConnected){ - Toast.makeText(applicationContext,"No Internet Connection!",Toast.LENGTH_LONG).show() + Toast.makeText(applicationContext,getString(R.string.hello_blank_fragment),Toast.LENGTH_LONG).show() } } diff --git a/app/src/main/java/com/zurichat/app/ui/activities/OpenCameraActivity.java b/app/src/main/java/com/zurichat/app/ui/activities/OpenCameraActivity.java index adecb579..e826a62b 100644 --- a/app/src/main/java/com/zurichat/app/ui/activities/OpenCameraActivity.java +++ b/app/src/main/java/com/zurichat/app/ui/activities/OpenCameraActivity.java @@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) { if (intent.resolveActivity(getPackageManager()) != null){ activityResultLauncher.launch(intent); }else{ - Toast.makeText(OpenCameraActivity.this, "Unable to Start Camera!", + Toast.makeText(OpenCameraActivity.this, getString(R.string.unable_to_start_camera), Toast.LENGTH_SHORT).show(); } }); diff --git a/app/src/main/java/com/zurichat/app/ui/activities/ProfileActivity.kt b/app/src/main/java/com/zurichat/app/ui/activities/ProfileActivity.kt index 7ce75d2b..96f9e206 100644 --- a/app/src/main/java/com/zurichat/app/ui/activities/ProfileActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/activities/ProfileActivity.kt @@ -69,7 +69,7 @@ open class ProfileActivity: AppCompatActivity() { //user = intent.extras?.getParcelable("USER")!! - user = intent.getParcelableExtra("USER") as User + user = intent.getParcelableExtra(getString(R.string.user)) as User setContentView(R.layout.activity_profile) token = user?.token @@ -154,8 +154,8 @@ open class ProfileActivity: AppCompatActivity() { val phoneTextView = findViewById(R.id.tv_phoneno) with(builder){ - setTitle("Edit Phone Number") - setPositiveButton("Save"){ _, _ -> + setTitle(getString(R.string.edit_number)) + setPositiveButton(getString(R.string.save)){ _, _ -> phoneTextView.text = editText.text.toString() // populates the value of the @@ -169,7 +169,7 @@ open class ProfileActivity: AppCompatActivity() { editor.apply() } - setNegativeButton("Cancel") { _, _ -> + setNegativeButton(getString(R.string.cancel_mute_channel_settings)) { _, _ -> Timber.d("This button clicked successfully!!") //just for log purposes } setView(dialogLayout) @@ -196,7 +196,7 @@ open class ProfileActivity: AppCompatActivity() { //set profile photo to image uri profilePhoto.setImageURI(uri) profilePhoto.invalidate() - Toast.makeText(this, "Update Successful", Toast.LENGTH_SHORT).show() + Toast.makeText(this, getString(R.string.successful), Toast.LENGTH_SHORT).show() updateProfilePhoto(uri) } } diff --git a/app/src/main/java/com/zurichat/app/ui/audio/AudiosActivity.java b/app/src/main/java/com/zurichat/app/ui/audio/AudiosActivity.java index 84f44dbb..a1843eb0 100644 --- a/app/src/main/java/com/zurichat/app/ui/audio/AudiosActivity.java +++ b/app/src/main/java/com/zurichat/app/ui/audio/AudiosActivity.java @@ -67,15 +67,15 @@ private void sendAudio() { @java.lang.Override public void onResponse(Call call, Response response) { if(response.isSuccessful()){ - Toast.makeText(AudiosActivity.this, "Sent Successfully", Toast.LENGTH_SHORT).show(); + Toast.makeText(AudiosActivity.this, getString(R.string.sent_successfully), Toast.LENGTH_SHORT).show(); }else if (response.code() == 400){ - Toast.makeText(AudiosActivity.this, "Error 400, invalid", Toast.LENGTH_SHORT).show(); + Toast.makeText(AudiosActivity.this, getString(R.string.invalid_error), Toast.LENGTH_SHORT).show(); }else if (response.code() == 404){ - Toast.makeText(AudiosActivity.this, "Error 404, Not found", Toast.LENGTH_SHORT).show(); + Toast.makeText(AudiosActivity.this, getString(R.string.not_found_error), Toast.LENGTH_SHORT).show(); }else if (response.code() == 401){ - Toast.makeText(AudiosActivity.this, "Error 400, invalid", Toast.LENGTH_SHORT).show(); + Toast.makeText(AudiosActivity.this, getString(R.string.invalid_error), Toast.LENGTH_SHORT).show(); } } diff --git a/app/src/main/java/com/zurichat/app/ui/dm/DMFragment.kt b/app/src/main/java/com/zurichat/app/ui/dm/DMFragment.kt index e813c877..9b16b2d2 100644 --- a/app/src/main/java/com/zurichat/app/ui/dm/DMFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/dm/DMFragment.kt @@ -83,7 +83,7 @@ class DMFragment : Fragment(R.layout.fragment_dm) { senderId = roomList.room_user_ids.last() binding.iconBtn.setOnClickListener { - Toast.makeText(context, "Show Emoji", Toast.LENGTH_LONG).show() + Toast.makeText(context, getString(R.string.show_emoji), Toast.LENGTH_LONG).show() } // arguments?.let { bundle -> @@ -202,7 +202,7 @@ class DMFragment : Fragment(R.layout.fragment_dm) { when (imageResult) { is ImageResult.Success -> handleAttachmentUpload(listOf(imageResult.value)) is ImageResult.Failure -> { - Toast.makeText(requireContext(), "Picture not taken", Toast.LENGTH_LONG).show() + Toast.makeText(requireContext(), getString(R.string.picture_not_taken), Toast.LENGTH_LONG).show() } } } diff --git a/app/src/main/java/com/zurichat/app/ui/dm/dm_notification/DMWorkerUtils.kt b/app/src/main/java/com/zurichat/app/ui/dm/dm_notification/DMWorkerUtils.kt index 33975507..d2715b8c 100644 --- a/app/src/main/java/com/zurichat/app/ui/dm/dm_notification/DMWorkerUtils.kt +++ b/app/src/main/java/com/zurichat/app/ui/dm/dm_notification/DMWorkerUtils.kt @@ -35,7 +35,7 @@ fun makeNotification(context: Context, message: String) { val notification = NotificationCompat.Builder(context, CHANNEL_ID) .setContentText(message) .setAutoCancel(true) - .setContentTitle("New message") + .setContentTitle(context.getString(R.string.new_message)) .setPriority(NotificationCompat.PRIORITY_HIGH) .setSmallIcon(R.drawable.notifications_icon) .setContentIntent(pendingIntent) diff --git a/app/src/main/java/com/zurichat/app/ui/dm_chat/fragment/RoomFragment.kt b/app/src/main/java/com/zurichat/app/ui/dm_chat/fragment/RoomFragment.kt index e50f20b6..676e6bfd 100644 --- a/app/src/main/java/com/zurichat/app/ui/dm_chat/fragment/RoomFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/dm_chat/fragment/RoomFragment.kt @@ -3,8 +3,6 @@ package com.zurichat.app.ui.dm_chat.fragment import android.content.Context import android.content.SharedPreferences import android.os.Bundle -import android.os.Handler -import android.os.Looper import android.text.format.DateUtils import android.util.Log import android.view.LayoutInflater @@ -29,16 +27,12 @@ import com.zurichat.app.models.User import com.zurichat.app.ui.add_channel.BaseItem import com.zurichat.app.ui.add_channel.BaseListAdapter import com.zurichat.app.ui.dm.MEDIA -import com.zurichat.app.ui.dm_chat.apiservice.ApiDMService import com.zurichat.app.ui.dm_chat.model.request.SendMessageBody import com.zurichat.app.ui.dm_chat.model.response.message.BaseRoomData import com.zurichat.app.ui.dm_chat.model.response.message.Data -import com.zurichat.app.ui.dm_chat.model.response.message.Result import com.zurichat.app.ui.dm_chat.model.response.message.SendMessageResponse import com.zurichat.app.ui.dm_chat.model.response.room.RoomsListResponseItem -import com.zurichat.app.ui.dm_chat.repository.Repository import com.zurichat.app.ui.dm_chat.viewmodel.RoomViewModel -import com.zurichat.app.ui.dm_chat.viewmodel.RoomViewModelFactory import com.zurichat.app.ui.fragments.channel_chat.ChannelHeaderItem import com.zurichat.app.ui.fragments.home_screen.CentrifugeClient import com.zurichat.app.util.isInternetAvailable diff --git a/app/src/main/java/com/zurichat/app/ui/documents/DocumentActivity.java b/app/src/main/java/com/zurichat/app/ui/documents/DocumentActivity.java index 976f5cef..3d44112b 100644 --- a/app/src/main/java/com/zurichat/app/ui/documents/DocumentActivity.java +++ b/app/src/main/java/com/zurichat/app/ui/documents/DocumentActivity.java @@ -80,15 +80,15 @@ private void sendDocument() { @java.lang.Override public void onResponse(Call call, Response response) { if(response.isSuccessful()){ - Toast.makeText(DocumentActivity.this, "Sent Successfully", Toast.LENGTH_SHORT).show(); + Toast.makeText(DocumentActivity.this, getString(R.string.successful), Toast.LENGTH_SHORT).show(); }else if (response.code() == 400){ - Toast.makeText(DocumentActivity.this, "Error 400, invalid", Toast.LENGTH_SHORT).show(); + Toast.makeText(DocumentActivity.this, getString(R.string.invalid_error), Toast.LENGTH_SHORT).show(); }else if (response.code() == 404){ - Toast.makeText(DocumentActivity.this, "Error 404, Not found", Toast.LENGTH_SHORT).show(); + Toast.makeText(DocumentActivity.this, getString(R.string.not_found_error), Toast.LENGTH_SHORT).show(); }else if (response.code() == 401){ - Toast.makeText(DocumentActivity.this, "Error 400, invalid", Toast.LENGTH_SHORT).show(); + Toast.makeText(DocumentActivity.this, getString(R.string.invalid_error), Toast.LENGTH_SHORT).show(); } } diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/channel_chat/ChannelChatFragment.kt b/app/src/main/java/com/zurichat/app/ui/fragments/channel_chat/ChannelChatFragment.kt index 6734abfb..015b5b91 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/channel_chat/ChannelChatFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/channel_chat/ChannelChatFragment.kt @@ -237,7 +237,7 @@ class ChannelChatFragment : Fragment() { //sendVoiceNote.visibility = View.VISIBLE dimmerBox.visibility = View.GONE toolbar.subtitle = channel.members.plus(1).toString().plus(" Members") - Toast.makeText(requireContext(), "Joined Channel Successfully", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.join_channel_success), Toast.LENGTH_SHORT).show() binding.channelJoinBar.visibility = View.GONE channelJoined = true } else { diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/home_screen/chats_and_channels/ChannelsFragment.kt b/app/src/main/java/com/zurichat/app/ui/fragments/home_screen/chats_and_channels/ChannelsFragment.kt index 41549602..8ad650d5 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/home_screen/chats_and_channels/ChannelsFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/home_screen/chats_and_channels/ChannelsFragment.kt @@ -336,8 +336,8 @@ class ChannelsFragment : Fragment(R.layout.fragment_channels) { private fun showSnackBar() { val view: View = CoordinatorLayout(requireContext()) - val snack = Snackbar.make(view, "An Error Occurred!", Snackbar.LENGTH_INDEFINITE) - snack.setAction("Retry") { + val snack = Snackbar.make(view, getString(R.string.an_error_occured), Snackbar.LENGTH_INDEFINITE) + snack.setAction(getString(R.string.retry)) { viewModel.getChannelsList(organizationID) } snack.show() diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/AccountsFragment.kt b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/AccountsFragment.kt index d7770bcd..236b374d 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/AccountsFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/AccountsFragment.kt @@ -54,7 +54,7 @@ class AccountsFragment : Fragment() { if (!user.isNullOrEmpty())textView.visibility = View.GONE adapter.setData(user) if (user.isNotEmpty()){ - toolbar.subtitle = user.size.toString()+ " Account(s)" + toolbar.subtitle = user.size.toString()+ getString(R.string.accts) } }) diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ChangePassFragment.kt b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ChangePassFragment.kt index 4a4ca505..e929af52 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ChangePassFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ChangePassFragment.kt @@ -58,10 +58,10 @@ class ChangePassFragment: Fragment(R.layout.fragment_confirm_password) { val newPassFld = binding.textEditNewpass val confPassFld = binding.textEditConfirmpassWord if (newPassFld.text.toString()==confPassFld.text.toString()){ - Toast.makeText(requireContext(), "Password match", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.password_match), Toast.LENGTH_SHORT).show() updatePass(newPassFld.text.toString()) }else if (newPassFld.text.toString()!=confPassFld.text.toString()){ - binding.textEditNewpass.error = "Password doesn't match" + binding.textEditNewpass.error = getString(R.string.password_not_match) } } @@ -83,19 +83,19 @@ class ChangePassFragment: Fragment(R.layout.fragment_confirm_password) { userViewModel.deleteUser(args.account) val action = ChangePassFragmentDirections.actionChangePassFragmentToLoginActivity() - Toast.makeText(requireContext(), "password change successful\n Fresh sign in required", + Toast.makeText(requireContext(), getString(R.string.fresh_sign_in), Toast.LENGTH_SHORT).show() findNavController().navigate(action) requireActivity().finish() } private fun updateError(throwable: Throwable){ - Toast.makeText(requireContext(), "Please try again", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.please_try_again), Toast.LENGTH_SHORT).show() Timber.e(throwable) } private fun handleLoading(){ - Toast.makeText(requireContext(), "Please wait", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.pls_wait), Toast.LENGTH_SHORT).show() } //update user state in database @@ -119,16 +119,16 @@ class ChangePassFragment: Fragment(R.layout.fragment_confirm_password) { when (it) { is Result.Success -> { Toast.makeText(context, - "You have been successfully logged out of previous account", + getString(R.string.log_out_success), Toast.LENGTH_SHORT).show() updateUser() logoutSuccess() } is Result.Error -> { - Toast.makeText(context, "Error", Toast.LENGTH_SHORT).show() + Toast.makeText(context, getString(R.string.error), Toast.LENGTH_SHORT).show() } is Result.Loading -> { - Toast.makeText(context, "Loading", Toast.LENGTH_SHORT).show() + Toast.makeText(context, getString(R.string.loading), Toast.LENGTH_SHORT).show() } } }) diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/EnterOtpACFragment.kt b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/EnterOtpACFragment.kt index 6bd07129..8fb3eb2b 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/EnterOtpACFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/EnterOtpACFragment.kt @@ -62,7 +62,7 @@ class EnterOtpACFragment:Fragment(R.layout.fragment_enter_otp) { } private fun resetSuccess(){ - Toast.makeText(requireContext(), "correct code", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.correct_code), Toast.LENGTH_SHORT).show() val otpCode = binding.pinView.text.toString() val action = EnterOtpACFragmentDirections .actionEnterOtpACFragmentToChangePassFragment(args.account,otpCode,args.curUser) @@ -70,12 +70,12 @@ class EnterOtpACFragment:Fragment(R.layout.fragment_enter_otp) { } private fun resetError(throwable: Throwable){ - Toast.makeText(requireContext(), "Wrong code try again", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.wrong_code_retry), Toast.LENGTH_SHORT).show() Timber.e(throwable) } private fun handleLoading() { - Toast.makeText(context, "Please wait", Toast.LENGTH_LONG).show() + Toast.makeText(context, getString(R.string.pls_wait), Toast.LENGTH_LONG).show() } } \ No newline at end of file diff --git a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ForgetAccountPassword.kt b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ForgetAccountPassword.kt index 048b4342..6f8d9b8e 100644 --- a/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ForgetAccountPassword.kt +++ b/app/src/main/java/com/zurichat/app/ui/fragments/switch_account/ForgetAccountPassword.kt @@ -40,10 +40,10 @@ class ForgetAccountPassword : Fragment(R.layout.fragment_forget_account_pass) { success(message) } is Result.Error -> { - Toast.makeText(requireContext(), "please try again", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.please_try_again), Toast.LENGTH_SHORT).show() } is Result.Loading ->{ - Toast.makeText(requireContext(), "please wait", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.pls_wait), Toast.LENGTH_SHORT).show() } } }) @@ -51,12 +51,12 @@ class ForgetAccountPassword : Fragment(R.layout.fragment_forget_account_pass) { private fun dialogue (){ MaterialAlertDialogBuilder(requireContext()) - .setTitle("Confirmation ") - .setMessage("Are you sure you want to reset the password for this account?") - .setNegativeButton("No"){dialog,which-> + .setTitle(getString(R.string.confirm)) + .setMessage(getString(R.string.sure_reset_password)) + .setNegativeButton(getString(R.string.no)){dialog,which-> } - .setPositiveButton("Yes"){dialog,which-> + .setPositiveButton(getString(R.string.yes)){dialog,which-> viewModel.passwordReset(PasswordResetBody(args.account.email)) } .show() diff --git a/app/src/main/java/com/zurichat/app/ui/login/LoginActivity.kt b/app/src/main/java/com/zurichat/app/ui/login/LoginActivity.kt index 6dc13ee8..9bd1927b 100644 --- a/app/src/main/java/com/zurichat/app/ui/login/LoginActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/login/LoginActivity.kt @@ -56,7 +56,7 @@ class LoginActivity : AppCompatActivity() { val isConnected: Boolean = activeNetwork?.isConnectedOrConnecting == true if(!isConnected){ - Toast.makeText(applicationContext,"No Internet Connection!",Toast.LENGTH_LONG).show() + Toast.makeText(applicationContext,getString(R.string.hello_blank_fragment),Toast.LENGTH_LONG).show() /*val ft = supportFragmentManager.beginTransaction() ft.replace(R.id.fragment_placeholder, InternetFragment()) ft.commit()*/ diff --git a/app/src/main/java/com/zurichat/app/ui/login/LoginViewModel.kt b/app/src/main/java/com/zurichat/app/ui/login/LoginViewModel.kt index 49d114a3..73e7bb92 100644 --- a/app/src/main/java/com/zurichat/app/ui/login/LoginViewModel.kt +++ b/app/src/main/java/com/zurichat/app/ui/login/LoginViewModel.kt @@ -1,6 +1,9 @@ package com.zurichat.app.ui.login -import androidx.lifecycle.* +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope import com.zurichat.app.data.repository.UserRepository import com.zurichat.app.models.* import com.zurichat.app.ui.login.password.confirm.ConfirmPasswordData @@ -9,10 +12,10 @@ import com.zurichat.app.ui.login.password.resetuserpass.ResetUserPasswordRespons import com.zurichat.app.util.Result import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineExceptionHandler +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject -import kotlinx.coroutines.Dispatchers @HiltViewModel class LoginViewModel @Inject constructor(private val repository: UserRepository) : ViewModel() { diff --git a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/NewChannelDataFragment.kt b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/NewChannelDataFragment.kt index 2a6bd842..3182c0e3 100644 --- a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/NewChannelDataFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/NewChannelDataFragment.kt @@ -259,7 +259,7 @@ class NewChannelDataFragment : Fragment(R.layout.fragment_new_channel_data) { bundle.putBoolean("Channel Joined", true) if (binding.channelName.text!!.isEmpty()) { - binding.channelName.error = "Channel name can't be empty." + binding.channelName.error = getString(R.string.channel_name_not_empty) } else { try { findNavController().navigate(R.id.channelChatFragment, diff --git a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectMemberFragment.kt b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectMemberFragment.kt index 5c350883..754a374b 100644 --- a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectMemberFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectMemberFragment.kt @@ -103,13 +103,14 @@ class SelectMemberFragment : Fragment(R.layout.fragment_select_member) { if (it.isEmpty()) { binding.topRecyclerView.visibility = View.GONE binding.fabAddChannel.visibility = View.GONE - binding.toolbar.subtitle = "Choose Channel Members" + binding.toolbar.subtitle = getString(R.string.choose_channel_members) } else { binding.topRecyclerView.visibility = View.VISIBLE binding.fabAddChannel.visibility = View.VISIBLE selectedMemberAdapter.selectedUserList = it selectedMemberAdapter.notifyDataSetChanged() - binding.toolbar.subtitle = "${selectedUsers.size} out of ${userList.size} selected" + binding.toolbar.subtitle = "${selectedUsers.size}" + getString(R.string.out_of) + "${userList.size}" + getString( + R.string.selected) binding.topRecyclerView.smoothScrollToPosition(selectedUsers.size - 1) } diff --git a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectNewChannelFragment.kt b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectNewChannelFragment.kt index 8549dbae..3628bfc1 100644 --- a/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectNewChannelFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/newchannel/fragment/SelectNewChannelFragment.kt @@ -66,7 +66,7 @@ class SelectNewChannelFragment : Fragment(R.layout.fragment_select_new_channel) progressDialog.dismiss() }catch (e:Exception){ - Toast.makeText(requireContext(), "an error occurred please try again later", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.err_occured_try_again), Toast.LENGTH_SHORT).show() progressDialog.dismiss() } @@ -213,7 +213,7 @@ class SelectNewChannelFragment : Fragment(R.layout.fragment_select_new_channel) viewModel._endPointResult.collect { endPointLoadingState = it if ( it is SelectNewChannelViewState.Error) { - Toast.makeText(requireContext(),"Error in Loading data from server", Toast.LENGTH_LONG).show() + Toast.makeText(requireContext(),getString(R.string.err_loading_data), Toast.LENGTH_LONG).show() } } } diff --git a/app/src/main/java/com/zurichat/app/ui/newchannel/newchannel_notification/NewChannelWorkerUtils.kt b/app/src/main/java/com/zurichat/app/ui/newchannel/newchannel_notification/NewChannelWorkerUtils.kt index 0725638f..10bf7f36 100644 --- a/app/src/main/java/com/zurichat/app/ui/newchannel/newchannel_notification/NewChannelWorkerUtils.kt +++ b/app/src/main/java/com/zurichat/app/ui/newchannel/newchannel_notification/NewChannelWorkerUtils.kt @@ -35,7 +35,7 @@ fun makeNotification(context: Context, message: String) { val notification = NotificationCompat.Builder(context, CHANNEL_ID) .setContentText(message) .setAutoCancel(true) - .setContentTitle("New channel") + .setContentTitle(context.getString(R.string.new_channel)) .setPriority(NotificationCompat.PRIORITY_HIGH) .setSmallIcon(R.drawable.notifications_icon) .setContentIntent(pendingIntent) diff --git a/app/src/main/java/com/zurichat/app/ui/organizations/AddByEmailFragment.kt b/app/src/main/java/com/zurichat/app/ui/organizations/AddByEmailFragment.kt index 00dfcbba..b9b0464c 100644 --- a/app/src/main/java/com/zurichat/app/ui/organizations/AddByEmailFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/organizations/AddByEmailFragment.kt @@ -48,7 +48,7 @@ class AddByEmailFragment : Fragment(R.layout.fragment_add_by_email) { val toolbar = binding.toolbarContainer.toolbar progressDialog = ProgressDialog(context) - toolbar.title = "Invite By Email" + toolbar.title = getString(R.string.invite_by_email) toolbar.subtitle = organizationName binding.toolbarContainer.toolbar.setLogo(drawable.ic_back) val logoView = toolbar.getChildAt(1) @@ -84,7 +84,7 @@ class AddByEmailFragment : Fragment(R.layout.fragment_add_by_email) { list.add(recipientEmail.email) } if (list.size == 0){ - binding.recipientEmailEdit.setError("You must at least add one email") + binding.recipientEmailEdit.setError(getString(R.string.add_one_email)) }else{ val sendInviteBody = SentInviteBody(list) val call = apiService.sendInvite(organizationId, sendInviteBody) @@ -96,7 +96,7 @@ class AddByEmailFragment : Fragment(R.layout.fragment_add_by_email) { response: Response ) { if (response.code() == 200) { - Toast.makeText(context, "Invitation sent successfully", Toast.LENGTH_SHORT) + Toast.makeText(context, getString(R.string.invite_sent_succesfully), Toast.LENGTH_SHORT) .show() val bundle = bundleOf( "organizationId" to organizationId, diff --git a/app/src/main/java/com/zurichat/app/ui/organizations/NextFragment.kt b/app/src/main/java/com/zurichat/app/ui/organizations/NextFragment.kt index 5ac498e8..6087ac4e 100644 --- a/app/src/main/java/com/zurichat/app/ui/organizations/NextFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/organizations/NextFragment.kt @@ -37,8 +37,8 @@ class NextFragment : Fragment(R.layout.fragment_add_to_organization) { if(prevDestLabel.equals("fragment_add_by_email")){ }else{ - generateMaterialDialog(requireActivity(),"Successful","You have successfully created" + - " $organizationName","Dismiss",null) + generateMaterialDialog(requireActivity(),getString(R.string.successful),getString(R.string.successfully_created) + + " $organizationName",getString(R.string.dismiss),null) } diff --git a/app/src/main/java/com/zurichat/app/ui/organizations/ShareLinkFragment.kt b/app/src/main/java/com/zurichat/app/ui/organizations/ShareLinkFragment.kt index 44362851..381cfa0d 100644 --- a/app/src/main/java/com/zurichat/app/ui/organizations/ShareLinkFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/organizations/ShareLinkFragment.kt @@ -59,7 +59,7 @@ class ShareLinkFragment : Fragment() { val clipboard = context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager val clip = ClipData.newPlainText("TextView", binding.linkGenerated.text.toString()) clipboard.setPrimaryClip(clip) - Toast.makeText(context, "link copied", Toast.LENGTH_SHORT).show() + Toast.makeText(context, getString(R.string.link_copied), Toast.LENGTH_SHORT).show() } // Set function to each item on the toolbar when they are been clicked binding.toolbarAddToSL.setNavigationOnClickListener { requireActivity().onBackPressed() } diff --git a/app/src/main/java/com/zurichat/app/ui/organizations/ui/SwitchOrganizationFragment.kt b/app/src/main/java/com/zurichat/app/ui/organizations/ui/SwitchOrganizationFragment.kt index 1275b535..33146df3 100644 --- a/app/src/main/java/com/zurichat/app/ui/organizations/ui/SwitchOrganizationFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/organizations/ui/SwitchOrganizationFragment.kt @@ -104,7 +104,7 @@ class SwitchOrganizationsFragment : Fragment(R.layout.fragment_switch_organizati if (it.orgData.isNotEmpty()) { firstTime = false setUpViews(it.orgData) - binding.toolbar4.subtitle = "${it.orgData.size} Organization(s)" + binding.toolbar4.subtitle = "${it.orgData.size} " + getString(R.string.orgz) } else { firstTime = true } @@ -184,7 +184,7 @@ class SwitchOrganizationsFragment : Fragment(R.layout.fragment_switch_organizati // progressLoader.hide() if (firstTime) { progressLoader.hide() - val errorMessage = "An Error Occurred" + val errorMessage = getString(R.string.an_error_occured) snackBar(errorMessage) } } @@ -211,7 +211,7 @@ class SwitchOrganizationsFragment : Fragment(R.layout.fragment_switch_organizati adapter = userOrgAdapter } } catch (e: NullPointerException) { - Toast.makeText(context, "User has no organization", Toast.LENGTH_LONG).show() + Toast.makeText(context, getString(R.string.user_no_org), Toast.LENGTH_LONG).show() } } @@ -256,7 +256,7 @@ class SwitchOrganizationsFragment : Fragment(R.layout.fragment_switch_organizati requireActivity().finish() } is Result.Error -> { - Toast.makeText(context, "Error", Toast.LENGTH_SHORT).show() + Toast.makeText(context, getString(R.string.error), Toast.LENGTH_SHORT).show() progressLoader.hide() } is Result.Loading -> { diff --git a/app/src/main/java/com/zurichat/app/ui/settings/ChatBackupActivity.kt b/app/src/main/java/com/zurichat/app/ui/settings/ChatBackupActivity.kt index 1fc16559..534f2e89 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/ChatBackupActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/ChatBackupActivity.kt @@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.AttributeSet import android.view.View +import com.zurichat.app.R import com.zurichat.app.databinding.ActivityChatBackupBinding import com.zurichat.app.ui.settings.dialogs.BackUpGoogleDialogFragment import com.zurichat.app.ui.settings.dialogs.BackUpOverDialogFragment @@ -40,12 +41,12 @@ class ChatBackupActivity : AppCompatActivity() { binding.btnBackupOver.setOnClickListener { val backupOverDialog = BackUpOverDialogFragment(this) - backupOverDialog.show(supportFragmentManager, "Back up Dialog") + backupOverDialog.show(supportFragmentManager, getString(R.string.backup_dialog)) } binding.btnBackupGoogle.setOnClickListener { val backupGoogleDialog = BackUpGoogleDialogFragment(this) - backupGoogleDialog.show(supportFragmentManager, "Back up Google") + backupGoogleDialog.show(supportFragmentManager, getString(R.string.backup_google)) } diff --git a/app/src/main/java/com/zurichat/app/ui/settings/LargerItemsActivity.kt b/app/src/main/java/com/zurichat/app/ui/settings/LargerItemsActivity.kt index 1244fd33..bf403cc6 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/LargerItemsActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/LargerItemsActivity.kt @@ -32,11 +32,11 @@ class LargerItemsActivity : AppCompatActivity() { return when (item.itemId) { R.id.action_save -> { - Toast.makeText(applicationContext, "click to save", Toast.LENGTH_SHORT).show() + Toast.makeText(applicationContext, getString(R.string.click_save), Toast.LENGTH_SHORT).show() true } R.id.action_delete -> { - Toast.makeText(applicationContext, "click to delete", Toast.LENGTH_SHORT).show() + Toast.makeText(applicationContext, getString(R.string.click_delete), Toast.LENGTH_SHORT).show() true } else -> diff --git a/app/src/main/java/com/zurichat/app/ui/settings/SettingsActivity.kt b/app/src/main/java/com/zurichat/app/ui/settings/SettingsActivity.kt index fec4b1fd..094abf8d 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/SettingsActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/SettingsActivity.kt @@ -71,7 +71,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere } supportActionBar?.setDisplayHomeAsUpEnabled(true) - user = intent.extras?.getParcelable("USER")!! + user = intent.extras?.getParcelable(getString(R.string.user))!! if (!(user.first_name.isEmpty() && user.last_name.isEmpty())){ nameTxt.text = user.first_name.plus(" "+user.last_name) }else if (user.first_name.isNotEmpty()){ @@ -140,15 +140,15 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.settings_preferences, rootKey) - user = requireActivity().intent.extras?.getParcelable("USER")!! + user = requireActivity().intent.extras?.getParcelable(getString(R.string.user))!! - val chatSettings = findPreference("chat_header") - val securitySettings = findPreference("security_header") - val storageSettings = findPreference("storage_header") - val notificationSettings = findPreference("notification_header") + val chatSettings = findPreference(getString(R.string.chat_header)) + val securitySettings = findPreference(getString(R.string.security_header)) + val storageSettings = findPreference(getString(R.string.storage_header)) + val notificationSettings = findPreference(getString(R.string.notification_header)) val languageSettings = findPreference(getString(R.string.languages)) - val logout = findPreference("logout_header") + val logout = findPreference(getString(R.string.logout_header)) val profileContainer = activity?.findViewById(R.id.profile_container) @@ -164,7 +164,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere //make profile container clickable profileContainer?.setOnClickListener { val bundle = Bundle() - bundle.putParcelable("USER",user) + bundle.putParcelable(getString(R.string.user),user) val intent = Intent(requireContext(), ProfileActivity::class.java) intent.putExtras(bundle) startActivity(intent) @@ -249,7 +249,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere //logout() val callback: Callback = { logoutUser() } val logoutDialog = LogOutDialogFragment(callback) - logoutDialog.show(childFragmentManager, "LOG_OUT") + logoutDialog.show(childFragmentManager, getString(R.string.logged_out)) true } } @@ -258,7 +258,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere userViewModel.logoutResponse.observe(viewLifecycleOwner, { when (it) { is Result.Success -> { - ZuriSharePreference(requireContext()).setString("Current Organization ID","") + ZuriSharePreference(requireContext()).setString(getString(R.string.current_org_id),"") //Toast.makeText(context, "You have been successfully logged out", Toast.LENGTH_SHORT).show() progressLoader.hide() updateUser() @@ -266,7 +266,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere startActivity(intent) } is Result.Error -> { - Toast.makeText(requireContext(), "Error", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), getString(R.string.error), Toast.LENGTH_SHORT).show() progressLoader.hide() } is Result.Loading -> { @@ -329,39 +329,39 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.notifications_and_sound, rootKey) - val channelTones = findPreference("channel_tones") - val messageTone = findPreference("message_tone") - val vibrate = findPreference("vibrate") - val highPriority = findPreference("high_priority") + val channelTones = findPreference(getString(R.string.channel_tones)) + val messageTone = findPreference(getString(R.string.message_tone)) + val vibrate = findPreference(getString(R.string.vibrate)) + val highPriority = findPreference(getString(R.string.high_priority)) channelTones?.setOnPreferenceChangeListener { preference, newValue -> if (channelTones.isChecked){ isChannelToneChecked = true - Toast.makeText(activity, "Channel tones off", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.Channel_tones_off), Toast.LENGTH_SHORT).show() }else{ isChannelToneChecked = false - Toast.makeText(activity, "Channel tones on", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.channel_tones_on), Toast.LENGTH_SHORT).show() } return@setOnPreferenceChangeListener true } messageTone?.setOnPreferenceChangeListener { preference, newValue -> if (messageTone.isChecked){ isMessageToneChecked = true - Toast.makeText(activity, "Message tones off", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.message_tones_off), Toast.LENGTH_SHORT).show() }else{ isMessageToneChecked = false - Toast.makeText(activity, "Message tones on", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.message_tones_on), Toast.LENGTH_SHORT).show() } return@setOnPreferenceChangeListener true } vibrate?.setOnPreferenceChangeListener { preference, newValue -> if (vibrate.isChecked){ isVibrateChecked = true - Toast.makeText(activity, "Vibrate off", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.vibrate_off), Toast.LENGTH_SHORT).show() }else{ isVibrateChecked = false - Toast.makeText(activity, "Vibrate on", Toast.LENGTH_SHORT).show() + Toast.makeText(activity, getString(R.string.vibrate_on), Toast.LENGTH_SHORT).show() vibrateDevice(requireContext()) } return@setOnPreferenceChangeListener true @@ -369,10 +369,10 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere highPriority?.setOnPreferenceChangeListener { preference, newValue -> if (highPriority.isChecked){ isHighPriorityChecked = true - Toast.makeText(activity, "High priority Notifications off", Toast.LENGTH_LONG).show() + Toast.makeText(activity, getString(R.string.high_priority_notification), Toast.LENGTH_LONG).show() }else{ isHighPriorityChecked = false - Toast.makeText(activity, "High priority Notifications on", Toast.LENGTH_LONG).show() + Toast.makeText(activity, getString(R.string.high_priority_notifications_on), Toast.LENGTH_LONG).show() } return@setOnPreferenceChangeListener true } diff --git a/app/src/main/java/com/zurichat/app/ui/settings/WallpaperActivity.kt b/app/src/main/java/com/zurichat/app/ui/settings/WallpaperActivity.kt index c842f11e..2164ed8d 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/WallpaperActivity.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/WallpaperActivity.kt @@ -73,14 +73,14 @@ class WallpaperActivity : AppCompatActivity(), // startActivity(Intent(activity, ManageWallpaperActivity::class.java)) // } - val change = findPreference("change_wallpaper") + val change = findPreference(getString(R.string.change_wallpaper)) change?.setOnPreferenceClickListener { startActivity(Intent(activity,ChooseWallpaperCategory::class.java)) true } //background dimming code - val barPref = findPreference("bar") + val barPref = findPreference(getString(R.string.bar)) barPref?.updatesContinuously = true PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this) @@ -89,7 +89,7 @@ class WallpaperActivity : AppCompatActivity(), override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { val dimmer:View? = view?.findViewById(R.id.dimmer_view) - if (key == "bar"){ + if (key == getString(R.string.bar)){ val barIncr = sharedPreferences?.getInt("bar",50)?.toFloat() val flt = barIncr?.div(100.0f) if (flt != null) { diff --git a/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpGoogleDialogFragment.kt b/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpGoogleDialogFragment.kt index 0775c136..a4fa064b 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpGoogleDialogFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpGoogleDialogFragment.kt @@ -14,7 +14,7 @@ class BackUpGoogleDialogFragment(val activity: Activity?) : DialogFragment() { return activity?.let { val builder = AlertDialog.Builder(it) - builder.setTitle("Back up to Google Drive") + builder.setTitle(getString(R.string.backup_google_drive)) .setMultiChoiceItems( R.array.back_up_google, null, diff --git a/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpOverDialogFragment.kt b/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpOverDialogFragment.kt index 3f6caa60..7b23878a 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpOverDialogFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/dialogs/BackUpOverDialogFragment.kt @@ -14,7 +14,7 @@ class BackUpOverDialogFragment(val activity: Activity?) : DialogFragment() { return activity?.let { val builder = AlertDialog.Builder(it) - builder.setTitle("Back up Over") + builder.setTitle(getString(R.string.back_up_over)) .setSingleChoiceItems( R.array.back_up_over, 0, diff --git a/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChatFragment.kt b/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChatFragment.kt index a02b3415..a7e1be60 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChatFragment.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChatFragment.kt @@ -45,7 +45,7 @@ class ChatFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.chat_preferences, rootKey) - findPreference("chat_backup")?.setOnPreferenceClickListener { + findPreference(getString(R.string.chat_backup))?.setOnPreferenceClickListener { val intent = Intent(requireActivity(), ChatBackupActivity::class.java) startActivity(intent) diff --git a/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChooseWallpaperCategory.kt b/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChooseWallpaperCategory.kt index 35c0cfb4..a8822057 100644 --- a/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChooseWallpaperCategory.kt +++ b/app/src/main/java/com/zurichat/app/ui/settings/fragments/ChooseWallpaperCategory.kt @@ -9,7 +9,7 @@ class ChooseWallpaperCategory: AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.fragment_choose_wallpaper_category) - title = "Choose Wallpaper Category" + title = getString(R.string.choose_category) supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true) diff --git a/app/src/main/java/com/zurichat/app/util/FragmentViewBindingDelegate.kt b/app/src/main/java/com/zurichat/app/util/FragmentViewBindingDelegate.kt index 703cd815..1d621f79 100644 --- a/app/src/main/java/com/zurichat/app/util/FragmentViewBindingDelegate.kt +++ b/app/src/main/java/com/zurichat/app/util/FragmentViewBindingDelegate.kt @@ -9,6 +9,7 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.Observer import androidx.viewbinding.ViewBinding +import com.zurichat.app.R import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty @@ -53,7 +54,7 @@ class FragmentViewBindingDelegate( val lifecycle = fragment.viewLifecycleOwner.lifecycle if (!lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) { - throw IllegalStateException("Should not attempt to get bindings when Fragment views are destroyed.") + throw IllegalStateException(fragment.getString(R.string.fragment_view_destroyed)) } return viewBindingFactory(thisRef.requireView()).also { this.binding = it } diff --git a/app/src/main/res/menu/home_menu.xml b/app/src/main/res/menu/home_menu.xml index 677b3057..6e9283fc 100644 --- a/app/src/main/res/menu/home_menu.xml +++ b/app/src/main/res/menu/home_menu.xml @@ -19,7 +19,7 @@ android:visible="true" />-->