Commit 8c8aa192 authored by aniket's avatar aniket

adds layout for creating new channel

parent c097f168
......@@ -50,9 +50,9 @@
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name=".create_channel.ui.CreateNewChannelActivity"
android:name=".createChannel.ui.CreateNewChannelActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".chatroom.ui.PinnedMessagesActivity"
......
......@@ -13,7 +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.createChannel.ui.CreateNewChannelActivity
import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.domain.SettingsRepository
import chat.rocket.android.util.extensions.*
......
package chat.rocket.android.create_channel.di
package chat.rocket.android.createChannel.di
import android.arch.lifecycle.LifecycleOwner
import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.create_channel.ui.CreateNewChannelActivity
import chat.rocket.android.createChannel.ui.CreateNewChannelActivity
import dagger.Module
import dagger.Provides
import kotlinx.coroutines.experimental.Job
......@@ -19,4 +19,7 @@ class CreateNewChannelModule {
return CancelStrategy(owner, jobs)
}
}
\ No newline at end of file
package chat.rocket.android.create_channel.di
package chat.rocket.android.createChannel.di
import chat.rocket.android.create_channel.ui.CreateNewChannelActivity
import chat.rocket.android.createChannel.ui.CreateNewChannelActivity
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module
abstract class CreateNewChannelProvider {
@ContributesAndroidInjector(modules = [CreateNewChannelModule::class])
abstract fun provideNewChannelActivity(): CreateNewChannelActivity
......
package chat.rocket.android.createChannel.presentation
import javax.inject.Inject
class CreateNewChannelPresenter @Inject constructor() {
}
\ No newline at end of file
package chat.rocket.android.create_channel.presentation
package chat.rocket.android.createChannel.presentation
interface CreateNewChannelView {
//TODO add functions to be implemented
......
package chat.rocket.android.createChannel.ui
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
import chat.rocket.android.R
import chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import chat.rocket.android.createChannel.presentation.CreateNewChannelView
import com.jakewharton.rxbinding2.widget.RxTextView
import dagger.android.AndroidInjection
import kotlinx.android.synthetic.main.activity_create_new_channel.*
import javax.inject.Inject
class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
@Inject
lateinit var presenter: CreateNewChannelPresenter
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item?.itemId) {
R.id.home -> {
finish()
return true
}
}
return super.onOptionsItemSelected(item)
}
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_create_new_channel)
setUpToolBar()
setUpOnClickListeners()
}
private fun setUpToolBar() {
setSupportActionBar(toolbar)
supportActionBar?.title = getString(R.string.title_create_new_channel)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
RxTextView.textChanges(channel_name_edit_text).subscribe { text ->
create_channel_action_text.isEnabled = text != ""
if (text != "")
create_channel_action_text.alpha = 1.0f
else
create_channel_action_text.alpha = 0.5f
}
}
private fun setUpOnClickListeners(){
public_channel.setOnClickListener{
channel_type.text = getString(R.string.public_channel_type)
channel_description.text = getString(R.string.private_channel_type_description)
placeholder.setImageDrawable(getDrawable(R.drawable.ic_hashtag_black))
(getDrawable(R.drawable.button_border) as GradientDrawable).setColor(resources.getColor(R.color.colorLightTheme))
(getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.red))
private_channel.background = getDrawable(R.drawable.button_border)
public_channel.background = getDrawable(R.drawable.button_solid)
private_channel.setTextColor(resources.getColor(R.color.red))
public_channel.setTextColor(resources.getColor(R.color.colorLightTheme))
}
private_channel.setOnClickListener{
channel_type.text = getString(R.string.private_channel_type)
channel_description.text = getString(R.string.public_channel_description)
placeholder.setImageDrawable(getDrawable(R.drawable.ic_room_lock))
(getDrawable(R.drawable.button_border) as GradientDrawable).setColor(resources.getColor(R.color.red))
(getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.colorLightTheme))
private_channel.background = getDrawable(R.drawable.button_border)
public_channel.background = getDrawable(R.drawable.button_solid)
private_channel.setTextColor(resources.getColor(R.color.colorLightTheme))
public_channel.setTextColor(resources.getColor(R.color.red))
}
}
}
\ No newline at end of file
package chat.rocket.android.create_channel.presentation
/**
* Created by aniket on 9/3/18.
*/
class CreateNewChannelPresenter {
}
\ No newline at end of file
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
......@@ -12,6 +12,8 @@ import chat.rocket.android.chatroom.ui.ChatRoomActivity
import chat.rocket.android.chatroom.ui.PinnedMessagesActivity
import chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import chat.rocket.android.chatrooms.di.ChatRoomsModule
import chat.rocket.android.createChannel.di.CreateNewChannelProvider
import chat.rocket.android.createChannel.ui.CreateNewChannelActivity
import chat.rocket.android.dagger.scope.PerActivity
import chat.rocket.android.main.di.MainActivityProvider
import chat.rocket.android.main.di.MainModule
......@@ -55,4 +57,9 @@ abstract class ActivityBuilder {
@PerActivity
@ContributesAndroidInjector(modules = [PasswordFragmentProvider::class])
abstract fun bindPasswordActivity(): PasswordActivity
@PerActivity
@ContributesAndroidInjector(modules = [CreateNewChannelProvider::class])
abstract fun bindCreateNewChannelActivity(): CreateNewChannelActivity
}
\ No newline at end of file
......@@ -52,6 +52,6 @@
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:src="@drawable/ic_add_24dp"
android:backgroundTint="@color/black"
app:backgroundTint="@color/black"
/>
</RelativeLayout>
\ No newline at end of file
......@@ -72,6 +72,7 @@
<string name="private_channel_type_description"></string>
<string name="public_channel_description"></string>
<string name="new_channel_edit_text_hint">Channel Name</string>
<string name="create_new_channel_action">CREATE</string>
<!-- System messages -->
<string name="message_room_name_changed">Room name changed to: %1$s by %2$s</string>
......
......@@ -11,6 +11,10 @@
<item name="windowActionModeOverlay">true</item>
</style>
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/colorPrimary</item>
</style>
<style name="AuthenticationTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:windowBackground">@color/colorPrimary</item>
......
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