Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
a0869f09
Commit
a0869f09
authored
Feb 08, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extensions to show Toast
parent
50fa7847
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
27 deletions
+30
-27
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+3
-2
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+2
-4
SignupFragment.kt
...rocket/android/authentication/signup/ui/SignupFragment.kt
+3
-4
TwoFAFragment.kt
...cket/android/authentication/twofactor/ui/TwoFAFragment.kt
+1
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-3
PinnedMessagesFragment.kt
...chat/rocket/android/chatroom/ui/PinnedMessagesFragment.kt
+3
-4
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+3
-2
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+3
-6
ActivityExtensions.kt
.../main/java/chat/rocket/android/util/ActivityExtensions.kt
+9
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
a0869f09
...
...
@@ -21,6 +21,7 @@ import chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.showToast
import
chat.rocket.android.util.textContent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_log_in.*
...
...
@@ -170,9 +171,9 @@ class LoginFragment : Fragment(), LoginView {
enableUserInput
(
true
)
}
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
(
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
a0869f09
package
chat.rocket.android.authentication.server.ui
import
android.os.Bundle
import
android.support.annotation.StringRes
import
android.support.v4.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.authentication.server.presentation.ServerPresenter
import
chat.rocket.android.authentication.server.presentation.ServerView
...
...
@@ -57,9 +55,9 @@ class ServerFragment : Fragment(), ServerView {
enableUserInput
(
true
)
}
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
(
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/authentication/signup/ui/SignupFragment.kt
View file @
a0869f09
...
...
@@ -15,6 +15,7 @@ import chat.rocket.android.helper.AnimationHelper
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.showToast
import
chat.rocket.android.util.textContent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_sign_up.*
...
...
@@ -100,11 +101,9 @@ class SignupFragment : Fragment(), SignupView {
enableUserInput
(
true
)
}
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
{
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
{
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/ui/TwoFAFragment.kt
View file @
a0869f09
...
...
@@ -83,7 +83,7 @@ class TwoFAFragment : Fragment(), TwoFAView {
enableUserInput
(
true
)
}
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
a0869f09
...
...
@@ -10,7 +10,6 @@ import android.support.v7.widget.DefaultItemAnimator
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.view.*
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import
chat.rocket.android.chatroom.presentation.ChatRoomView
...
...
@@ -19,6 +18,7 @@ import chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.showToast
import
chat.rocket.android.util.textContent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_chat_room.*
...
...
@@ -168,9 +168,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
override
fun
hideLoading
()
=
view_loading
.
setVisible
(
false
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
(
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/PinnedMessagesFragment.kt
View file @
a0869f09
...
...
@@ -15,6 +15,7 @@ import chat.rocket.android.chatroom.presentation.PinnedMessagesView
import
chat.rocket.android.chatroom.viewmodel.MessageViewModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.showToast
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_pinned_messages.*
import
javax.inject.Inject
...
...
@@ -65,11 +66,9 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
override
fun
hideLoading
()
=
view_loading
.
setVisible
(
false
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
{
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
a0869f09
...
...
@@ -16,6 +16,7 @@ import chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.showToast
import
chat.rocket.android.widget.DividerItemDecoration
import
chat.rocket.core.model.ChatRoom
import
dagger.android.support.AndroidSupportInjection
...
...
@@ -99,9 +100,9 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
override
fun
hideLoading
()
=
view_loading
.
setVisible
(
false
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
(
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
a0869f09
...
...
@@ -11,10 +11,7 @@ import chat.rocket.android.R
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.profile.presentation.ProfilePresenter
import
chat.rocket.android.profile.presentation.ProfileView
import
chat.rocket.android.util.getObservable
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.textContent
import
chat.rocket.android.util.*
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.rxkotlin.Observables
import
kotlinx.android.synthetic.main.app_bar.*
...
...
@@ -79,9 +76,9 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
enableUserInput
(
true
)
}
override
fun
showMessage
(
resId
:
Int
)
=
show
Message
(
getString
(
resId
)
)
override
fun
showMessage
(
resId
:
Int
)
=
show
Toast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
(
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
...
...
app/src/main/java/chat/rocket/android/util/ActivityExtensions.kt
View file @
a0869f09
...
...
@@ -2,9 +2,11 @@ package chat.rocket.android.util
import
android.app.Activity
import
android.content.Context
import
android.support.annotation.StringRes
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.view.inputmethod.InputMethodManager
import
android.widget.Toast
import
chat.rocket.android.R
fun
AppCompatActivity
.
addFragment
(
tag
:
String
,
layoutId
:
Int
,
newInstance
:
()
->
Fragment
)
{
...
...
@@ -26,4 +28,10 @@ fun AppCompatActivity.addFragmentBackStack(tag: String, layoutId: Int, newInstan
fun
Activity
.
hideKeyboard
()
{
val
imm
=
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
currentFocus
.
windowToken
,
InputMethodManager
.
RESULT_UNCHANGED_SHOWN
)
}
\ No newline at end of file
}
fun
Activity
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
showToast
(
getString
(
resource
),
duration
)
fun
Activity
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
Toast
.
makeText
(
this
,
message
,
duration
).
show
()
fun
Fragment
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
showToast
(
getString
(
resource
),
duration
)
fun
Fragment
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
activity
!!
.
showToast
(
message
,
duration
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment