Commit f199fcc2 authored by aniket's avatar aniket

minor fixes

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