use of com.trovebox.android.common.util.RunnableWithParameter in project mobile-android by photo.
the class FacebookFragment method init.
void init(View view) {
try {
new ShowCurrentlyLoggedInUserTask(view).execute();
messageEt = (EditText) view.findViewById(R.id.message);
messageEt.setText(null);
Button logOutButton = (Button) view.findViewById(R.id.logoutBtn);
logOutButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TrackerUtils.trackButtonClickEvent("logoutBtn", FacebookFragment.this);
performFacebookLogout();
}
});
sendButton = (Button) view.findViewById(R.id.sendBtn);
sendButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TrackerUtils.trackButtonClickEvent("sendBtn", FacebookFragment.this);
if (GuiUtils.checkLoggedInAndOnline()) {
postPhoto();
}
}
});
{
sendButton.setEnabled(false);
PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(photo, new RunnableWithParameter<Photo>() {
@Override
public void run(Photo parameter) {
sendButton.setEnabled(true);
}
}, new Runnable() {
@Override
public void run() {
sendButton.setEnabled(false);
}
}, new FBLoadingControl(view));
}
} catch (Exception ex) {
GuiUtils.error(TAG, R.string.errorCouldNotInitFacebookFragment, ex, getActivity());
dismissAllowingStateLoss();
}
}
use of com.trovebox.android.common.util.RunnableWithParameter in project mobile-android by photo.
the class SyncUploadFragment method init.
public void init(View v, Bundle savedInstanceState) {
final Button uploadBtn = (Button) v.findViewById(R.id.uploadBtn);
uploadBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TrackerUtils.trackButtonClickEvent("uploadBtn", SyncUploadFragment.this);
if (!UploadUiFragment.checkAlbumRequiredAndSpecified(albumsWrapper)) {
return;
}
v.setEnabled(false);
uploadSelectedFiles(true, true);
}
});
uploadBtn.setEnabled(false);
editTitle = (EditText) v.findViewById(R.id.edit_title);
editTags = (EditText) v.findViewById(R.id.edit_tags);
albumsText = ((EditText) v.findViewById(R.id.edit_albums));
albumsText.setVisibility(Preferences.isLimitedAccountAccessType() ? View.GONE : View.VISIBLE);
privateSwitch = (Switch) v.findViewById(R.id.private_switch);
twitterSwitch = (Switch) v.findViewById(R.id.twitter_switch);
facebookSwitch = (Switch) v.findViewById(R.id.facebook_switch);
albumsText.setOnClickListener(this);
if (Preferences.isLimitedAccountAccessType()) {
privateSwitch.setChecked(true);
privateSwitch.setEnabled(false);
}
privateSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
reinitShareSwitches(!isChecked);
}
});
reinitShareSwitches();
AccountLimitUtils2.tryToRefreshLimitInformationAndRunInContextAsync(new Runnable() {
@Override
public void run() {
if (!isAdded()) {
return;
}
UploadUiFragment.checkCanUpload(albumsText, uploadBtn, new RunnableWithParameter<StringMapParcelableWrapper>() {
@Override
public void run(StringMapParcelableWrapper parameter) {
SyncUploadFragment.this.albumsWrapper = parameter;
}
});
}
}, new Runnable() {
@Override
public void run() {
CommonUtils.debug(TAG, "Limit information refresh failed");
}
}, loadingControl);
}
use of com.trovebox.android.common.util.RunnableWithParameter in project mobile-android by photo.
the class ShareUtils method shareViaEMail.
/**
* Shares the specified photo via email. The email application should be
* installed on the user device
*
* @param photo
* @param context
* @param loadingControl the loading control for token retrieval operation
*/
public static void shareViaEMail(Photo photo, final Context context, LoadingControl loadingControl) {
RunnableWithParameter<Photo> runnable = new RunnableWithParameter<Photo>() {
@Override
public void run(Photo photo) {
String mailId = "";
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", mailId, null));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, CommonUtils.getStringResource(R.string.share_email_default_title));
String url = PhotoUtils.getShareUrl(photo);
String bodyText = CommonUtils.getStringResource(R.string.share_email_default_body, url, url);
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(bodyText));
context.startActivity(Intent.createChooser(emailIntent, CommonUtils.getStringResource(R.string.share_email_send_title)));
}
};
PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(photo, runnable, null, loadingControl);
}
use of com.trovebox.android.common.util.RunnableWithParameter in project mobile-android by photo.
the class ShareUtils method shareViaSystem.
/**
* Shares the specified photo url via system share menu.
*
* @param photo
* @param context
* @param loadingControl the loading control for token retrieval operation
*/
public static void shareViaSystem(Photo photo, final Context context, LoadingControl loadingControl) {
RunnableWithParameter<Photo> runnable = new RunnableWithParameter<Photo>() {
@Override
public void run(Photo photo) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, CommonUtils.getStringResource(R.string.share_system_default_title));
String url = PhotoUtils.getShareUrl(photo);
String bodyText = CommonUtils.getStringResource(R.string.share_system_default_body, url, url);
shareIntent.putExtra(Intent.EXTRA_TEXT, bodyText);
context.startActivity(Intent.createChooser(shareIntent, CommonUtils.getStringResource(R.string.share_system_send_title)));
}
};
PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(photo, runnable, null, loadingControl);
}
Aggregations