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
c097f168
Commit
c097f168
authored
Mar 10, 2018
by
aniket
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds basic code for creating new channel
parent
c1871a62
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
256 additions
and
22 deletions
+256
-22
build.gradle
app/build.gradle
+0
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+12
-8
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+18
-5
CreateNewChannelModule.kt
...ocket/android/create_channel/di/CreateNewChannelModule.kt
+22
-0
CreateNewChannelProvider.kt
...ket/android/create_channel/di/CreateNewChannelProvider.kt
+10
-0
CreateNewChannelPresenter.kt
.../create_channel/presentation/CreateNewChannelPresenter.kt
+7
-0
CreateNewChannelView.kt
...droid/create_channel/presentation/CreateNewChannelView.kt
+5
-0
CreateNewChannelActivity.kt
...ket/android/create_channel/ui/CreateNewChannelActivity.kt
+38
-0
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+0
-7
button_border.xml
app/src/main/res/drawable/button_border.xml
+13
-0
button_solid.xml
app/src/main/res/drawable/button_solid.xml
+8
-0
ic_add_24dp.xml
app/src/main/res/drawable/ic_add_24dp.xml
+1
-1
ic_fab_24dp.xml
app/src/main/res/drawable/ic_fab_24dp.xml
+9
-0
activity_create_new_channel.xml
app/src/main/res/layout/activity_create_new_channel.xml
+97
-0
fragment_chat_rooms.xml
app/src/main/res/layout/fragment_chat_rooms.xml
+10
-0
strings.xml
app/src/main/res/values/strings.xml
+6
-0
No files found.
app/build.gradle
View file @
c097f168
...
...
@@ -53,7 +53,6 @@ dependencies {
implementation
libraries
.
kotlin
implementation
libraries
.
coroutines
implementation
libraries
.
coroutinesAndroid
implementation
libraries
.
appCompat
implementation
libraries
.
recyclerview
implementation
libraries
.
design
...
...
app/src/main/AndroidManifest.xml
View file @
c097f168
...
...
@@ -37,23 +37,27 @@
<activity
android:name=
".main.ui.MainActivity"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
android:
theme=
"@style/AppTheme
"
/>
android:
theme=
"@style/AppTheme
"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
/>
<activity
android:name=
".webview.WebViewActivity"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
android:
theme=
"@style/AppTheme
"
/>
android:
theme=
"@style/AppTheme
"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
/>
<activity
android:name=
".chatroom.ui.ChatRoomActivity"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
android:theme=
"@style/AppTheme"
/>
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
<activity
android:name=
".create_channel.ui.CreateNewChannelActivity"
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
<activity
android:name=
".chatroom.ui.PinnedMessagesActivity"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
android:
theme=
"@style/AppTheme
"
/>
android:
theme=
"@style/AppTheme
"
android:
windowSoftInputMode=
"adjustResize|stateAlwaysHidden
"
/>
<activity
android:name=
".settings.password.ui.PasswordActivity"
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
c097f168
package
chat.rocket.android.chatrooms.ui
import
android.content.Intent
import
android.os.Bundle
import
android.os.Handler
import
android.support.v4.app.Fragment
...
...
@@ -12,6 +13,7 @@ import android.view.*
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
import
chat.rocket.android.create_channel.ui.CreateNewChannelActivity
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.util.extensions.*
...
...
@@ -28,9 +30,12 @@ import kotlinx.coroutines.experimental.launch
import
javax.inject.Inject
class
ChatRoomsFragment
:
Fragment
(),
ChatRoomsView
{
@Inject
lateinit
var
presenter
:
ChatRoomsPresenter
@Inject
lateinit
var
serverInteractor
:
GetCurrentServerInteractor
@Inject
lateinit
var
settingsRepository
:
SettingsRepository
@Inject
lateinit
var
presenter
:
ChatRoomsPresenter
@Inject
lateinit
var
serverInteractor
:
GetCurrentServerInteractor
@Inject
lateinit
var
settingsRepository
:
SettingsRepository
private
var
searchView
:
SearchView
?
=
null
private
val
handler
=
Handler
()
...
...
@@ -59,6 +64,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
setupToolbar
()
setupRecyclerView
()
setUpFAB
()
presenter
.
loadChatRooms
()
}
...
...
@@ -156,6 +162,13 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
}
}
private
fun
setUpFAB
()
{
create_new_channel_fab
.
setOnClickListener
{
val
intent
=
Intent
(
activity
,
CreateNewChannelActivity
::
class
.
java
)
startActivity
(
intent
)
}
}
private
fun
queryChatRoomsByName
(
name
:
String
?):
Boolean
{
presenter
.
chatRoomsByName
(
name
?:
""
)
return
true
...
...
app/src/main/java/chat/rocket/android/create_channel/di/CreateNewChannelModule.kt
0 → 100644
View file @
c097f168
package
chat.rocket.android.create_channel.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.create_channel.ui.CreateNewChannelActivity
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
class
CreateNewChannelModule
{
@Provides
fun
provideLifecycleOwner
(
activity
:
CreateNewChannelActivity
):
LifecycleOwner
{
return
activity
}
@Provides
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
{
return
CancelStrategy
(
owner
,
jobs
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/create_channel/di/CreateNewChannelProvider.kt
0 → 100644
View file @
c097f168
package
chat.rocket.android.create_channel.di
import
chat.rocket.android.create_channel.ui.CreateNewChannelActivity
import
dagger.android.ContributesAndroidInjector
abstract
class
CreateNewChannelProvider
{
@ContributesAndroidInjector
(
modules
=
[
CreateNewChannelModule
::
class
])
abstract
fun
provideNewChannelActivity
():
CreateNewChannelActivity
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/create_channel/presentation/CreateNewChannelPresenter.kt
0 → 100644
View file @
c097f168
package
chat.rocket.android.create_channel.presentation
/**
* Created by aniket on 9/3/18.
*/
class
CreateNewChannelPresenter
{
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/create_channel/presentation/CreateNewChannelView.kt
0 → 100644
View file @
c097f168
package
chat.rocket.android.create_channel.presentation
interface
CreateNewChannelView
{
//TODO add functions to be implemented
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/create_channel/ui/CreateNewChannelActivity.kt
0 → 100644
View file @
c097f168
package
chat.rocket.android.create_channel.ui
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.create_channel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.create_channel.presentation.CreateNewChannelView
import
dagger.android.AndroidInjection
import
javax.inject.Inject
class
CreateNewChannelActivity
:
AppCompatActivity
(),
CreateNewChannelView
{
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
when
(
item
?.
itemId
)
{
R
.
id
.
home
->
{
finish
()
return
true
}
}
return
super
.
onOptionsItemSelected
(
item
)
}
@Inject
var
presenter
:
CreateNewChannelPresenter
=
CreateNewChannelPresenter
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_create_new_channel
)
setUpToolBar
()
}
private
fun
setUpToolBar
()
{
supportActionBar
?.
title
=
getString
(
R
.
string
.
title_create_new_channel
)
supportActionBar
?.
setDisplayHomeAsUpEnabled
(
true
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
c097f168
...
...
@@ -7,16 +7,10 @@ import android.support.v7.app.AppCompatActivity
import
android.view.Gravity
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import
chat.rocket.android.profile.ui.ProfileFragment
import
chat.rocket.android.settings.ui.SettingsFragment
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.main.presentation.MainView
import
chat.rocket.android.util.extensions.showToast
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
...
...
@@ -34,7 +28,6 @@ class MainActivity : AppCompatActivity(), MainView, HasSupportFragmentInjector {
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_main
)
presenter
.
connect
()
setupToolbar
()
setupNavigationView
()
...
...
app/src/main/res/drawable/button_border.xml
0 → 100644
View file @
c097f168
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<gradient
android:endColor=
"#0000"
android:startColor=
"#0000"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/red"
/>
<corners
android:bottomRightRadius=
"5dp"
android:topRightRadius=
"5dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/button_solid.xml
0 → 100644
View file @
c097f168
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/red"
/>
<corners
android:bottomLeftRadius=
"5dp"
android:topLeftRadius=
"5dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/ic_add_24dp.xml
View file @
c097f168
...
...
@@ -5,7 +5,7 @@
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"
#FF2F343D
"
android:fillColor=
"
@color/colorLightTheme
"
android:pathData=
"M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
/>
</vector>
\ No newline at end of file
app/src/main/res/drawable/ic_fab_24dp.xml
0 → 100644
View file @
c097f168
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
/>
</vector>
app/src/main/res/layout/activity_create_new_channel.xml
0 → 100644
View file @
c097f168
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:padding=
"8dp"
>
<android.support.constraint.Guideline
android:id=
"@+id/button_top_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.03"
/>
<android.support.constraint.Guideline
android:id=
"@+id/button_bottom_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.09"
/>
<Button
android:id=
"@+id/public_channel"
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:background=
"@drawable/button_solid"
android:text=
"@string/public_channel_type"
android:textColor=
"@color/white"
app:layout_constraintBottom_toBottomOf=
"@id/button_bottom_guideline"
app:layout_constraintEnd_toStartOf=
"@+id/private_channel"
app:layout_constraintHorizontal_chainStyle=
"packed"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/button_top_guideline"
/>
<Button
android:id=
"@+id/private_channel"
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:background=
"@drawable/button_border"
android:text=
"@string/private_channel_type"
android:textColor=
"@color/red"
app:layout_constraintBottom_toBottomOf=
"@id/button_bottom_guideline"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/public_channel"
app:layout_constraintTop_toTopOf=
"@id/button_top_guideline"
/>
<TextView
android:id=
"@+id/channel_type"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/private_channel_type"
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/public_channel"
/>
<TextView
android:id=
"@+id/channel_description"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/private_channel_type_description"
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/channel_type"
/>
<View
android:id=
"@+id/separator"
android:layout_width=
"0dp"
android:layout_height=
"0.1dp"
android:layout_marginTop=
"4dp"
android:background=
"@color/colorDividerMessageComposer"
app:layout_constraintTop_toBottomOf=
"@id/channel_description"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:layout_marginTop=
"6dp"
android:src=
"@drawable/ic_hashtag_black"
app:layout_constraintBottom_toBottomOf=
"@id/channel_name_text_input_layout"
app:layout_constraintTop_toTopOf=
"@id/channel_name_text_input_layout"
/>
<android.support.design.widget.TextInputLayout
android:id=
"@+id/channel_name_text_input_layout"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"6dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/separator"
android:focusable=
"true"
android:hint=
"@string/new_channel_edit_text_hint"
>
<android.support.design.widget.TextInputEditText
android:id=
"@+id/channel_name_edit_text"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</android.support.design.widget.TextInputLayout>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_chat_rooms.xml
View file @
c097f168
...
...
@@ -44,4 +44,14 @@
tools:visibility=
"visible"
tools:text=
"connected"
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/create_new_channel_fab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:src=
"@drawable/ic_add_24dp"
android:backgroundTint=
"@color/black"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
c097f168
...
...
@@ -12,6 +12,7 @@
<string
name=
"title_settings"
>
Settings
</string>
<string
name=
"title_password"
>
Change Password
</string>
<string
name=
"title_update_profile"
>
Update profile
</string>
<string
name=
"title_create_new_channel"
>
Create New Channel
</string>
<!-- Actions -->
<string
name=
"action_connect"
>
Connect
</string>
...
...
@@ -66,6 +67,11 @@
<string
name=
"msg_utc_offset"
>
UTC offset
</string>
<string
name=
"msg_new_password"
>
Enter New Password
</string>
<string
name=
"msg_confirm_password"
>
Confirm New Password
</string>
<string
name=
"private_channel_type"
>
Private
</string>
<string
name=
"public_channel_type"
>
Public
</string>
<string
name=
"private_channel_type_description"
></string>
<string
name=
"public_channel_description"
></string>
<string
name=
"new_channel_edit_text_hint"
>
Channel Name
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
Room name changed to: %1$s by %2$s
</string>
...
...
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