use of android.support.transition.AutoTransition in project Memento-Calendar by alexstyl.
the class FadeOutTransition method withAction.
/**
* Creates a AutoTransition that calls the {@linkplain Transition.TransitionListener#onTransitionEnd(Transition)}
* of the passing DonationCallbacks when complete
*/
public static Transition withAction(TransitionListener finishingAction) {
AutoTransition transition = new AutoTransition();
transition.setDuration(FADE_OUT_DURATION);
transition.addListener(finishingAction);
return transition;
}
use of android.support.transition.AutoTransition in project samourai-wallet-android by Samourai-Wallet.
the class ReceiveActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_receive);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
setTitle("");
advanceOptionsContainer = findViewById(R.id.container_advance_options);
tvAddress = findViewById(R.id.receive_address);
tvPath = findViewById(R.id.path);
addressTypesSpinner = findViewById(R.id.address_type_spinner);
ivQR = findViewById(R.id.qr);
advancedButton = findViewById(R.id.advance_button);
edAmountBTC = findViewById(R.id.amountBTC);
edAmountSAT = findViewById(R.id.amountSAT);
populateSpinner();
edAmountBTC.setFilters(new InputFilter[] { new DecimalDigitsInputFilter(8, 8) });
edAmountBTC.addTextChangedListener(BTCWatcher);
edAmountSAT.addTextChangedListener(satWatcher);
Display display = (ReceiveActivity.this).getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
imgWidth = Math.max(size.x - 460, 150);
ivQR.setMaxWidth(imgWidth);
useSegwit = PrefsUtil.getInstance(ReceiveActivity.this).getValue(PrefsUtil.USE_SEGWIT, true);
advancedButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(advanceOptionsContainer, new AutoTransition());
int visibility = advanceOptionsContainer.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE;
advanceOptionsContainer.setVisibility(visibility);
}
});
idx84 = BIP84Util.getInstance(ReceiveActivity.this).getWallet().getAccount(0).getChain(0).getAddrIdx();
idx49 = BIP49Util.getInstance(ReceiveActivity.this).getWallet().getAccount(0).getChain(0).getAddrIdx();
try {
idx44 = HD_WalletFactory.getInstance(ReceiveActivity.this).get().getAccount(0).getChain(0).getAddrIdx();
} catch (IOException | MnemonicException.MnemonicLengthException e) {
;
}
addr84 = AddressFactory.getInstance(ReceiveActivity.this).getBIP84(AddressFactory.RECEIVE_CHAIN).getBech32AsString();
addr49 = AddressFactory.getInstance(ReceiveActivity.this).getBIP49(AddressFactory.RECEIVE_CHAIN).getAddressAsString();
addr44 = AddressFactory.getInstance(ReceiveActivity.this).get(AddressFactory.RECEIVE_CHAIN).getAddressString();
if (useSegwit && isBIP84Selected()) {
addr = addr84;
} else if (useSegwit && !isBIP84Selected()) {
addr = addr49;
} else {
addr = addr44;
}
addressTypesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch(position) {
case 0:
{
addr = addr49;
break;
}
case 1:
{
addr = addr84;
break;
}
case 2:
{
addr = addr44;
break;
}
default:
{
addr = addr49;
}
}
displayQRCode();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
;
}
});
if (useSegwit) {
addressTypesSpinner.setSelection(1);
} else {
addressTypesSpinner.setSelection(2);
}
tvAddress.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
new AlertDialog.Builder(ReceiveActivity.this).setTitle(R.string.app_name).setMessage(R.string.receive_address_to_clipboard).setCancelable(false).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ReceiveActivity.this.getSystemService(android.content.Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = null;
clip = android.content.ClipData.newPlainText("Receive address", addr);
clipboard.setPrimaryClip(clip);
Toast.makeText(ReceiveActivity.this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
}).show();
return false;
}
});
ivQR.setOnTouchListener(new OnSwipeTouchListener(ReceiveActivity.this) {
@Override
public void onSwipeLeft() {
if (useSegwit && isBIP84Selected() && canRefresh84) {
addr84 = AddressFactory.getInstance(ReceiveActivity.this).getBIP84(AddressFactory.RECEIVE_CHAIN).getBech32AsString();
addr = addr84;
canRefresh84 = false;
_menu.findItem(R.id.action_refresh).setVisible(false);
displayQRCode();
} else if (useSegwit && !isBIP84Selected() && canRefresh49) {
addr49 = AddressFactory.getInstance(ReceiveActivity.this).getBIP49(AddressFactory.RECEIVE_CHAIN).getAddressAsString();
addr = addr49;
canRefresh49 = false;
_menu.findItem(R.id.action_refresh).setVisible(false);
displayQRCode();
} else if (!useSegwit && canRefresh44) {
addr44 = AddressFactory.getInstance(ReceiveActivity.this).get(AddressFactory.RECEIVE_CHAIN).getAddressString();
addr = addr44;
canRefresh44 = false;
_menu.findItem(R.id.action_refresh).setVisible(false);
displayQRCode();
} else {
;
}
}
});
DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
DecimalFormatSymbols symbols = format.getDecimalFormatSymbols();
defaultSeparator = Character.toString(symbols.getDecimalSeparator());
displayQRCode();
}
use of android.support.transition.AutoTransition in project Memento-Calendar by alexstyl.
the class FadeInTransition method createTransition.
public static Transition createTransition() {
AutoTransition transition = new AutoTransition();
transition.setDuration(FADE_IN_DURATION);
return transition;
}
Aggregations