use of com.abewy.android.apps.klyph.core.fql.Stream in project Klyph by jonathangerbaud.
the class StreamActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d("StreamActivity", "onCreate: ");
super.onCreate(savedInstanceState);
Log.d("StreamActivity", "onCreate: 2");
// Let the Application class know that the first launch is complete
// If we come from a notification, then do not show the ads
// When going back to main activity
KlyphApplication.getInstance().launchComplete();
if (Session.getActiveSession() == null) {
Log.d("StreamActivity", "Session is null ");
Session.openActiveSessionFromCache(this);
}
StreamFragment streamFragment = (StreamFragment) getFragmentManager().findFragmentById(R.id.stream_fragment);
// setTitle("Messages");
Stream stream = getIntent().getParcelableExtra(KlyphBundleExtras.STREAM_PARCELABLE);
if (stream != null) {
Log.d("StreamActivity", "setStreamAndLoad ");
streamFragment.setStreamAndLoad(stream);
} else {
Log.d("StreamAct", "Received id " + getIntent().getStringExtra(KlyphBundleExtras.STREAM_ID) + " " + getIntent().getBooleanExtra(KlyphBundleExtras.STREAM_GROUP, false));
streamFragment.setElementId(getIntent().getStringExtra(KlyphBundleExtras.STREAM_ID));
if (getIntent().getBooleanExtra(KlyphBundleExtras.STREAM_GROUP, false) == true) {
Log.d("StreamAct", "is group ");
streamFragment.setIsStreamGroup();
}
Log.d("StreamActivity", "load ");
streamFragment.load();
}
}
use of com.abewy.android.apps.klyph.core.fql.Stream in project Klyph by jonathangerbaud.
the class EventFragment method onGridItemClick.
@Override
protected void onGridItemClick(KlyphGridView gridView, View view, int position, long id) {
GraphObject o = (GraphObject) gridView.getItemAtPosition(position);
if (o instanceof Stream) {
Stream stream = (Stream) o;
startActivity(Klyph.getIntentForGraphObject(getActivity(), stream));
}
}
use of com.abewy.android.apps.klyph.core.fql.Stream in project Klyph by jonathangerbaud.
the class StreamListFragment method populateNewest.
@Override
protected void populateNewest(List<GraphObject> data) {
int n = data.size();
if (n > 0) {
int index = getListView().getFirstVisiblePosition();
View v = getListView().getChildAt(index);
int top = v == null ? 0 : v.getTop();
int lastIndex = -1;
if (KlyphPreferences.getNewsfeedGoToTop() == false) {
List<GraphObject> list = new ArrayList<GraphObject>();
list.addAll(getAdapter().getItems());
// Looking for a matching post
outer: for (int i = 0; i < n; i++) {
Stream stream = (Stream) data.get(i);
for (int j = 0, m = list.size(); j < m; j++) {
if (list.get(j) instanceof Stream) {
Stream s = (Stream) list.get(j);
Log.d("StreamListFragment", "populateNewest: " + stream.getPost_id() + " " + s.getPost_id());
if (stream.getPost_id().equals(s.getPost_id())) {
lastIndex = i;
// list.add(stream);
break outer;
}
}
}
}
Log.d("StreamListFragment", "populateNewest: " + lastIndex);
// If no match, then insert all the data
if (lastIndex == -1)
lastIndex = data.size();
// Insert filtered data
for (int i = lastIndex - 1; i >= 0; i--) {
list.add(0, data.get(i));
}
getAdapter().clear(false);
getAdapter().addAll(list);
} else {
getAdapter().clear(false);
getAdapter().addAll(data);
setOffset(((Stream) data.get(data.size() - 1)).getCreated_time());
}
if (getListAdapter() instanceof KlyphAnimationAdapter) {
int firstVisiblePosition = getListView().getFirstVisiblePosition();
int lastVisiblePosition = getListView().getLastVisiblePosition();
if (firstVisiblePosition != lastVisiblePosition)
((KlyphAnimationAdapter) getListAdapter()).deactivateNext(lastVisiblePosition - firstVisiblePosition);
else
((KlyphAnimationAdapter) getListAdapter()).deactivateNext(1);
}
getAdapter().notifyDataSetChanged();
if (KlyphPreferences.getNewsfeedGoToTop() == false) {
getListView().setSelectionFromTop(lastIndex, top);
}
}
setNewestLoading(false);
setPullToRefreshRefreshing(false);
if (data.size() > 0) {
storeSessionStreams();
storeData();
}
}
use of com.abewy.android.apps.klyph.core.fql.Stream in project Klyph by jonathangerbaud.
the class StreamAdapter2 method manageAttachment.
private void manageAttachment(StreamHolder holder, Stream stream) {
Attachment attachment = stream.getAttachment();
Media media = attachment.getMedia().size() > 0 ? attachment.getMedia().get(0) : null;
int type = stream.getType();
if ((type == 245 || type == 257) && stream.getParent_stream() != null) {
final Stream parentStream = stream.getParent_stream();
headerAdapter.mergeData(holder, parentStream, true);
messageAdapter.mergeData(holder, parentStream);
buttonBarAdapter.mergeData(holder, stream);
}
if (type == 161 && stream.getDescription_tags().size() > 0 && stream.getLiked_pages().size() > 0) {
linkAdapter.manageLikedPage(holder, stream);
}
if (stream.isStatus()) {
statusAdapter.mergeData(holder, stream);
} else if (stream.isPhoto()) {
photoAdapter.mergeData(holder, stream, stream.getPhoto());
} else if (stream.isVideo()) {
photoAdapter.mergeData(holder, stream, stream.getVideo());
} else if (attachment.isPhoto() || ((media != null && media.isFydv()))) {
photoAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (attachment.isAlbum()) {
albumAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (attachment.isCheckin()) {
manageAttachmentCheckin(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (stream.getLink().isEventLink()) {
linkAdapter.mergeData(holder, stream, stream.getLink());
} else if (stream.getType() == 161 || attachment.getMedia().size() > 0) {
linkAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (stream.isLink()) {
linkAdapter.mergeData(holder, stream, stream.getLink());
} else {
buttonBarAdapter.mergeData(holder, stream);
}
}
use of com.abewy.android.apps.klyph.core.fql.Stream in project Klyph by jonathangerbaud.
the class StreamAdapter2 method mergeViewWithData.
@Override
protected void mergeViewWithData(View view, GraphObject data) {
super.mergeViewWithData(view, data);
if (buttonBarAdapter == null)
buttonBarAdapter = new StreamButtonBar(parentAdapter, specialLayout);
if (photoAdapter == null)
photoAdapter = new StreamPhoto(parentAdapter, specialLayout);
if (linkAdapter == null)
linkAdapter = new StreamLink(parentAdapter, specialLayout);
if (statusAdapter == null)
statusAdapter = new StreamStatus(parentAdapter, specialLayout);
final StreamHolder holder = (StreamHolder) getHolder(view);
setData(view, data);
final Stream stream = (Stream) data;
setData(holder, stream);
}
Aggregations