Fixed addContact fab in and out animation

This commit is contained in:
Severiano Jaramillo 2017-12-03 20:05:47 -06:00
parent c45edc3ea6
commit 534e41db00
2 changed files with 28 additions and 5 deletions

View file

@ -8,6 +8,7 @@ import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
@ -22,6 +23,7 @@ import butterknife.OnClick;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.fragments.BalanceFragment;
import cy.agorise.crystalwallet.fragments.ContactsFragment;
import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
/**
@ -47,12 +49,21 @@ public class BoardActivity extends AppCompatActivity {
public BoardPagerAdapter boardAdapter;
/*
* the id of the account of this crypto net balance. It will be loaded
* when the element is bounded.
*/
long cryptoNetAccountId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.board);
ButterKnife.bind(this);
//-1 represents a crypto net account not loaded yet
this.cryptoNetAccountId = -1;
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@ -64,13 +75,12 @@ public class BoardActivity extends AppCompatActivity {
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
/*fabSend.setOnClickListener(new View.OnClickListener() {
fabSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
sendFromThisAccount();
}
});*/
});
// Hide Add Contact fab, it won't hide until first page changed...
// Convert 72dp to pixels (fab is 56dp in diameter + 16dp margin)
@ -118,6 +128,19 @@ public class BoardActivity extends AppCompatActivity {
});
}
public void sendFromThisAccount(){
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("SendDialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
SendTransactionFragment newFragment = SendTransactionFragment.newInstance(this.cryptoNetAccountId);
newFragment.show(ft, "SendDialog");
}
@OnClick(R.id.btnGeneralSettings)
public void onBtnGeneralSettingsClick(){
Intent intent = new Intent(this, GeneralSettingsActivity.class);

View file

@ -52,6 +52,6 @@
</style>
<style name="CustomDialog" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="android:windowNoTitle">false</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>