Giter Club home page Giter Club logo

dalal-street-android's Introduction

CircleCI build status Go Report Card

Dalal-Street

Sublime's custom image

Dalal Street App

Pragyan Event : Manigma : Online

Are you a stock market enthusiast? Do the words Sensex and Nasdaq mean more to you than just names at the bottom of news channels? At Pragyan 2020, we have the perfect platform for you to test your trading skills, and see if you understand the evolution of trade from barter to modern-day stock exchange here at Dalal Street! Grit your teeth, take calculated risks under pressure and become the richest man on the market!

Register now and see if you can become the next Wolf of Dalal Street!

Setup

Clone this repository

git clone https://github.com/delta/dalal-street-android.git

Update submodule for protocol buffers:

git submodule init
git submodule update --recursive --remote

In Android Studio just clean build should work.

Uses GRPC to send and receive requests/responses from web socket API (Dalal server).

dalal-street-android's People

Contributors

ar-sibi avatar avikumar15 avatar dhruv1294 avatar harsh2098 avatar kanishk779 avatar ranaaditya avatar santhoshsamy29 avatar satyamurti avatar sudhindra3000 avatar vivekuchiha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dalal-street-android's Issues

Fix setting stock IDs in requests

At some places, we assume that stockId is equal to position of company in a list. This is particularly happening where spinners are used.

For example, in MortgageFragment.kt :-
RetrieveMortgageStocksRequest.newBuilder()
.setStockId(mortgage_companies_spinner.selectedItemPosition + 1)
.setStockQuantity(Integer.parseInt(stocks_editText.text.toString())).build()

Here, stockId depends on position of spinner, it should instead depend on getStockIdFromCompanyName() helper functions or something equivalent

Transaction fragment fix

While on Transactions fragment, when you open drawer and click Transactions, new set of transactions show up.

Mortgage Fragment layout change

Have 2 sub fragments like MarketDepthFragment, one for mortgage and another for retrieve.

  1. Mortgage
    Will show spinner, stocks owned, stocks in mortgage, edittext to enter stock amount to mortgage, button

  2. Retrieve part will have RecyclerView (retrieveRecyclerView), no spinner required here.

News Fragment Crashing

Okay this does not happen everytime, but it still happens

  1. While on HomeFragment turn off WiFi.
  2. Open navigation drawer and click NewsFragment
  3. When navigated to news fragment, as expected you'll get dialog saying no internet.
  4. Turn On Wifi and click RETRY.
  5. App crashes after clicking RETRY.

Logcat says outOfBoundsException on index 0 in MainActivity.kt:-
val currentFragment = navHostFragment?.childFragmentManager?.fragments?.get(0)

Allow user to enter number of stocks faster

Right now we just have an edit-text. As price changes rapidly and entering number into edit text takes 1-2 sec, stock price might in that short time. I thought of having +1 and +5 buttons to increase/decrease stocks instead of edit text.

Synchronize worth textview animations

When animateWorthChange() is called twice at the same time (while first animation is running), only the second function call is effective.
For example consider 2 consecutive calls:-
animateWorthChange(oldValue, value1, cashWorthtextView, cashIndicatorImageView)
animateWorthChange(oldValue, value2, cashWorthtextView, cashIndicatorImageView)

Final cash displayed is oldValue + value2 (wrong) and not oldValue + value1 + value2 (correct)

User has to click twice on Interval spinner

In DepthGraphFragment, once I select some interval; next time when I want to change interval (select another interval from spinner) I have to tap twice on the interval spinner to open it.

Joyride

https://github.com/KeepSafe/TapTargetView

Easy library. Tap target sequence should start whenever a fragment is open for the first time. Max. target per fragment should be 2-3 or 0 if joyride on that fragment is not necessary. Keep description lucid and clear.

Removing Server's SSL Certificate

The server's Certificate is hardcoded in the app which is not a good practice. Find a solution for this. One may be to get a trusted certificate for the server which does not need special whitelisting on the app.

Retrieve Mortgage

Sometime when I retrieve stocks, I get transaction successful toast but neither worth textviews (cash/stock/total) change nor that row in retrieve recycler view updates. Happens sometimes.

Add Market Depth in Trade Fragment

The user cannot continuously monitor the stock price while placing an order. Add some kind of shortcut to market depth or any other better alternative as there isn’t much space in the fragment.

Encrypting the Shared Preferences

Currently Shared Preferences in the app are not Encrypted !

Need to encrypt the Shared Preferences in the app !

