Commit fe569254 authored by Isira Seneviratne's avatar Isira Seneviratne

Use String.toUri() extension function.

parent 4c4c39bd
......@@ -23,7 +23,6 @@ import android.app.Service
import android.content.*
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.net.Uri
import android.os.Bundle
import android.os.IBinder
import android.os.RemoteException
......@@ -35,6 +34,7 @@ import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.fragment.app.replace
import androidx.lifecycle.lifecycleScope
......@@ -261,8 +261,8 @@ class BOINCActivity : AppCompatActivity() {
ft.replace<ProjectsFragment>(R.id.frame_container)
fragmentChanges = true
}
R.string.menu_help -> startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://boinc.berkeley.edu/wiki/BOINC_Help")))
R.string.menu_report_issue -> startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://boinc.berkeley.edu/trac/wiki/ReportBugs")))
R.string.menu_help -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/wiki/BOINC_Help".toUri()))
R.string.menu_report_issue -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/trac/wiki/ReportBugs".toUri()))
R.string.menu_about -> {
val dialog = Dialog(this).apply {
requestWindowFeature(Window.FEATURE_NO_TITLE)
......
......@@ -26,7 +26,6 @@ import android.content.Intent
import android.content.IntentFilter
import android.graphics.Bitmap
import android.graphics.Point
import android.net.Uri
import android.os.Bundle
import android.os.RemoteException
import android.text.SpannableString
......@@ -35,6 +34,7 @@ import android.util.Log
import android.view.*
import android.widget.Button
import android.widget.TextView
import androidx.core.net.toUri
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import edu.berkeley.boinc.databinding.ProjectDetailsLayoutBinding
......@@ -251,7 +251,7 @@ class ProjectDetailsFragment : Fragment() {
content.setSpan(UnderlineSpan(), 0, content.length, 0)
binding.projectUrl.text = content
binding.projectUrl.setOnClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(project!!.masterURL)))
startActivity(Intent(Intent.ACTION_VIEW, project!!.masterURL.toUri()))
}
// set general area
......
......@@ -23,11 +23,11 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.Uri
import android.os.Bundle
import android.os.RemoteException
import android.util.Log
import android.view.*
import androidx.core.net.toUri
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import edu.berkeley.boinc.adapter.ProjectControlsListAdapter
......@@ -393,7 +393,7 @@ class ProjectsFragment : Fragment() {
dialog.show()
} else if (operation == VISIT_WEBSITE) { // command does not require confirmation and is not RPC based
dialogControls!!.dismiss()
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(data.id)))
startActivity(Intent(Intent.ACTION_VIEW, data.id!!.toUri()))
} else { // command does not require confirmation, but is RPC based
lifecycleScope.launch {
performProjectOperationAsync(data, operation)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment