Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sociald] Check online status before loading images. Contributes to J…
…B#12351 This commit ensures that Image source urls are set to a placeholder image url if network connectivity is not available, to avoid popping up connection dialogs while scrolling through the feeds view. Contributes to JB#12351
- Loading branch information
Chris Adams
committed
Nov 7, 2013
1 parent
435302f
commit e8925a3
Showing
19 changed files
with
199 additions
and
26 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
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,44 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
Item { | ||
id: container | ||
|
||
property url source | ||
property url placeholderSource | ||
property bool connectedToNetwork | ||
|
||
property alias fillMode: image.fillMode | ||
property alias sourceSize: image.sourceSize | ||
|
||
// --------------------- | ||
|
||
onConnectedToNetworkChanged: _setImageSource() | ||
onSourceChanged: _setImageSource() | ||
Component.onCompleted: _setImageSource() | ||
|
||
function _setImageSource() { | ||
if (container.connectedToNetwork || container.source.toString().indexOf("http") != 0) { | ||
image.source = container.source | ||
} else { | ||
image.source = container.placeholderSource | ||
} | ||
} | ||
|
||
Rectangle { | ||
id: placeholderRect | ||
visible: !image.visible | ||
color: Theme.highlightColor | ||
opacity: 0.06 | ||
width: container.width | ||
height: container.height | ||
} | ||
|
||
Image { | ||
id: image | ||
visible: container.connectedToNetwork || image.source.toString().length > 0 | ||
asynchronous: true | ||
width: container.width | ||
height: container.height | ||
} | ||
} |
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
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
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.