NOTE - if we implement the encryption using the androidx's EncryptedSharedPreferences, we need to upgrade the min SDK required to 23. And Implementing our own custom wrapper over Shared Preferences would be a tedious job

ps: please have a look of jetpack's Datastore, it has type safe way to store proto objects

Add large cash amount formatting

At some places this has to be added, right now it displays in this format only in the cash/stock/total worth textviews.
val formatter = DecimalFormat("##,##,###")

When Internet Available

After user clicks retry, reload fragment which was previously in display. Sometime after reconnecting to WiFi and clicking RETRY, dialog box is dismissed but fragment remains blank (eg. News Fragment)

Fix channel not shutdown properly issue.

After switching some fragments, the logcat prints the following error:

  • ~ * ~ * ~ Channel {0} was not shutdown properly!!! ~ * ~ * ~ *
    Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
    java.lang.RuntimeException: ManagedChannel allocation site

Update the Project to latest Dependencies Versions

  • Need to update the versions of many dependencies and build tools version
  • Need to update the version of Kotlin in Project , we are using 1.3.61 but latest is 1.4.x

Note: this task should be done without breaking the existing codebase and functionality of the app

Title not changing

Title should change according to fragment, except for Home fragment which should display Dalal Street.

Smaller news content in home fragment

Full news content displayed in home fragment for each news item which is useless. What we want is to have the headlines and 2-3 lines of news content with ... in the end. So when user clicks news item, it will take him to NewsDetailsFragment with that particular news item displayed with image. So in adapter while setting news content reduce it to 50 words or something equivalent.

Time stamp

Time stamps are not being parsed correctly due to different incoming timestamp from server.

Replacing Koltin-synthetics with Jetpack's view binding

Kotlin Android Extensions is deprecated, which means that using Kotlin synthetics for view binding is no longer supported !

Need to Upgrade the app with view binding, Migration docs are available here

NOTE: this going to be big edit and replace issue so need to be done with proper testing after each component

Stock Exchange Fragment Input

Right now we have EditText to enter number of stocks. It takes time to open keyboard, enter number, close keyboard, press button.. We need to speed up this process. Either use another view like number picker or have +1, +5 buttons near the input field.

Network error handler code refactoring

A) Change nested ifs in all fragments to if-else-if ladder.

if (!ConnectionUtils.getConnectionInfo(context)) {
     uiThread { networkDownHandler.onNetworkDownError(resources.getString(R.string.error_check_internet)) }
} else if (!ConnectionUtils.isReachableByTcp(Constants.HOST, Constants.PORT)) {
     uiThread { networkDownHandler.onNetworkDownError(resources.getString(R.string.error_server_down)) }
} else {
    // Do actual thing
}

B) Apart from having RETRY button in that non cancellable (.setCancelable(false)) dialog box which you would be displaying from MainActivity, you can automatically detect if internet is available again by doing this:-

  1. Add new module to dagger (it'll make MainActivity.kt short)
@Module
class ConnectivityModule {
    @Provides
    @BingoApplicationScope
    internal fun getConnectivityManager(context: Context) = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

    @Provides
    @BingoApplicationScope
    fun getNetworkRequest() = NetworkRequest.Builder().addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
            .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR).build()
}
  1. Inject these 2 things in MainActivity:-
@Inject
    lateinit var connectivityManager: ConnectivityManager

    @Inject
    lateinit var networkRequest: NetworkRequest
  1. In MainActivity.kt in onResume()
    connectivityManager.registerNetworkCallback(networkRequest, networkCallback)
  2. In MainActivity.kt in onPause()
    connectivityManager.unregisterNetworkCallback(networkCallback)
  3. Create networkCallback object like this:-
networkCallback = object : ConnectivityManager.NetworkCallback() {

            override fun onAvailable(network: Network) {
                super.onAvailable(network)
                runOnUiThread {
                    // Do something ....
                }
            }

            override fun onLost(network: Network) {
                super.onLost(network)
                // Do something as network lost
            }
        }

Refactor

In MainActivity.kt private fun unsubscribeFromAllStreams(shouldSubscribeAgain: Boolean)
wherever this functions is called parameter passed is false. Check if we can remove this parameter from the function signature.

Upgrade the build system to the latest standards

  • Need to upgrade the build system to the latest standards !
  • Need to Migrate from Groovy to Kotlin-DSL
  • In existing build scripts some functionalities are depreceated and gives warning on building, need to fix them
  • Need to restructure the build system

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.