use of com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback in project Klyph by jonathangerbaud.
the class StreamListFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
MultiObjectAdapter adapter = /* KlyphPreferences.areBannerAdsEnabled() ? new NewsfeedAdapter(getListView()) : */
new MultiObjectAdapter(getListView());
if (KlyphPreferences.animateCards()) {
GoogleCardStyleAdapter gcsAdapter = new GoogleCardStyleAdapter(adapter);
gcsAdapter.setAbsListView(getListView());
setListAdapter(gcsAdapter);
} else {
setListAdapter(adapter);
}
defineEmptyText(R.string.empty_list_no_stream);
// getListView().setPadding(0, 8, 0, 0);
// getListView().setDivider(getResources().getDrawable(R.drawable.hdivider_transparent));
// getGridView().setVerticalSpacing(16);
// getListView().setItemsCanFocus(false);
getListView().setDrawSelectorOnTop(true);
getListView().setSelector(AttrUtil.getResourceId(getActivity(), R.attr.streamSelector));
setListVisible(false);
if (KlyphData.getFriendLists() == null) {
new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {
@Override
public void onComplete(Response response) {
onRequestComplete(response);
}
}).execute();
}
super.onViewCreated(view, savedInstanceState);
}
use of com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback in project Klyph by jonathangerbaud.
the class PostActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent.getStringExtra(KlyphBundleExtras.EVENT_ID) != null) {
elementId = intent.getStringExtra(KlyphBundleExtras.EVENT_ID);
isEventMessage = true;
} else if (intent.getStringExtra(KlyphBundleExtras.PAGE_ID) != null) {
elementId = intent.getStringExtra(KlyphBundleExtras.PAGE_ID);
isPageMessage = true;
} else if (intent.getStringExtra(KlyphBundleExtras.GROUP_ID) != null) {
elementId = intent.getStringExtra(KlyphBundleExtras.GROUP_ID);
isGroupMessage = true;
} else {
elementId = KlyphSession.getSessionUserId();
}
Log.d("PostActivity", "event " + isEventMessage + " page " + isPageMessage + " group " + isGroupMessage);
boolean shareLink = intent.getBooleanExtra(KlyphBundleExtras.SHARE, false);
String action = intent.getAction();
String type = intent.getType();
setTitle(isEventMessage == false ? R.string.publish_new_status : R.string.publish_new_event_message);
photoUris = new ArrayList<String>();
messageTextView = (TextView) findViewById(R.id.message_textview);
friendsTextView = (TextView) findViewById(R.id.friends_textview);
placeTextView = (TextView) findViewById(R.id.place_textview);
photosFragment = (PostPhotos) getFragmentManager().findFragmentById(R.id.photos_fragment);
albumsFragment = (PostAlbums) getFragmentManager().findFragmentById(R.id.albums_fragment);
linkFragment = (PostLink) getFragmentManager().findFragmentById(R.id.link_fragment);
shareFragment = (PostShare) getFragmentManager().findFragmentById(R.id.share_fragment);
getFragmentManager().beginTransaction().hide(photosFragment).commitAllowingStateLoss();
getFragmentManager().beginTransaction().hide(albumsFragment).commitAllowingStateLoss();
getFragmentManager().beginTransaction().hide(linkFragment).commitAllowingStateLoss();
if (shareLink == true) {
shareFragment.initWithIntent(getIntent());
shareFragmentVisible = true;
} else {
getFragmentManager().beginTransaction().hide(shareFragment).commit();
}
if (isEventMessage == true) {
LinearLayout buttonBar = (LinearLayout) findViewById(R.id.button_bar);
buttonBar.setVisibility(View.GONE);
} else {
ImageButton placeDeleteButton = (ImageButton) findViewById(R.id.place_delete_button);
ImageButton friendsDeleteButton = (ImageButton) findViewById(R.id.friends_delete_button);
friendsButton = (ImageButton) findViewById(R.id.friends_button);
photosButton = (ImageButton) findViewById(R.id.picture_button);
placeButton = (ImageButton) findViewById(R.id.place_button);
linkButton = (ImageButton) findViewById(R.id.link_button);
privacyButton = (ImageButton) findViewById(R.id.privacy_button);
placeDeleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearPlace();
updateButtonStatus();
}
});
friendsDeleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearFriends();
updateButtonStatus();
}
});
friendsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(PostActivity.this, FriendPickerActivity.class);
if (friends != null && friends.size() > 0) {
ArrayList<String> ids = new ArrayList<String>();
ids.addAll(friends.keySet());
intent.putStringArrayListExtra(KlyphBundleExtras.FRIEND_PICKER_IDS, ids);
}
startActivityForResult(intent, FRIEND_PICKER);
}
});
photosButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startGallery();
}
});
placeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(PostActivity.this, PlacePickerActivity.class), PLACE_PICKER);
}
});
linkButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
linkFragment.reset();
getFragmentManager().beginTransaction().show(linkFragment).commitAllowingStateLoss();
linkFragmentVisible = true;
updateButtonStatus();
}
});
setPrivacyListenerApi11();
setPrivacy(KlyphPreferences.getPrivacy());
if (Intent.ACTION_SEND.equals(action) && type != null) {
displayBackArrow(false);
setAppIconBackToHomeEnabled(false);
if ("text/plain".equals(type)) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
String sharedSubject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
if (sharedText != null) {
boolean isUrl = false;
try {
new URL(sharedText);
isUrl = true;
} catch (MalformedURLException e) {
isUrl = false;
}
if (isUrl == true) {
linkFragment.setUrl(sharedText);
linkFragment.setTitle(sharedSubject);
getFragmentManager().beginTransaction().show(linkFragment).commitAllowingStateLoss();
} else {
messageTextView.setText(sharedText);
}
}
} else if (type.startsWith("image/")) {
Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (imageUri != null) {
// Update UI to reflect image being shared
photoUris = new ArrayList<String>();
if (StringUtils.startsWith(imageUri.toString(), "content://")) {
photoUris.add(getRealPathFromURI(imageUri));
} else {
photoUris.add(imageUri.getPath());
}
photosFragment.setImages(photoUris);
getFragmentManager().beginTransaction().show(photosFragment).commitAllowingStateLoss();
photosFragment.updateLayout();
}
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
displayBackArrow(false);
setAppIconBackToHomeEnabled(false);
if (type.startsWith("image/")) {
ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (imageUris != null) {
// Update UI to reflect multiple images being shared
photoUris = new ArrayList<String>();
for (Uri uri : imageUris) {
if (StringUtils.startsWith(uri.toString(), "content://")) {
photoUris.add(getRealPathFromURI(uri));
} else {
photoUris.add(uri.getPath());
}
}
photosFragment.setImages(photoUris);
getFragmentManager().beginTransaction().show(photosFragment).commitAllowingStateLoss();
photosFragment.updateLayout();
}
}
} else {
Log.d("PostActivity", "Received other");
}
updateButtonStatus();
privacyButton.setVisibility(isGroupMessage == true || isEventMessage == true ? View.GONE : View.VISIBLE);
}
if (KlyphData.getFriendLists() == null) {
new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {
@Override
public void onComplete(Response response) {
onRequestComplete(response);
}
}).execute();
}
}
use of com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback in project Klyph by jonathangerbaud.
the class PostPhotosActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
photoUris = new ArrayList<String>();
setTitle(R.string.publish_new_photos);
messageTextView = (TextView) findViewById(R.id.message_textview);
friendsTextView = (TextView) findViewById(R.id.friends_textview);
placeTextView = (TextView) findViewById(R.id.place_textview);
photosFragment = (PostPhotos) getFragmentManager().findFragmentById(R.id.photos_fragment);
albumsFragment = (AlbumSpinner) getFragmentManager().findFragmentById(R.id.albums_fragment);
albumsFragment.setDefaultAlbumId(getIntent().getExtras().getString(KlyphBundleExtras.ALBUM_ID));
albumsFragment.setOnSelectionChangeListener(this);
getFragmentManager().beginTransaction().hide(photosFragment).commit();
ImageButton placeDeleteButton = (ImageButton) findViewById(R.id.place_delete_button);
ImageButton friendsDeleteButton = (ImageButton) findViewById(R.id.friends_delete_button);
friendsButton = (ImageButton) findViewById(R.id.friends_button);
ImageButton add = (ImageButton) findViewById(R.id.add_button);
ImageButton place = (ImageButton) findViewById(R.id.place_button);
privacyButton = (ImageButton) findViewById(R.id.privacy_button);
privacyButton.setEnabled(false);
placeDeleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearPlace();
}
});
friendsDeleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearFriends();
}
});
friendsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(PostPhotosActivity.this, FriendPickerActivity.class);
if (friends != null && friends.size() > 0) {
ArrayList<String> ids = new ArrayList<String>();
ids.addAll(friends.keySet());
intent.putStringArrayListExtra(KlyphBundleExtras.FRIEND_PICKER_IDS, ids);
}
startActivityForResult(intent, FRIEND_PICKER);
}
});
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startGallery();
}
});
place.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(PostPhotosActivity.this, PlacePickerActivity.class), PLACE_PICKER);
}
});
setPrivacyListenerApi11();
setPrivacy(KlyphPreferences.getPrivacy());
if (KlyphData.getFriendLists() == null) {
new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {
@Override
public void onComplete(Response response) {
onRequestComplete(response);
}
}).execute();
}
}
Aggregations