-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes and performance improvement.
- Loading branch information
Showing
40 changed files
with
1,200 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/crypto/delta/exchange/openexchange/adapter/HomeAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package crypto.delta.exchange.openexchange.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.appcompat.widget.AppCompatTextView | ||
import androidx.fragment.app.FragmentActivity | ||
import androidx.navigation.findNavController | ||
import androidx.recyclerview.widget.RecyclerView | ||
import crypto.delta.exchange.openexchange.R | ||
import crypto.delta.exchange.openexchange.pojo.products.ProductsResponse | ||
import crypto.delta.exchange.openexchange.utils.AppPreferenceManager | ||
|
||
class HomeAdapter( | ||
private var productsResponseList: List<ProductsResponse>, | ||
private val requireActivity: FragmentActivity | ||
) : RecyclerView.Adapter<HomeAdapter.ViewHolder>() { | ||
|
||
override fun getItemCount() = productsResponseList.size | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
val v = LayoutInflater.from(parent.context) | ||
.inflate(R.layout.adapter_home, parent, false) | ||
return ViewHolder(v) | ||
} | ||
|
||
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
internal val symbol: AppCompatTextView = itemView.findViewById(R.id.symbol) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
val product = productsResponseList[position] | ||
holder.symbol.text = product.symbol | ||
holder.itemView.setOnClickListener { | ||
AppPreferenceManager(requireActivity).setCurrentProductSymbol(product.symbol) | ||
AppPreferenceManager(requireActivity).setCurrentProductId(product.id.toString()) | ||
requireActivity.findNavController(R.id.nav_host_fragment).navigate(R.id.navigation_chart) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/src/main/java/crypto/delta/exchange/openexchange/pojo/products/ConstituentExchange.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package crypto.delta.exchange.openexchange.pojo.products | ||
|
||
import com.google.gson.annotations.Expose | ||
import com.google.gson.annotations.SerializedName | ||
|
||
class ConstituentExchange { | ||
@SerializedName("weight") | ||
@Expose | ||
var weight: Int? = null | ||
|
||
@SerializedName("exchange") | ||
@Expose | ||
var exchange: String? = null | ||
|
||
@SerializedName("health_interval") | ||
@Expose | ||
var healthInterval: Int? = null | ||
|
||
@SerializedName("health_priority") | ||
@Expose | ||
var healthPriority: Int? = null | ||
|
||
@SerializedName("toSym") | ||
@Expose | ||
var toSym: String? = null | ||
|
||
@SerializedName("fromSym") | ||
@Expose | ||
var fromSym: String? = null | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/crypto/delta/exchange/openexchange/pojo/products/ProductSpecs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package crypto.delta.exchange.openexchange.pojo.products | ||
|
||
import com.google.gson.annotations.Expose | ||
import com.google.gson.annotations.SerializedName | ||
|
||
class ProductSpecs { | ||
@SerializedName("fixed_ir_index") | ||
@Expose | ||
var fixedIrIndex: String? = null | ||
|
||
@SerializedName("floating_ir_index") | ||
@Expose | ||
var floatingIrIndex: String? = null | ||
|
||
@SerializedName("floating_rate_max") | ||
@Expose | ||
var floatingRateMax: String? = null | ||
|
||
@SerializedName("floating_rate_min") | ||
@Expose | ||
var floatingRateMin: String? = null | ||
|
||
@SerializedName("rate_exchange_interval") | ||
@Expose | ||
var rateExchangeInterval: Int? = null | ||
|
||
} |
Oops, something went wrong.