Added advanced settings to EditProfile view

This commit is contained in:
Michael Schättgen 2018-04-05 00:07:48 +02:00
parent a00bcfe2cb
commit 211f228efa
4 changed files with 97 additions and 2 deletions

View file

@ -41,5 +41,6 @@ dependencies {
compile 'com.madgag.spongycastle:core:1.56.0.0'
compile 'com.github.apl-devs:appintro:v4.2.2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.github.aakira:expandable-layout:1.6.0@aar'
testCompile 'junit:junit:4.12'
}

View file

@ -11,12 +11,18 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import com.amulyakhare.textdrawable.TextDrawable;
import com.github.aakira.expandablelayout.ExpandableLinearLayout;
import com.github.aakira.expandablelayout.ExpandableRelativeLayout;
import me.impy.aegis.R;
import me.impy.aegis.crypto.KeyInfo;
@ -102,6 +108,39 @@ public class EditProfileActivity extends AegisActivity {
_iconView.setImageDrawable(drawable);
}
});
ExpandableRelativeLayout content=(ExpandableRelativeLayout) findViewById(R.id.expandableLayout);
RelativeLayout header=(RelativeLayout) findViewById(R.id.accordian_header);
//to toggle content
header.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Animation fadeOut = new AlphaAnimation(1, 0); // the 1, 0 here notifies that we want the opacity to go from opaque (1) to transparent (0)
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(220); // Fadeout duration should be 1000 milli seconds
header.startAnimation(fadeOut);
fadeOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
header.setVisibility(View.GONE);
content.toggle();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
});
}
private void updateFields() {

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/>
</vector>

View file

@ -69,7 +69,53 @@
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
<RelativeLayout
android:foreground="?android:attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/accordian_header"
android:focusable="true"
android:clickable="true">
<ImageView
android:id="@+id/down_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="14dp"
android:src="@drawable/ic_keyboard_arrow_down_black_24dp" />
<TextView
android:id="@+id/accordian_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_toEndOf="@+id/down_btn"
android:padding="16dp"
android:text="Advanced"
android:textColor="#333"
android:textStyle="bold" />
</RelativeLayout>
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
android:id="@+id/expandableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ael_expanded="false"
app:ael_duration="100"
app:ael_interpolator="accelerate"
app:ael_orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/background"
android:orientation="vertical"
android:stretchColumns="1"
android:layout_marginEnd="35dp">
<TableRow
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
@ -184,8 +230,8 @@
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</TableRow>
</TableLayout>
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
</LinearLayout>
</ScrollView>