diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ba2bf0d..2c1aff3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,6 +33,9 @@ + + diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index c9f5a16..c342c2b 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -8,6 +8,8 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Typeface; import android.media.MediaPlayer; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; @@ -19,12 +21,19 @@ import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; import android.util.Pair; +import android.util.TypedValue; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; +import android.view.ViewGroup; import android.view.animation.LinearInterpolator; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import com.sjaramillo10.animatedtablayout.AnimatedTabLayout; @@ -47,7 +56,7 @@ import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel; * */ -public class BoardActivity extends AppCompatActivity { +public class BoardActivity extends CustomActivity { @BindView(R.id.tabLayout) public TabLayout tabLayout; @@ -98,6 +107,54 @@ public class BoardActivity extends AppCompatActivity { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + /* + * Listener tabLayout to resalt text when clicked + * */ + final TabLayout tabLayoutFinal = tabLayout; + tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(final TabLayout.Tab tab) { + + globalActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + + LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition()); + TextView tabTextView = (TextView) tabLayout.getChildAt(1); + //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50); + Spannable WordtoSpan = new SpannableString(tabTextView.getText()); + WordtoSpan.setSpan(new ForegroundColorSpan(Color.WHITE), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + tabTextView.setText(WordtoSpan); + tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD); + } + }); + } + + @Override + public void onTabUnselected(final TabLayout.Tab tab) { + + globalActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + + LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition()); + TextView tabTextView = (TextView) tabLayout.getChildAt(1); + //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50); + Spannable WordtoSpan = new SpannableString(tabTextView.getText()); + WordtoSpan.setSpan(new ForegroundColorSpan(globalActivity.getResources().getColor(R.color.whiteclear)), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + tabTextView.setText(WordtoSpan); + tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL); + } + }); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + + + } + }); + // Appbar animation mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java index 34608cd..75513a3 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java @@ -63,8 +63,6 @@ public class IntroActivity extends CustomActivity { ButterKnife.bind(this); - - /* * Test connection with server * */ diff --git a/app/src/main/java/cy/agorise/crystalwallet/network/WebSocketThread.java b/app/src/main/java/cy/agorise/crystalwallet/network/WebSocketThread.java index 2488678..f2cf5c0 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/network/WebSocketThread.java +++ b/app/src/main/java/cy/agorise/crystalwallet/network/WebSocketThread.java @@ -12,6 +12,7 @@ import com.neovisionaries.ws.client.WebSocketListener; import java.io.IOException; import java.util.HashMap; +import cy.agorise.crystalwallet.activities.LoadingActivity; import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator; import cy.agorise.crystalwallet.dialogs.material.DialogMaterial; @@ -157,6 +158,13 @@ public class WebSocketThread extends Thread { canChange = false; + /* + * Show the loading activity so user can see the progress + * */ + if(activity!=null){ + LoadingActivity.show(activity); + } + // Moves the current Thread into the background android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); @@ -174,6 +182,13 @@ public class WebSocketThread extends Thread { WebSocketThread.currentThreads.put(this.getId(),this); mWebSocket.connect(); + /* + * Hide the loading activity, now it is not more necesary + * */ + if(activity!=null){ + LoadingActivity.dismiss(); + } + /* * * Websocket success response @@ -185,6 +200,11 @@ public class WebSocketThread extends Thread { } catch (final Exception e) { Log.e(TAG, "WebSocketException. Msg: "+e.getMessage()); + /* + * Hide the loading activity, now it is not more necesary + * */ + LoadingActivity.dismiss(); + //Deliver error to user if(activity!=null){ diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java b/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java index bf1d66e..4a2043c 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java +++ b/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java @@ -192,7 +192,14 @@ public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder { } else { final CryptoNetBalanceViewHolder thisViewHolder = this; this.cryptoNetAccountId = balance.getAccountId(); - cryptoNetName.setText(balance.getCryptoNet().getLabel()); + + /* + * The first letter should be in mayus + * */ + final String crypto = balance.getCryptoNet().getLabel().toString().toLowerCase(); + final String upperString = crypto.substring(0,1).toUpperCase() + crypto.substring(1); + + cryptoNetName.setText(upperString); //Loads the crypto coin balance list of this account using a ViewModel and retrieving a LiveData List CryptoCoinBalanceListViewModel cryptoCoinBalanceListViewModel = ViewModelProviders.of(this.fragment).get(CryptoCoinBalanceListViewModel.class); diff --git a/app/src/main/res/layout/balance_list_item.xml b/app/src/main/res/layout/balance_list_item.xml index 997394a..0c65a38 100644 --- a/app/src/main/res/layout/balance_list_item.xml +++ b/app/src/main/res/layout/balance_list_item.xml @@ -25,8 +25,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" - android:maxHeight="32dp" - android:maxWidth="32dp" + android:maxHeight="28dp" + android:maxWidth="28dp" app:srcCompat="@drawable/bts" /> diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index 8e0b8e4..4b8f6a9 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -101,7 +101,10 @@ android:layout_gravity="bottom" android:layout_width="match_parent" android:layout_height="wrap_content" + app:tabSelectedTextColor="@color/white" app:layout_collapseMode="pin" + app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget" + app:tabTextColor="@color/whiteclear" android:animateLayoutChanges="true" /> diff --git a/app/src/main/res/layout/fragment_balance.xml b/app/src/main/res/layout/fragment_balance.xml index c04016d..41f5dc2 100644 --- a/app/src/main/res/layout/fragment_balance.xml +++ b/app/src/main/res/layout/fragment_balance.xml @@ -4,9 +4,19 @@ android:layout_height="match_parent" tools:context="cy.agorise.crystalwallet.fragments.BalanceFragment"> + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 527e956..a975956 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,6 +14,9 @@ #147b00 + + #cccccc + #000000 #70882E #ff0000