本文整理汇总了Java中com.actionbarsherlock.app.SherlockDialogFragment类的典型用法代码示例。如果您正苦于以下问题:Java SherlockDialogFragment类的具体用法?Java SherlockDialogFragment怎么用?Java SherlockDialogFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SherlockDialogFragment类属于com.actionbarsherlock.app包,在下文中一共展示了SherlockDialogFragment类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDialogPositiveClick
import com.actionbarsherlock.app.SherlockDialogFragment; //导入依赖的package包/类
@Override
public void onDialogPositiveClick() {
setSendPaymentControlsState(false);
if (lastBluetoothAddress != null)
maybePrepareBluetoothBroadcast(lastBluetoothAddress);
this.parentActivity.getServiceUtils().sendCommand(lastSendPayment, new ParameterizedRunnable() {
@Override
public void run(WebsocketReply reply) {
String tx = null;
if (reply.getReplyType() == WebsocketReply.TYPE_WS_SEND_FAILED) {
WSSendFailed wsSF = (WSSendFailed)reply;
String message = getString(R.string.send_payment_error)
+ " " + wsSF.getReason();
SherlockDialogFragment dialog = ErrorMessageDialogFragment.newInstance(message);
dialog.show(getActivity().getSupportFragmentManager(), "errormessage");
}
if (reply.getReplyType() == WebsocketReply.TYPE_WS_SEND_SUCCESSFUL) {
recipientAddressEditText.setText("");
amountEditText.setText("");
WSSendSuccessful wsSS = (WSSendSuccessful)reply;
tx = wsSS.getTx();
Toast.makeText(getActivity()
, R.string.send_payment_success, Toast.LENGTH_SHORT).show();
}
maybeBroadcastViaBluetooth(tx);
setSendPaymentControlsState(true);
}
});
}
示例2: onOptionsItemSelected
import com.actionbarsherlock.app.SherlockDialogFragment; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.record:
// record the data
SherlockDialogFragment dialog = new RecordOptionDialogFragment(chartTitle);
dialog.show(getSupportFragmentManager(), "RecordOptionDialogFragment");
return true;
case R.id.about:
// about
return true;
default:
return false;
}
}
示例3: onItemClick
import com.actionbarsherlock.app.SherlockDialogFragment; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> av, View v, int position, long id) {
Log.i(THIS_FILE, "Item clicked : " + id +" " + position);
HelpArrayAdapter haa = (HelpArrayAdapter) av.getAdapter();
HelpEntry he = haa.getItem(position);
SherlockDialogFragment newFragment;
switch (he.choiceTag) {
case FAQ:
newFragment = Faq.newInstance();
newFragment.show(getFragmentManager(), "faq");
break;
case LEGALS:
newFragment = Legal.newInstance();
newFragment.show(getFragmentManager(), "issues");
break;
case OPEN_ISSUES:
Intent it = new Intent(Intent.ACTION_VIEW);
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
it.setData(Uri.parse("http://code.google.com/p/csipsimple/issues"));
startActivity(it);
break;
case NIGHTLY:
// We have to check for an update
final NightlyUpdater nu = new NightlyUpdater(getActivity());
Thread t = new Thread() {
public void run() {
UpdaterPopupLauncher ru = nu.getUpdaterPopup(true);
if (ru != null) {
getActivity().runOnUiThread(ru);
}
};
};
t.start();
break;
case SEND_LOGS:
prefsWrapper.setPreferenceStringValue(SipConfigManager.LOG_LEVEL, "1");
try {
startActivityForResult(CollectLogs.getLogReportIntent("<<<PLEASE ADD THE BUG DESCRIPTION HERE>>>", getActivity()), REQUEST_SEND_LOGS);
}catch(Exception e) {
Log.e(THIS_FILE, "Impossible to send logs...", e);
}
Log.setLogLevel(1);
break;
case START_LOGS:
prefsWrapper.setPreferenceStringValue(SipConfigManager.LOG_LEVEL, "4");
Log.setLogLevel(4);
Intent intent = new Intent(SipManager.ACTION_SIP_REQUEST_RESTART);
getActivity().sendBroadcast(intent);
dismiss();
break;
default:
break;
}
}
示例4: onClick
import com.actionbarsherlock.app.SherlockDialogFragment; //导入依赖的package包/类
@Override
public void onClick(View v) {
String address = recipientAddressEditText.getText().toString();
double amount = parseAmount();
long adjustedAmount = 0;
AmountType type = getAmountType();
if (type == AmountType.AMOUNT_BASED_ON_BTC) {
adjustedAmount = Math.round(amount * BackendService.BTC_BASE_AMOUNT);
} else {
adjustedAmount = Math.round(amount * BackendService.USD_BASE_AMOUNT);
}
// double check; should not be necessary
// though, as the button should be disabled then
if (!isReadyToSendPayment().isReady())
return;
// always use 0 as request id; we will not track it
SendPayment sp = new SendPayment(0, address, type, adjustedAmount);
// prepare confirmation text
String message = "";
WSQuote quote = null;
if (lastSuccessfulRequestQuote != null
&& lastSuccessfulRequestQuote.isSimilarRequest(sp)) {
quote = lastSuccessfulQuote;
}
switch (type) {
case AMOUNT_BASED_ON_BTC:
if (quote == null)
message = getString(
R.string.send_payment_confirmation_text_based_on_btc
, formatBTC(adjustedAmount), address);
else
message = getString(
R.string.send_payment_confirmation_text_based_on_btc_with_quote
, formatBTC(adjustedAmount)
, formatUSD(quote.getUsdRecipient(), Rounding.NO_ROUNDING), address);
break;
case AMOUNT_BASED_ON_USD_BEFORE_FEES:
if (quote == null)
message = getString(
R.string.send_payment_confirmation_text_based_on_usd_before_fees
, formatUSD(adjustedAmount, Rounding.NO_ROUNDING), address);
else
message = getString(
R.string.send_payment_confirmation_text_based_on_usd_before_fees_with_quote
, formatUSD(adjustedAmount, Rounding.NO_ROUNDING)
, formatBTC(quote.getBtc()), address);
break;
case AMOUNT_BASED_ON_USD_AFTER_FEES:
if (quote == null)
message = getString(
R.string.send_payment_confirmation_text_based_on_usd_after_fees
, formatUSD(adjustedAmount, Rounding.NO_ROUNDING), address);
else
message = getString(
R.string.send_payment_confirmation_text_based_on_usd_after_fees_with_quote
, formatUSD(adjustedAmount, Rounding.NO_ROUNDING)
, formatBTC(quote.getBtc()), address);
break;
}
lastSendPayment = sp;
SherlockDialogFragment dialog = SendConfirmationDialogFragment.newInstance(message);
dialog.show(getActivity().getSupportFragmentManager(), "sendconfirmation");
}