Created ReceiveTransactionFragment layout and fixed fragment transitions

master
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()] arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
} }
} }
vectorDrawables {
useSupportLibrary true
}
multiDexEnabled true multiDexEnabled true
} }
buildTypes { buildTypes {
@ -49,7 +52,7 @@ dependencies {
compile 'org.tukaani:xz:1.6' compile 'org.tukaani:xz:1.6'
compile 'com.jakewharton:butterknife:8.8.1' compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.github.bilthon:graphenej:0.4.6-alpha1' 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 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19' 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.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.ReceiveTransactionFragment;
import cy.agorise.crystalwallet.fragments.SendTransactionFragment; import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
import cy.agorise.crystalwallet.fragments.TransactionsFragment; import cy.agorise.crystalwallet.fragments.TransactionsFragment;
@ -75,6 +76,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));
fabReceive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
receiveToThisAccount();
}
});
fabSend.setOnClickListener(new View.OnClickListener() { fabSend.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { 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(){ public void sendFromThisAccount(){
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("SendDialog"); 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.WriterException;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import butterknife.OnClick;
import cy.agorise.graphenej.Invoice; import cy.agorise.graphenej.Invoice;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -62,6 +63,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
TextView tvAssetError; TextView tvAssetError;
@BindView(R.id.ivQrCode) @BindView(R.id.ivQrCode)
ImageView ivQrCode; ImageView ivQrCode;
@BindView(R.id.tvCancel)
TextView tvCancel;
private Button btnShareQrCode; private Button btnShareQrCode;
private Button btnClose; private Button btnClose;
@ -97,8 +100,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.ReceiveTransactionTheme);
builder.setTitle("Receive Assets"); //builder.setTitle("Receive Assets");
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.receive_transaction, null); View view = inflater.inflate(R.layout.receive_transaction, null);
@ -138,18 +141,18 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
builder.setView(view); builder.setView(view);
builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() { /*builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
shareQrCode(); shareQrCode();
} }
}); });*/
builder.setNegativeButton("Close", new DialogInterface.OnClickListener() { /*builder.setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
} }
}); });*/
AlertDialog dialog = builder.create(); 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 @Override
public void onValidationSucceeded(final ValidationField field) { public void onValidationSucceeded(final ValidationField field) {
final ReceiveTransactionFragment fragment = this; final ReceiveTransactionFragment fragment = this;

View File

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

View File

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

View File

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

View File

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