Advertisement
Tanver247

MainActivity.java

Apr 16th, 2020
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package com.mycompany.myapp4;
  2.  
  3. public class MainActivity extends Activity {
  4.     boolean isExpanded = false;
  5.     LinearLayout moreDataLayout;
  6.     private CardView mCard;
  7.     private TextView TxtOne, HiddenTxtTwo, viewMore;
  8.     @Override
  9.     protected void onCreate(Bundle savedInstanceState)  {   super.onCreate(savedInstanceState);
  10.         setContentView(R.layout.main);
  11.         viewMore = findViewById(R.id.viewMoreText); moreDataLayout=findViewById(R.id.moreDataLayout);   mCard=findViewById(R.id.stateDataCard); TxtOne=findViewById(R.id.txtOne);   HiddenTxtTwo=findViewById(R.id.txtTwo);
  12.         mCard.setOnClickListener(new View.OnClickListener() {
  13.                 @Override
  14.                 public void onClick(View view) {
  15.                     if (isExpanded) {   TransitionManager.beginDelayedTransition(mCard, new AutoTransition());  moreDataLayout.setVisibility(View.GONE);    viewMore.setVisibility(View.VISIBLE);
  16.                         isExpanded = false;
  17.                     } else {    TransitionManager.beginDelayedTransition(mCard, new AutoTransition());  viewMore.setVisibility(View.GONE);  moreDataLayout.setVisibility(View.VISIBLE);
  18.                         isExpanded = true;
  19.                     }
  20.                 }
  21.             });
  22.     }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement