Skip to content

Commit

Permalink
Fix three bugs, read description
Browse files Browse the repository at this point in the history
1. the text colour of alert dialogues would remain dark when on the dark theme, this has been fixed to show the right colour
2. the rewards popup would show up on each app start because of a wrong check, this has been fixed
3. the rewards popup has been simplified and no custom view has been inflated
  • Loading branch information
hispeedimagins committed Mar 8, 2019
1 parent ad954ae commit 67911e3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 36 deletions.
38 changes: 11 additions & 27 deletions app/src/main/java/com/insteem/ipfreely/steem/MainActivity.kt
Expand Up @@ -553,7 +553,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
if(result.user.reward_sbd_balance != "0.000 SBD" ||
result.user.reward_steem_balance != "0.000 STEEM" ||
result.user.reward_vesting_steem != "0.000 STEEM" ||
result.user.reward_steem_balance != "0.000000 VESTS"){
result.user.reward_vesting_balance != "0.000000 VESTS"){
openRewardAlert(result)
}
//val resultp = gson.fromJson<prof.profiledata>(result.user.json_metadata,prof.profiledata::class.java)
Expand Down Expand Up @@ -599,36 +599,20 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
//if the user wishes to claim them then a request will be made
fun openRewardAlert(profile:ProfileJsonSteemit){
val alertDialogBuilder = AlertDialog.Builder(MiscConstants.ApplyMyThemeRet(this@MainActivity))
//val alertDialogBuilder = AlertDialog.Builder(this@MainActivity)
alertDialogBuilder.setTitle("Claim Rewards?")

val inflater = layoutInflater
val dialogView : View = inflater.inflate(R.layout.dialog_open_a_blog, null)

alertDialogBuilder.setView(dialogView)
val edittext = dialogView.findViewById<EditText>(R.id.name)
edittext.setText("${profile.user?.reward_sbd_balance} , ${profile.user?.reward_steem_balance} , ${profile.user?.reward_vesting_steem}")
edittext.isEnabled = false
alertDialogBuilder.setPositiveButton("ok") { diin, num ->
if(edittext.text != null){
var ms = MakeOperationsMine()
var ope = ms.claimRewards(AccountName(username),profile.user?.reward_sbd_balance,profile.user?.reward_steem_balance,profile.user?.reward_vesting_balance,profile.user?.reward_vesting_steem)
var opl = ArrayList<Operation>()
opl.add(ope)
var dy = GetDynamicAndBlock(this@MainActivity,null,0,opl,"Rewards claimed",MyOperationTypes.claim_reward_balance,null,null)
dy.GetDynamicGlobalProperties()
diin.dismiss()

}


}

alertDialogBuilder.setNegativeButton("No") { diin, num ->
alertDialogBuilder.setMessage("${profile.user?.reward_sbd_balance} , ${profile.user?.reward_steem_balance} , ${profile.user?.reward_vesting_balance}")
alertDialogBuilder.setPositiveButton("Ok") { diin, num ->
var ms = MakeOperationsMine()
var ope = ms.claimRewards(AccountName(username),profile.user?.reward_sbd_balance,profile.user?.reward_steem_balance,profile.user?.reward_vesting_balance,profile.user?.reward_vesting_steem)
var opl = ArrayList<Operation>()
opl.add(ope)
var dy = GetDynamicAndBlock(this@MainActivity,null,0,opl,"Rewards claimed",MyOperationTypes.claim_reward_balance,null,null)
dy.GetDynamicGlobalProperties()
diin.dismiss()

}
alertDialogBuilder.setNegativeButton("No") { diin, num -> }
val alertDialog = alertDialogBuilder.create()

alertDialog.show()
}

Expand Down
Expand Up @@ -349,13 +349,8 @@ public ClaimRewardBalanceOperation claimRewards(AccountName accountName,String s
Asset steemReward = new Asset(steem);
Asset sbdReward = new Asset(sbd);
Asset vestingReward = new Asset(vesting);

// Create claim operation based on available reward balances
ClaimRewardBalanceOperation claimOperation = new ClaimRewardBalanceOperation(accountName, steemReward,
sbdReward, vestingReward);


return claimOperation;
return new ClaimRewardBalanceOperation(accountName, steemReward, sbdReward, vestingReward);
}


Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dateholderandanimator.xml
Expand Up @@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:paddingLeft="7dp"
android:paddingRight="7dp"
android:textColor="?attr/textColorMine"
android:textColor="@color/white"
android:textIsSelectable="false"
android:background="?attr/colorPrimary"
android:textAlignment="center"
Expand All @@ -38,7 +38,7 @@

<TextView
android:id="@+id/textview_sticky_header_section_2"
android:textColor="?attr/textColorMine"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="7dp"
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/dialog_open_a_blog.xml
Expand Up @@ -2,15 +2,21 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/AppTheme"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
app:layout_constraintTop_toTopOf="parent"
android:inputType="text"
app:layout_constraintBaseline_toBaselineOf="parent"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/name"
android:hint="username"
/>



</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/styles.xml
Expand Up @@ -58,12 +58,14 @@
<item name="android:popupBackground">@color/background_light</item>
<item name="android:background">@color/background_light</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textColorPrimary">@color/text_primary_dark</item>
</style>

<style name="Plaid.AlertDialog.AppCompat.Dark" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:popupBackground">@color/background_dark</item>
<item name="android:background">@color/background_dark</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textColorPrimary">@color/text_primary_light</item>
</style>


Expand Down

0 comments on commit 67911e3

Please sign in to comment.