-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Clicking on room name redirect to connected device fragment #2288
fix: Clicking on room name redirect to connected device fragment #2288
Conversation
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of d05a46c. Here's the output:
|
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 361d40a. Here's the output:
|
@iamareebjamal please review it. It is an important bug that needs to be fixed. |
@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme | |||
val roomNameClicked = availableRoomsList[adapterPosition].room | |||
var intent = Intent(context, DeviceActivity::class.java) | |||
intent.putExtra("roomName", roomNameClicked) | |||
intent.putExtra("connectTo", "DeviceConnectFragment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DeviceActivity is the base activity for 2 major features. The intent parameter is passed to tell the activity which fragment it should load.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -15,6 +15,9 @@ object Constant { | |||
const val MIC_INPUT = "mic_input" | |||
|
|||
const val ACCESS_TOKEN = "access_token" | |||
const val CONNECT_TO = "connectTo" | |||
const val DEVICE_CONNECT_FRAGMENT = "device_connect_fragment" | |||
const val CONNECTED_DEVICE_FRAGMENT = "connected_device_fragment" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the activity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean to rename the variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, move them
@@ -48,6 +48,8 @@ class ChatSettingsFragment : PreferenceFragmentCompat(), ISettingsView { | |||
private val TAG_ABOUT_FRAGMENT = "AboutUsFragment" | |||
private val TAG_HELP_FRAGMENT = "HelpFragment" | |||
private val TAG_PRIVACY_FRAGMENT = "PrivacyFragment" | |||
private val TAG_CONNECTED_DEVICE_FRAGMENT = "ConnectedDeviceFragment" | |||
private val TAG_DEVICE_CONNECT_FRAGMENT = "DeviceConnectFragment" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you duplicate the variable, the entire point of making it a constant is lost
@iamareebjamal please review it. |
@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme | |||
val roomNameClicked = availableRoomsList[adapterPosition].room | |||
var intent = Intent(context, DeviceActivity::class.java) | |||
intent.putExtra("roomName", roomNameClicked) | |||
intent.putExtra(DeviceActivity().CONNECT_TO, DeviceActivity().TAG_DEVICE_CONNECT_FRAGMENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow
@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme | |||
val roomNameClicked = availableRoomsList[adapterPosition].room | |||
var intent = Intent(context, DeviceActivity::class.java) | |||
intent.putExtra("roomName", roomNameClicked) | |||
intent.putExtra(DeviceActivity().CONNECT_TO, DeviceActivity().TAG_DEVICE_CONNECT_FRAGMENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to instantiate activity. Heard of static final variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can do so via using the companion object in kotlin.
Fixes #2286
Changes:
Screenshots for the change:
![ezgif com-video-to-gif](https://user-images.githubusercontent.com/43731599/60384331-ec800f00-9a99-11e9-8f9f-4b3aff6cb376.gif)
Apk:
app-fdroid-debug.apk.zip