Skip to content
Snippets Groups Projects
Commit db1e07ca authored by Adrien Béraud's avatar Adrien Béraud
Browse files

misc: various cleanup

Change-Id: If61036b8cf5128fa94dbed2f10008ccbb3208e83
parent 44da959d
No related branches found
No related tags found
No related merge requests found
......@@ -38,20 +38,9 @@ import cx.ring.client.HomeActivity
import cx.ring.databinding.FragAboutBinding
class AboutFragment : Fragment() {
private var binding: FragAboutBinding? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragAboutBinding.inflate(inflater, container, false)
return binding!!.root
}
override fun onDestroyView() {
super.onDestroyView()
binding = null
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
setHasOptionsMenu(true)
binding!!.apply {
return FragAboutBinding.inflate(inflater, container, false).apply {
release.text = getString(R.string.app_release, BuildConfig.VERSION_NAME)
logo.setOnClickListener { openWebsite(getString(R.string.app_website)) }
sflLogo.setOnClickListener { openWebsite(getString(R.string.savoirfairelinux_website)) }
......@@ -59,7 +48,7 @@ class AboutFragment : Fragment() {
licenseContainer.setOnClickListener { openWebsite(getString(R.string.gnu_license_website)) }
emailReportContainer.setOnClickListener { sendFeedbackEmail() }
credits.setOnClickListener { creditsClicked() }
}
}.root
}
override fun onResume() {
......
......@@ -63,11 +63,9 @@ class CallActivity : AppCompatActivity() {
setShowWhenLocked(true)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
} else {
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
)
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
setContentView(R.layout.activity_call_layout)
volumeControlStream = AudioManager.STREAM_VOICE_CALL
......
......@@ -103,9 +103,8 @@ class AccountMigrationFragment : Fragment() {
migratingAccount = true
//orientation is locked during the migration of account to avoid the destruction of the thread
val activity: Activity? = activity
if (activity != null) requireActivity().requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
mProgress = ProgressDialog(getActivity()).apply {
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
mProgress = ProgressDialog(requireContext()).apply {
setTitle(R.string.dialog_wait_update)
setMessage(getString(R.string.dialog_wait_update_details))
setCancelable(false)
......
......@@ -91,7 +91,6 @@ import net.jami.smartlist.ConversationItemViewModel
import java.io.File
import java.util.*
@AndroidEntryPoint
class ConversationFragment : BaseSupportFragment<ConversationPresenter, ConversationView>(),
MediaButtonsHelperCallback, ConversationView, OnSharedPreferenceChangeListener {
......@@ -934,27 +933,22 @@ class ConversationFragment : BaseSupportFragment<ConversationPresenter, Conversa
override fun goToCallActivity(conferenceId: String, withCamera: Boolean) {
startActivity(Intent(Intent.ACTION_VIEW)
.setClass(requireContext().applicationContext, CallActivity::class.java)
.setClass(requireContext(), CallActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(NotificationService.KEY_CALL_ID, conferenceId)
)
.putExtra(NotificationService.KEY_CALL_ID, conferenceId))
}
override fun goToCallActivityWithResult(accountId: String, conversationUri: net.jami.model.Uri, contactUri: net.jami.model.Uri, withCamera: Boolean) {
val intent = Intent(Intent.ACTION_CALL)
startActivity(Intent(Intent.ACTION_CALL)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setClass(requireContext(), CallActivity::class.java)
.putExtras(ConversationPath.toBundle(accountId, conversationUri))
.putExtra(Intent.EXTRA_PHONE_NUMBER, contactUri.uri)
.putExtra(CallFragment.KEY_HAS_VIDEO, withCamera)
startActivity(intent)
.putExtra(CallFragment.KEY_HAS_VIDEO, withCamera))
}
private fun setupActionbar(conversation: Conversation, contacts: List<ContactViewModel>) {
if (!isVisible) {
return
}
val activity: Activity = requireActivity()
val activity = activity ?: return
val displayName = ConversationItemViewModel.getTitle(conversation, contacts)
val identity = ConversationItemViewModel.getUriTitle(conversation.uri, contacts)
val toolbar: Toolbar = activity.findViewById(R.id.main_toolbar)
......
......@@ -91,7 +91,7 @@ class HardwareServiceImpl(
val pm = mContext.packageManager
var hasMicrophone = pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)
if (!hasMicrophone) {
val recorder = MediaRecorder()
val recorder = MediaRecorder(mContext)
val testFile = File(mContext.cacheDir, "MediaUtil#micAvailTestFile")
hasMicrophone = try {
recorder.setAudioSource(MediaRecorder.AudioSource.MIC)
......
......@@ -39,14 +39,13 @@ class PluginSettingsFragment : PreferenceFragmentCompat() {
screen.addPreference(preference)
}
preferenceScreen = screen
return root!!
return root
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.plugin_edition, menu)
val item = menu.findItem(R.id.menuitem_delete)
item.isVisible = false
super.onCreateOptionsMenu(menu, inflater)
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment