Skip to content

Commit

Permalink
added TS ad
Browse files Browse the repository at this point in the history
  • Loading branch information
Dryec committed Aug 22, 2018
1 parent c136db5 commit d525cda
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.eletac.tronwallet.R;
Expand Down Expand Up @@ -94,6 +95,9 @@ public class WitnessItemViewHolder extends RecyclerView.ViewHolder {
private TextView mMissed_TextView;
private EditText mVoteNumber_EditText;

private TextView mTronSocietyAd_TextView;
private ImageView mTronSocietyAdBorder_ImageView;

private Protocol.Witness mWitness;

private TextWatcher mTextWatcher;
Expand All @@ -110,6 +114,8 @@ public WitnessItemViewHolder(View itemView) {
mProduced_TextView = itemView.findViewById(R.id.Witness_produced_textView);
mMissed_TextView = itemView.findViewById(R.id.Witness_missed_textView);
mVoteNumber_EditText = itemView.findViewById(R.id.Witness_votes_editText);
mTronSocietyAd_TextView = itemView.findViewById(R.id.Witness_tron_society_ad_textView);
mTronSocietyAdBorder_ImageView = itemView.findViewById(R.id.Witness_tron_society_ad_border_imageView);

mVoteNumber_EditText.setVisibility(mShowVoteEditText ? View.VISIBLE : View.GONE);

Expand Down Expand Up @@ -173,6 +179,10 @@ public void bind(Protocol.Witness witness) {
mProduced_TextView.setText(numberFormat.format(witness.getTotalProduced()));
mMissed_TextView.setText(numberFormat.format(witness.getTotalMissed()));

boolean isTronSociety = WalletManager.encode58Check(witness.getAddress().toByteArray()).equals("TQwqK8LhHGria5gkkfCVqQfE5mSwpvdp3B");
mTronSocietyAd_TextView.setVisibility(mShowVoteEditText ? (isTronSociety ? View.VISIBLE : View.GONE) : View.GONE);
mTronSocietyAdBorder_ImageView.setVisibility(mShowVoteEditText ? (isTronSociety ? View.VISIBLE : View.GONE) : View.GONE);

if(mShowVoteEditText) {
mVoteNumber_EditText.removeTextChangedListener(mTextWatcher);
mVoteNumber_EditText.setText("");
Expand Down
29 changes: 28 additions & 1 deletion app/src/main/res/layout/list_vote_witness_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/Witness_address_textView"
app:layout_constraintTop_toBottomOf="@+id/Witness_address_textView">
app:layout_constraintTop_toBottomOf="@+id/Witness_address_textView"
app:layout_constraintVertical_bias="0.0">

<TextView
android:id="@+id/Witness_total_votes_text_textView"
Expand Down Expand Up @@ -223,6 +224,32 @@
app:layout_constraintTop_toBottomOf="@+id/Witness_total_votes_text_textView" />
</android.support.constraint.ConstraintLayout>

<TextView
android:id="@+id/Witness_tron_society_ad_textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:text="Tron Society is the team behind the Tron Wallet App.\nIf you want to support us and bring more innovative apps and improvements, help us with a vote!"
android:textColor="@android:color/white"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/Witness_tron_society_ad_border_imageView"
app:layout_constraintTop_toBottomOf="@+id/Wtiness_constraintLayout3" />

<ImageView
android:id="@+id/Witness_tron_society_ad_border_imageView"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginTop="2dp"
app:layout_constraintBottom_toBottomOf="@+id/Witness_tron_society_ad_textView"
app:layout_constraintStart_toStartOf="@+id/Wtiness_constraintLayout3"
app:layout_constraintTop_toTopOf="@+id/Witness_tron_society_ad_textView"
app:srcCompat="@color/colorAccent" />

</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>

0 comments on commit d525cda

Please sign in to comment.