Fixed addContact fab in and out animation
This commit is contained in:
parent
c45edc3ea6
commit
534e41db00
2 changed files with 28 additions and 5 deletions
|
@ -8,6 +8,7 @@ import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -22,6 +23,7 @@ import butterknife.OnClick;
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
import cy.agorise.crystalwallet.fragments.BalanceFragment;
|
import cy.agorise.crystalwallet.fragments.BalanceFragment;
|
||||||
import cy.agorise.crystalwallet.fragments.ContactsFragment;
|
import cy.agorise.crystalwallet.fragments.ContactsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
|
||||||
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
|
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,12 +49,21 @@ public class BoardActivity extends AppCompatActivity {
|
||||||
|
|
||||||
public BoardPagerAdapter boardAdapter;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.board);
|
setContentView(R.layout.board);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
//-1 represents a crypto net account not loaded yet
|
||||||
|
this.cryptoNetAccountId = -1;
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
@ -64,13 +75,12 @@ public class BoardActivity extends AppCompatActivity {
|
||||||
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
|
||||||
|
|
||||||
/*fabSend.setOnClickListener(new View.OnClickListener() {
|
fabSend.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
sendFromThisAccount();
|
||||||
.setAction("Action", null).show();
|
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
|
|
||||||
// Hide Add Contact fab, it won't hide until first page changed...
|
// Hide Add Contact fab, it won't hide until first page changed...
|
||||||
// Convert 72dp to pixels (fab is 56dp in diameter + 16dp margin)
|
// 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)
|
@OnClick(R.id.btnGeneralSettings)
|
||||||
public void onBtnGeneralSettingsClick(){
|
public void onBtnGeneralSettingsClick(){
|
||||||
Intent intent = new Intent(this, GeneralSettingsActivity.class);
|
Intent intent = new Intent(this, GeneralSettingsActivity.class);
|
||||||
|
|
|
@ -52,6 +52,6 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CustomDialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
<style name="CustomDialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
||||||
<item name="android:windowNoTitle">false</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue