Skip to content

Commit

Permalink
Fixes for Twitter event feed display
Browse files Browse the repository at this point in the history
This commit includes fixes for Twitter in the event
feed display, and also more shared code between Facebook
and Twitter attached pages.
  • Loading branch information
SfietKonstantin committed Aug 12, 2013
1 parent 58eb0af commit 4bfbb36
Show file tree
Hide file tree
Showing 11 changed files with 369 additions and 306 deletions.
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions src/eventfeed/SocialContent.qml
@@ -0,0 +1,82 @@
import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
id: container
property alias avatar: socialAvatar.icon
property alias source: header.title
property date timestamp
property alias body: body.text
property alias belowAvatar: belowAvatarContainer.children
property alias socialButtons: socialButtonsContainer.children

height: childrenRect.height
anchors {
left: parent.left
right: parent.right
}

Formatter {
id: formatter
}

Rectangle {
anchors.fill: parent
color: Theme.highlightColor
opacity: 0.1
}

PageHeader {
id: header
}

SocialAvatar {
id: socialAvatar
anchors.top: header.bottom
}

SocialBody {
id: body
anchors {
top: header.bottom
left: socialAvatar.right
leftMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.paddingLarge
}

time: formatter.formatDate(container.timestamp, Formatter.DurationElapsed)
}

// This item is used to anchors social buttons and below avatar content
Item {
id: mainContentMask
anchors.top: header.bottom
anchors.left: parent.left
anchors.right: parent.right
height: belowAvatarContainer.childrenRect.height > 0 ? Math.max(body.height, socialAvatar.height)
: body.height
}

Item {
id: belowAvatarContainer
anchors {
left: socialAvatar.left
right: socialAvatar.right
top: mainContentMask.bottom
}
height: socialButtonsContainer.height
}

Item {
id: socialButtonsContainer
anchors {
top: mainContentMask.bottom
left: belowAvatarContainer.right
leftMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.paddingLarge
}
height: childrenRect.height
}
}
29 changes: 29 additions & 0 deletions src/eventfeed/SocialInfoLabel.qml
@@ -0,0 +1,29 @@
import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
property alias text: label.text
anchors {
left: parent.left
right: parent.right
}

height: label.text != "" ? (label.height + 2 * Theme.paddingLarge) : Theme.paddingLarge
opacity: label.text != "" ? 1 : 0

Label {
id: label
anchors {
left: parent.left
leftMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.paddingMedium
verticalCenter: parent.verticalCenter
}
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.WordWrap
}

Behavior on opacity { FadeAnimation {} }
Behavior on height { FadeAnimation { property: "height" } }
}
File renamed without changes.
54 changes: 54 additions & 0 deletions src/eventfeed/SocialReplyField.qml
@@ -0,0 +1,54 @@
import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
id: container
property bool displayMargins
property alias avatar: avatar.source
property alias placeholderText: textField.placeholderText
property alias text: textField.text
property alias allowComment: textField.enabled
signal enterKeyClicked()

function forceActiveFocus() {
textField.forceActiveFocus()
}

function clear() {
textField.text = ""
}

anchors {
left: parent.left
right: parent.right
}
height: childrenRect.height + Theme.paddingMedium
+ (displayMargins ? Theme.paddingLarge : 0)

Behavior on opacity { FadeAnimation {} }

Image {
id: avatar
anchors {
left: parent.left
top: parent.top
topMargin: container.displayMargins ? Theme.paddingLarge : 0
}
width: Theme.iconSizeMedium
height: Theme.iconSizeMedium
}

TextField {
id: textField
anchors {
top: parent.top
topMargin: container.displayMargins ? Theme.paddingLarge : 0
left: avatar.right
right: parent.right
}

EnterKey.onClicked: {
container.enterKeyClicked()
}
}
}

0 comments on commit 4bfbb36

Please sign in to comment.