Created ReceiveTransactionFragment layout and fixed fragment transitions

This commit is contained in:
Severiano Jaramillo 2017-12-07 22:59:18 -06:00
parent b992f0a374
commit efef66f4e9
7 changed files with 60 additions and 16 deletions

View file

@ -15,6 +15,9 @@ android {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
vectorDrawables {
useSupportLibrary true
}
multiDexEnabled true
}
buildTypes {
@ -49,7 +52,7 @@ dependencies {
compile 'org.tukaani:xz:1.6'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.github.bilthon:graphenej:0.4.6-alpha1'
compile 'com.google.zxing:core:3.3.1';
compile 'com.google.zxing:core:3.3.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'

View file

@ -23,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.ReceiveTransactionFragment;
import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
@ -75,6 +76,12 @@ public class BoardActivity extends AppCompatActivity {
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
fabReceive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
receiveToThisAccount();
}
});
fabSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -128,6 +135,25 @@ public class BoardActivity extends AppCompatActivity {
});
}
/*
* dispatch the user to the receive fragment using this account
*/
public void receiveToThisAccount(){
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("ReceiveDialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
ReceiveTransactionFragment newFragment = ReceiveTransactionFragment.newInstance(this.cryptoNetAccountId);
newFragment.show(ft, "ReceiveDialog");
}
/*
* dispatch the user to the send fragment using this account
*/
public void sendFromThisAccount(){
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("SendDialog");

View file

@ -26,6 +26,7 @@ import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import butterknife.OnClick;
import cy.agorise.graphenej.Invoice;
import java.util.ArrayList;
import java.util.List;
@ -62,6 +63,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
TextView tvAssetError;
@BindView(R.id.ivQrCode)
ImageView ivQrCode;
@BindView(R.id.tvCancel)
TextView tvCancel;
private Button btnShareQrCode;
private Button btnClose;
@ -97,8 +100,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Receive Assets");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.ReceiveTransactionTheme);
//builder.setTitle("Receive Assets");
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.receive_transaction, null);
@ -138,18 +141,18 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
builder.setView(view);
builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() {
/*builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
shareQrCode();
}
});
builder.setNegativeButton("Close", new DialogInterface.OnClickListener() {
});*/
/*builder.setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
});*/
AlertDialog dialog = builder.create();
@ -184,6 +187,11 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
}
}
@OnClick(R.id.tvCancel)
public void cancel(){
this.dismiss();
}
@Override
public void onValidationSucceeded(final ValidationField field) {
final ReceiveTransactionFragment fragment = this;

View file

@ -4,9 +4,12 @@
android:interpolator="@android:anim/overshoot_interpolator" >
<translate
android:fromXDelta="-150%"
android:fromYDelta="-150%"
android:toXDelta="0%"
android:startOffset="0"
android:duration="350" />
<translate
android:fromYDelta="150%"
android:toYDelta="0%"
android:startOffset="0"
android:duration="300" />
android:duration="420" />
</set>

View file

@ -18,7 +18,7 @@
android:shareInterpolator="true"
android:interpolator="@android:anim/linear_interpolator" >
<scale
android:pivotX="100%"
android:pivotX="0%"
android:pivotY="100%"
android:fromXScale="100%"
android:fromYScale="100%"

View file

@ -4,9 +4,12 @@
android:interpolator="@android:anim/overshoot_interpolator" >
<translate
android:fromXDelta="150%"
android:fromYDelta="150%"
android:toXDelta="0%"
android:startOffset="0"
android:duration="350" />
<translate
android:fromYDelta="150%"
android:toYDelta="0%"
android:startOffset="0"
android:duration="300" />
android:duration="420" />
</set>

View file

@ -12,6 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
@ -19,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:background="@color/transparent"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="Client Logo"
@ -48,19 +49,19 @@
android:id="@+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Balances" />
android:text="@string/balances" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transactions" />
android:text="@string/transactions" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contacts" />
android:text="@string/contacts" />
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>