Improving views and navitation of Tweets.
This commit is contained in:
parent
907deb5752
commit
11b95e0b19
14
Datanalitica.package/Tweet.class/instance/asCardElement.st
Normal file
14
Datanalitica.package/Tweet.class/instance/asCardElement.st
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
accessing
|
||||||
|
asCardElement
|
||||||
|
^ BrHorizontalPane new
|
||||||
|
hFitContent;
|
||||||
|
vFitContent;
|
||||||
|
padding: (BlInsets all: 20);
|
||||||
|
margin: (BlInsets all: 10);
|
||||||
|
addChild: (self user profileImage asElement asScalableElement size: 64@64);
|
||||||
|
addChild: (BrVerticalPane new
|
||||||
|
fitContent;
|
||||||
|
margin: (BlInsets left: 20);
|
||||||
|
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self created);
|
||||||
|
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self text));
|
||||||
|
when: BlClickEvent do: [:e | e target phlow spawnObject: self]
|
@ -4,6 +4,6 @@ fromDictionary: aDictionary
|
|||||||
text := aDictionary at: 'text'.
|
text := aDictionary at: 'text'.
|
||||||
id := aDictionary at: 'id'.
|
id := aDictionary at: 'id'.
|
||||||
authorId := aDictionary at: 'author_id'.
|
authorId := aDictionary at: 'author_id'.
|
||||||
username := aDictionary at: 'username' ifAbsent: [''] .
|
user := aDictionary at: 'username' ifAbsent: [''] .
|
||||||
conversationId := aDictionary at: 'conversation_id' ifAbsent: [ '' ].
|
conversationId := aDictionary at: 'conversation_id' ifAbsent: [ '' ].
|
||||||
^ self
|
^ self
|
3
Datanalitica.package/Tweet.class/instance/user..st
Normal file
3
Datanalitica.package/Tweet.class/instance/user..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
user: aTwitterUser
|
||||||
|
user := aTwitterUser
|
3
Datanalitica.package/Tweet.class/instance/user.st
Normal file
3
Datanalitica.package/Tweet.class/instance/user.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
user
|
||||||
|
^ user
|
@ -11,7 +11,7 @@
|
|||||||
"id",
|
"id",
|
||||||
"authorId",
|
"authorId",
|
||||||
"conversationId",
|
"conversationId",
|
||||||
"username"
|
"user"
|
||||||
],
|
],
|
||||||
"name" : "Tweet",
|
"name" : "Tweet",
|
||||||
"type" : "normal"
|
"type" : "normal"
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
add: aTweet
|
||||||
|
self tweets add: aTweet
|
@ -0,0 +1,26 @@
|
|||||||
|
accessing
|
||||||
|
gtTweetsFor: aView
|
||||||
|
<gtView>
|
||||||
|
^ aView explicit
|
||||||
|
title: 'Tweets';
|
||||||
|
stencil: [
|
||||||
|
| container imageContainer |
|
||||||
|
container := BlElement new
|
||||||
|
layout: BlFlowLayout new;
|
||||||
|
constraintsDo: [ :c |
|
||||||
|
c vertical fitContent.
|
||||||
|
c horizontal matchParent ];
|
||||||
|
padding: (BlInsets all: 10).
|
||||||
|
self tweets do: [ :each |
|
||||||
|
imageContainer := BlLazyElement new
|
||||||
|
withGlamorousPreview;
|
||||||
|
aptitude: BrShadowAptitude new;
|
||||||
|
background: Color white;
|
||||||
|
|
||||||
|
margin: (BlInsets all: 20);
|
||||||
|
constraintsDo: [ :c |
|
||||||
|
c vertical exact: 100.
|
||||||
|
c horizontal exact: 1000 ];
|
||||||
|
elementBuilder: [ each asCardElement margin: (BlInsets all: 20) ].
|
||||||
|
container addChild: imageContainer].
|
||||||
|
container asScrollableElement ]
|
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: '( ',self size asString, ' Tweet(s) )'
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
size
|
||||||
|
^ self tweets size
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
tweets: aTweetsCollection
|
||||||
|
^ tweets := aTweetsCollection
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
tweets
|
||||||
|
^ tweets ifNil: [ tweets := OrderedCollection new]
|
13
Datanalitica.package/TweetsCollection.class/properties.json
Normal file
13
Datanalitica.package/TweetsCollection.class/properties.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Datanalitica-Datanalitica",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"tweets"
|
||||||
|
],
|
||||||
|
"name" : "TweetsCollection",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
@ -5,8 +5,10 @@ messagesAuthors
|
|||||||
groupedTweets := self data groupedBy: [:each | each at: 'author_id' ].
|
groupedTweets := self data groupedBy: [:each | each at: 'author_id' ].
|
||||||
^ (self includes at: 'users') collect: [:userDict | | user |
|
^ (self includes at: 'users') collect: [:userDict | | user |
|
||||||
user := TwitterUser new fromDictionary: userDict.
|
user := TwitterUser new fromDictionary: userDict.
|
||||||
(groupedTweets at: (user id)) do: [:tweetDict |
|
(groupedTweets at: (user id)) do: [:tweetDict | | currentTweet |
|
||||||
user tweets add: (Tweet new fromDictionary: tweetDict)
|
currentTweet := Tweet new fromDictionary: tweetDict.
|
||||||
|
currentTweet user: user.
|
||||||
|
user tweets add: currentTweet.
|
||||||
].
|
].
|
||||||
user.
|
user.
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
accessing
|
accessing
|
||||||
gtViewContactDetailsOn: aView
|
gtViewProfileDetailsOn: aView
|
||||||
<gtView>
|
<gtView>
|
||||||
^ aView explicit
|
^ aView explicit
|
||||||
title: 'Details' translated;
|
title: 'Details' translated;
|
@ -4,13 +4,13 @@ profileImage
|
|||||||
response := ZnClient new url: (self profileImageUrl); get; response.
|
response := ZnClient new url: (self profileImageUrl); get; response.
|
||||||
response contentType = ZnMimeType imageJpeg
|
response contentType = ZnMimeType imageJpeg
|
||||||
ifTrue: [ | imageTemp |
|
ifTrue: [ | imageTemp |
|
||||||
imageTemp := [JPEGReadWriter gtFromBuffer: response contents].
|
imageTemp := [ JPEGReadWriter gtFromBuffer: response contents ].
|
||||||
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
||||||
^ imageTemp value asElement
|
^ imageTemp value asElement
|
||||||
].
|
].
|
||||||
response contentType = ZnMimeType imagePng
|
response contentType = ZnMimeType imagePng
|
||||||
ifTrue: [ | imageTemp |
|
ifTrue: [ | imageTemp |
|
||||||
imageTemp := [PNGReadWriter gtFromBuffer: response contents].
|
imageTemp := [ PNGReadWriter gtFromBuffer: response contents ].
|
||||||
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
||||||
^ imageTemp value asElement
|
^ imageTemp value asElement
|
||||||
].
|
].
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
accessing
|
accessing
|
||||||
tweets
|
tweets
|
||||||
^ tweets ifNil: [ tweets := OrderedCollection new]
|
^ tweets ifNil: [ tweets := TweetsCollection new]
|
Loading…
Reference in New Issue
Block a user