Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sociald] Implemented subpages for social media feeds. Contributes to…
… JB#2551
- Loading branch information
Antti Seppälä
committed
Oct 10, 2013
1 parent
28b3699
commit 4a18317
Showing
21 changed files
with
630 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,22 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
Item { | ||
id: container | ||
property string icon | ||
Image { | ||
id: image | ||
width: Theme.itemSizeExtraLarge | ||
height: Theme.itemSizeExtraLarge | ||
asynchronous: true | ||
fillMode: Image.PreserveAspectCrop | ||
sourceSize { | ||
width: image.width | ||
height: image.height | ||
} | ||
|
||
Rectangle { | ||
anchors.fill: parent | ||
color: Theme.highlightColor | ||
opacity: 0.5 | ||
} | ||
|
||
Image { | ||
anchors.fill: parent | ||
sourceSize { | ||
width: container.width | ||
height: container.height | ||
} | ||
asynchronous: true | ||
fillMode: Image.PreserveAspectCrop | ||
source: { | ||
if (container.icon == "") { | ||
return container.icon | ||
} else if (container.icon.indexOf("http") == 0) { | ||
return container.icon | ||
} else if (container.icon.indexOf("/") == 0) { | ||
return "image://nemoThumbnail/" + container.icon | ||
} else { | ||
return "image://theme/" + container.icon | ||
} | ||
} | ||
visible: image.status !== Image.Ready | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
BackgroundItem { | ||
width: parent.width | ||
height: Theme.itemSizeLarge | ||
|
||
property Page feedPage | ||
property Item subviewModel | ||
property alias iconSource: icon.source | ||
|
||
onClicked: { | ||
pageStack.push(feedPage) | ||
feedPage.positionViewAtBeginning() | ||
} | ||
|
||
Rectangle { | ||
anchors.fill: parent | ||
gradient: Gradient { | ||
GradientStop { position: 0; color: Theme.rgba(Theme.highlightColor, 0) } | ||
GradientStop { position: 1; color: Theme.rgba(Theme.highlightColor, 0.2) } | ||
} | ||
} | ||
|
||
Image { | ||
id: icon | ||
anchors { | ||
verticalCenter: parent.verticalCenter | ||
right: parent.right | ||
rightMargin: Theme.paddingLarge | ||
} | ||
width: parent.height / 2 | ||
height: width | ||
} | ||
|
||
function sync() { | ||
feedPage.sync() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
BackgroundItem { | ||
property string timestamp: model.timestamp | ||
property string formattedTime | ||
property SocialAvatar avatar: _avatar | ||
|
||
onTimestampChanged: formatTime() | ||
|
||
SocialAvatar { | ||
id: _avatar | ||
source: model.icon | ||
width: Theme.itemSizeMedium | ||
height: Theme.itemSizeMedium | ||
} | ||
|
||
Connections { | ||
target: refreshTimer | ||
onTriggered: formatTime() | ||
} | ||
|
||
function formatTime() { | ||
formattedTime = Format.formatDate(timestamp, Formatter.DurationElapsed) | ||
} | ||
|
||
Component.onCompleted: formatTime() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import org.nemomobile.socialcache 1.0 | ||
|
||
Page { | ||
id: page | ||
|
||
property alias listModel: _listView.model | ||
property alias listDelegate: _listView.delegate | ||
property alias socialNetwork: syncHelper.socialNetwork | ||
property string headerTitle | ||
property SilicaListView listView: _listView | ||
|
||
signal refreshTime | ||
|
||
onVisibleChanged: { | ||
if (visible && status === PageStatus.Active) { | ||
page.refreshTime() | ||
} | ||
} | ||
|
||
onStatusChanged: { | ||
if (status === PageStatus.Active) { | ||
page.refreshTime() | ||
} | ||
} | ||
|
||
SyncHelper { | ||
id: syncHelper | ||
socialNetwork: SocialSync.Twitter | ||
dataType: SocialSync.Posts | ||
onLoadingChanged: { | ||
if (!loading && page.listModel) { | ||
page.listModel.refresh() | ||
} | ||
} | ||
} | ||
|
||
SilicaListView { | ||
id: _listView | ||
anchors.fill: parent | ||
cacheBuffer: Screen.height * 4 | ||
header: PageHeader { | ||
title: page.headerTitle | ||
} | ||
|
||
VerticalScrollDecorator {} | ||
} | ||
|
||
function sync() { | ||
syncHelper.sync() | ||
} | ||
|
||
function positionViewAtBeginning() { | ||
_listView.positionViewAtBeginning() | ||
} | ||
|
||
Component.onCompleted: sync() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.