ff19

ngse_diff.diff

Aug 6th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 150.93 KB | None | 0 0
  1. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/CreateAccountActivity.java b/evraz-wallet/app/src/main/java/com/ngse/ui/CreateAccountActivity.java
  2. similarity index 69%
  3. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/CreateAccountActivity.java
  4. rename to evraz-wallet/app/src/main/java/com/ngse/ui/CreateAccountActivity.java
  5. index 6ab3d5e..083021f 100644
  6. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/CreateAccountActivity.java
  7. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/CreateAccountActivity.java
  8. @@ -1,9 +1,9 @@
  9. -package com.bitshares.bitshareswallet;
  10. +package com.ngse.ui;
  11.  
  12.  import android.content.Intent;
  13. +import android.os.Bundle;
  14.  import android.support.v7.app.AlertDialog;
  15.  import android.support.v7.app.AppCompatActivity;
  16. -import android.os.Bundle;
  17.  import android.support.v7.widget.Toolbar;
  18.  import android.text.Editable;
  19.  import android.text.InputFilter;
  20. @@ -22,6 +22,8 @@ import com.bitshares.bitshareswallet.wallet.exception.NetworkStatusException;
  21.  import com.bitshares.bitshareswallet.wallet.faucet.CreateAccountException;
  22.  import com.kaopiz.kprogresshud.KProgressHUD;
  23.  
  24. +import org.evrazcoin.evrazwallet.R;
  25. +
  26.  import io.reactivex.Flowable;
  27.  import io.reactivex.Observable;
  28.  import io.reactivex.android.schedulers.AndroidSchedulers;
  29. @@ -29,7 +31,17 @@ import io.reactivex.schedulers.Schedulers;
  30.  
  31.  import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
  32.  import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
  33. -import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.*;
  34. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_ACCOUNT_OBJECT_EXIST;
  35. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_FILE_NOT_FOUND;
  36. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_FILE_READ_FAIL;
  37. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_IMPORT_NOT_MATCH_PRIVATE_KEY;
  38. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_NETWORK_FAIL;
  39. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_NO_ACCOUNT_OBJECT;
  40. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_PASSWORD_CONFIRM_FAIL;
  41. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_PASSWORD_INVALID;
  42. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_SERVER_CREATE_ACCOUNT_FAIL;
  43. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_SERVER_RESPONSE_FAIL;
  44. +import static com.bitshares.bitshareswallet.wallet.common.ErrorCode.ERROR_UNKNOWN;
  45.  
  46.  public class CreateAccountActivity extends AppCompatActivity {
  47.      private Toolbar mToolbar;
  48. @@ -38,16 +50,11 @@ public class CreateAccountActivity extends AppCompatActivity {
  49.      @Override
  50.      protected void onCreate(Bundle savedInstanceState) {
  51.          super.onCreate(savedInstanceState);
  52. -        setContentView(R.layout.activity_create_account);
  53. +        setContentView(R.layout.new_activity_create_account);
  54.  
  55. -        mToolbar = (Toolbar) findViewById(R.id.toolbar);
  56. +        mToolbar = findViewById(R.id.toolbar);
  57.          setSupportActionBar(mToolbar);
  58. -        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
  59. -            @Override
  60. -            public void onClick(View v) {
  61. -                onBackPressed();
  62. -            }
  63. -        });
  64. +        mToolbar.setNavigationOnClickListener(v -> onBackPressed());
  65.  
  66.          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  67.  
  68. @@ -59,20 +66,20 @@ public class CreateAccountActivity extends AppCompatActivity {
  69.                  .setAnimationSpeed(2)
  70.                  .setDimAmount(0.5f);
  71.  
  72. -        findViewById(R.id.buttonCreate).setOnClickListener(new View.OnClickListener() {
  73. -            @Override
  74. -            public void onClick(View v) {
  75. +        findViewById(R.id.buttonCreate).setOnClickListener(v -> {
  76.              mProcessHud.show();
  77.  
  78.              String strAccount = ((EditText) findViewById(R.id.editTextAccountName)).getText().toString();
  79.              String strPassword = ((EditText) findViewById(R.id.editTextPassword)).getText().toString();
  80.              String strPasswordConfirm = ((EditText) findViewById(R.id.editTextPasswordConfirm)).getText().toString();
  81. -                CheckBox checkBox = (CheckBox)findViewById(R.id.checkBoxConfirm);
  82. +            CheckBox checkBox = findViewById(R.id.checkBoxConfirm);
  83. +            CheckBox checkBox2 = findViewById(R.id.checkBoxConfirm2);
  84. +            CheckBox checkBox3 = findViewById(R.id.checkBoxConfirm3);
  85.  
  86.  
  87. -                TextView textViewAccountError = (TextView)findViewById(R.id.textViewErrorAccount);
  88. -                TextView textViewPasswordError = (TextView)findViewById(R.id.textViewErrorPasswrod);
  89. -                TextView textViewPasswordConfirmError = (TextView)findViewById(R.id.textViewErrorInfo);
  90. +            TextView textViewAccountError = findViewById(R.id.textViewErrorAccount);
  91. +            TextView textViewPasswordError = findViewById(R.id.textViewErrorPasswrod);
  92. +            TextView textViewPasswordConfirmError = findViewById(R.id.textViewErrorInfo);
  93.  
  94.              boolean bError = false;
  95.              if (strAccount.isEmpty()) {
  96. @@ -91,10 +98,10 @@ public class CreateAccountActivity extends AppCompatActivity {
  97.              }
  98.  
  99.              if (bError == false && textViewAccountError.getText().length() == 0 && textViewPasswordError.getText().length() == 0) {
  100. -                    if (checkBox.isChecked() == true) {
  101. +                if (checkBox.isChecked() && checkBox2.isChecked() && checkBox3.isChecked()) {
  102.                      processCreateAccount(strAccount, strPassword, strPasswordConfirm);
  103.                  } else {
  104. -                        AlertDialog.Builder builder = new AlertDialog.Builder(CreateAccountActivity.this);
  105. +                    AlertDialog.Builder builder = new AlertDialog.Builder(CreateAccountActivity.this, R.style.CustomDialogTheme);
  106.                      builder.setMessage(R.string.create_account_check_box_confirm);
  107.                      builder.show();
  108.                      mProcessHud.dismiss();
  109. @@ -102,16 +109,10 @@ public class CreateAccountActivity extends AppCompatActivity {
  110.              } else {
  111.                  mProcessHud.dismiss();
  112.              }
  113. -            }
  114.          });
  115.  
  116. -        EditText editTextAccountName = (EditText)findViewById(R.id.editTextAccountName);
  117. -        InputFilter lowercaseFilter = new InputFilter() {
  118. -            @Override
  119. -            public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
  120. -                return source.toString().toLowerCase();
  121. -            }
  122. -        };
  123. +        EditText editTextAccountName = findViewById(R.id.editTextAccountName);
  124. +        InputFilter lowercaseFilter = (source, start, end, dest, dstart, dend) -> source.toString().toLowerCase();
  125.          editTextAccountName.setFilters(new InputFilter[]{lowercaseFilter, new InputFilter.LengthFilter(63)});
  126.  
  127.          editTextAccountName.addTextChangedListener(new TextWatcher() {
  128. @@ -132,7 +133,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  129.                      return;
  130.                  }
  131.  
  132. -                TextView textViewError = (TextView)findViewById(R.id.textViewErrorAccount);
  133. +                TextView textViewError = findViewById(R.id.textViewErrorAccount);
  134.                  if (Character.isLetter(strAccountName.charAt(0)) == false) {
  135.                      textViewError.setText(R.string.create_account_account_name_error_start_letter);
  136.                      findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
  137. @@ -162,7 +163,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  138.              }
  139.          });
  140.  
  141. -        final EditText editTextPassword = (EditText)findViewById(R.id.editTextPassword);
  142. +        final EditText editTextPassword = findViewById(R.id.editTextPassword);
  143.          editTextPassword.addTextChangedListener(new TextWatcher() {
  144.              @Override
  145.              public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  146. @@ -178,7 +179,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  147.              public void afterTextChanged(Editable s) {
  148.                  String strPassword = s.toString();
  149.  
  150. -                TextView textViewError = (TextView)findViewById(R.id.textViewErrorPasswrod);
  151. +                TextView textViewError = findViewById(R.id.textViewErrorPasswrod);
  152.                  if (strPassword.length() < 12) {
  153.                      textViewError.setText(R.string.create_account_password_requirement);
  154.                  } else {
  155. @@ -194,7 +195,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  156.              }
  157.          });
  158.  
  159. -        EditText editTextPasswordConfirm = (EditText)findViewById(R.id.editTextPasswordConfirm);
  160. +        EditText editTextPasswordConfirm = findViewById(R.id.editTextPasswordConfirm);
  161.          editTextPasswordConfirm.addTextChangedListener(new TextWatcher() {
  162.              @Override
  163.              public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  164. @@ -211,7 +212,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  165.                  String strPassword = editTextPassword.getText().toString();
  166.                  String strPasswordConfirm = s.toString();
  167.  
  168. -                TextView textViewErrorInfo = (TextView)findViewById(R.id.textViewErrorInfo);
  169. +                TextView textViewErrorInfo = findViewById(R.id.textViewErrorInfo);
  170.                  if (strPassword.compareTo(strPasswordConfirm) == 0) {
  171.                      findViewById(R.id.imageViewPasswordConfirmCheck).setVisibility(View.VISIBLE);
  172.                      textViewErrorInfo.setText("");
  173. @@ -270,7 +271,8 @@ public class CreateAccountActivity extends AppCompatActivity {
  174.          }).observeOn(AndroidSchedulers.mainThread())
  175.                  .subscribe(integer -> {
  176.                      mProcessHud.dismiss();
  177. -                    Intent intent = new Intent(CreateAccountActivity.this, MainActivity.class);
  178. +                    Intent intent = new Intent(CreateAccountActivity.this, NewMainActivity.class);
  179. +//                    Intent intent = new Intent(CreateAccountActivity.this, MainActivity.class);
  180.                      intent.setFlags(FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
  181.                      startActivity(intent);
  182.                  }, throwable -> {
  183. @@ -288,7 +290,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  184.      }
  185.  
  186.      private void processErrorCode(final int nErrorCode) {
  187. -        final TextView textView = (TextView) findViewById(R.id.textViewErrorInfo);
  188. +        final TextView textView = findViewById(R.id.textViewErrorInfo);
  189.          switch (nErrorCode) {
  190.              case ERROR_NETWORK_FAIL:
  191.                  textView.setText(R.string.create_account_activity_network_fail);
  192. @@ -327,7 +329,7 @@ public class CreateAccountActivity extends AppCompatActivity {
  193.      }
  194.  
  195.      private void processExceptionMessage(final String strMessage) {
  196. -        final TextView textView = (TextView) findViewById(R.id.textViewErrorInfo);
  197. +        final TextView textView = findViewById(R.id.textViewErrorInfo);
  198.          textView.setText(strMessage);
  199.      }
  200.  
  201. @@ -345,10 +347,10 @@ public class CreateAccountActivity extends AppCompatActivity {
  202.                                  if (accountObect == null) {
  203.                                      findViewById(R.id.imageViewAccountCheck).setVisibility(View.VISIBLE);
  204.                                  } else {
  205. -                                    EditText editTextAccount = (EditText)findViewById(R.id.editTextAccountName);
  206. +                                    EditText editTextAccount = findViewById(R.id.editTextAccountName);
  207.                                      String strAccountName = editTextAccount.getText().toString();
  208.                                      if (strAccountName.compareTo(accountObect.name) == 0) {
  209. -                                        TextView textViewError = (TextView) findViewById(R.id.textViewErrorAccount);
  210. +                                        TextView textViewError = findViewById(R.id.textViewErrorAccount);
  211.                                          textViewError.setText(R.string.create_account_activity_account_object_exist);
  212.                                          findViewById(R.id.imageViewAccountCheck).setVisibility(View.INVISIBLE);
  213.                                      }
  214. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/ImportActivty.java b/evraz-wallet/app/src/main/java/com/ngse/ui/ImportActivty.java
  215. similarity index 97%
  216. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/ImportActivty.java
  217. rename to evraz-wallet/app/src/main/java/com/ngse/ui/ImportActivty.java
  218. index 0d8d876..36f34d2 100644
  219. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/ImportActivty.java
  220. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/ImportActivty.java
  221. @@ -1,4 +1,4 @@
  222. -package com.bitshares.bitshareswallet;
  223. +package com.ngse.ui;
  224.  
  225.  import android.content.Intent;
  226.  import android.content.pm.PackageManager;
  227. @@ -20,6 +20,8 @@ import com.bitshares.bitshareswallet.wallet.common.ConvertUriToFilePath;
  228.  import com.bitshares.bitshareswallet.wallet.common.ErrorCode;
  229.  import com.kaopiz.kprogresshud.KProgressHUD;
  230.  
  231. +import org.evrazcoin.evrazwallet.R;
  232. +
  233.  import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
  234.  import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
  235.  
  236. @@ -53,7 +55,7 @@ public class ImportActivty extends AppCompatActivity {
  237.      @Override
  238.      protected void onCreate(Bundle savedInstanceState) {
  239.          super.onCreate(savedInstanceState);
  240. -        setContentView(R.layout.activity_import_activty);
  241. +        setContentView(R.layout.new_activity_import_activty);
  242.  
  243.          mToolbar = (Toolbar) findViewById(R.id.toolbar);
  244.          setSupportActionBar(mToolbar);
  245. @@ -127,7 +129,7 @@ public class ImportActivty extends AppCompatActivity {
  246.          mnModel = getIntent().getIntExtra("model", 0);
  247.          switch (mnModel) {
  248.              case ACCOUNT_MODEL:
  249. -                getSupportActionBar().setTitle(R.string.import_activity_account_model);
  250. +                getSupportActionBar().setTitle(R.string.auth);
  251.                  break;
  252.              case WALLET_MODEL_BIN_FILE:
  253.                  getSupportActionBar().setTitle(R.string.import_activity_wallet_model);
  254. @@ -221,7 +223,8 @@ public class ImportActivty extends AppCompatActivity {
  255.  
  256.                  if (nRet == 0) {
  257.                      mProcessHud.dismiss();
  258. -                    Intent intent = new Intent(ImportActivty.this, MainActivity.class);
  259. +                    Intent intent = new Intent(ImportActivty.this, NewMainActivity.class);
  260. +//                    Intent intent = new Intent(ImportActivty.this, MainActivity.class);
  261.                      intent.setFlags(FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
  262.                      startActivity(intent);
  263.                  } else {
  264. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/MainActivity.java b/evraz-wallet/app/src/main/java/com/ngse/ui/NewMainActivity.java
  265. similarity index 68%
  266. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/MainActivity.java
  267. rename to evraz-wallet/app/src/main/java/com/ngse/ui/NewMainActivity.java
  268. index e1ab7b0..74b01c0 100644
  269. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/MainActivity.java
  270. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/NewMainActivity.java
  271. @@ -1,4 +1,4 @@
  272. -package com.bitshares.bitshareswallet;
  273. +package com.ngse.ui;
  274.  
  275.  import android.app.Activity;
  276.  import android.arch.lifecycle.ViewModelProviders;
  277. @@ -8,23 +8,20 @@ import android.content.Context;
  278.  import android.content.DialogInterface;
  279.  import android.content.Intent;
  280.  import android.content.SharedPreferences;
  281. -import android.content.pm.PackageInfo;
  282. -import android.content.pm.PackageManager;
  283.  import android.content.res.Resources;
  284.  import android.net.Uri;
  285. +import android.os.Bundle;
  286.  import android.os.Handler;
  287.  import android.support.annotation.NonNull;
  288. -import android.support.design.widget.BottomNavigationView;
  289.  import android.support.design.widget.NavigationView;
  290. +import android.support.v4.app.FragmentManager;
  291. +import android.support.v4.app.FragmentTransaction;
  292.  import android.support.v4.content.LocalBroadcastManager;
  293. -import android.support.v4.media.session.PlaybackStateCompat;
  294.  import android.support.v4.view.GravityCompat;
  295. -import android.support.v4.view.ViewPager;
  296.  import android.support.v4.widget.DrawerLayout;
  297.  import android.support.v7.app.ActionBarDrawerToggle;
  298.  import android.support.v7.app.AlertDialog;
  299.  import android.support.v7.app.AppCompatActivity;
  300. -import android.os.Bundle;
  301.  import android.support.v7.app.AppCompatDelegate;
  302.  import android.support.v7.preference.PreferenceManager;
  303.  import android.support.v7.widget.Toolbar;
  304. @@ -38,6 +35,10 @@ import android.widget.LinearLayout;
  305.  import android.widget.TextView;
  306.  import android.widget.Toast;
  307.  
  308. +import com.bitshares.bitshareswallet.AboutActivity;
  309. +import com.bitshares.bitshareswallet.BitsharesApplication;
  310. +import com.bitshares.bitshareswallet.OnFragmentInteractionListener;
  311. +import com.bitshares.bitshareswallet.SettingsActivity;
  312.  import com.bitshares.bitshareswallet.room.BitsharesAsset;
  313.  import com.bitshares.bitshareswallet.room.BitsharesDao;
  314.  import com.bitshares.bitshareswallet.room.BitsharesOperationHistory;
  315. @@ -49,14 +50,21 @@ import com.bitshares.bitshareswallet.wallet.account_object;
  316.  import com.bitshares.bitshareswallet.wallet.fc.crypto.sha256_object;
  317.  import com.bitshares.bitshareswallet.wallet.graphene.chain.signed_transaction;
  318.  import com.bitshares.bitshareswallet.wallet.graphene.chain.utils;
  319. +import com.ngse.ui.main.MainWalletFragment;
  320. +import com.ngse.ui.main.trading.TradingScheduleFragment;
  321. +import com.ngse.ui.main.balanceitems.OpenOrdersFragment;
  322. +import com.ngse.ui.main.balanceitems.PortfolioFragment;
  323. +import com.ngse.ui.main.balanceitems.TransactionsFragment;
  324. +
  325. +import org.evrazcoin.evrazwallet.R;
  326. +
  327.  import java.util.List;
  328.  
  329.  import io.reactivex.Flowable;
  330.  import io.reactivex.schedulers.Schedulers;
  331.  
  332.  
  333. -
  334. -public class MainActivity extends AppCompatActivity
  335. +public class NewMainActivity extends AppCompatActivity
  336.          implements OnFragmentInteractionListener {
  337.  
  338.      static {
  339. @@ -68,16 +76,11 @@ public class MainActivity extends AppCompatActivity
  340.      private Toolbar mToolbar;
  341.      private DrawerLayout mDrawerLayout;
  342.      private ActionBarDrawerToggle mActionBarDrawerToggle;
  343. -    private NonScrollViewPager mViewPager;
  344.  
  345. -    private WalletFragment mWalletFragment;
  346. -    private QuotationFragment mQuotationFragment;
  347. -    private ExchangeFragment mExchangeFragment;
  348. -    private BtsFragmentPageAdapter mMainFragmentPageAdapter;
  349. +    private MainWalletFragment mWalletFragment;
  350.      private TextView mTxtTitle;
  351.      private LinearLayout mLayoutTitle;
  352. -    private BottomNavigationView mBottomNavigation;
  353. -    private Handler mHandler = new Handler();
  354. +
  355.  
  356.      private static final int REQUEST_CODE_SETTINGS = 1;
  357.  
  358. @@ -101,6 +104,7 @@ public class MainActivity extends AppCompatActivity
  359.          updateTitle();
  360.          LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(Broadcast.CURRENCY_UPDATED));
  361.      }
  362. +
  363.      @Override
  364.      protected void onNewIntent(Intent intent) {
  365.          super.onNewIntent(intent);
  366. @@ -118,7 +122,7 @@ public class MainActivity extends AppCompatActivity
  367.          );
  368.      }
  369.  
  370. -    private void setTitleVisible(boolean visible){
  371. +    public void setTitleVisible(boolean visible) {
  372.          mLayoutTitle.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
  373.      }
  374.  
  375. @@ -127,7 +131,7 @@ public class MainActivity extends AppCompatActivity
  376.          super.onCreate(savedInstanceState);
  377.  
  378.          rasingColorRevers = getResources().getConfiguration().locale.getCountry().equals("CN");
  379. -        setContentView(R.layout.activity_main);
  380. +        setContentView(R.layout.new_activity_main);
  381.  
  382.          mToolbar = (Toolbar) findViewById(R.id.toolbar);
  383.          setSupportActionBar(mToolbar);
  384. @@ -156,65 +160,29 @@ public class MainActivity extends AppCompatActivity
  385.          mDrawerLayout.addDrawerListener(mActionBarDrawerToggle);
  386.          mActionBarDrawerToggle.syncState();
  387.  
  388. -        mViewPager = (NonScrollViewPager) findViewById(R.id.viewPager);
  389.  
  390. -        mMainFragmentPageAdapter = new BtsFragmentPageAdapter(getSupportFragmentManager());
  391. +        mWalletFragment = MainWalletFragment.newInstance();
  392.  
  393. -        mWalletFragment = WalletFragment.newInstance("","");
  394. -        mQuotationFragment = QuotationFragment.newInstance();
  395. -        mExchangeFragment = ExchangeFragment.newInstance("", "");
  396.  
  397. -        mMainFragmentPageAdapter.addFragment(mWalletFragment, "Wallet");
  398. -        mMainFragmentPageAdapter.addFragment(mQuotationFragment, "Quotation");
  399. -        mMainFragmentPageAdapter.addFragment(mExchangeFragment, "Exchange");
  400. -        mViewPager.setAdapter(mMainFragmentPageAdapter);
  401. -
  402. -        mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  403. -            @Override
  404. -            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
  405. -
  406. -            }
  407. -
  408. -            @Override
  409. -            public void onPageSelected(int position) {
  410. -                if(position == 0) {
  411. -                    mBottomNavigation.setSelectedItemId(R.id.navigation_wallet);
  412. -                } else if(position == 1) {
  413. -                    mBottomNavigation.setSelectedItemId(R.id.navigation_quotation);
  414. -                } else if(position == 2) {
  415. -                    mBottomNavigation.setSelectedItemId(R.id.navigation_exchange);
  416. -                }
  417. -                setTitleVisible(position!=0);
  418. -                mMainFragmentPageAdapter.updatePagePosition(position);
  419. -            }
  420. -
  421. -            @Override
  422. -            public void onPageScrollStateChanged(int state) {
  423. -
  424. -            }
  425. -        });
  426. -        NavigationView navigationView = (NavigationView)findViewById(R.id.navigation_view);
  427. -        navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
  428. -            @Override
  429. -            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  430. +        NavigationView navigationView = findViewById(R.id.navigation_view);
  431. +        navigationView.setNavigationItemSelectedListener(item -> {
  432.              switch (item.getItemId()) {
  433.                  case R.id.logout:
  434.                      processLogout();
  435.                      break;
  436.                  case R.id.settings:
  437. -                        Intent intentSettings = new Intent(MainActivity.this, SettingsActivity.class);
  438. +                    Intent intentSettings = new Intent(NewMainActivity.this, SettingsActivity.class);
  439.                      //startActivity(intent);
  440.                      startActivityForResult(intentSettings, REQUEST_CODE_SETTINGS);
  441.                      break;
  442.                  case R.id.about:
  443. -                        Intent intentAbout = new Intent(MainActivity.this, AboutActivity.class);
  444. +                    Intent intentAbout = new Intent(NewMainActivity.this, AboutActivity.class);
  445.                      startActivity(intentAbout);
  446.                      break;
  447.              }
  448.  
  449.              mDrawerLayout.closeDrawer(GravityCompat.START);
  450.              return false;
  451. -            }
  452.          });
  453.  
  454.          WalletViewModel walletViewModel = ViewModelProviders.of(this).get(WalletViewModel.class);
  455. @@ -250,7 +218,7 @@ public class MainActivity extends AppCompatActivity
  456.                          ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
  457.                          ClipData clipData = ClipData.newPlainText("account name", accountObject.name);
  458.                          clipboardManager.setPrimaryClip(clipData);
  459. -                        Toast toast = Toast.makeText(MainActivity.this, "Copy Successfully", Toast.LENGTH_SHORT);
  460. +                        Toast toast = Toast.makeText(NewMainActivity.this, "Copy Successfully", Toast.LENGTH_SHORT);
  461.                          toast.show();
  462.                      }
  463.                  });
  464. @@ -258,25 +226,6 @@ public class MainActivity extends AppCompatActivity
  465.          }
  466.  
  467.  
  468. -        mBottomNavigation = (BottomNavigationView) findViewById(R.id.navigation_bottom);
  469. -        mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
  470. -            @Override
  471. -            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  472. -                switch (item.getItemId()){
  473. -                    case R.id.navigation_wallet:
  474. -                        mViewPager.setCurrentItem(0, true);
  475. -                        return true;
  476. -                    case R.id.navigation_quotation:
  477. -                        mViewPager.setCurrentItem(1, true);
  478. -                        return true;
  479. -                    case R.id.navigation_exchange:
  480. -                        mViewPager.setCurrentItem(2, true);
  481. -                        return true;
  482. -                }
  483. -                return false;
  484. -            }
  485. -        });
  486. -
  487.          QuotationViewModel viewModel = ViewModelProviders.of(this).get(QuotationViewModel.class);
  488.          viewModel.getSelectedMarketTicker().observe(this,
  489.                  currencyPair -> {
  490. @@ -285,19 +234,10 @@ public class MainActivity extends AppCompatActivity
  491.                              utils.getAssetSymbolDisply(currencyPair.first))
  492.                      );
  493.                  });
  494. -    }
  495.  
  496. -    @Override
  497. -    protected void onPause() {
  498. -        super.onPause();
  499. -        mMainFragmentPageAdapter.updateShowing(false);
  500. +        showWalletFragment();
  501.      }
  502.  
  503. -    @Override
  504. -    protected void onResume() {
  505. -        super.onResume();
  506. -        mMainFragmentPageAdapter.updateShowing(true);
  507. -    }
  508.  
  509.      @Override
  510.      public void onFragmentInteraction(Uri uri) {
  511. @@ -324,6 +264,7 @@ public class MainActivity extends AppCompatActivity
  512.              imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
  513.          }
  514.      }
  515. +
  516.      public static void showSoftKeyboard(View view, Context context) {
  517.          if (view != null && context != null) {
  518.              InputMethodManager imm = (InputMethodManager) context
  519. @@ -340,14 +281,15 @@ public class MainActivity extends AppCompatActivity
  520.      }
  521.  
  522.      private void processLogout() {
  523. -        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
  524. +        AlertDialog.Builder builder = new AlertDialog.Builder(NewMainActivity.this, R.style.CustomDialogTheme);
  525.          builder.setPositiveButton(R.string.log_out_dialog_confirm_button, new DialogInterface.OnClickListener() {
  526.              @Override
  527.              public void onClick(DialogInterface dialog, int which) {
  528.                  Flowable.just(0)
  529.                          .subscribeOn(Schedulers.io())
  530.                          .map(integer -> {
  531. -                            BitsharesDao bitsharesDao = BitsharesApplication.getInstance().getBitsharesDatabase().getBitsharesDao();;
  532. +                            BitsharesDao bitsharesDao = BitsharesApplication.getInstance().getBitsharesDatabase().getBitsharesDao();
  533. +                            ;
  534.                              List<BitsharesAsset> bitsharesAssetList = bitsharesDao.queryBalanceList();
  535.                              List<BitsharesOperationHistory> bitsharesOperationHistoryList = bitsharesDao.queryOperationHistoryList();
  536.                              bitsharesDao.deleteBalance(bitsharesAssetList);
  537. @@ -357,7 +299,7 @@ public class MainActivity extends AppCompatActivity
  538.                          }).subscribe();
  539.  
  540.                  BitsharesWalletWraper.getInstance().reset();
  541. -                Intent intent = new Intent(MainActivity.this, SignUpButtonActivity.class);
  542. +                Intent intent = new Intent(NewMainActivity.this, SignUpButtonActivity.class);
  543.                  startActivity(intent);
  544.                  finish();
  545.              }
  546. @@ -374,7 +316,7 @@ public class MainActivity extends AppCompatActivity
  547.      }
  548.  
  549.      private void processChooseCurency() {
  550. -        final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
  551. +        final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(NewMainActivity.this, R.style.CustomDialogTheme);
  552.          dialogBuilder.setTitle(R.string.title_select_currency);
  553.          Resources res = getResources();
  554.          final String[] arrValues = res.getStringArray(R.array.quotation_currency_pair_values);
  555. @@ -395,20 +337,55 @@ public class MainActivity extends AppCompatActivity
  556.                          putString("quotation_currency_pair", arrValues[which])
  557.                          .apply();
  558.                  String strAsset[] = arrValues[which].split(":");
  559. -                QuotationViewModel viewModel = ViewModelProviders.of(MainActivity.this).get(QuotationViewModel.class);
  560. +                QuotationViewModel viewModel = ViewModelProviders.of(NewMainActivity.this).get(QuotationViewModel.class);
  561.                  viewModel.selectedMarketTicker(new Pair(strAsset[1], strAsset[0]));
  562.  
  563.                  onCurrencyUpdate();
  564.              }
  565.          });
  566.  
  567. -        dialogBuilder.setPositiveButton(R.string.log_out_dialog_cancel_button, new DialogInterface.OnClickListener() {
  568. -            @Override
  569. -            public void onClick(DialogInterface dialog, int which) {
  570. -                dialog.dismiss();
  571. +        dialogBuilder.setPositiveButton(R.string.log_out_dialog_cancel_button, (dialog, which) -> dialog.dismiss());
  572. +        dialogBuilder.show();
  573.      }
  574. -        });
  575.  
  576. -        dialogBuilder.show();
  577. +    public void showWalletFragment() {
  578. +        FragmentManager fragmentManager = getSupportFragmentManager();
  579. +        FragmentTransaction ft = fragmentManager.beginTransaction();
  580. +        ft.replace(R.id.fragmentFrameLayout, mWalletFragment, MainWalletFragment.TAG);
  581. +        ft.commitAllowingStateLoss();
  582. +    }
  583. +
  584. +    public void showTransactionsFragment() {
  585. +        FragmentManager fragmentManager = getSupportFragmentManager();
  586. +        FragmentTransaction ft = fragmentManager.beginTransaction();
  587. +        ft.replace(R.id.fragmentFrameLayout, TransactionsFragment.newInstance(), TransactionsFragment.TAG);
  588. +        ft.addToBackStack(TransactionsFragment.TAG);
  589. +        ft.commitAllowingStateLoss();
  590. +    }
  591. +
  592. +    public void showPortfolioFragment() {
  593. +        FragmentManager fragmentManager = getSupportFragmentManager();
  594. +        FragmentTransaction ft = fragmentManager.beginTransaction();
  595. +        ft.replace(R.id.fragmentFrameLayout, PortfolioFragment.newInstance(), PortfolioFragment.TAG);
  596. +        ft.addToBackStack(PortfolioFragment.TAG);
  597. +        ft.commitAllowingStateLoss();
  598.      }
  599. +
  600. +    public void showOpenOrdersFragment() {
  601. +        FragmentManager fragmentManager = getSupportFragmentManager();
  602. +        FragmentTransaction ft = fragmentManager.beginTransaction();
  603. +        ft.replace(R.id.fragmentFrameLayout, OpenOrdersFragment.newInstance(), OpenOrdersFragment.TAG);
  604. +        ft.addToBackStack(OpenOrdersFragment.TAG);
  605. +        ft.commitAllowingStateLoss();
  606. +    }
  607. +
  608. +    public void showTradingScheduleFragment() {
  609. +        FragmentManager fragmentManager = getSupportFragmentManager();
  610. +        FragmentTransaction ft = fragmentManager.beginTransaction();
  611. +        ft.replace(R.id.fragmentFrameLayout, TradingScheduleFragment.newInstance(), TradingScheduleFragment.TAG);
  612. +        ft.addToBackStack(TradingScheduleFragment.TAG);
  613. +        ft.commitAllowingStateLoss();
  614. +    }
  615. +
  616. +
  617.  }
  618. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpButtonActivity.java b/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpButtonActivity.java
  619. new file mode 100644
  620. index 0000000..7e44eee
  621. --- /dev/null
  622. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpButtonActivity.java
  623. @@ -0,0 +1,34 @@
  624. +package com.ngse.ui;
  625. +
  626. +import android.content.Intent;
  627. +import android.os.Bundle;
  628. +import android.support.v7.app.AppCompatActivity;
  629. +
  630. +
  631. +
  632. +import org.evrazcoin.evrazwallet.R;
  633. +
  634. +/**
  635. + * An example full-screen activity that shows and hides the system UI (i.e.
  636. + * status bar and navigation/system bar) with user interaction.
  637. + */
  638. +public class SignUpButtonActivity extends AppCompatActivity {
  639. +    @Override
  640. +    protected void onCreate(Bundle savedInstanceState) {
  641. +        super.onCreate(savedInstanceState);
  642. +
  643. +        setContentView(R.layout.new_activity_sign_up_button);
  644. +        findViewById(R.id.sign_up_button).setOnClickListener(v -> {
  645. +            Intent intent = new Intent(SignUpButtonActivity.this, SignUpInfoActivity.class);
  646. +            startActivity(intent);
  647. +        });
  648. +
  649. +        findViewById(R.id.buttonLogin).setOnClickListener(v -> {
  650. +            Intent intent = new Intent(SignUpButtonActivity.this, ImportActivty.class);
  651. +            intent.putExtra("model", ImportActivty.ACCOUNT_MODEL);
  652. +            startActivity(intent);
  653. +     /*       Intent intent = new Intent(SignUpButtonActivity.this, ModelSelectActivity.class);
  654. +            startActivity(intent);*/
  655. +        });
  656. +    }
  657. +}
  658. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpInfoActivity.java b/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpInfoActivity.java
  659. new file mode 100644
  660. index 0000000..23848f5
  661. --- /dev/null
  662. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/SignUpInfoActivity.java
  663. @@ -0,0 +1,32 @@
  664. +package com.ngse.ui;
  665. +
  666. +import android.content.Intent;
  667. +import android.os.Bundle;
  668. +import android.support.v7.app.AppCompatActivity;
  669. +import android.support.v7.widget.Toolbar;
  670. +
  671. +import org.evrazcoin.evrazwallet.R;
  672. +
  673. +
  674. +public class SignUpInfoActivity extends AppCompatActivity {
  675. +    private Toolbar mToolbar;
  676. +
  677. +    @Override
  678. +    protected void onCreate(Bundle savedInstanceState) {
  679. +        super.onCreate(savedInstanceState);
  680. +
  681. +        setContentView(R.layout.new_activity_sign_up_info);
  682. +        mToolbar = findViewById(R.id.toolbar);
  683. +        setSupportActionBar(mToolbar);
  684. +        mToolbar.setNavigationOnClickListener(v -> onBackPressed());
  685. +        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  686. +        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  687. +
  688. +        findViewById(R.id.sign_up_next).setOnClickListener(v -> {
  689. +            Intent intent = new Intent(SignUpInfoActivity.this, CreateAccountActivity.class);
  690. +            startActivity(intent);
  691. +        });
  692. +
  693. +
  694. +    }
  695. +}
  696. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/custom/CustomListPreference.java b/evraz-wallet/app/src/main/java/com/ngse/ui/custom/CustomListPreference.java
  697. new file mode 100644
  698. index 0000000..dd2894f
  699. --- /dev/null
  700. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/custom/CustomListPreference.java
  701. @@ -0,0 +1,37 @@
  702. +package com.ngse.ui.custom;
  703. +
  704. +import java.util.ArrayList;
  705. +
  706. +import android.content.Context;
  707. +import android.content.DialogInterface;
  708. +import android.content.SharedPreferences;
  709. +import android.content.res.TypedArray;
  710. +import android.graphics.Color;
  711. +
  712. +
  713. +import android.support.v7.preference.ListPreference;
  714. +import android.util.AttributeSet;
  715. +import android.view.ContextThemeWrapper;
  716. +
  717. +
  718. +public class CustomListPreference extends ListPreference {
  719. +    private static int[] ATTRS = {android.R.attr.theme};
  720. +    private ContextThemeWrapper mContextWrapper;
  721. +
  722. +
  723. +    public CustomListPreference(Context context) {
  724. +        this(context, null);
  725. +    }
  726. +
  727. +    public CustomListPreference(Context context, AttributeSet attrs) {
  728. +        super(context, attrs);
  729. +        TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
  730. +        mContextWrapper = new ContextThemeWrapper(context, a.getResourceId(0, 0));
  731. +        a.recycle();
  732. +    }
  733. +
  734. +    @Override
  735. +    public Context getContext() {
  736. +        return mContextWrapper;
  737. +    }
  738. +}
  739. \ No newline at end of file
  740. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/WalletFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/BalanceFragment.java
  741. similarity index 55%
  742. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/WalletFragment.java
  743. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/BalanceFragment.java
  744. index e3533c7..32f0344 100644
  745. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/WalletFragment.java
  746. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/BalanceFragment.java
  747. @@ -1,104 +1,47 @@
  748. -package com.bitshares.bitshareswallet;
  749. +package com.ngse.ui.main;
  750.  
  751.  import android.arch.lifecycle.ViewModelProviders;
  752.  import android.content.Context;
  753.  import android.content.DialogInterface;
  754. -import android.content.Intent;
  755. -import android.content.res.Resources;
  756.  import android.net.Uri;
  757.  import android.os.Bundle;
  758. -import android.os.Handler;
  759. -import android.support.design.widget.TabLayout;
  760. -import android.support.v4.app.Fragment;
  761. -import android.support.v4.view.ViewPager;
  762.  import android.support.v7.app.AlertDialog;
  763. -import android.text.TextUtils;
  764.  import android.view.LayoutInflater;
  765.  import android.view.View;
  766.  import android.view.ViewGroup;
  767.  import android.widget.TextView;
  768.  
  769. +import com.bitshares.bitshareswallet.BaseFragment;
  770.  import com.bitshares.bitshareswallet.room.BitsharesBalanceAsset;
  771.  import com.bitshares.bitshareswallet.viewmodel.WalletViewModel;
  772. +import com.ngse.ui.NewMainActivity;
  773. +
  774. +import org.evrazcoin.evrazwallet.R;
  775.  
  776.  import java.util.List;
  777.  import java.util.Locale;
  778.  
  779.  import butterknife.BindView;
  780.  import butterknife.ButterKnife;
  781. +import butterknife.OnClick;
  782.  
  783.  
  784. -/**
  785. - * A simple {@link Fragment} subclass.
  786. - * Activities that contain this fragment must implement the
  787. - * {@link OnFragmentInteractionListener} interface
  788. - * to handle interaction events.
  789. - * Use the {@link WalletFragment#newInstance} factory method to
  790. - * create an instance of this fragment.
  791. - */
  792. -public class WalletFragment extends BaseFragment {
  793. -    // TODO: Rename parameter arguments, choose names that match
  794. -    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  795. -    private static final String ARG_PARAM1 = "param1";
  796. -    private static final String ARG_PARAM2 = "param2";
  797. -
  798. -    // TODO: Rename and change types of parameters
  799. -    private String mParam1;
  800. -    private String mParam2;
  801. +public class BalanceFragment extends BaseFragment {
  802. +    public static final String TAG = BalanceFragment.class.getName();
  803.  
  804.      private OnFragmentInteractionListener mListener;
  805.  
  806. -    private BtsFragmentPageAdapter mWalletFragmentPageAdapter;
  807. -    private Handler mHandler = new Handler();
  808.  
  809. -    private SendFragment mSendFragment;
  810. -
  811. -    @BindView(R.id.fw_viewPager) ViewPager mViewPager;
  812. -    @BindView(R.id.tabLayout) TabLayout mTabLayout;
  813. -    @BindView(R.id.textTotalBalance) TextView textViewBalances;
  814. -    @BindView(R.id.textViewCurrency) TextView textViewCurency;
  815. -
  816. -    public WalletFragment() {
  817. -        // Required empty public constructor
  818. -    }
  819. +    @BindView(R.id.textTotalBalance)
  820. +    TextView textViewBalances;
  821. +    @BindView(R.id.textViewCurrency)
  822. +    TextView textViewCurency;
  823.  
  824. -    public void onNewIntent(Intent intent){
  825. -        String strAction = intent.getStringExtra("action");
  826. -        if (TextUtils.isEmpty(strAction) == false) {
  827. -            mViewPager.setCurrentItem(2);
  828. -            String strName = intent.getStringExtra("name");
  829. -            int nAmount = Integer.valueOf(intent.getStringExtra("amount"));
  830. -            String strUnit = intent.getStringExtra("unit");
  831. -            mSendFragment.processDonate(strName, nAmount, strUnit);
  832. -        }
  833. -    }
  834.  
  835. -    /**
  836. -     * Use this factory method to create a new instance of
  837. -     * this fragment using the provided parameters.
  838. -     *
  839. -     * @param param1 Parameter 1.
  840. -     * @param param2 Parameter 2.
  841. -     * @return A new instance of fragment WalletFragment.
  842. -     */
  843. -    // TODO: Rename and change types and number of parameters
  844. -    public static WalletFragment newInstance(String param1, String param2) {
  845. -        WalletFragment fragment = new WalletFragment();
  846. -        Bundle args = new Bundle();
  847. -        args.putString(ARG_PARAM1, param1);
  848. -        args.putString(ARG_PARAM2, param2);
  849. -        fragment.setArguments(args);
  850. -        return fragment;
  851. +    public static BalanceFragment newInstance() {
  852. +        return new BalanceFragment();
  853.      }
  854.  
  855. -    @Override
  856. -    public void onCreate(Bundle savedInstanceState) {
  857. -        super.onCreate(savedInstanceState);
  858. -        if (getArguments() != null) {
  859. -            mParam1 = getArguments().getString(ARG_PARAM1);
  860. -            mParam2 = getArguments().getString(ARG_PARAM2);
  861. -        }
  862. -    }
  863.  
  864.      @Override
  865.      public void onResume() {
  866. @@ -163,12 +106,10 @@ public class WalletFragment extends BaseFragment {
  867.          String strTotalBalance = String.format(Locale.ENGLISH, "%d %s", totalBTS, "BTS");
  868.          textViewBalances.setText(strTotalBalance);
  869.          textViewCurency.setVisibility(View.VISIBLE);
  870. -
  871. -        mWalletFragmentPageAdapter.notifyUpdate();
  872.      }
  873.  
  874.      void processError() {
  875. -        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  876. +        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CustomDialogTheme);
  877.          builder.setPositiveButton(R.string.connect_fail_dialog_retry, new DialogInterface.OnClickListener() {
  878.              @Override
  879.              public void onClick(DialogInterface dialog, int which) {
  880. @@ -183,41 +124,27 @@ public class WalletFragment extends BaseFragment {
  881.      @Override
  882.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  883.                               Bundle savedInstanceState) {
  884. -        View view = inflater.inflate(R.layout.fragment_wallet, container, false);
  885. +        View view = inflater.inflate(R.layout.new_fragment_balance, container, false);
  886.          ButterKnife.bind(this, view);
  887. -        Resources res = getResources();
  888. -        mWalletFragmentPageAdapter = new BtsFragmentPageAdapter(getFragmentManager());
  889. -        mWalletFragmentPageAdapter.addFragment(BalancesFragment.newInstance("", ""), res.getString(R.string.tab_balances));
  890. -        mWalletFragmentPageAdapter.addFragment(TransactionsFragment.newInstance("", ""), res.getString(R.string.tab_transactions));
  891. -        mSendFragment = SendFragment.newInstance("", "");
  892. -        mWalletFragmentPageAdapter.addFragment(mSendFragment, res.getString(R.string.tab_send));
  893. -
  894. -        mViewPager.setAdapter(mWalletFragmentPageAdapter);
  895. -        initPager(mViewPager, mWalletFragmentPageAdapter);
  896. -
  897. -        mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
  898. -            @Override
  899. -            public void onTabSelected(TabLayout.Tab tab) {
  900. -                mViewPager.setCurrentItem(tab.getPosition());
  901. -                if (tab.getPosition() != 2) {
  902. -                    MainActivity.hideSoftKeyboard(mTabLayout, getActivity());
  903. -                }
  904. +        return view;
  905.      }
  906.  
  907. -            @Override
  908. -            public void onTabUnselected(TabLayout.Tab tab) {
  909. -
  910. +    @OnClick(R.id.portfolio)
  911. +    void portfolioClick() {
  912. +        ((NewMainActivity) getActivity()).showPortfolioFragment();
  913.      }
  914.  
  915. -            @Override
  916. -            public void onTabReselected(TabLayout.Tab tab) {
  917. -
  918. +    @OnClick(R.id.openOrders)
  919. +    void openOrdersClick() {
  920. +        ((NewMainActivity) getActivity()).showOpenOrdersFragment();
  921.      }
  922. -        });
  923. -        mTabLayout.setupWithViewPager(mViewPager);
  924. -        return view;
  925. +
  926. +    @OnClick(R.id.transactions)
  927. +    void transactionsClick() {
  928. +        ((NewMainActivity) getActivity()).showTransactionsFragment();
  929.      }
  930.  
  931. +
  932.      // TODO: Rename method, update argument and hook method into UI event
  933.      public void onButtonPressed(Uri uri) {
  934.          if (mListener != null) {
  935. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/main/ExchangeFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/ExchangeFragment.java
  936. new file mode 100644
  937. index 0000000..5e45275
  938. --- /dev/null
  939. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/ExchangeFragment.java
  940. @@ -0,0 +1,114 @@
  941. +package com.ngse.ui.main;
  942. +
  943. +import android.arch.lifecycle.ViewModelProviders;
  944. +import android.os.Bundle;
  945. +import android.support.v7.widget.LinearLayoutManager;
  946. +import android.support.v7.widget.RecyclerView;
  947. +import android.util.Pair;
  948. +import android.view.LayoutInflater;
  949. +import android.view.View;
  950. +import android.view.ViewGroup;
  951. +
  952. +import com.bitshares.bitshareswallet.BaseFragment;
  953. +import com.bitshares.bitshareswallet.market.MarketTicker;
  954. +import com.bitshares.bitshareswallet.viewmodel.QuotationViewModel;
  955. +import com.ngse.ui.NewMainActivity;
  956. +
  957. +import org.evrazcoin.evrazwallet.R;
  958. +
  959. +import butterknife.BindView;
  960. +import butterknife.ButterKnife;
  961. +
  962. +public class ExchangeFragment extends BaseFragment {
  963. +    private static final String TAG = "QuotationFragment";
  964. +
  965. +    private QuotationCurrencyPairAdapter quotationCurrencyPairAdapter;
  966. +
  967. +    @BindView(R.id.recyclerView)
  968. +    RecyclerView mRecyclerView;
  969. +
  970. +
  971. +    public ExchangeFragment() {
  972. +
  973. +    }
  974. +
  975. +
  976. +    @Override
  977. +    public void onCreate(Bundle savedInstanceState) {
  978. +        super.onCreate(savedInstanceState);
  979. +    }
  980. +
  981. +    public static ExchangeFragment newInstance() {
  982. +        ExchangeFragment fragment = new ExchangeFragment();
  983. +        return fragment;
  984. +    }
  985. +
  986. +    @Override
  987. +    public View onCreateView(LayoutInflater inflater, ViewGroup container,
  988. +                             Bundle savedInstanceState) {
  989. +        View view = inflater.inflate(R.layout.new_fragment_exchange, container, false);
  990. +        ButterKnife.bind(this, view);
  991. +
  992. +        quotationCurrencyPairAdapter = new QuotationCurrencyPairAdapter(getActivity());
  993. +        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
  994. +        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  995. +        mRecyclerView.setLayoutManager(linearLayoutManager);
  996. +        mRecyclerView.setAdapter(quotationCurrencyPairAdapter);
  997. +        mRecyclerView.setItemAnimator(null);
  998. +
  999. +
  1000. +        QuotationViewModel viewModel = ViewModelProviders.of(getActivity()).get(QuotationViewModel.class);
  1001. +        quotationCurrencyPairAdapter.setOnItemClickListenr(new QuotationCurrencyPairAdapter.OnItemClickListner() {
  1002. +            @Override
  1003. +            public void onItemClick(View view, int position) {
  1004. +                //mListener.notifyCurrencyPairChange();
  1005. +                if (quotationCurrencyPairAdapter.getSelectedMarketTicker() != null) {
  1006. +                    MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  1007. +                    viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  1008. +                    ((NewMainActivity) getActivity()).showTradingScheduleFragment();
  1009. +                }
  1010. +
  1011. +            }
  1012. +        });
  1013. +
  1014. +        return view;
  1015. +    }
  1016. +
  1017. +
  1018. +    @Override
  1019. +    public void onShow() {
  1020. +        super.onShow();
  1021. +
  1022. +        QuotationViewModel viewModel = ViewModelProviders.of(getActivity()).get(QuotationViewModel.class);
  1023. +        viewModel.getMarketTicker().observe(
  1024. +                this,
  1025. +                marketTickerListResource -> {
  1026. +                    switch (marketTickerListResource.status) {
  1027. +                        case ERROR:
  1028. +                            break;
  1029. +                        case LOADING:
  1030. +                            if (marketTickerListResource.data != null && marketTickerListResource.data.size() != 0) {
  1031. +                                quotationCurrencyPairAdapter.notifyDataUpdated(marketTickerListResource.data);
  1032. +                                MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  1033. +                                viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  1034. +                            }
  1035. +                            break;
  1036. +                        case SUCCESS:
  1037. +                            quotationCurrencyPairAdapter.notifyDataUpdated(marketTickerListResource.data);
  1038. +                            MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  1039. +                            viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  1040. +                            break;
  1041. +                    }
  1042. +                });
  1043. +
  1044. +
  1045. +        viewModel.getSelectedMarketTicker().observe(this, currencyPair -> quotationCurrencyPairAdapter.notifyDataSetChanged());
  1046. +    }
  1047. +
  1048. +    @Override
  1049. +    public void onHide() {
  1050. +        super.onHide();
  1051. +    }
  1052. +
  1053. +
  1054. +}
  1055. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/main/MainWalletFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/MainWalletFragment.java
  1056. new file mode 100644
  1057. index 0000000..dc57e4c
  1058. --- /dev/null
  1059. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/MainWalletFragment.java
  1060. @@ -0,0 +1,161 @@
  1061. +package com.ngse.ui.main;
  1062. +
  1063. +import android.content.Context;
  1064. +import android.content.Intent;
  1065. +import android.content.res.Resources;
  1066. +import android.net.Uri;
  1067. +import android.os.Bundle;
  1068. +import android.support.v4.app.Fragment;
  1069. +import android.support.v4.view.ViewPager;
  1070. +import android.text.TextUtils;
  1071. +import android.view.LayoutInflater;
  1072. +import android.view.View;
  1073. +import android.view.ViewGroup;
  1074. +import android.widget.RadioGroup;
  1075. +
  1076. +import com.bitshares.bitshareswallet.BaseFragment;
  1077. +import com.bitshares.bitshareswallet.BtsFragmentPageAdapter;
  1078. +import com.bitshares.bitshareswallet.TransactionsFragment;
  1079. +
  1080. +import org.evrazcoin.evrazwallet.R;
  1081. +
  1082. +import butterknife.BindView;
  1083. +import butterknife.ButterKnife;
  1084. +
  1085. +
  1086. +/**
  1087. + * A simple {@link Fragment} subclass.
  1088. + * Activities that contain this fragment must implement the
  1089. + * {@link OnFragmentInteractionListener} interface
  1090. + * to handle interaction events.
  1091. + * Use the {@link MainWalletFragment#newInstance} factory method to
  1092. + * create an instance of this fragment.
  1093. + */
  1094. +public class MainWalletFragment extends BaseFragment {
  1095. +    public static final String TAG = MainWalletFragment.class.getName();
  1096. +
  1097. +
  1098. +    private OnFragmentInteractionListener mListener;
  1099. +
  1100. +    private BtsFragmentPageAdapter mWalletFragmentPageAdapter;
  1101. +
  1102. +    private SendFragment mSendFragment;
  1103. +
  1104. +    @BindView(R.id.fw_viewPager)
  1105. +    ViewPager mViewPager;
  1106. +    @BindView(R.id.viewPagerSwitcher)
  1107. +    RadioGroup viewPagerSwitcher;
  1108. +
  1109. +
  1110. +    public MainWalletFragment() {
  1111. +        // Required empty public constructor
  1112. +    }
  1113. +
  1114. +    public void onNewIntent(Intent intent) {
  1115. +        String strAction = intent.getStringExtra("action");
  1116. +        if (TextUtils.isEmpty(strAction) == false) {
  1117. +//            mViewPager.setCurrentItem(1);
  1118. +            viewPagerSwitcher.check(R.id.sendButton);
  1119. +            String strName = intent.getStringExtra("name");
  1120. +            int nAmount = Integer.valueOf(intent.getStringExtra("amount"));
  1121. +            String strUnit = intent.getStringExtra("unit");
  1122. +            mSendFragment.processDonate(strName, nAmount, strUnit);
  1123. +        }
  1124. +    }
  1125. +
  1126. +    public static MainWalletFragment newInstance() {
  1127. +        return new MainWalletFragment();
  1128. +    }
  1129. +
  1130. +
  1131. +    @Override
  1132. +    public void onResume() {
  1133. +        super.onResume();
  1134. +
  1135. +
  1136. +    }
  1137. +
  1138. +    @Override
  1139. +    public void onShow() {
  1140. +        super.onShow();
  1141. +    }
  1142. +
  1143. +    @Override
  1144. +    public void onHide() {
  1145. +        super.onHide();
  1146. +    }
  1147. +
  1148. +
  1149. +
  1150. +
  1151. +    @Override
  1152. +    public View onCreateView(LayoutInflater inflater, ViewGroup container,
  1153. +                             Bundle savedInstanceState) {
  1154. +        View view = inflater.inflate(R.layout.new_fragment_wallet, container, false);
  1155. +        ButterKnife.bind(this, view);
  1156. +        Resources res = getResources();
  1157. +        mWalletFragmentPageAdapter = new BtsFragmentPageAdapter(getFragmentManager());
  1158. +        mWalletFragmentPageAdapter.addFragment(BalanceFragment.newInstance(), res.getString(R.string.tab_balances));
  1159. +        mSendFragment = SendFragment.newInstance("", "");
  1160. +        mWalletFragmentPageAdapter.addFragment(mSendFragment, res.getString(R.string.tab_send));
  1161. +        mWalletFragmentPageAdapter.addFragment(ExchangeFragment.newInstance(), res.getString(R.string.tab_transactions));
  1162. +//        mWalletFragmentPageAdapter.addFragment(TransactionsFragment.newInstance("", ""), res.getString(R.string.tab_transactions));
  1163. +
  1164. +
  1165. +        mViewPager.setAdapter(mWalletFragmentPageAdapter);
  1166. +        initPager(mViewPager, mWalletFragmentPageAdapter);
  1167. +        viewPagerSwitcher.setOnCheckedChangeListener((group, checkedId) -> {
  1168. +            switch (checkedId) {
  1169. +                case R.id.balanceButton:
  1170. +                    mViewPager.setCurrentItem(0);
  1171. +                    break;
  1172. +                case R.id.sendButton:
  1173. +                    mViewPager.setCurrentItem(1);
  1174. +                    break;
  1175. +                case R.id.exchangeButton:
  1176. +                    mViewPager.setCurrentItem(2);
  1177. +                    break;
  1178. +            }
  1179. +        });
  1180. +        return view;
  1181. +    }
  1182. +
  1183. +    // TODO: Rename method, update argument and hook method into UI event
  1184. +    public void onButtonPressed(Uri uri) {
  1185. +        if (mListener != null) {
  1186. +            mListener.onFragmentInteraction(uri);
  1187. +        }
  1188. +    }
  1189. +
  1190. +    @Override
  1191. +    public void onAttach(Context context) {
  1192. +        super.onAttach(context);
  1193. +        if (context instanceof OnFragmentInteractionListener) {
  1194. +            mListener = (OnFragmentInteractionListener) context;
  1195. +        } else {
  1196. +//            throw new RuntimeException(context.toString()
  1197. +//                    + " must implement OnFragmentInteractionListener");
  1198. +        }
  1199. +    }
  1200. +
  1201. +    @Override
  1202. +    public void onDetach() {
  1203. +        super.onDetach();
  1204. +        mListener = null;
  1205. +    }
  1206. +
  1207. +    /**
  1208. +     * This interface must be implemented by activities that contain this
  1209. +     * fragment to allow an interaction in this fragment to be communicated
  1210. +     * to the activity and potentially other fragments contained in that
  1211. +     * activity.
  1212. +     * <p>
  1213. +     * See the Android Training lesson <a href=
  1214. +     * "http://developer.android.com/training/basics/fragments/communicating.html"
  1215. +     * >Communicating with Other Fragments</a> for more information.
  1216. +     */
  1217. +    public interface OnFragmentInteractionListener {
  1218. +        // TODO: Update argument type and name
  1219. +        void onFragmentInteraction(Uri uri);
  1220. +    }
  1221. +}
  1222. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationCurrencyPairAdapter.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/QuotationCurrencyPairAdapter.java
  1223. similarity index 92%
  1224. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationCurrencyPairAdapter.java
  1225. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/QuotationCurrencyPairAdapter.java
  1226. index 1ba06cd..c60510c 100644
  1227. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationCurrencyPairAdapter.java
  1228. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/QuotationCurrencyPairAdapter.java
  1229. @@ -1,4 +1,4 @@
  1230. -package com.bitshares.bitshareswallet;
  1231. +package com.ngse.ui.main;
  1232.  
  1233.  import android.content.Context;
  1234.  import android.content.SharedPreferences;
  1235. @@ -10,9 +10,13 @@ import android.view.ViewGroup;
  1236.  import android.widget.ImageView;
  1237.  import android.widget.TextView;
  1238.  
  1239. +
  1240.  import com.bitshares.bitshareswallet.market.MarketTicker;
  1241.  import com.bitshares.bitshareswallet.room.BitsharesMarketTicker;
  1242.  import com.bitshares.bitshareswallet.wallet.graphene.chain.utils;
  1243. +import com.ngse.ui.NewMainActivity;
  1244. +
  1245. +import org.evrazcoin.evrazwallet.R;
  1246.  
  1247.  import java.text.DecimalFormat;
  1248.  import java.util.ArrayList;
  1249. @@ -25,9 +29,6 @@ import java.util.Locale;
  1250.  import java.util.Map;
  1251.  import java.util.Set;
  1252.  
  1253. -/**
  1254. - * Created by lorne on 22/09/2017.
  1255. - */
  1256.  
  1257.  public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<QuotationCurrencyPairAdapter.ViewHolder> {
  1258.      public interface OnItemClickListner {
  1259. @@ -36,7 +37,7 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1260.  
  1261.      public class ViewHolder extends RecyclerView.ViewHolder {
  1262.          private View mView;
  1263. -        private View mViewSelected;
  1264. +//        private View mViewSelected;
  1265.          private ImageView mCurrencyIconView;
  1266.          private TextView mViewCurrencyPair;
  1267.          private TextView mViewPrice;
  1268. @@ -45,7 +46,7 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1269.          public ViewHolder(View itemView) {
  1270.              super(itemView);
  1271.              mView = itemView;
  1272. -            mViewSelected = mView.findViewById(R.id.viewSelected);
  1273. +//            mViewSelected = mView.findViewById(R.id.viewSelected);
  1274.              mCurrencyIconView = (ImageView) mView.findViewById(R.id.imageViewCurrency);
  1275.              mViewCurrencyPair = (TextView) mView.findViewById(R.id.textViewCurrencyPair);
  1276.              mViewPrice = (TextView) mView.findViewById(R.id.textViewPrice);
  1277. @@ -68,6 +69,7 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1278.          marrValues = context.getResources().getStringArray(R.array.quotation_currency_pair_values);
  1279.          currecnyPairSet.addAll(Arrays.asList(marrValues));
  1280.  
  1281. +        mapSymbol2Id.put("EVRAZ", R.mipmap.evraz);
  1282.          mapSymbol2Id.put("BTS", R.mipmap.bts);
  1283.          mapSymbol2Id.put("BTC", R.mipmap.btc);
  1284.          mapSymbol2Id.put("ETH", R.mipmap.eth);
  1285. @@ -84,7 +86,7 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1286.      @Override
  1287.      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  1288.          View view = LayoutInflater.from(parent.getContext())
  1289. -                .inflate(R.layout.recyclerview_item_currency_pair, parent, false);
  1290. +                .inflate(R.layout.new_recyclerview_item_currency_pair, parent, false);
  1291.          return new ViewHolder(view);
  1292.      }
  1293.  
  1294. @@ -92,11 +94,11 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1295.      public void onBindViewHolder(final ViewHolder holder, final int position) {
  1296.          BitsharesMarketTicker bitsharesMarketTicker = bitsharesMarketTickerList.get(position);
  1297.  
  1298. -        if (selected == position) {
  1299. +      /*  if (selected == position) {
  1300.              holder.mViewSelected.setVisibility(View.VISIBLE);
  1301.          } else {
  1302.              holder.mViewSelected.setVisibility(View.INVISIBLE);
  1303. -        }
  1304. +        }*/
  1305.  
  1306.          MarketTicker marketTicker = bitsharesMarketTicker.marketTicker;
  1307.          String currencyPair = utils.getAssetSymbolDisply(marketTicker.quote) + " : " +
  1308. @@ -122,10 +124,10 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1309.  
  1310.          String strPercentChange;
  1311.          if (percent_change >= 0) {
  1312. -            if (!MainActivity.rasingColorRevers) {
  1313. -                holder.mView24h.setBackgroundResource(R.drawable.percent_change_background_green);
  1314. +            if (!NewMainActivity.rasingColorRevers) {
  1315. +                holder.mView24h.setBackgroundResource(R.drawable.oval_green_background);
  1316.              } else {
  1317. -                holder.mView24h.setBackgroundResource(R.drawable.percent_change_background_red);
  1318. +                holder.mView24h.setBackgroundResource(R.drawable.oval_red_background);
  1319.              }
  1320.              strPercentChange = String.format(
  1321.                      Locale.ENGLISH,
  1322. @@ -133,10 +135,10 @@ public class QuotationCurrencyPairAdapter extends RecyclerView.Adapter<Quotation
  1323.                      percent_change
  1324.              );
  1325.          } else {
  1326. -            if (!MainActivity.rasingColorRevers) {
  1327. -                holder.mView24h.setBackgroundResource(R.drawable.percent_change_background_red);
  1328. +            if (!NewMainActivity.rasingColorRevers) {
  1329. +                holder.mView24h.setBackgroundResource(R.drawable.oval_red_background);
  1330.              } else {
  1331. -                holder.mView24h.setBackgroundResource(R.drawable.percent_change_background_green);
  1332. +                holder.mView24h.setBackgroundResource(R.drawable.oval_green_background);
  1333.              }
  1334.              strPercentChange = String.format(
  1335.                      Locale.ENGLISH,
  1336. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/SendFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/SendFragment.java
  1337. similarity index 94%
  1338. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/SendFragment.java
  1339. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/SendFragment.java
  1340. index 24ebd9f..a995f65 100644
  1341. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/SendFragment.java
  1342. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/SendFragment.java
  1343. @@ -1,4 +1,4 @@
  1344. -package com.bitshares.bitshareswallet;
  1345. +package com.ngse.ui.main;
  1346.  
  1347.  import android.app.Activity;
  1348.  import android.arch.lifecycle.ViewModelProviders;
  1349. @@ -25,6 +25,9 @@ import android.widget.Spinner;
  1350.  import android.widget.TextView;
  1351.  import android.widget.Toast;
  1352.  
  1353. +import com.bitshares.bitshareswallet.BaseFragment;
  1354. +import com.bitshares.bitshareswallet.BitsharesApplication;
  1355. +import com.bitshares.bitshareswallet.OnFragmentInteractionListener;
  1356.  import com.bitshares.bitshareswallet.room.BitsharesAssetObject;
  1357.  import com.bitshares.bitshareswallet.room.BitsharesBalanceAsset;
  1358.  import com.bitshares.bitshareswallet.viewmodel.SendViewModel;
  1359. @@ -39,6 +42,8 @@ import com.bitshares.bitshareswallet.wallet.graphene.chain.signed_transaction;
  1360.  import com.bituniverse.utils.NumericUtil;
  1361.  import com.kaopiz.kprogresshud.KProgressHUD;
  1362.  
  1363. +import org.evrazcoin.evrazwallet.R;
  1364. +
  1365.  import java.util.ArrayList;
  1366.  import java.util.List;
  1367.  import java.util.Locale;
  1368. @@ -60,16 +65,11 @@ import io.reactivex.schedulers.Schedulers;
  1369.   * create an instance of this fragment.
  1370.   */
  1371.  public class SendFragment extends BaseFragment {
  1372. -    // TODO: Rename parameter arguments, choose names that match
  1373. -    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  1374. -    private static final String ARG_PARAM1 = "param1";
  1375. -    private static final String ARG_PARAM2 = "param2";
  1376. +
  1377.      private KProgressHUD mProcessHud;
  1378.      private Spinner mSpinner;
  1379.  
  1380. -    // TODO: Rename and change types of parameters
  1381. -    private String mParam1;
  1382. -    private String mParam2;
  1383. +
  1384.  
  1385.      private OnFragmentInteractionListener mListener;
  1386.  
  1387. @@ -95,28 +95,14 @@ public class SendFragment extends BaseFragment {
  1388.       */
  1389.      // TODO: Rename and change types and number of parameters
  1390.      public static SendFragment newInstance(String param1, String param2) {
  1391. -        SendFragment fragment = new SendFragment();
  1392. -        Bundle args = new Bundle();
  1393. -        args.putString(ARG_PARAM1, param1);
  1394. -        args.putString(ARG_PARAM2, param2);
  1395. -        fragment.setArguments(args);
  1396. -        return fragment;
  1397. -    }
  1398. -
  1399. -    @Override
  1400. -    public void onCreate(Bundle savedInstanceState) {
  1401. -        super.onCreate(savedInstanceState);
  1402. -        if (getArguments() != null) {
  1403. -            mParam1 = getArguments().getString(ARG_PARAM1);
  1404. -            mParam2 = getArguments().getString(ARG_PARAM2);
  1405. -        }
  1406. +        return new SendFragment();
  1407.      }
  1408.  
  1409.      @Override
  1410.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  1411.                               Bundle savedInstanceState) {
  1412.          // Inflate the layout for this fragment
  1413. -        mView = inflater.inflate(R.layout.fragment_send, container, false);
  1414. +        mView = inflater.inflate(R.layout.new_fragment_send, container, false);
  1415.          ButterKnife.bind(this, mView);
  1416.  
  1417.          EditText editTextFrom = (EditText)mView.findViewById(R.id.editTextFrom);
  1418. @@ -215,11 +201,11 @@ public class SendFragment extends BaseFragment {
  1419.  
  1420.                  ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
  1421.                          getActivity(),
  1422. -                        android.R.layout.simple_spinner_item,
  1423. +                        R.layout.new_custom_spinner_item,
  1424.                          symbolList
  1425.                  );
  1426.  
  1427. -                arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  1428. +                arrayAdapter.setDropDownViewResource(R.layout.new_spinner_style);
  1429.                  mSpinner.setAdapter(arrayAdapter);
  1430.              }
  1431.          });
  1432. @@ -502,12 +488,12 @@ public class SendFragment extends BaseFragment {
  1433.  
  1434.          ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
  1435.                  getActivity(),
  1436. -                android.R.layout.simple_spinner_item,
  1437. +                R.layout.new_custom_spinner_item,
  1438.                  listSymbols
  1439.          );
  1440.  
  1441.          if (mSpinner != null) {
  1442. -            arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  1443. +            arrayAdapter.setDropDownViewResource(R.layout.new_spinner_style);
  1444.              spinner.setAdapter(arrayAdapter);
  1445.          }
  1446.      }
  1447. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/OrdersFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/OpenOrdersFragment.java
  1448. similarity index 66%
  1449. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/OrdersFragment.java
  1450. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/OpenOrdersFragment.java
  1451. index 85a4349..00b92b8 100644
  1452. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/OrdersFragment.java
  1453. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/OpenOrdersFragment.java
  1454. @@ -1,4 +1,4 @@
  1455. -package com.bitshares.bitshareswallet;
  1456. +package com.ngse.ui.main.balanceitems;
  1457.  
  1458.  import android.content.BroadcastReceiver;
  1459.  import android.content.Context;
  1460. @@ -15,11 +15,18 @@ import android.support.v7.widget.LinearLayoutManager;
  1461.  import android.support.v7.widget.RecyclerView;
  1462.  import android.util.Log;
  1463.  import android.view.LayoutInflater;
  1464. +import android.view.Menu;
  1465. +import android.view.MenuInflater;
  1466. +import android.view.MenuItem;
  1467.  import android.view.View;
  1468.  import android.view.ViewGroup;
  1469. +import android.widget.ImageView;
  1470.  import android.widget.TextView;
  1471.  import android.widget.Toast;
  1472.  
  1473. +import com.bitshares.bitshareswallet.BaseFragment;
  1474. +import com.bitshares.bitshareswallet.CancelOrderDialog;
  1475. +import com.bitshares.bitshareswallet.TransactionSellBuyPasswordDialog;
  1476.  import com.bitshares.bitshareswallet.market.MarketStat;
  1477.  import com.bitshares.bitshareswallet.market.OpenOrder;
  1478.  import com.bitshares.bitshareswallet.wallet.BitsharesWalletWraper;
  1479. @@ -28,14 +35,18 @@ import com.bitshares.bitshareswallet.wallet.exception.NetworkStatusException;
  1480.  import com.bitshares.bitshareswallet.wallet.graphene.chain.utils;
  1481.  import com.kaopiz.kprogresshud.KProgressHUD;
  1482.  
  1483. +import org.evrazcoin.evrazwallet.R;
  1484. +
  1485.  import java.text.SimpleDateFormat;
  1486.  import java.util.List;
  1487.  import java.util.Locale;
  1488.  import java.util.concurrent.TimeUnit;
  1489.  
  1490.  
  1491. -public class OrdersFragment extends BaseFragment
  1492. +public class OpenOrdersFragment extends BaseFragment
  1493.          implements MarketStat.OnMarketStatUpdateListener {
  1494. +
  1495. +    public static final String TAG = OpenOrdersFragment.class.getName();
  1496.      private static final long MARKET_STAT_INTERVAL_MILLIS = TimeUnit.SECONDS.toMillis(10);
  1497.  
  1498.      private RecyclerView listOrders;
  1499. @@ -46,7 +57,7 @@ public class OrdersFragment extends BaseFragment
  1500.      private String baseAsset;
  1501.      private String quoteAsset;
  1502.      private KProgressHUD mProcessHud;
  1503. -    private Handler handler = new Handler();
  1504. +//    private MenuItem backMenuItem;
  1505.  
  1506.      private BroadcastReceiver currencyUpdateReceiver = new BroadcastReceiver() {
  1507.          @Override
  1508. @@ -54,7 +65,7 @@ public class OrdersFragment extends BaseFragment
  1509.              marketStat.unsubscribe(baseAsset, quoteAsset);
  1510.              updateCurrency();
  1511.              marketStat.subscribe(baseAsset, quoteAsset, MarketStat.STAT_MARKET_OPEN_ORDER,
  1512. -                    MARKET_STAT_INTERVAL_MILLIS, OrdersFragment.this);
  1513. +                    MARKET_STAT_INTERVAL_MILLIS, OpenOrdersFragment.this);
  1514.          }
  1515.      };
  1516.  
  1517. @@ -62,12 +73,27 @@ public class OrdersFragment extends BaseFragment
  1518.          marketStat.updateImmediately(baseAsset, quoteAsset);
  1519.      }
  1520.  
  1521. -    public OrdersFragment() {
  1522. +    public OpenOrdersFragment() {
  1523.          marketStat = new MarketStat();
  1524.      }
  1525.  
  1526. -    public static OrdersFragment newInstance() {
  1527. -        OrdersFragment fragment = new OrdersFragment();
  1528. +  /*  @Override
  1529. +    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  1530. +        super.onCreateOptionsMenu(menu, inflater);
  1531. +        backMenuItem = menu.add(R.string.back)
  1532. +                .setIcon(R.drawable.abc_ic_ab_back_material)
  1533. +                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
  1534. +    }
  1535. +
  1536. +    @Override
  1537. +    public boolean onOptionsItemSelected(MenuItem item) {
  1538. +        if (item == backMenuItem)
  1539. +            getActivity().onBackPressed();
  1540. +        return super.onOptionsItemSelected(item);
  1541. +    }*/
  1542. +
  1543. +    public static OpenOrdersFragment newInstance() {
  1544. +        OpenOrdersFragment fragment = new OpenOrdersFragment();
  1545.          return fragment;
  1546.      }
  1547.  
  1548. @@ -80,7 +106,7 @@ public class OrdersFragment extends BaseFragment
  1549.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  1550.                               Bundle savedInstanceState) {
  1551.  
  1552. -        View view = inflater.inflate(R.layout.fragment_orders, container, false);
  1553. +        View view = inflater.inflate(R.layout.new_fragment_orders, container, false);
  1554.  
  1555.          adapterOrders = new OrderListAdapter();
  1556.  
  1557. @@ -101,6 +127,12 @@ public class OrdersFragment extends BaseFragment
  1558.          return view;
  1559.      }
  1560.  
  1561. +    @Override
  1562. +    public void onResume() {
  1563. +        super.onResume();
  1564. +        onShow();
  1565. +    }
  1566. +
  1567.      @Override
  1568.      public void onShow() {
  1569.          super.onShow();
  1570. @@ -158,10 +190,11 @@ public class OrdersFragment extends BaseFragment
  1571.  
  1572.      class OrderListAdapter extends RecyclerView.Adapter<OrderViewHolder> {
  1573.          List<OpenOrder> listOrders;
  1574. +
  1575.          @Override
  1576.          public OrderViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  1577.              View view = LayoutInflater.from(
  1578. -                    parent.getContext()).inflate(R.layout.view_my_order_item, parent, false);
  1579. +                    parent.getContext()).inflate(R.layout.new_view_my_order_item, parent, false);
  1580.              return new OrderViewHolder(view);
  1581.          }
  1582.  
  1583. @@ -182,61 +215,62 @@ public class OrdersFragment extends BaseFragment
  1584.      }
  1585.  
  1586.      class OrderViewHolder extends RecyclerView.ViewHolder {
  1587. -        TextView txtExpiration;
  1588. -        TextView txtCacel;
  1589. +
  1590. +        ImageView imageCacel;
  1591.          TextView txtOperation;
  1592.          TextView txtPrice;
  1593. -        TextView txtSrcCoin;
  1594. -        TextView txtSrcCoinName;
  1595. -        TextView txtTargetCoin;
  1596. -        TextView txtTargetCoinName;
  1597. +//        TextView txtPriceUsd;
  1598.  
  1599.          OpenOrder order;
  1600.  
  1601.          public OrderViewHolder(View itemView) {
  1602.              super(itemView);
  1603. +            imageCacel = itemView.findViewById(R.id.voi_cacel);
  1604.  
  1605. -            txtExpiration = (TextView)itemView.findViewById(R.id.voi_txt_expiration);
  1606. -            txtCacel = (TextView)itemView.findViewById(R.id.voi_txt_cacel);
  1607.              txtOperation = (TextView) itemView.findViewById(R.id.voi_txt_operation);
  1608.              txtPrice = (TextView) itemView.findViewById(R.id.voi_txt_price);
  1609. -            txtSrcCoin = (TextView)itemView.findViewById(R.id.voi_txt_src_coin);
  1610. -            txtSrcCoinName = (TextView)itemView.findViewById(R.id.voi_txt_src_coin_name);
  1611. -            txtTargetCoin = (TextView)itemView.findViewById(R.id.voi_txt_target_coin);
  1612. -            txtTargetCoinName = (TextView)itemView.findViewById(R.id.voi_txt_target_coin_name);
  1613. +//            txtPriceUsd = (TextView) itemView.findViewById(R.id.voi_txt_price_usd);
  1614. +
  1615.  
  1616. -            txtCacel.setOnClickListener(onCancelClickListener);
  1617. +            imageCacel.setOnClickListener(onCancelClickListener);
  1618.          }
  1619.  
  1620.          public void update(OpenOrder order) {
  1621. +
  1622. +            String operation;
  1623. +            String firstAmount;
  1624. +            String secondAmount;
  1625. +
  1626.              this.order = order;
  1627. +            String baseCurrency = utils.getAssetSymbolDisply(order.base.symbol);
  1628. +            String quoteCurrency = utils.getAssetSymbolDisply(order.quote.symbol);
  1629.              if (order.limitOrder.sell_price.quote.asset_id.equals(order.quote.id)) {
  1630. -                txtOperation.setText(R.string.label_buy);
  1631. +                operation = txtOperation.getContext().getString(R.string.label_buy);
  1632.                  double buyAmount = utils.get_asset_amount(order.limitOrder.sell_price.quote.amount, order.quote);
  1633. -                txtTargetCoin.setText(String.format("%.6f",buyAmount));
  1634. -
  1635. +                firstAmount = String.format(Locale.ENGLISH, "%.2f %s", buyAmount, quoteCurrency);
  1636.                  double sellAmount = utils.get_asset_amount(order.limitOrder.sell_price.base.amount, order.base);
  1637. -                txtSrcCoin.setText(String.format("%.6f",sellAmount));
  1638. +                secondAmount = String.format(Locale.ENGLISH, "%.2f %s", sellAmount, baseCurrency);
  1639. +
  1640. +              /*  txtOperation.setText(R.string.label_buy);
  1641. +                txtTargetCoin.setText(String.format("%.6f", buyAmount));
  1642. +                txtSrcCoin.setText(String.format("%.6f", sellAmount));*/
  1643.              } else {
  1644. -                txtOperation.setText(R.string.label_sell);
  1645. +                operation = txtOperation.getContext().getString(R.string.label_sell);
  1646.                  double buyAmount = utils.get_asset_amount(order.limitOrder.sell_price.quote.amount, order.base);
  1647. -                txtSrcCoin.setText(String.format("%.6f",buyAmount));
  1648. -
  1649. +                secondAmount = String.format(Locale.ENGLISH, "%.2f %s", buyAmount, baseCurrency);
  1650.                  double sellAmount = utils.get_asset_amount(order.limitOrder.sell_price.base.amount, order.quote);
  1651. -                txtTargetCoin.setText(String.format("%.6f",sellAmount));
  1652. -            }
  1653. +                firstAmount = String.format(Locale.ENGLISH, "%.2f %s", sellAmount, quoteCurrency);
  1654.  
  1655. -            txtPrice.setText(String.format(Locale.ENGLISH,
  1656. -                    "%.6f %s/%s",
  1657. -                    order.price,
  1658. -                    utils.getAssetSymbolDisply(order.base.symbol),
  1659. -                    utils.getAssetSymbolDisply(order.quote.symbol)
  1660. -            ));
  1661. -            //txtSrcCoinName.setText(order.base.symbol);
  1662. -            //txtTargetCoinName.setText(order.quote.symbol);
  1663.  
  1664. -            SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
  1665. -            txtExpiration.setText(formatter.format(order.limitOrder.expiration));
  1666. +               /* txtOperation.setText(R.string.label_sell);
  1667. +                txtSrcCoin.setText(String.format("%.6f", buyAmount));
  1668. +                txtTargetCoin.setText(String.format("%.6f", sellAmount));*/
  1669. +            }
  1670. +            txtOperation.setText(txtOperation.getContext().getString(R.string.buy_string, operation, firstAmount, secondAmount));
  1671. +            txtPrice.setText(String.format(Locale.ENGLISH, "%.4f", order.price));
  1672. +//            txtPriceUsd.setText();
  1673. +           /* SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
  1674. +            txtExpiration.setText(formatter.format(order.limitOrder.expiration));*/
  1675.          }
  1676.  
  1677.          private View.OnClickListener onCancelClickListener = new View.OnClickListener() {
  1678. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/BalancesFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/PortfolioFragment.java
  1679. similarity index 56%
  1680. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/BalancesFragment.java
  1681. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/PortfolioFragment.java
  1682. index 28e3ca0..8d48e90 100644
  1683. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/BalancesFragment.java
  1684. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/PortfolioFragment.java
  1685. @@ -1,141 +1,67 @@
  1686. -package com.bitshares.bitshareswallet;
  1687. +package com.ngse.ui.main.balanceitems;
  1688.  
  1689.  import android.arch.lifecycle.ViewModelProviders;
  1690.  import android.content.Context;
  1691.  import android.net.Uri;
  1692.  import android.os.Bundle;
  1693. -import android.support.v4.app.Fragment;
  1694.  import android.support.v7.widget.LinearLayoutManager;
  1695.  import android.support.v7.widget.RecyclerView;
  1696.  import android.view.LayoutInflater;
  1697. +import android.view.Menu;
  1698. +import android.view.MenuInflater;
  1699. +import android.view.MenuItem;
  1700.  import android.view.View;
  1701.  import android.view.ViewGroup;
  1702.  import android.widget.TextView;
  1703.  
  1704. +import com.bitshares.bitshareswallet.BaseFragment;
  1705.  import com.bitshares.bitshareswallet.room.BitsharesBalanceAsset;
  1706.  import com.bitshares.bitshareswallet.viewmodel.WalletViewModel;
  1707.  
  1708. +import org.evrazcoin.evrazwallet.R;
  1709. +
  1710.  import java.util.List;
  1711.  import java.util.Locale;
  1712.  
  1713. +import butterknife.BindView;
  1714. +import butterknife.ButterKnife;
  1715.  
  1716. -/**
  1717. - * A simple {@link Fragment} subclass.
  1718. - * Activities that contain this fragment must implement the
  1719. - * {@link BalancesFragment.OnFragmentInteractionListener} interface
  1720. - * to handle interaction events.
  1721. - * Use the {@link BalancesFragment#newInstance} factory method to
  1722. - * create an instance of this fragment.
  1723. - */
  1724. -public class BalancesFragment extends BaseFragment {
  1725. -    // TODO: Rename parameter arguments, choose names that match
  1726. -    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  1727. -    private static final String ARG_PARAM1 = "param1";
  1728. -    private static final String ARG_PARAM2 = "param2";
  1729.  
  1730. -    // TODO: Rename and change types of parameters
  1731. -    private String mParam1;
  1732. -    private String mParam2;
  1733. +public class PortfolioFragment extends BaseFragment {
  1734.  
  1735. +    public static final String TAG = PortfolioFragment.class.getName();
  1736.      private BalancesAdapter mBalancesAdapter;
  1737.  
  1738.      private OnFragmentInteractionListener mListener;
  1739. +    private MenuItem backMenuItem;
  1740.  
  1741. -    class BalanceItemViewHolder extends RecyclerView.ViewHolder {
  1742. -        public View view;
  1743. -        public TextView viewNumber;
  1744. -        public TextView viewUnit;
  1745. -        public TextView viewEqual;
  1746. -        public TextView viewConvertNumber;
  1747. -        public TextView viewConvertUnit;
  1748. +    @BindView(R.id.textUSDBalance)
  1749. +    TextView textUSDBalance;
  1750. +    @BindView(R.id.usdRateTitle)
  1751. +    TextView usdRateTitle;
  1752. +    @BindView(R.id.usdCostTitle)
  1753. +    TextView usdCostTitle;
  1754.  
  1755. -        public BalanceItemViewHolder(View itemView) {
  1756. -            super(itemView);
  1757. -            view = itemView;
  1758. -            viewNumber = (TextView) itemView.findViewById(R.id.textViewNumber);
  1759. -            viewUnit = (TextView) itemView.findViewById(R.id.textViewUnit);
  1760. -            viewEqual = (TextView) itemView.findViewById(R.id.textViewEqual);
  1761. -            viewConvertNumber = (TextView) itemView.findViewById(R.id.textViewNumber2);
  1762. -            viewConvertUnit = (TextView) itemView.findViewById(R.id.textViewUnit2);
  1763. -        }
  1764. -    }
  1765. -
  1766. -    class BalancesAdapter extends RecyclerView.Adapter<BalanceItemViewHolder> {
  1767. -        private List<BitsharesBalanceAsset> bitsharesBalanceAssetList;
  1768.  
  1769.      @Override
  1770. -        public BalanceItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  1771. -            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_item_balances, parent, false);
  1772. -            return new BalanceItemViewHolder(view);
  1773. -        }
  1774. -
  1775. -        @Override
  1776. -        public void onBindViewHolder(BalanceItemViewHolder holder, int position) {
  1777. -            BitsharesBalanceAsset bitsharesBalanceAsset = bitsharesBalanceAssetList.get(position);
  1778. -            String strBalances = String.format(
  1779. -                    Locale.ENGLISH,
  1780. -                    "%.4f",
  1781. -                    (float)bitsharesBalanceAsset.amount / bitsharesBalanceAsset.quote_precision
  1782. -            );
  1783. -
  1784. -            holder.viewNumber.setText(strBalances);
  1785. -            holder.viewUnit.setText(bitsharesBalanceAsset.quote);
  1786. -            if (bitsharesBalanceAsset.quote.compareTo("BTS") != 0) {
  1787. -                int nResult = (int)Math.rint(bitsharesBalanceAsset.total / bitsharesBalanceAsset.base_precision);
  1788. -
  1789. -                holder.viewEqual.setText("=");
  1790. -                holder.viewConvertNumber.setText(Integer.valueOf(nResult).toString());
  1791. -                holder.viewConvertUnit.setText("BTS");
  1792. -            }
  1793. -
  1794. +    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  1795. +        super.onCreateOptionsMenu(menu, inflater);
  1796. +        backMenuItem = menu.add(R.string.back)
  1797. +                .setIcon(R.drawable.abc_ic_ab_back_material)
  1798. +                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
  1799.      }
  1800.  
  1801.      @Override
  1802. -        public int getItemCount() {
  1803. -            if (bitsharesBalanceAssetList == null) {
  1804. -                return 0;
  1805. -            } else {
  1806. -                return bitsharesBalanceAssetList.size();
  1807. -            }
  1808. +    public boolean onOptionsItemSelected(MenuItem item) {
  1809. +        if (item == backMenuItem)
  1810. +            getActivity().onBackPressed();
  1811. +        return super.onOptionsItemSelected(item);
  1812.      }
  1813.  
  1814. -        public void notifyBalancesDataChanged(List<BitsharesBalanceAsset> bitsharesBalanceAssetList) {
  1815. -            this.bitsharesBalanceAssetList = bitsharesBalanceAssetList;
  1816. -
  1817. -            notifyDataSetChanged();
  1818. -        }
  1819. +    public static PortfolioFragment newInstance() {
  1820. +        return new PortfolioFragment();
  1821.      }
  1822.  
  1823. -    public BalancesFragment() {
  1824. -        // Required empty public constructor
  1825. -    }
  1826. -
  1827. -    /**
  1828. -     * Use this factory method to create a new instance of
  1829. -     * this fragment using the provided parameters.
  1830. -     *
  1831. -     * @param param1 Parameter 1.
  1832. -     * @param param2 Parameter 2.
  1833. -     * @return A new instance of fragment BalancesFragment.
  1834. -     */
  1835. -    // TODO: Rename and change types and number of parameters
  1836. -    public static BalancesFragment newInstance(String param1, String param2) {
  1837. -        BalancesFragment fragment = new BalancesFragment();
  1838. -        Bundle args = new Bundle();
  1839. -        args.putString(ARG_PARAM1, param1);
  1840. -        args.putString(ARG_PARAM2, param2);
  1841. -        fragment.setArguments(args);
  1842. -        return fragment;
  1843. -    }
  1844. -
  1845. -    @Override
  1846. -    public void onCreate(Bundle savedInstanceState) {
  1847. -        super.onCreate(savedInstanceState);
  1848. -        if (getArguments() != null) {
  1849. -            mParam1 = getArguments().getString(ARG_PARAM1);
  1850. -            mParam2 = getArguments().getString(ARG_PARAM2);
  1851. -        }
  1852. -    }
  1853.  
  1854.      @Override
  1855.      public void onResume() {
  1856. @@ -146,6 +72,7 @@ public class BalancesFragment extends BaseFragment {
  1857.                  this, resourceBalanceList -> {
  1858.                      switch (resourceBalanceList.status) {
  1859.                          case SUCCESS:
  1860. +                            processShowdata(resourceBalanceList.data);
  1861.                              mBalancesAdapter.notifyBalancesDataChanged(resourceBalanceList.data);
  1862.                              break;
  1863.                          case LOADING:
  1864. @@ -166,15 +93,41 @@ public class BalancesFragment extends BaseFragment {
  1865.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  1866.                               Bundle savedInstanceState) {
  1867.          // Inflate the layout for this fragment
  1868. -        View view = inflater.inflate(R.layout.fragment_balances, container, false);
  1869. -        RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.recyclerView);
  1870. +        View view = inflater.inflate(R.layout.new_fragment_portfolio, container, false);
  1871. +        RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
  1872.          recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  1873.          mBalancesAdapter = new BalancesAdapter();
  1874.          recyclerView.setAdapter(mBalancesAdapter);
  1875.  
  1876. +        ButterKnife.bind(this, view);
  1877.          return view;
  1878.      }
  1879.  
  1880. +    void processShowdata(List<BitsharesBalanceAsset> bitsharesBalanceAssetList) {
  1881. +//        long totalBTS = 0;
  1882. +        long totalBalance = 0;
  1883. +        for (BitsharesBalanceAsset bitsharesBalanceAsset : bitsharesBalanceAssetList) {
  1884. +//            totalBTS += bitsharesBalanceAsset.total;
  1885. +            totalBalance += bitsharesBalanceAsset.balance;
  1886. +        }
  1887. +
  1888. +        if (!bitsharesBalanceAssetList.isEmpty()) {
  1889. +            BitsharesBalanceAsset bitsharesBalanceAsset = bitsharesBalanceAssetList.get(0);
  1890. +           /* double exchangeRate = (double) totalBalance / bitsharesBalanceAsset.currency_precision / totalBTS * bitsharesBalanceAsset.base_precision;
  1891. +            totalBTS /= bitsharesBalanceAssetList.get(0).base_precision;*/
  1892. +            totalBalance /= bitsharesBalanceAssetList.get(0).currency_precision;
  1893. +
  1894. +            String strTotalCurrency = getString(R.string.total_usd, totalBalance,
  1895. +                    bitsharesBalanceAsset.currency);
  1896. +
  1897. +
  1898. +            textUSDBalance.setText(strTotalCurrency);
  1899. +            usdRateTitle.setText(getString(R.string.usd_rate, bitsharesBalanceAsset.currency));
  1900. +            usdCostTitle.setText(getString(R.string.usd_cost, bitsharesBalanceAsset.currency));
  1901. +        }
  1902. +
  1903. +    }
  1904. +
  1905.      // TODO: Rename method, update argument and hook method into UI event
  1906.      public void onButtonPressed(Uri uri) {
  1907.          if (mListener != null) {
  1908. @@ -218,4 +171,67 @@ public class BalancesFragment extends BaseFragment {
  1909.      public void notifyUpdate() {
  1910.  
  1911.      }
  1912. +
  1913. +    class BalanceItemViewHolder extends RecyclerView.ViewHolder {
  1914. +        public View view;
  1915. +        public TextView viewNumber;
  1916. +        public TextView viewUnit;
  1917. +        //        public TextView viewEqual;
  1918. +        public TextView viewUSBBalance;
  1919. +        public TextView viewExchangeRate;
  1920. +
  1921. +        public BalanceItemViewHolder(View itemView) {
  1922. +            super(itemView);
  1923. +            view = itemView;
  1924. +            viewNumber = (TextView) itemView.findViewById(R.id.textViewNumber);
  1925. +            viewUnit = (TextView) itemView.findViewById(R.id.textViewUnit);
  1926. +//            viewEqual = (TextView) itemView.findViewById(R.id.textViewEqual);
  1927. +            viewUSBBalance = (TextView) itemView.findViewById(R.id.textUSDBalance);
  1928. +            viewExchangeRate = (TextView) itemView.findViewById(R.id.textExchangeRate);
  1929. +        }
  1930. +    }
  1931. +
  1932. +    class BalancesAdapter extends RecyclerView.Adapter<BalanceItemViewHolder> {
  1933. +        private List<BitsharesBalanceAsset> bitsharesBalanceAssetList;
  1934. +
  1935. +        @Override
  1936. +        public BalanceItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  1937. +            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_recyclerview_item_balances, parent, false);
  1938. +            return new BalanceItemViewHolder(view);
  1939. +        }
  1940. +
  1941. +        @Override
  1942. +        public void onBindViewHolder(BalanceItemViewHolder holder, int position) {
  1943. +            BitsharesBalanceAsset bitsharesBalanceAsset = bitsharesBalanceAssetList.get(position);
  1944. +            float balance = (float) bitsharesBalanceAsset.amount / bitsharesBalanceAsset.quote_precision;
  1945. +            float usdBalance = (float) bitsharesBalanceAsset.balance / bitsharesBalanceAsset.currency_precision;
  1946. +            float usdExchangeRate = usdBalance / balance;
  1947. +            String strBalances = String.format(Locale.ENGLISH, "%.2f", balance);
  1948. +            String strUsdBalance = String.format(Locale.ENGLISH, "%.4f", usdBalance);
  1949. +            String strUsdExchangeRate = String.format(Locale.ENGLISH, "%.4f", usdExchangeRate);
  1950. +            holder.viewNumber.setText(strBalances);
  1951. +
  1952. +            holder.viewUnit.setText(bitsharesBalanceAsset.quote);
  1953. +
  1954. +            holder.viewExchangeRate.setText(strUsdExchangeRate);
  1955. +            holder.viewUSBBalance.setText(strUsdBalance);
  1956. +
  1957. +        }
  1958. +
  1959. +        @Override
  1960. +        public int getItemCount() {
  1961. +            if (bitsharesBalanceAssetList == null) {
  1962. +                return 0;
  1963. +            } else {
  1964. +                return bitsharesBalanceAssetList.size();
  1965. +            }
  1966. +        }
  1967. +
  1968. +        public void notifyBalancesDataChanged(List<BitsharesBalanceAsset> bitsharesBalanceAssetList) {
  1969. +            this.bitsharesBalanceAssetList = bitsharesBalanceAssetList;
  1970. +
  1971. +            notifyDataSetChanged();
  1972. +        }
  1973. +    }
  1974. +
  1975.  }
  1976. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TranactionsAdapter.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TranactionsAdapter.java
  1977. similarity index 94%
  1978. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TranactionsAdapter.java
  1979. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TranactionsAdapter.java
  1980. index 3b2ffa7..7f89b16 100644
  1981. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TranactionsAdapter.java
  1982. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TranactionsAdapter.java
  1983. @@ -1,4 +1,4 @@
  1984. -package com.bitshares.bitshareswallet;
  1985. +package com.ngse.ui.main.balanceitems;
  1986.  
  1987.  import android.content.Context;
  1988.  import android.content.DialogInterface;
  1989. @@ -21,11 +21,11 @@ import com.bitshares.bitshareswallet.wallet.graphene.chain.config;
  1990.  import com.bitshares.bitshareswallet.wallet.graphene.chain.memo_data;
  1991.  import com.bitshares.bitshareswallet.wallet.graphene.chain.operations;
  1992.  
  1993. +import org.evrazcoin.evrazwallet.R;
  1994. +
  1995.  import java.util.Locale;
  1996.  
  1997. -/**
  1998. - * Created by lorne on 01/11/2017.
  1999. - */
  2000. +
  2001.  class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.TransactionsItemViewHolder> {
  2002.      class TransactionsItemViewHolder extends RecyclerView.ViewHolder {
  2003.          public View view;
  2004. @@ -52,7 +52,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2005.  
  2006.      @Override
  2007.      public TransactionsItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  2008. -        View view = mLayoutInflater.inflate(R.layout.recyclerview_item_transactions, parent, false);
  2009. +        View view = mLayoutInflater.inflate(R.layout.new_recyclerview_item_transactions, parent, false);
  2010.          return new TransactionsItemViewHolder(view);
  2011.      }
  2012.  
  2013. @@ -151,7 +151,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2014.          operations.account_create_operation operation = (operations.account_create_operation) operationType.operationContent;
  2015.          String strRegistarName = operationHistoryWrapper.mapId2AccountObject.get(operation.registrar).name;
  2016.  
  2017. -        String strTransferFormat = "<font color=\'#2d95ff\'>%s</font> registered the account <font color=\'#2d95ff\'>%s</font>";
  2018. +        String strTransferFormat = "<font color=\'#FFAB40\'>%s</font> registered the account <font color=\'#FFAB40\'>%s</font>";
  2019.          String strResult = String.format(
  2020.                  Locale.ENGLISH,
  2021.                  strTransferFormat,
  2022. @@ -173,7 +173,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2023.          String strTo = operationHistoryWrapper.mapId2AccountObject.get(operation.to).name;
  2024.          BitsharesAssetObject bitsharesAssetObject = operationHistoryWrapper.mapId2AssetObject.get(operation.amount.asset_id);
  2025.  
  2026. -        String strTransferFormat = "<font color=\'#2d95ff\'>%s</font> sent <font color=\'#000000\'>%s %s</font> to <font color=\'#2d95ff\'>%s</font>";
  2027. +        String strTransferFormat = "<font color=\'#FFAB40\'>%s</font> sent <font color=\'#ffffff\'>%s %s</font> to <font color=\'#FFAB40\'>%s</font>";
  2028.  
  2029.          String strResult = String.format(
  2030.                  Locale.ENGLISH, strTransferFormat,
  2031. @@ -190,7 +190,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2032.      }
  2033.  
  2034.      private void processMemoUnlockClick() {
  2035. -        AlertDialog.Builder builder = new AlertDialog.Builder(transactionsFragment.getActivity());
  2036. +        AlertDialog.Builder builder = new AlertDialog.Builder(transactionsFragment.getActivity(), R.style.CustomDialogTheme);
  2037.          LayoutInflater layoutInflater = transactionsFragment.getActivity().getLayoutInflater();
  2038.          final View viewGroup = layoutInflater.inflate(R.layout.dialog_password_unlock, null);
  2039.          builder.setPositiveButton(
  2040. @@ -251,7 +251,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2041.                  layoutTransaction.setOnClickListener(new View.OnClickListener() {
  2042.                      @Override
  2043.                      public void onClick(View v) {
  2044. -                        AlertDialog.Builder builder = new AlertDialog.Builder(transactionsFragment.getActivity());
  2045. +                        AlertDialog.Builder builder = new AlertDialog.Builder(transactionsFragment.getActivity(), R.style.CustomDialogTheme);
  2046.                          builder.setMessage(strMemo);
  2047.                          builder.show();
  2048.                      }
  2049. @@ -271,7 +271,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2050.          holder.viewAction.setText("Create Order");
  2051.          operations.limit_order_create_operation operation = (operations.limit_order_create_operation) operationType.operationContent;
  2052.  
  2053. -        String strTransferFormat = "<font color=\'#000000\'>To buy %.5f %s</font> at %.5f %s/%s";
  2054. +        String strTransferFormat = "<font color=\'#ffffff\'>To buy %.5f %s</font> at %.5f %s/%s";
  2055.          String strResult = processOrderOperation(operation.amount_to_sell, operation.min_to_receive, strTransferFormat);
  2056.  
  2057.  
  2058. @@ -285,7 +285,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2059.          holder.viewAction.setText("Cancel Order");
  2060.          operations.limit_order_cancel_operation operation = (operations.limit_order_cancel_operation) operationType.operationContent;
  2061.  
  2062. -        String strTransferFormat = "<font color=\'#000000\'>Canceled order #%d</font>";
  2063. +        String strTransferFormat = "<font color=\'#ffffff\'>Canceled order #%d</font>";
  2064.          String strResult = String.format(
  2065.                  Locale.ENGLISH,
  2066.                  strTransferFormat,
  2067. @@ -302,7 +302,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2068.          holder.viewAction.setText("Update Order");
  2069.          operations.call_order_update_operation operation = (operations.call_order_update_operation) operationType.operationContent;
  2070.  
  2071. -        String strTransferFormat = "<font color=\'#000000\'>%s</font>";
  2072. +        String strTransferFormat = "<font color=\'#ffffff\'>%s</font>";
  2073.  
  2074.          String strResult = String.format(
  2075.                  Locale.ENGLISH,
  2076. @@ -320,7 +320,7 @@ class TranactionsAdapter extends RecyclerView.Adapter<TranactionsAdapter.Transac
  2077.          holder.viewAction.setText("Fill Order");
  2078.          operations.fill_order_operation operation = (operations.fill_order_operation) operationType.operationContent;
  2079.  
  2080. -        String strTransferFormat = "<font color=\'#000000\'>Bought %.5f %s</font> at %.5f %s/%s";
  2081. +        String strTransferFormat = "<font color=\'#ffffff\'>Bought %.5f %s</font> at %.5f %s/%s";
  2082.          String strResult = processOrderOperation(operation.pays, operation.receives, strTransferFormat);
  2083.  
  2084.          if (operation.receives.asset_id.equals(config.asset_object_base)) {
  2085. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionsFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TransactionsFragment.java
  2086. similarity index 68%
  2087. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionsFragment.java
  2088. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TransactionsFragment.java
  2089. index 090770d..4e39274 100644
  2090. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionsFragment.java
  2091. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/balanceitems/TransactionsFragment.java
  2092. @@ -1,54 +1,52 @@
  2093. -package com.bitshares.bitshareswallet;
  2094. +package com.ngse.ui.main.balanceitems;
  2095.  
  2096.  import android.arch.lifecycle.ViewModelProviders;
  2097.  import android.content.Context;
  2098.  import android.net.Uri;
  2099.  import android.os.Bundle;
  2100. -import android.support.v4.app.Fragment;
  2101.  import android.support.v7.widget.LinearLayoutManager;
  2102.  import android.support.v7.widget.RecyclerView;
  2103.  import android.view.LayoutInflater;
  2104. +import android.view.Menu;
  2105. +import android.view.MenuInflater;
  2106. +import android.view.MenuItem;
  2107.  import android.view.View;
  2108.  import android.view.ViewGroup;
  2109. -import android.widget.ImageView;
  2110. -import android.widget.TextView;
  2111. +
  2112. +import com.bitshares.bitshareswallet.BaseFragment;
  2113.  
  2114.  import com.bitshares.bitshareswallet.viewmodel.TransactionViewModel;
  2115.  
  2116. +import org.evrazcoin.evrazwallet.R;
  2117. +
  2118.  import butterknife.BindView;
  2119.  import butterknife.ButterKnife;
  2120.  
  2121.  
  2122. -/**
  2123. - * A simple {@link Fragment} subclass.
  2124. - * Activities that contain this fragment must implement the
  2125. - * {@link TransactionsFragment.OnFragmentInteractionListener} interface
  2126. - * to handle interaction events.
  2127. - * Use the {@link TransactionsFragment#newInstance} factory method to
  2128. - * create an instance of this fragment.
  2129. - */
  2130.  public class TransactionsFragment extends BaseFragment {
  2131. -    // TODO: Rename parameter arguments, choose names that match
  2132. -    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  2133. -    private static final String ARG_PARAM1 = "param1";
  2134. -    private static final String ARG_PARAM2 = "param2";
  2135. -
  2136. -    // TODO: Rename and change types of parameters
  2137. -    private String mParam1;
  2138. -    private String mParam2;
  2139.  
  2140. +    public static final String TAG = TransactionsFragment.class.getName();
  2141.      private OnFragmentInteractionListener mListener;
  2142.  
  2143.      private TranactionsAdapter mTranactionsAdapter;
  2144.  
  2145. -    @BindView(R.id.recyclerView) RecyclerView mRecyclerView;
  2146. -    @BindView(R.id.layoutChartLoading) View mLoadingChartView;
  2147. -    @BindView(R.id.layoutLoadingError) View mLoadingErrorView;
  2148. -
  2149. +    @BindView(R.id.recyclerView)
  2150. +    RecyclerView mRecyclerView;
  2151. +    @BindView(R.id.layoutChartLoading)
  2152. +    View mLoadingChartView;
  2153. +    @BindView(R.id.layoutLoadingError)
  2154. +    View mLoadingErrorView;
  2155. +    private MenuItem backMenuItem;
  2156.      private static final int SHOW_HISTORY_VIEW_LODING = 1;
  2157.      private static final int SHOW_HISTORY_VIEW_LODING_FAIL = 2;
  2158.      private static final int SHOW_HISTORY_VIEW_READY = 3;
  2159.  
  2160. +    @Override
  2161. +    public void onResume() {
  2162. +        super.onResume();
  2163. +        onShow();
  2164. +    }
  2165. +
  2166.      @Override
  2167.      public void onShow() {
  2168.          super.onShow();
  2169. @@ -59,7 +57,7 @@ public class TransactionsFragment extends BaseFragment {
  2170.                  operationHistoryWrapperResource -> {
  2171.                      switch (operationHistoryWrapperResource.status) {
  2172.                          case ERROR:
  2173. -                            changeShowedView(SHOW_HISTORY_VIEW_LODING_FAIL);
  2174. +//                            changeShowedView(SHOW_HISTORY_VIEW_LODING_FAIL);
  2175.                              break;
  2176.                          case SUCCESS:
  2177.                              changeShowedView(SHOW_HISTORY_VIEW_READY);
  2178. @@ -77,42 +75,31 @@ public class TransactionsFragment extends BaseFragment {
  2179.                  });
  2180.      }
  2181.  
  2182. -    public TransactionsFragment() {
  2183. -        // Required empty public constructor
  2184. -    }
  2185. -
  2186. -    /**
  2187. -     * Use this factory method to create a new instance of
  2188. -     * this fragment using the provided parameters.
  2189. -     *
  2190. -     * @param param1 Parameter 1.
  2191. -     * @param param2 Parameter 2.
  2192. -     * @return A new instance of fragment TransactionsFragment.
  2193. -     */
  2194. -    // TODO: Rename and change types and number of parameters
  2195. -    public static TransactionsFragment newInstance(String param1, String param2) {
  2196. -        TransactionsFragment fragment = new TransactionsFragment();
  2197. -        Bundle args = new Bundle();
  2198. -        args.putString(ARG_PARAM1, param1);
  2199. -        args.putString(ARG_PARAM2, param2);
  2200. -        fragment.setArguments(args);
  2201. -        return fragment;
  2202. +    @Override
  2203. +    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  2204. +        super.onCreateOptionsMenu(menu, inflater);
  2205. +        backMenuItem = menu.add(R.string.back)
  2206. +                .setIcon(R.drawable.abc_ic_ab_back_material)
  2207. +                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
  2208.      }
  2209.  
  2210.      @Override
  2211. -    public void onCreate(Bundle savedInstanceState) {
  2212. -        super.onCreate(savedInstanceState);
  2213. -        if (getArguments() != null) {
  2214. -            mParam1 = getArguments().getString(ARG_PARAM1);
  2215. -            mParam2 = getArguments().getString(ARG_PARAM2);
  2216. +    public boolean onOptionsItemSelected(MenuItem item) {
  2217. +        if (item == backMenuItem)
  2218. +            getActivity().onBackPressed();
  2219. +        return super.onOptionsItemSelected(item);
  2220.      }
  2221. +
  2222. +    public static TransactionsFragment newInstance() {
  2223. +        return new TransactionsFragment();
  2224.      }
  2225.  
  2226. +
  2227.      @Override
  2228.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  2229.                               Bundle savedInstanceState) {
  2230.          // Inflate the layout for this fragment
  2231. -        View view = inflater.inflate(R.layout.fragment_transactions, container, false);
  2232. +        View view = inflater.inflate(R.layout.new_fragment_transactions, container, false);
  2233.          ButterKnife.bind(this, view);
  2234.  
  2235.          mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  2236. @@ -161,10 +148,6 @@ public class TransactionsFragment extends BaseFragment {
  2237.          void onFragmentInteraction(Uri uri);
  2238.      }
  2239.  
  2240. -    @Override
  2241. -    public void notifyUpdate(){
  2242. -
  2243. -    }
  2244.  
  2245.      private void changeShowedView(int nShowView) {
  2246.          switch (nShowView) {
  2247. diff --git a/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingOrdersFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingOrdersFragment.java
  2248. new file mode 100644
  2249. index 0000000..8974d9e
  2250. --- /dev/null
  2251. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingOrdersFragment.java
  2252. @@ -0,0 +1,577 @@
  2253. +package com.ngse.ui.main.trading;
  2254. +
  2255. +import android.content.BroadcastReceiver;
  2256. +import android.content.Context;
  2257. +import android.content.Intent;
  2258. +import android.content.IntentFilter;
  2259. +import android.content.SharedPreferences;
  2260. +import android.net.Uri;
  2261. +import android.os.Bundle;
  2262. +import android.support.v4.content.LocalBroadcastManager;
  2263. +import android.support.v7.preference.PreferenceManager;
  2264. +import android.support.v7.widget.LinearLayoutManager;
  2265. +import android.support.v7.widget.RecyclerView;
  2266. +import android.view.LayoutInflater;
  2267. +import android.view.View;
  2268. +import android.view.ViewGroup;
  2269. +
  2270. +import com.bitshares.bitshareswallet.BaseFragment;
  2271. +import com.bitshares.bitshareswallet.DensityUtil;
  2272. +import com.bitshares.bitshareswallet.market.MarketStat;
  2273. +import com.bitshares.bitshareswallet.wallet.Broadcast;
  2274. +import com.bitshares.bitshareswallet.wallet.graphene.chain.utils;
  2275. +
  2276. +import org.evrazcoin.evrazwallet.R;
  2277. +
  2278. +import java.util.concurrent.TimeUnit;
  2279. +
  2280. +
  2281. +public class TradingOrdersFragment extends BaseFragment
  2282. +        implements  MarketStat.OnMarketStatUpdateListener
  2283. +         {//View.OnClickListener, TextWatcher , ConfirmOrderDialog.OnDialogInterationListener
  2284. +
  2285. +    private static final long MARKET_STAT_INTERVAL_MILLIS = TimeUnit.SECONDS.toMillis(5);
  2286. +//    private static final String TRANSACTION_TYPE = "transaction_type";
  2287. +
  2288. +//    private static int buyTimeSec = 5 * 365 * 24 * 60 * 60;
  2289. +
  2290. +    private TransactionSellBuyRecyclerViewAdapter buyRecyclerViewAdapter;
  2291. +    private TransactionSellBuyRecyclerViewAdapter sellRecyclerViewAdapter;
  2292. +    private RecyclerView buyRecyclerView;
  2293. +    private RecyclerView sellRecyclerView;
  2294. +    private int maxOrderCount = 10;
  2295. +
  2296. +    /*public static final int TRANSACTION_BUY = 1;
  2297. +    public static final int TRANSACTION_SELL = 2;
  2298. +    private int transactionType;*/
  2299. +    private MarketStat orderStat;
  2300. +    private String baseAsset;
  2301. +    private String quoteAsset;
  2302. +//    private double lowestSellPrice = -1;
  2303. +//    private double higgestBuyPrice = -1;
  2304. +    private OnFragmentInteractionListener mListener;
  2305. +/*
  2306. +    private EditText qEditText;
  2307. +    private EditText pEditText;
  2308. +    private EditText tEditText;
  2309. +    private EditText fEditText;
  2310. +
  2311. +    private TextView pTextLastView;
  2312. +    private TextView qTextLastView;
  2313. +    private TextView tTextLastView;
  2314. +
  2315. +    private TextView balanceText;
  2316. +    private TextView askText;
  2317. +
  2318. +    private TextView balanceTextBase;
  2319. +    private TextView askTextBase;
  2320. +    private TextView askTextInfo;
  2321. +
  2322. +    private KProgressHUD mProcessHud;
  2323. +
  2324. +    private asset_object btsAssetObj;
  2325. +    private asset_object baseAssetObj;
  2326. +    private asset_object quoteAssetObj;
  2327. +    private global_property_object globalPropertyObject;
  2328. +    private boolean isAssetObjIsInit;
  2329. +    private boolean isInitPriceValue;*/
  2330. +
  2331. +    public TradingOrdersFragment() {
  2332. +        orderStat = new MarketStat();
  2333. +    }
  2334. +
  2335. +    public static TradingOrdersFragment newInstance() {//int transactionType
  2336. +      /*  TradingOrdersFragment fragment = new TradingOrdersFragment();
  2337. +        Bundle args = new Bundle();
  2338. +        args.putInt(TRANSACTION_TYPE, transactionType);
  2339. +        fragment.setArguments(args);*/
  2340. +        return new TradingOrdersFragment();
  2341. +    }
  2342. +
  2343. +    private BroadcastReceiver currencyUpdateReceiver = new BroadcastReceiver() {
  2344. +        @Override
  2345. +        public void onReceive(Context context, Intent intent) {
  2346. +            orderStat.unsubscribe(baseAsset, quoteAsset);
  2347. +
  2348. +            updateCurency();
  2349. +            orderStat.subscribe(baseAsset, quoteAsset, MarketStat.STAT_MARKET_ORDER_BOOK,
  2350. +                    MARKET_STAT_INTERVAL_MILLIS, TradingOrdersFragment.this);
  2351. +        }
  2352. +    };
  2353. +
  2354. +    @Override
  2355. +    public void onMarketStatUpdate(MarketStat.Stat stat) {
  2356. +        if (getView() == null || stat.orderBook == null) {
  2357. +            return;
  2358. +        }
  2359. +
  2360. +        if (stat.orderBook.bids != null && !stat.orderBook.bids.isEmpty()) {
  2361. +            int maxCount = Math.min(stat.orderBook.bids.size(), maxOrderCount);
  2362. +            buyRecyclerViewAdapter.setList(stat.orderBook.bids.subList(0, maxCount));
  2363. +
  2364. +//            higgestBuyPrice = stat.orderBook.bids.get(0).price;
  2365. +        } else {
  2366. +//            higgestBuyPrice = -1;
  2367. +        }
  2368. +
  2369. +        if (stat.orderBook.asks != null && !stat.orderBook.asks.isEmpty()) {
  2370. +            int maxCount = Math.min(stat.orderBook.asks.size(), maxOrderCount);
  2371. +            sellRecyclerViewAdapter.setList(stat.orderBook.asks.subList(0, maxCount));
  2372. +
  2373. +//            lowestSellPrice = stat.orderBook.asks.get(0).price;
  2374. +        } else {
  2375. +//            lowestSellPrice = -1;
  2376. +        }
  2377. +
  2378. +//        initPriceValue();
  2379. +    }
  2380. +
  2381. +/*    public void initPriceValue() {
  2382. +        DecimalFormat decimalFormat = new DecimalFormat("#.####");
  2383. +        if (!isInitPriceValue) {
  2384. +            isInitPriceValue = true;
  2385. +            if (transactionType == TRANSACTION_BUY && lowestSellPrice != -1) {
  2386. +                pEditText.setText(decimalFormat.format(lowestSellPrice));
  2387. +            } else if (transactionType == TRANSACTION_SELL && higgestBuyPrice != -1) {
  2388. +                pEditText.setText(decimalFormat.format(higgestBuyPrice));
  2389. +            }
  2390. +        }
  2391. +
  2392. +        if (transactionType == TRANSACTION_BUY && lowestSellPrice != -1) {
  2393. +            askText.setText(decimalFormat.format(lowestSellPrice));
  2394. +        } else if (transactionType == TRANSACTION_SELL && higgestBuyPrice != -1) {
  2395. +            askText.setText(decimalFormat.format(higgestBuyPrice));
  2396. +        }
  2397. +    }*/
  2398. +
  2399. +   /* @Override
  2400. +    public void onCreate(Bundle savedInstanceState) {
  2401. +        super.onCreate(savedInstanceState);
  2402. +        if (getArguments() != null) {
  2403. +            transactionType = getArguments().getInt(TRANSACTION_TYPE);
  2404. +        }
  2405. +    }
  2406. +*/
  2407. +    @Override
  2408. +    public void onResume() {
  2409. +        super.onResume();
  2410. +        onShow();
  2411. +    }
  2412. +
  2413. +    @Override
  2414. +    public void onShow() {
  2415. +        super.onShow();
  2416. +        updateCurency();
  2417. +//        initFee();
  2418. +        updateMaxOrderCount();
  2419. +        orderStat.subscribe(baseAsset, quoteAsset, MarketStat.STAT_MARKET_ORDER_BOOK,
  2420. +                MARKET_STAT_INTERVAL_MILLIS, this);
  2421. +
  2422. +        IntentFilter intentFilter = new IntentFilter();
  2423. +        intentFilter.addAction(Broadcast.CURRENCY_UPDATED);
  2424. +        LocalBroadcastManager.getInstance(getContext())
  2425. +                .registerReceiver(currencyUpdateReceiver, intentFilter);
  2426. +
  2427. +        /*SellBuyViewModel viewModel = ViewModelProviders.of(this).get(SellBuyViewModel.class);
  2428. +        if (isBuy()) {
  2429. +            viewModel.changeBalanceAsset(baseAsset);
  2430. +        } else {
  2431. +            viewModel.changeBalanceAsset(quoteAsset);
  2432. +        }*/
  2433. +
  2434. +    /*    viewModel.getAvaliableBalance().observe(this, bitsharesAssetResource -> {
  2435. +            if (bitsharesAssetResource.status == Status.SUCCESS) {
  2436. +                BitsharesAsset bitsharesAsset = bitsharesAssetResource.data;
  2437. +                if (bitsharesAsset != null) {
  2438. +                    DecimalFormat decimalFormat = new DecimalFormat("#.####");
  2439. +                    balanceText.setText(decimalFormat.format((double) bitsharesAsset.amount / bitsharesAsset.precision));
  2440. +                } else {
  2441. +                    balanceText.setText("0");
  2442. +                }
  2443. +            }
  2444. +        });*/
  2445. +    }
  2446. +
  2447. +    @Override
  2448. +    public void onHide() {
  2449. +        super.onHide();
  2450. +        orderStat.unsubscribe(baseAsset, quoteAsset);
  2451. +        LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(currencyUpdateReceiver);
  2452. +    }
  2453. +
  2454. +    @Override
  2455. +    public View onCreateView(LayoutInflater inflater, ViewGroup container,
  2456. +                             Bundle savedInstanceState) {
  2457. +        View view = inflater.inflate(R.layout.new_fragment_buy_sell_orders, container, false);
  2458. +
  2459. +        /*Button okButton = (Button) view.findViewById(R.id.okButton);
  2460. +        okButton.setOnClickListener(this);
  2461. +        if (isBuy()) {
  2462. +            okButton.setText(getResources().getString(R.string.title_buy));
  2463. +        } else {
  2464. +            okButton.setText(getResources().getString(R.string.title_sell));
  2465. +        }
  2466. +*/
  2467. +       /* mProcessHud = KProgressHUD.create(getActivity())
  2468. +                .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
  2469. +                .setLabel("Please Wait")
  2470. +                .setCancellable(false)
  2471. +                .setAnimationSpeed(2)
  2472. +                .setDimAmount(0.5f);*/
  2473. +
  2474. +       /* Button restButton = (Button) view.findViewById(R.id.restButton);
  2475. +        restButton.setOnClickListener(this);
  2476. +
  2477. +        qEditText = (EditText) view.findViewById(R.id.qEditText);
  2478. +        pEditText = (EditText) view.findViewById(R.id.pEditText);
  2479. +        pEditText.addTextChangedListener(this);
  2480. +        qEditText.addTextChangedListener(this);
  2481. +
  2482. +        tEditText = (EditText) view.findViewById(R.id.tEditText);
  2483. +        fEditText = (EditText) view.findViewById(R.id.fEditText);
  2484. +        pTextLastView = (TextView) view.findViewById(R.id.pTextLastView);
  2485. +        qTextLastView = (TextView) view.findViewById(R.id.qTextLastView);
  2486. +        tTextLastView = (TextView) view.findViewById(R.id.tTextLastView);
  2487. +
  2488. +        balanceText = (TextView) view.findViewById(R.id.balanceText);
  2489. +        askText = (TextView) view.findViewById(R.id.askText);
  2490. +
  2491. +        balanceTextBase = (TextView) view.findViewById(R.id.balanceTextBase);
  2492. +        askTextBase = (TextView) view.findViewById(R.id.askTextBase);
  2493. +        askTextInfo = (TextView) view.findViewById(R.id.askTextInfo);*/
  2494. +
  2495. +        buyRecyclerView = view.findViewById(R.id.buy_recycler);
  2496. +        buyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  2497. +        buyRecyclerViewAdapter = new TransactionSellBuyRecyclerViewAdapter();
  2498. +        buyRecyclerView.setAdapter(buyRecyclerViewAdapter);
  2499. +        buyRecyclerView.setItemAnimator(null);
  2500. +
  2501. +        sellRecyclerView = view.findViewById(R.id.sell_recycler);
  2502. +        sellRecyclerViewAdapter = new TransactionSellBuyRecyclerViewAdapter();
  2503. +        sellRecyclerView.setAdapter(sellRecyclerViewAdapter);
  2504. +        sellRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  2505. +        sellRecyclerView.setItemAnimator(null);
  2506. +
  2507. +        return view;
  2508. +    }
  2509. +
  2510. +    // TODO: Rename method, update argument and hook method into UI event
  2511. +    public void onButtonPressed(Uri uri) {
  2512. +        if (mListener != null) {
  2513. +            mListener.onFragmentInteraction(uri);
  2514. +        }
  2515. +    }
  2516. +
  2517. +    @Override
  2518. +    public void onAttach(Context context) {
  2519. +        super.onAttach(context);
  2520. +        if (context instanceof OnFragmentInteractionListener) {
  2521. +            mListener = (OnFragmentInteractionListener) context;
  2522. +        } else {
  2523. +//            throw new RuntimeException(context.toString()
  2524. +//                    + " must implement OnFragmentInteractionListener");
  2525. +        }
  2526. +
  2527. +
  2528. +    }
  2529. +
  2530. +    @Override
  2531. +    public void onDetach() {
  2532. +        super.onDetach();
  2533. +        mListener = null;
  2534. +    }
  2535. +
  2536. +    /**
  2537. +     * This interface must be implemented by activities that contain this
  2538. +     * fragment to allow an interaction in this fragment to be communicated
  2539. +     * to the activity and potentially other fragments contained in that
  2540. +     * activity.
  2541. +     * <p>
  2542. +     * See the Android Training lesson <a href=
  2543. +     * "http://developer.android.com/training/basics/fragments/communicating.html"
  2544. +     * >Communicating with Other Fragments</a> for more information.
  2545. +     */
  2546. +    public interface OnFragmentInteractionListener {
  2547. +        // TODO: Update argument type and name
  2548. +        void onFragmentInteraction(Uri uri);
  2549. +    }
  2550. +
  2551. +   /* @Override
  2552. +    public void onClick(View v) {
  2553. +        switch (v.getId()) {
  2554. +            case R.id.okButton:
  2555. +                ConfirmOrderDialog.ConfirmOrderData confirmOrderData = new ConfirmOrderDialog.ConfirmOrderData();
  2556. +                if (transactionType == TRANSACTION_BUY) {
  2557. +                    confirmOrderData.setOperationName(getResources().getString(R.string.title_buy));
  2558. +                } else {
  2559. +                    confirmOrderData.setOperationName(getResources().getString(R.string.title_sell));
  2560. +                }
  2561. +                confirmOrderData.setPrice(pEditText.getText().toString());
  2562. +                confirmOrderData.setQuantity(qEditText.getText().toString());
  2563. +                confirmOrderData.setTotal(tEditText.getText().toString());
  2564. +                confirmOrderData.setFree(fEditText.getText().toString());
  2565. +                confirmOrderData.setQuantityType(utils.getAssetSymbolDisply(quoteAsset));
  2566. +                confirmOrderData.setTotalType(utils.getAssetSymbolDisply(baseAsset));
  2567. +
  2568. +                Calendar calendar = Calendar.getInstance();
  2569. +                calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 5);
  2570. +                calendar.getTime();
  2571. +                SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
  2572. +                confirmOrderData.setTimeExpiration(formatter.format(calendar.getTimeInMillis()));
  2573. +                ConfirmOrderDialog confirmOrderDialog = new ConfirmOrderDialog(getActivity(), confirmOrderData);
  2574. +                confirmOrderDialog.setListener(this);
  2575. +                confirmOrderDialog.show();
  2576. +                break;
  2577. +            case R.id.restButton:
  2578. +                resetInputInfo();
  2579. +                break;
  2580. +        }
  2581. +    }*/
  2582. +
  2583. +   /* public void resetInputInfo() {
  2584. +        qEditText.setText("");
  2585. +        pEditText.setText("");
  2586. +        tEditText.setText("");
  2587. +        fEditText.setText("");
  2588. +
  2589. +        isInitPriceValue = false;
  2590. +        initPriceValue();
  2591. +    }*/
  2592. +
  2593. +   /* @Override
  2594. +    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  2595. +
  2596. +    }
  2597. +
  2598. +    @Override
  2599. +    public void onTextChanged(CharSequence s, int start, int before, int count) {
  2600. +
  2601. +    }
  2602. +
  2603. +    @Override
  2604. +    public void afterTextChanged(Editable s) {
  2605. +        String qString = qEditText.getText().toString();
  2606. +        String pString = pEditText.getText().toString();
  2607. +        if (TextUtils.isEmpty(qString) || TextUtils.isEmpty(pString)) {
  2608. +            return;
  2609. +        }
  2610. +
  2611. +        double qValue = NumericUtil.parseDouble(qString, -1.0D);
  2612. +        double pValue = NumericUtil.parseDouble(pString, -1.0D);
  2613. +        double total = qValue * pValue;
  2614. +
  2615. +        DecimalFormat decimalFormat = new DecimalFormat("#.########");
  2616. +        tEditText.setText(decimalFormat.format(total));
  2617. +
  2618. +        if (isBuy()) {
  2619. +            double fee = calculateBuyFee(quoteAssetObj, baseAssetObj, pValue, qValue);
  2620. +            fEditText.setText(decimalFormat.format(fee));
  2621. +        } else {
  2622. +            double fee = calculateSellFee(quoteAssetObj, baseAssetObj, pValue, qValue);
  2623. +            fEditText.setText(decimalFormat.format(fee));
  2624. +        }
  2625. +    }*/
  2626. +
  2627. +   /* @Override
  2628. +    public void onConfirm() {
  2629. +        String qString = qEditText.getText().toString();
  2630. +        String pString = pEditText.getText().toString();
  2631. +        if (qString.equals("") || pString.equals("")) {
  2632. +            return;
  2633. +        }
  2634. +
  2635. +        final double qValue;
  2636. +        final double pValue;
  2637. +        try {
  2638. +            qValue = Double.parseDouble(qString);
  2639. +            pValue = Double.parseDouble(pString);
  2640. +        } catch (Exception e) {
  2641. +            e.printStackTrace();
  2642. +            return;
  2643. +        }
  2644. +
  2645. +        if (qValue <= 0 || pValue <= 0) {
  2646. +            return;
  2647. +        }
  2648. +
  2649. +        if (!BitsharesWalletWraper.getInstance().is_locked()) {
  2650. +            if (transactionType == TRANSACTION_BUY) {
  2651. +                buy(pValue, qValue, buyTimeSec);
  2652. +            } else if (transactionType == TRANSACTION_SELL) {
  2653. +                sell(pValue, qValue, buyTimeSec);
  2654. +            }
  2655. +        } else {
  2656. +            TransactionSellBuyPasswordDialog builder = new TransactionSellBuyPasswordDialog(getActivity());
  2657. +            builder.setListener(new TransactionSellBuyPasswordDialog.OnDialogInterationListener() {
  2658. +                @Override
  2659. +                public void onConfirm(AlertDialog dialog, String passwordString) {
  2660. +                    if (BitsharesWalletWraper.getInstance().unlock(passwordString) == 0) {
  2661. +                        dialog.dismiss();
  2662. +                        if (transactionType == TRANSACTION_BUY) {
  2663. +                            buy(pValue, qValue, buyTimeSec);
  2664. +                        } else if (transactionType == TRANSACTION_SELL) {
  2665. +                            sell(pValue, qValue, buyTimeSec);
  2666. +                        }
  2667. +                    } else {
  2668. +                        Toast.makeText(getContext(), getContext().getString(R.string.password_invalid), Toast.LENGTH_LONG).show();
  2669. +                    }
  2670. +                }
  2671. +
  2672. +                @Override
  2673. +                public void onReject(AlertDialog dialog) {
  2674. +                    dialog.dismiss();
  2675. +                }
  2676. +            });
  2677. +            builder.show();
  2678. +        }
  2679. +    }
  2680. +
  2681. +    @Override
  2682. +    public void onReject() {
  2683. +
  2684. +    }*/
  2685. +
  2686. +   /* private void initFee() {
  2687. +        isAssetObjIsInit = false;
  2688. +        new Thread(new Runnable() {
  2689. +            @Override
  2690. +            public void run() {
  2691. +                try {
  2692. +                    btsAssetObj = BitsharesWalletWraper.getInstance().lookup_asset_symbols("BTS");
  2693. +                    baseAssetObj = BitsharesWalletWraper.getInstance().lookup_asset_symbols(baseAsset);
  2694. +                    quoteAssetObj = BitsharesWalletWraper.getInstance().lookup_asset_symbols(quoteAsset);
  2695. +                    globalPropertyObject = BitsharesWalletWraper.getInstance().get_global_properties();
  2696. +                    getActivity().runOnUiThread(new Runnable() {
  2697. +                        @Override
  2698. +                        public void run() {
  2699. +                            isAssetObjIsInit = true;
  2700. +                        }
  2701. +                    });
  2702. +                } catch (Exception e) {
  2703. +                    e.printStackTrace();
  2704. +                }
  2705. +            }
  2706. +        }).start();
  2707. +    }*/
  2708. +
  2709. +  /*  private void buy(final double rate, final double amount, final int timeSec) {
  2710. +        mProcessHud.show();
  2711. +        new Thread(new Runnable() {
  2712. +            @Override
  2713. +            public void run() {
  2714. +                try {
  2715. +                    BitsharesWalletWraper.getInstance().buy(quoteAsset, baseAsset, rate, amount, timeSec);
  2716. +                    getActivity().runOnUiThread(new Runnable() {
  2717. +                        @Override
  2718. +                        public void run() {
  2719. +                            mProcessHud.dismiss();
  2720. +                        }
  2721. +                    });
  2722. +                } catch (Exception e) {
  2723. +                    getActivity().runOnUiThread(new Runnable() {
  2724. +                        @Override
  2725. +                        public void run() {
  2726. +                            mProcessHud.dismiss();
  2727. +                        }
  2728. +                    });
  2729. +                    e.printStackTrace();
  2730. +                }
  2731. +            }
  2732. +        }).start();
  2733. +    }
  2734. +
  2735. +    private void sell(final double rate, final double amount, final int timeSec) {
  2736. +        mProcessHud.show();
  2737. +        new Thread(new Runnable() {
  2738. +            @Override
  2739. +            public void run() {
  2740. +                try {
  2741. +                    BitsharesWalletWraper.getInstance().sell(quoteAsset, baseAsset, rate, amount, timeSec);
  2742. +                    getActivity().runOnUiThread(new Runnable() {
  2743. +                        @Override
  2744. +                        public void run() {
  2745. +                            mProcessHud.dismiss();
  2746. +                        }
  2747. +                    });
  2748. +                } catch (Exception e) {
  2749. +                    getActivity().runOnUiThread(new Runnable() {
  2750. +                        @Override
  2751. +                        public void run() {
  2752. +                            mProcessHud.dismiss();
  2753. +                        }
  2754. +                    });
  2755. +                    e.printStackTrace();
  2756. +                }
  2757. +            }
  2758. +        }).start();
  2759. +    }*/
  2760. +
  2761. +    private void updateMaxOrderCount(){
  2762. +        int orderItemHeightDp = DensityUtil.dpToPx(getContext(), TransactionSellBuyRecyclerViewAdapter.ORDERITEMHEIGHTDP);
  2763. +        int buyRecyclerHeight = buyRecyclerView.getHeight();
  2764. +
  2765. +        maxOrderCount = buyRecyclerHeight / orderItemHeightDp;
  2766. +        if (maxOrderCount <= 0) {
  2767. +            maxOrderCount = 8;
  2768. +        }
  2769. +    }
  2770. +
  2771. +    private void updateCurency(){
  2772. +        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
  2773. +        String strAssetPair = prefs.getString("quotation_currency_pair", "BTS:USD");
  2774. +        String strAsset[] = strAssetPair.split(":");
  2775. +        baseAsset = strAsset[1];
  2776. +        quoteAsset = strAsset[0];
  2777. +
  2778. +        String baseAssetDisplay = utils.getAssetSymbolDisply(baseAsset);
  2779. +        String quoteAssetDisplay = utils.getAssetSymbolDisply(quoteAsset);
  2780. +        /*pTextLastView.setText(baseAssetDisplay + "/" + quoteAssetDisplay);
  2781. +        qTextLastView.setText(quoteAssetDisplay);
  2782. +        tTextLastView.setText(baseAssetDisplay);
  2783. +        if (isBuy()) {
  2784. +            balanceTextBase.setText(baseAssetDisplay);
  2785. +            askTextBase.setText(baseAssetDisplay);
  2786. +            askTextInfo.setText(getString(R.string.label_lowest_ask));
  2787. +        } else {
  2788. +            balanceTextBase.setText(quoteAssetDisplay);
  2789. +            askTextBase.setText(quoteAssetDisplay);
  2790. +            askTextInfo.setText(getString(R.string.label_highest_bid));
  2791. +        }*/
  2792. +    }
  2793. +
  2794. +  /*  private boolean isBuy(){
  2795. +        return transactionType == TRANSACTION_BUY;
  2796. +    }*/
  2797. +
  2798. +/*    private double calculateSellFee(asset_object symbolToSell, asset_object symbolToReceive, double rate,
  2799. +                                    double amount) {
  2800. +        if (!isAssetObjIsInit) {
  2801. +            return 0;
  2802. +        }
  2803. +        asset a = BitsharesWalletWraper.getInstance().calculate_sell_fee(symbolToSell, symbolToReceive,
  2804. +                rate, amount, globalPropertyObject);
  2805. +        if (a.asset_id.equals(btsAssetObj.id)) {
  2806. +            return utils.get_asset_amount(a.amount, btsAssetObj);
  2807. +        } else if (a.asset_id.equals(baseAssetObj.id)) {
  2808. +            return utils.get_asset_amount(a.amount, baseAssetObj);
  2809. +        } else {
  2810. +            return utils.get_asset_amount(a.amount, quoteAssetObj);
  2811. +        }
  2812. +    }
  2813. +
  2814. +    private double calculateBuyFee(asset_object symbolToReceive, asset_object symbolToSell, double rate,
  2815. +                                   double amount) {
  2816. +        if (!isAssetObjIsInit) {
  2817. +            return 0;
  2818. +        }
  2819. +        asset a = BitsharesWalletWraper.getInstance().calculate_buy_fee(symbolToReceive, symbolToSell,
  2820. +                rate, amount, globalPropertyObject);
  2821. +        if (a.asset_id.equals(btsAssetObj.id)) {
  2822. +            return utils.get_asset_amount(a.amount, btsAssetObj);
  2823. +        } else if (a.asset_id.equals(baseAssetObj.id)) {
  2824. +            return utils.get_asset_amount(a.amount, baseAssetObj);
  2825. +        } else {
  2826. +            return utils.get_asset_amount(a.amount, quoteAssetObj);
  2827. +        }
  2828. +    }*/
  2829. +}
  2830. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingScheduleFragment.java
  2831. similarity index 73%
  2832. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationFragment.java
  2833. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingScheduleFragment.java
  2834. index 2bac1dd..7264030 100644
  2835. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/QuotationFragment.java
  2836. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TradingScheduleFragment.java
  2837. @@ -1,21 +1,28 @@
  2838. -package com.bitshares.bitshareswallet;
  2839. +package com.ngse.ui.main.trading;
  2840.  
  2841.  import android.arch.lifecycle.ViewModelProviders;
  2842.  import android.content.Context;
  2843. +import android.content.res.Resources;
  2844.  import android.graphics.Color;
  2845.  import android.graphics.Paint;
  2846. +import android.net.Uri;
  2847.  import android.os.Bundle;
  2848.  import android.support.v4.content.ContextCompat;
  2849. -import android.support.v7.widget.LinearLayoutManager;
  2850. -import android.support.v7.widget.RecyclerView;
  2851. -import android.util.Pair;
  2852. +import android.support.v4.view.ViewPager;
  2853.  import android.view.LayoutInflater;
  2854. +import android.view.Menu;
  2855. +import android.view.MenuInflater;
  2856. +import android.view.MenuItem;
  2857.  import android.view.View;
  2858.  import android.view.ViewGroup;
  2859. +import android.widget.RadioGroup;
  2860.  import android.widget.TextView;
  2861.  
  2862. +import com.bitshares.bitshareswallet.BaseFragment;
  2863. +import com.bitshares.bitshareswallet.BtsFragmentPageAdapter;
  2864. +import com.bitshares.bitshareswallet.MainActivity;
  2865. +
  2866.  import com.bitshares.bitshareswallet.data.HistoryPrice;
  2867. -import com.bitshares.bitshareswallet.market.MarketTicker;
  2868.  import com.bitshares.bitshareswallet.viewmodel.QuotationViewModel;
  2869.  import com.github.mikephil.charting.charts.CombinedChart;
  2870.  import com.github.mikephil.charting.components.AxisBase;
  2871. @@ -33,6 +40,10 @@ import com.github.mikephil.charting.data.Entry;
  2872.  import com.github.mikephil.charting.formatter.IAxisValueFormatter;
  2873.  import com.github.mikephil.charting.highlight.Highlight;
  2874.  import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
  2875. +import com.ngse.ui.NewMainActivity;
  2876. +import com.ngse.ui.main.balanceitems.OpenOrdersFragment;
  2877. +
  2878. +import org.evrazcoin.evrazwallet.R;
  2879.  
  2880.  import java.text.DecimalFormat;
  2881.  import java.text.SimpleDateFormat;
  2882. @@ -44,17 +55,28 @@ import java.util.Locale;
  2883.  import butterknife.BindView;
  2884.  import butterknife.ButterKnife;
  2885.  
  2886. -public class QuotationFragment extends BaseFragment {
  2887. -    private static final String TAG = "QuotationFragment";
  2888.  
  2889. -    private QuotationCurrencyPairAdapter quotationCurrencyPairAdapter;
  2890. -    private OnFragmentInteractionListener mListener;
  2891. +public class TradingScheduleFragment extends BaseFragment {
  2892. +    public static final String TAG = TradingScheduleFragment.class.getName();
  2893.  
  2894. -    @BindView(R.id.chart) CombinedChart mChart;
  2895. -    @BindView(R.id.recyclerView) RecyclerView mRecyclerView;
  2896. -    @BindView(R.id.layoutChartLoading) View mLoadingChartView;
  2897. -    @BindView(R.id.layoutLoadingError) View mLoadingErrorView;
  2898. -    @BindView(R.id.layoutSelected) View mviewLayoutSelected;
  2899. +
  2900. +    private OnFragmentInteractionListener mListener;
  2901. +    private MenuItem backMenuItem;
  2902. +    private BtsFragmentPageAdapter mExchangeFragmentPageAdapter;
  2903. +
  2904. +    @BindView(R.id.chart)
  2905. +    CombinedChart mChart;
  2906. +    @BindView(R.id.layoutChartLoading)
  2907. +    View mLoadingChartView;
  2908. +    @BindView(R.id.layoutLoadingError)
  2909. +    View mLoadingErrorView;
  2910. +    @BindView(R.id.layoutSelected)
  2911. +    View mviewLayoutSelected;
  2912. +
  2913. +    @BindView(R.id.viewPager)
  2914. +    ViewPager mViewPager;
  2915. +    @BindView(R.id.viewPagerSwitcher)
  2916. +    RadioGroup viewPagerSwitcher;
  2917.  
  2918.      private static final int SHOW_CHART_VIEW_NO_DATA = 0;
  2919.      private static final int SHOW_CHART_VIEW_LODING = 1;
  2920. @@ -62,45 +84,105 @@ public class QuotationFragment extends BaseFragment {
  2921.      private static final int SHOW_CHART_VIEW_READY = 3;
  2922.      private static final int SHOW_CHART_VIEW_NOT_SUPPORT = 4;
  2923.  
  2924. -    public QuotationFragment() {
  2925. +    public TradingScheduleFragment() {
  2926. +        // Required empty public constructor
  2927. +    }
  2928.  
  2929. +    @Override
  2930. +    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  2931. +        super.onCreateOptionsMenu(menu, inflater);
  2932. +        backMenuItem = menu.add(R.string.back)
  2933. +                .setIcon(R.drawable.abc_ic_ab_back_material)
  2934. +                .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
  2935.      }
  2936.  
  2937.      @Override
  2938. -    public void onAttach(Context context) {
  2939. -        super.onAttach(context);
  2940. +    public boolean onOptionsItemSelected(MenuItem item) {
  2941. +        if (item == backMenuItem)
  2942. +            getActivity().onBackPressed();
  2943. +        return super.onOptionsItemSelected(item);
  2944. +    }
  2945.  
  2946. -        if (context instanceof OnFragmentInteractionListener) {
  2947. -            mListener = (OnFragmentInteractionListener) context;
  2948. -        } else {
  2949. -            throw new RuntimeException(context.toString()
  2950. -                    + " must implement OnFragmentInteractionListener");
  2951. +    public static TradingScheduleFragment newInstance() {
  2952. +        return new TradingScheduleFragment();
  2953.      }
  2954. +
  2955. +
  2956. +    @Override
  2957. +    public void onResume() {
  2958. +        super.onResume();
  2959. +        onShow();
  2960. +        ((NewMainActivity) getActivity()).setTitleVisible(true);
  2961. +
  2962.      }
  2963.  
  2964.      @Override
  2965. -    public void onCreate(Bundle savedInstanceState) {
  2966. -        super.onCreate(savedInstanceState);
  2967. +    public void onDestroyView() {
  2968. +        ((NewMainActivity) getActivity()).setTitleVisible(false);
  2969. +        super.onDestroyView();
  2970.      }
  2971.  
  2972. -    public static QuotationFragment newInstance() {
  2973. -        QuotationFragment fragment = new QuotationFragment();
  2974. -        return fragment;
  2975. +    @Override
  2976. +    public void onShow() {
  2977. +        super.onShow();
  2978. +        QuotationViewModel viewModel = ViewModelProviders.of(getActivity()).get(QuotationViewModel.class);
  2979. +        viewModel.getHistoryPrice().observe(this, historyPriceListResource -> {
  2980. +            switch (historyPriceListResource.status) {
  2981. +                case ERROR:
  2982. +                    changeShowedView(SHOW_CHART_VIEW_LODING_FAIL);
  2983. +                    break;
  2984. +                case LOADING:
  2985. +                    changeShowedView(SHOW_CHART_VIEW_LODING);
  2986. +                    break;
  2987. +                case SUCCESS:
  2988. +                    changeShowedView(SHOW_CHART_VIEW_READY);
  2989. +                    updateChartData(historyPriceListResource.data);
  2990. +                    break;
  2991. +            }
  2992. +        });
  2993. +
  2994.      }
  2995.  
  2996. +    @Override
  2997. +    public void onHide() {
  2998. +        super.onHide();
  2999. +    }
  3000. +
  3001. +
  3002.      @Override
  3003.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  3004.                               Bundle savedInstanceState) {
  3005. -        View view = inflater.inflate(R.layout.fragment_quotation, container, false);
  3006. +        View view = inflater.inflate(R.layout.new_fragment_trading_schedule, container, false);
  3007.          ButterKnife.bind(this, view);
  3008. -
  3009. -        quotationCurrencyPairAdapter = new QuotationCurrencyPairAdapter(getActivity());
  3010. -        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
  3011. -        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  3012. -        mRecyclerView.setLayoutManager(linearLayoutManager);
  3013. -        mRecyclerView.setAdapter(quotationCurrencyPairAdapter);
  3014. -        mRecyclerView.setItemAnimator(null);
  3015. -
  3016. +        Resources res = getResources();
  3017. +        mExchangeFragmentPageAdapter = new BtsFragmentPageAdapter(getFragmentManager());
  3018. +        mExchangeFragmentPageAdapter.addFragment(TransactionSellBuyFragment.newInstance(TransactionSellBuyFragment.TRANSACTION_BUY), "");
  3019. +        mExchangeFragmentPageAdapter.addFragment(TransactionSellBuyFragment.newInstance(TransactionSellBuyFragment.TRANSACTION_SELL), "");
  3020. +        mExchangeFragmentPageAdapter.addFragment(TradingOrdersFragment.newInstance(),"");
  3021. +        mExchangeFragmentPageAdapter.addFragment(OpenOrdersFragment.newInstance(), "");
  3022. +//        mWalletFragmentPageAdapter.addFragment(TransactionsFragment.newInstance("", ""), res.getString(R.string.tab_transactions));
  3023. +
  3024. +
  3025. +        mViewPager.setAdapter(mExchangeFragmentPageAdapter);
  3026. +        initPager(mViewPager, mExchangeFragmentPageAdapter);
  3027. +        viewPagerSwitcher.setOnCheckedChangeListener((group, checkedId) -> {
  3028. +            switch (checkedId) {
  3029. +                case R.id.buyButton:
  3030. +                    mViewPager.setCurrentItem(0);
  3031. +                    break;
  3032. +                case R.id.sellButton:
  3033. +                    mViewPager.setCurrentItem(1);
  3034. +                    break;
  3035. +                case R.id.ordersButton:
  3036. +                    mViewPager.setCurrentItem(2);
  3037. +                    break;
  3038. +                case R.id.myOrdersButton:
  3039. +                    mViewPager.setCurrentItem(3);
  3040. +                    break;
  3041. +            }
  3042. +        });
  3043. +        viewPagerSwitcher.check(R.id.buyButton);
  3044. +        /////////////////////
  3045.          initChart();
  3046.  
  3047.          mChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
  3048. @@ -170,18 +252,6 @@ public class QuotationFragment extends BaseFragment {
  3049.              }
  3050.          });
  3051.  
  3052. -        QuotationViewModel viewModel = ViewModelProviders.of(getActivity()).get(QuotationViewModel.class);
  3053. -        quotationCurrencyPairAdapter.setOnItemClickListenr(new QuotationCurrencyPairAdapter.OnItemClickListner() {
  3054. -            @Override
  3055. -            public void onItemClick(View view, int position) {
  3056. -                //mListener.notifyCurrencyPairChange();
  3057. -                if (quotationCurrencyPairAdapter.getSelectedMarketTicker() != null) {
  3058. -                    MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  3059. -                    viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  3060. -                }
  3061. -
  3062. -            }
  3063. -        });
  3064.  
  3065.          return view;
  3066.      }
  3067. @@ -228,52 +298,43 @@ public class QuotationFragment extends BaseFragment {
  3068.          rightAxis.setAxisMinimum(0);
  3069.      }
  3070.  
  3071. -    @Override
  3072. -    public void onShow() {
  3073. -        super.onShow();
  3074. -
  3075. -        QuotationViewModel viewModel = ViewModelProviders.of(getActivity()).get(QuotationViewModel.class);
  3076. -        viewModel.getMarketTicker().observe(
  3077. -                this,
  3078. -                marketTickerListResource -> {
  3079. -                    switch (marketTickerListResource.status) {
  3080. -                        case ERROR:
  3081. -                            break;
  3082. -                        case LOADING:
  3083. -                            if (marketTickerListResource.data != null && marketTickerListResource.data.size() != 0) {
  3084. -                                quotationCurrencyPairAdapter.notifyDataUpdated(marketTickerListResource.data);
  3085. -                                MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  3086. -                                viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  3087. +    // TODO: Rename method, update argument and hook method into UI event
  3088. +    public void onButtonPressed(Uri uri) {
  3089. +        if (mListener != null) {
  3090. +            mListener.onFragmentInteraction(uri);
  3091.          }
  3092. -                            break;
  3093. -                        case SUCCESS:
  3094. -                            quotationCurrencyPairAdapter.notifyDataUpdated(marketTickerListResource.data);
  3095. -                            MarketTicker marketTicker = quotationCurrencyPairAdapter.getSelectedMarketTicker().marketTicker;
  3096. -                            viewModel.selectedMarketTicker(new Pair(marketTicker.base, marketTicker.quote));
  3097. -                            break;
  3098.      }
  3099. -                });
  3100.  
  3101. -        viewModel.getHistoryPrice().observe(this, historyPriceListResource -> {
  3102. -            switch (historyPriceListResource.status) {
  3103. -                case ERROR:
  3104. -                    changeShowedView(SHOW_CHART_VIEW_LODING_FAIL);
  3105. -                    break;
  3106. -                case LOADING:
  3107. -                    changeShowedView(SHOW_CHART_VIEW_LODING);
  3108. -                    break;
  3109. -                case SUCCESS:
  3110. -                    changeShowedView(SHOW_CHART_VIEW_READY);
  3111. -                    updateChartData(historyPriceListResource.data);
  3112. -                    break;
  3113. +    @Override
  3114. +    public void onAttach(Context context) {
  3115. +        super.onAttach(context);
  3116. +        if (context instanceof OnFragmentInteractionListener) {
  3117. +            mListener = (OnFragmentInteractionListener) context;
  3118. +        } else {
  3119. +//            throw new RuntimeException(context.toString()
  3120. +//                    + " must implement OnFragmentInteractionListener");
  3121.          }
  3122. -        });
  3123. -        viewModel.getSelectedMarketTicker().observe(this, currencyPair -> quotationCurrencyPairAdapter.notifyDataSetChanged() );
  3124.      }
  3125.  
  3126.      @Override
  3127. -    public void onHide() {
  3128. -        super.onHide();
  3129. +    public void onDetach() {
  3130. +        super.onDetach();
  3131. +        mListener = null;
  3132. +    }
  3133. +
  3134. +    /**
  3135. +     * This interface must be implemented by activities that contain this
  3136. +     * fragment to allow an interaction in this fragment to be communicated
  3137. +     * to the activity and potentially other fragments contained in that
  3138. +     * activity.
  3139. +     * <p>
  3140. +     * See the Android Training lesson <a href=
  3141. +     * "http://developer.android.com/training/basics/fragments/communicating.html"
  3142. +     * >Communicating with Other Fragments</a> for more information.
  3143. +     */
  3144. +    public interface OnFragmentInteractionListener {
  3145. +        // TODO: Update argument type and name
  3146. +        void onFragmentInteraction(Uri uri);
  3147.      }
  3148.  
  3149.      private void updateChartData(List<HistoryPrice> historyPriceList) {
  3150. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyFragment.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyFragment.java
  3151. similarity index 95%
  3152. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyFragment.java
  3153. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyFragment.java
  3154. index 1ed8c02..c4c7c76 100644
  3155. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyFragment.java
  3156. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyFragment.java
  3157. @@ -1,4 +1,4 @@
  3158. -package com.bitshares.bitshareswallet;
  3159. +package com.ngse.ui.main.trading;
  3160.  
  3161.  import android.arch.lifecycle.ViewModelProviders;
  3162.  import android.content.BroadcastReceiver;
  3163. @@ -24,6 +24,11 @@ import android.widget.EditText;
  3164.  import android.widget.TextView;
  3165.  import android.widget.Toast;
  3166.  
  3167. +import com.bitshares.bitshareswallet.BaseFragment;
  3168. +import com.bitshares.bitshareswallet.ConfirmOrderDialog;
  3169. +import com.bitshares.bitshareswallet.DensityUtil;
  3170. +import com.bitshares.bitshareswallet.TransactionSellBuyPasswordDialog;
  3171. +import com.bitshares.bitshareswallet.TransactionSellBuyRecyclerViewAdapter;
  3172.  import com.bitshares.bitshareswallet.market.MarketStat;
  3173.  import com.bitshares.bitshareswallet.room.BitsharesAsset;
  3174.  import com.bitshares.bitshareswallet.viewmodel.SellBuyViewModel;
  3175. @@ -37,6 +42,8 @@ import com.bituniverse.network.Status;
  3176.  import com.bituniverse.utils.NumericUtil;
  3177.  import com.kaopiz.kprogresshud.KProgressHUD;
  3178.  
  3179. +import org.evrazcoin.evrazwallet.R;
  3180. +
  3181.  import java.text.DecimalFormat;
  3182.  import java.text.SimpleDateFormat;
  3183.  import java.util.Calendar;
  3184. @@ -53,12 +60,12 @@ public class TransactionSellBuyFragment extends BaseFragment
  3185.      private static final String TRANSACTION_TYPE = "transaction_type";
  3186.  
  3187.      private static int buyTimeSec = 5 * 365 * 24 * 60 * 60;
  3188. -
  3189. +/*
  3190.      private TransactionSellBuyRecyclerViewAdapter buyRecyclerViewAdapter;
  3191.      private TransactionSellBuyRecyclerViewAdapter sellRecyclerViewAdapter;
  3192.      private RecyclerView buyRecyclerView;
  3193.      private RecyclerView sellRecyclerView;
  3194. -    private int maxOrderCount = 10;
  3195. +    private int maxOrderCount = 10;*/
  3196.  
  3197.      public static final int TRANSACTION_BUY = 1;
  3198.      public static final int TRANSACTION_SELL = 2;
  3199. @@ -125,8 +132,8 @@ public class TransactionSellBuyFragment extends BaseFragment
  3200.          }
  3201.  
  3202.          if (stat.orderBook.bids != null && !stat.orderBook.bids.isEmpty()) {
  3203. -            int maxCount = Math.min(stat.orderBook.bids.size(), maxOrderCount);
  3204. -            buyRecyclerViewAdapter.setList(stat.orderBook.bids.subList(0, maxCount));
  3205. +          /*  int maxCount = Math.min(stat.orderBook.bids.size(), maxOrderCount);
  3206. +            buyRecyclerViewAdapter.setList(stat.orderBook.bids.subList(0, maxCount));*/
  3207.  
  3208.              higgestBuyPrice = stat.orderBook.bids.get(0).price;
  3209.          } else {
  3210. @@ -134,8 +141,8 @@ public class TransactionSellBuyFragment extends BaseFragment
  3211.          }
  3212.  
  3213.          if (stat.orderBook.asks != null && !stat.orderBook.asks.isEmpty()) {
  3214. -            int maxCount = Math.min(stat.orderBook.asks.size(), maxOrderCount);
  3215. -            sellRecyclerViewAdapter.setList(stat.orderBook.asks.subList(0, maxCount));
  3216. +           /* int maxCount = Math.min(stat.orderBook.asks.size(), maxOrderCount);
  3217. +            sellRecyclerViewAdapter.setList(stat.orderBook.asks.subList(0, maxCount));*/
  3218.  
  3219.              lowestSellPrice = stat.orderBook.asks.get(0).price;
  3220.          } else {
  3221. @@ -150,9 +157,9 @@ public class TransactionSellBuyFragment extends BaseFragment
  3222.          if (!isInitPriceValue) {
  3223.              isInitPriceValue = true;
  3224.              if (transactionType == TRANSACTION_BUY && lowestSellPrice != -1) {
  3225. -                pEditText.setText(decimalFormat.format(lowestSellPrice));
  3226. +                pEditText.setText(decimalFormat.format(lowestSellPrice).replace(",", "."));
  3227.              } else if (transactionType == TRANSACTION_SELL && higgestBuyPrice != -1) {
  3228. -                pEditText.setText(decimalFormat.format(higgestBuyPrice));
  3229. +                pEditText.setText(decimalFormat.format(higgestBuyPrice).replace(",", "."));
  3230.              }
  3231.          }
  3232.  
  3233. @@ -171,12 +178,18 @@ public class TransactionSellBuyFragment extends BaseFragment
  3234.          }
  3235.      }
  3236.  
  3237. +    @Override
  3238. +    public void onResume() {
  3239. +        super.onResume();
  3240. +        onShow();
  3241. +    }
  3242. +
  3243.      @Override
  3244.      public void onShow() {
  3245.          super.onShow();
  3246.          updateCurency();
  3247.          initFee();
  3248. -        updateMaxOrderCount();
  3249. +//        updateMaxOrderCount();
  3250.          orderStat.subscribe(baseAsset, quoteAsset, MarketStat.STAT_MARKET_ORDER_BOOK,
  3251.                  MARKET_STAT_INTERVAL_MILLIS, this);
  3252.  
  3253. @@ -215,7 +228,7 @@ public class TransactionSellBuyFragment extends BaseFragment
  3254.      @Override
  3255.      public View onCreateView(LayoutInflater inflater, ViewGroup container,
  3256.                               Bundle savedInstanceState) {
  3257. -        View view = inflater.inflate(R.layout.fragment_buy_sell, container, false);
  3258. +        View view = inflater.inflate(R.layout.new_fragment_buy_sell, container, false);
  3259.  
  3260.          Button okButton = (Button) view.findViewById(R.id.okButton);
  3261.          okButton.setOnClickListener(this);
  3262. @@ -252,6 +265,7 @@ public class TransactionSellBuyFragment extends BaseFragment
  3263.          balanceTextBase = (TextView) view.findViewById(R.id.balanceTextBase);
  3264.          askTextBase = (TextView) view.findViewById(R.id.askTextBase);
  3265.          askTextInfo = (TextView) view.findViewById(R.id.askTextInfo);
  3266. +/*
  3267.  
  3268.          buyRecyclerView = (RecyclerView) view.findViewById(R.id.buy_recycler);
  3269.          buyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  3270. @@ -264,6 +278,7 @@ public class TransactionSellBuyFragment extends BaseFragment
  3271.          sellRecyclerView.setAdapter(sellRecyclerViewAdapter);
  3272.          sellRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  3273.          sellRecyclerView.setItemAnimator(null);
  3274. +*/
  3275.  
  3276.          return view;
  3277.      }
  3278. @@ -519,7 +534,7 @@ public class TransactionSellBuyFragment extends BaseFragment
  3279.          }).start();
  3280.      }
  3281.  
  3282. -    private void updateMaxOrderCount(){
  3283. +    /*private void updateMaxOrderCount(){
  3284.          int orderItemHeightDp = DensityUtil.dpToPx(getContext(), TransactionSellBuyRecyclerViewAdapter.ORDERITEMHEIGHTDP);
  3285.          int buyRecyclerHeight = buyRecyclerView.getHeight();
  3286.  
  3287. @@ -527,7 +542,7 @@ public class TransactionSellBuyFragment extends BaseFragment
  3288.          if (maxOrderCount <= 0) {
  3289.              maxOrderCount = 8;
  3290.          }
  3291. -    }
  3292. +    }*/
  3293.  
  3294.      private void updateCurency() {
  3295.          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
  3296. diff --git a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyRecyclerViewAdapter.java b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyRecyclerViewAdapter.java
  3297. similarity index 92%
  3298. rename from bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyRecyclerViewAdapter.java
  3299. rename to evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyRecyclerViewAdapter.java
  3300. index b727bb9..b2f97fd 100644
  3301. --- a/bitshares_andriod_wallet/app/src/main/java/com/bitshares/bitshareswallet/TransactionSellBuyRecyclerViewAdapter.java
  3302. +++ b/evraz-wallet/app/src/main/java/com/ngse/ui/main/trading/TransactionSellBuyRecyclerViewAdapter.java
  3303. @@ -1,4 +1,4 @@
  3304. -package com.bitshares.bitshareswallet;
  3305. +package com.ngse.ui.main.trading;
  3306.  
  3307.  import android.support.v7.widget.RecyclerView;
  3308.  import android.view.LayoutInflater;
  3309. @@ -8,7 +8,8 @@ import android.widget.TextView;
  3310.  
  3311.  import com.bitshares.bitshareswallet.market.Order;
  3312.  
  3313. -import java.text.DecimalFormat;
  3314. +import org.evrazcoin.evrazwallet.R;
  3315. +
  3316.  import java.util.List;
  3317.  
  3318.  public class TransactionSellBuyRecyclerViewAdapter extends RecyclerView.Adapter<TransactionSellBuyRecyclerViewAdapter.ViewHolder> {
  3319. @@ -30,7 +31,7 @@ public class TransactionSellBuyRecyclerViewAdapter extends RecyclerView.Adapter<
  3320.      @Override
  3321.      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  3322.          View view = LayoutInflater.from(parent.getContext())
  3323. -                .inflate(R.layout.view_order_item, parent, false);
  3324. +                .inflate(R.layout.new_view_order_item, parent, false);
  3325.          return new ViewHolder(view);
  3326.      }
  3327.  
  3328. diff --git a/evraz-wallet/app/src/main/java/com/ngse/utility/DebugUtility.java b/evraz-wallet/app/src/main/java/com/ngse/utility/DebugUtility.java
  3329. new file mode 100644
  3330. index 0000000..40287f5
  3331. --- /dev/null
  3332. +++ b/evraz-wallet/app/src/main/java/com/ngse/utility/DebugUtility.java
  3333. @@ -0,0 +1,118 @@
  3334. +package com.ngse.utility;
  3335. +
  3336. +import android.content.Context;
  3337. +import android.content.ContextWrapper;
  3338. +import android.os.Environment;
  3339. +import android.util.Log;
  3340. +
  3341. +import java.io.BufferedWriter;
  3342. +import java.io.File;
  3343. +import java.io.FileWriter;
  3344. +import java.io.IOException;
  3345. +import java.text.SimpleDateFormat;
  3346. +import java.util.Calendar;
  3347. +import java.util.Locale;
  3348. +
  3349. +/**
  3350. + * Created by Kulykov Anton on 26.07.2018
  3351. + */
  3352. +
  3353. +public class DebugUtility {
  3354. +    private static final boolean DEBUG = true;
  3355. +    private static final boolean DEBUG_FILE = false;
  3356. +    private static final String PRE_TAG = "TEST";
  3357. +    private static final String API_TAG = "API";
  3358. +    private static final String LOG_FOLDER = "logs";
  3359. +    public static SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
  3360. +    private static Object syncObject;
  3361. +
  3362. +
  3363. +    public static void logTest(String tag, String msg) {
  3364. +        tag = PRE_TAG + " " + tag;
  3365. +        Log.e(tag, msg);
  3366. +    }
  3367. +
  3368. +    public static void logApi(String tag, String msg) {
  3369. +        tag = API_TAG + " " + tag;
  3370. +        if (msg == null)
  3371. +            msg = "";
  3372. +        Log.e(tag, msg);
  3373. +    }
  3374. +
  3375. +    public static void logE(Context context, String tag, String msg) {
  3376. +        tag = PRE_TAG + " " + tag;
  3377. +        if (DEBUG_FILE) {
  3378. +            logToFile(context, tag, msg);
  3379. +        }
  3380. +        if (!DEBUG) {
  3381. +            return;
  3382. +        }
  3383. +        Log.e(tag, msg);
  3384. +    }
  3385. +
  3386. +    private static void logToFile(Context context, String tag, String msg) {
  3387. +        if (context == null) {
  3388. +            return;
  3389. +        }
  3390. +        synchronized (getSyncObject()) {
  3391. +            String path = getTempPath(context, LOG_FOLDER);
  3392. +            if (!isSDCardEnabled(context, LOG_FOLDER)) {
  3393. +                return;
  3394. +            }
  3395. +            File logFile = new File(path + File.separator + "logNEW.txt");
  3396. +            if (!logFile.exists()) {
  3397. +                try {
  3398. +                    logFile.createNewFile();
  3399. +                } catch (Exception e) {
  3400. +                    e.printStackTrace();
  3401. +                }
  3402. +            }
  3403. +            try {
  3404. +                // BufferedWriter for performance, true to set append to file flag
  3405. +                BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
  3406. +                buf.append(dateTimeFormatter.format(Calendar.getInstance().getTime()) + "  " + tag + "  " + msg);
  3407. +                buf.newLine();
  3408. +                buf.close();
  3409. +            } catch (IOException e) {
  3410. +                e.printStackTrace();
  3411. +            }
  3412. +        }
  3413. +    }
  3414. +
  3415. +    private static Object getSyncObject() {
  3416. +        if (syncObject == null)
  3417. +            syncObject = new Object();
  3418. +        return syncObject;
  3419. +    }
  3420. +
  3421. +    public static String getTempPath(Context context, String folder) {
  3422. +        String path = getRootFolder(context) +
  3423. +                folder;
  3424. +
  3425. +        return path;
  3426. +    }
  3427. +
  3428. +    public static String getRootFolder(Context context) {
  3429. +        String packageNameString = context != null ? context.getApplicationContext().getPackageName() : "com.NGSE.Temp";
  3430. +        return getRootFolderWithoutPackage(context) + packageNameString + File.separator;
  3431. +    }
  3432. +
  3433. +    public static String getRootFolderWithoutPackage(Context context) {
  3434. +        String state = Environment.getExternalStorageState();
  3435. +        boolean isTempStorageAccessibile = Environment.MEDIA_MOUNTED.equals(state);
  3436. +
  3437. +        if (isTempStorageAccessibile || context == null) {
  3438. +            return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/";
  3439. +        } else {
  3440. +            ContextWrapper cw = new ContextWrapper(context);
  3441. +            File directory = cw.getDir("media", Context.MODE_PRIVATE);
  3442. +            return directory.getAbsolutePath();
  3443. +        }
  3444. +    }
  3445. +
  3446. +    public static boolean isSDCardEnabled(Context context, String folder) {
  3447. +        File tempFile = new File(getTempPath(context, folder));
  3448. +        tempFile.mkdirs();
  3449. +        return tempFile.canWrite();
  3450. +    }
  3451. +}
  3452. \ No newline at end of file
Add Comment
Please, Sign In to add comment