Commit f199fcc2 authored by aniket's avatar aniket

minor fixes

parent 8c8aa192
...@@ -16,10 +16,11 @@ import javax.inject.Inject ...@@ -16,10 +16,11 @@ import javax.inject.Inject
class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView { class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
@Inject @Inject
lateinit var presenter: CreateNewChannelPresenter lateinit var presenter: CreateNewChannelPresenter
private var channelType: String = "public"
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item?.itemId) { when (item?.itemId) {
R.id.home -> { android.R.id.home -> {
finish() finish()
return true return true
} }
...@@ -38,38 +39,50 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView { ...@@ -38,38 +39,50 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
private fun setUpToolBar() { private fun setUpToolBar() {
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar?.title = getString(R.string.title_create_new_channel)
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
RxTextView.textChanges(channel_name_edit_text).subscribe { text -> RxTextView.textChanges(channel_name_edit_text).subscribe { text ->
create_channel_action_text.isEnabled = text != "" create_channel_action_text.isEnabled = text.isNotEmpty()
if (text != "") if (text.isEmpty())
create_channel_action_text.alpha = 1.0f create_channel_action_text.alpha = 0.8f
else else
create_channel_action_text.alpha = 0.5f create_channel_action_text.alpha = 1.0f
} }
} }
private fun setUpOnClickListeners(){ private fun setUpOnClickListeners() {
public_channel.setOnClickListener{ public_channel.setOnClickListener {
channelType = "public"
channel_type.text = getString(R.string.public_channel_type) channel_type.text = getString(R.string.public_channel_type)
channel_description.text = getString(R.string.private_channel_type_description) channel_description.text = getString(R.string.private_channel_type_description)
placeholder.setImageDrawable(getDrawable(R.drawable.ic_hashtag_black)) 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_border) as GradientDrawable).setColor(resources.getColor(R.color.colorLightTheme))
(getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.red)) (getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.red))
private_channel.background = getDrawable(R.drawable.button_border) private_channel.background = getDrawable(R.drawable.button_border)
public_channel.background = getDrawable(R.drawable.button_solid) public_channel.background = getDrawable(R.drawable.button_solid)
private_channel.setTextColor(resources.getColor(R.color.red)) private_channel.setTextColor(resources.getColor(R.color.red))
public_channel.setTextColor(resources.getColor(R.color.colorLightTheme)) public_channel.setTextColor(resources.getColor(R.color.colorLightTheme))
} }
private_channel.setOnClickListener{ private_channel.setOnClickListener {
channelType = "private"
channel_type.text = getString(R.string.private_channel_type) channel_type.text = getString(R.string.private_channel_type)
channel_description.text = getString(R.string.public_channel_description) channel_description.text = getString(R.string.public_channel_description)
placeholder.setImageDrawable(getDrawable(R.drawable.ic_room_lock)) 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_border) as GradientDrawable).setColor(resources.getColor(R.color.red))
(getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.colorLightTheme)) (getDrawable(R.drawable.button_solid) as GradientDrawable).setColor(resources.getColor(R.color.colorLightTheme))
(getDrawable(R.drawable.button_solid) as GradientDrawable).setStroke(1, resources.getColor(R.color.red))
private_channel.background = getDrawable(R.drawable.button_border) private_channel.background = getDrawable(R.drawable.button_border)
public_channel.background = getDrawable(R.drawable.button_solid) public_channel.background = getDrawable(R.drawable.button_solid)
private_channel.setTextColor(resources.getColor(R.color.colorLightTheme)) private_channel.setTextColor(resources.getColor(R.color.colorLightTheme))
public_channel.setTextColor(resources.getColor(R.color.red)) public_channel.setTextColor(resources.getColor(R.color.red))
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:endColor="#0000" android:endColor="@color/colorLightTheme"
android:startColor="#0000" /> android:startColor="@color/colorLightTheme" />
<stroke <stroke
android:width="1dp" android:width="1dp"
android:color="@color/red" /> android:color="@color/red" />
......
...@@ -6,40 +6,31 @@ ...@@ -6,40 +6,31 @@
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="56dp"
android:theme="@style/ToolbarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="@dimen/toolbar_height"
android:layout_marginEnd="16dp" android:background="@color/colorPrimary"
android:layout_marginStart="16dp" app:layout_scrollFlags="scroll|enterAlways"
android:gravity="center" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:orientation="horizontal"> app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/title_create_new_channel" android:text="@string/title_create_new_channel"
android:textColor="@color/colorLightTheme" android:textColor="@color/colorLightTheme"
android:textSize="20sp" android:textSize="20sp" />
/>
<TextView <TextView
android:id="@+id/create_channel_action_text" android:id="@+id/create_channel_action_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0.5" android:layout_marginEnd="16dp"
android:textColor="@color/colorLightTheme" android:alpha="0.7"
android:background="?selectableItemBackground"
android:enabled="false" android:enabled="false"
android:gravity="end" android:gravity="end"
android:text="@string/create_new_channel_action" android:text="@string/create_new_channel_action"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout>
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout
...@@ -94,6 +85,7 @@ ...@@ -94,6 +85,7 @@
android:id="@+id/channel_type" android:id="@+id/channel_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/private_channel_type" android:text="@string/private_channel_type"
android:textColor="@color/black" android:textColor="@color/black"
app:layout_constraintTop_toBottomOf="@id/public_channel" /> app:layout_constraintTop_toBottomOf="@id/public_channel" />
...@@ -109,8 +101,8 @@ ...@@ -109,8 +101,8 @@
<View <View
android:id="@+id/separator" android:id="@+id/separator"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0.1dp" android:layout_height="0.2dp"
android:layout_marginTop="4dp" android:layout_marginTop="8dp"
android:background="@color/colorDividerMessageComposer" android:background="@color/colorDividerMessageComposer"
app:layout_constraintTop_toBottomOf="@id/channel_description" /> app:layout_constraintTop_toBottomOf="@id/channel_description" />
...@@ -118,7 +110,7 @@ ...@@ -118,7 +110,7 @@
android:id="@+id/placeholder" android:id="@+id/placeholder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="6dp" android:layout_marginTop="8dp"
android:src="@drawable/ic_hashtag_black" android:src="@drawable/ic_hashtag_black"
app:layout_constraintBottom_toBottomOf="@id/channel_name_text_input_layout" app:layout_constraintBottom_toBottomOf="@id/channel_name_text_input_layout"
app:layout_constraintEnd_toStartOf="@id/channel_name_text_input_layout" app:layout_constraintEnd_toStartOf="@id/channel_name_text_input_layout"
...@@ -129,8 +121,8 @@ ...@@ -129,8 +121,8 @@
android:id="@+id/channel_name_text_input_layout" android:id="@+id/channel_name_text_input_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp" android:layout_marginStart="8dp"
android:layout_marginTop="6dp" android:layout_marginTop="8dp"
android:focusable="true" android:focusable="true"
android:hint="@string/new_channel_edit_text_hint" android:hint="@string/new_channel_edit_text_hint"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
app:useCompatPadding="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:src="@drawable/ic_add_24dp" android:src="@drawable/ic_add_24dp"
app:backgroundTint="@color/black" app:backgroundTint="@color/black"
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
<dimen name="picker_padding_bottom">16dp</dimen> <dimen name="picker_padding_bottom">16dp</dimen>
<dimen name="supposed_keyboard_height">252dp</dimen> <dimen name="supposed_keyboard_height">252dp</dimen>
<!--Toolbar-->
<dimen name="toolbar_height">56dp</dimen>
<!-- Message --> <!-- Message -->
<dimen name="padding_quote">8dp</dimen> <dimen name="padding_quote">8dp</dimen>
<dimen name="padding_mention">4dp</dimen> <dimen name="padding_mention">4dp</dimen>
......
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
<string name="msg_confirm_password">Confirm New Password</string> <string name="msg_confirm_password">Confirm New Password</string>
<string name="private_channel_type">Private</string> <string name="private_channel_type">Private</string>
<string name="public_channel_type">Public</string> <string name="public_channel_type">Public</string>
<string name="private_channel_type_description"></string> <string name="private_channel_type_description">Visible only to you and those whom you invite</string>
<string name="public_channel_description"></string> <string name="public_channel_description">Visible to everyone</string>
<string name="new_channel_edit_text_hint">Channel Name</string> <string name="new_channel_edit_text_hint">Channel Name</string>
<string name="create_new_channel_action">CREATE</string> <string name="create_new_channel_action">CREATE</string>
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
</style> </style>
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <style name="ToolbarTheme" parent="Base.Widget.AppCompat.Toolbar">
<item name="android:background">@color/colorPrimary</item> <item name="android:colorAccent">@color/colorLightTheme</item>
</style> </style>
<style name="AuthenticationTheme" parent="Theme.AppCompat.NoActionBar"> <style name="AuthenticationTheme" parent="Theme.AppCompat.NoActionBar">
......
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