From 119300d545cffc965bf65a6e581a7c51372fcc78 Mon Sep 17 00:00:00 2001 From: dtvv Date: Fri, 17 Aug 2018 00:43:03 -0500 Subject: [PATCH] =?UTF-8?q?-Create=20class=20LoadingActivity.kt=20-Create?= =?UTF-8?q?=20loading=5Factivity.xml=20layout=20-Static=20interface=20inte?= =?UTF-8?q?graci=C3=B3n=20in=20LoadingActivity.kt=20to=20entable=20simple?= =?UTF-8?q?=20use=20-In=20the=20Board=20Window=20in=20the=20server=20conne?= =?UTF-8?q?ction=20show=20the=20new=20loading=20acitivity=20-Take=20video?= =?UTF-8?q?=20called=20=E2=80=9CLoading=20screen=20when=20socket=20server?= =?UTF-8?q?=20comunicaci=C3=B3n=20comes=E2=80=9D=20-In=20the=20Intro=20Win?= =?UTF-8?q?dow:=20When=20the=20user=20tr=C3=ADes=20to=20clic=20button=20an?= =?UTF-8?q?d=20there=20are=20not=20server=20comunication=20it=20should=20s?= =?UTF-8?q?how=20loading=20screen=20-In=20the=20board=20window=20i=20teste?= =?UTF-8?q?d=20that=20the=20gestores=20GUI=20works=20fine=20in=20real=20de?= =?UTF-8?q?vice=20-In=20the=20BoardActivity=20there=20is=20a=20grey=20bran?= =?UTF-8?q?d=20below=20first=20panel=20gui=20balances=20-Change=20the=20Fo?= =?UTF-8?q?nt=20in=20the=20BoardAcivity=20to=20be=20the=20same=20as=20in?= =?UTF-8?q?=20the=20video=20-In=20the=20BoardActivity=20when=20clicling=20?= =?UTF-8?q?in=20sections=20that=20the=20sections=20show=20grayed=20for=20u?= =?UTF-8?q?nselected=20and=20White=20for=20selected=20-Change=20Bitshares?= =?UTF-8?q?=20Font=20style=20as=20the=20video=20-In=20the=20window=20Broad?= =?UTF-8?q?Activity=20set=20the=20left=20icon=20more=20mall=20and=20the=20?= =?UTF-8?q?Font=20as=20in=20the=20video?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 3 + .../activities/BoardActivity.java | 59 ++++++++++++++++++- .../activities/IntroActivity.java | 2 - .../network/WebSocketThread.java | 20 +++++++ .../views/CryptoNetBalanceViewHolder.java | 9 ++- app/src/main/res/layout/balance_list_item.xml | 5 +- app/src/main/res/layout/board.xml | 3 + app/src/main/res/layout/fragment_balance.xml | 10 ++++ app/src/main/res/values/colors.xml | 3 + 9 files changed, 108 insertions(+), 6 deletions(-) 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