Commit c4964ec9 authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Issue AGILE#196 Layout changes

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent 9017d48b
......@@ -6,7 +6,10 @@ import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -82,7 +85,6 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
}
}));
citizensPresenter.bindView(this);
citizensPresenter.requestCitizens();
......@@ -134,9 +136,6 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
}
public static class ConnectionFailureDialog extends DialogFragment {
public static final String DIALOG_MESSAGE_KEY = "message";
......@@ -157,4 +156,7 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
return builder.create();
}
}
}
......@@ -6,8 +6,11 @@ import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -90,6 +93,11 @@ public class TermActivity extends AppCompatActivity implements TermView {
rv_sectors.setLayoutManager(layout);
rv_sectors.addItemDecoration(
new DividerItemDecoration(ContextCompat.getDrawable(getApplicationContext(),
R.drawable.item_divider)));
termPresenter.bindView(this);
termPresenter.requestSectors();
......@@ -164,4 +172,33 @@ public class TermActivity extends AppCompatActivity implements TermView {
}
}
/**
* Based on: https://www.survivingwithandroid.com/2016/09/android-recyclerview-tutorial.html
*
*/
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider;
public DividerItemDecoration(Drawable divider) {
this.mDivider = divider;
}
@Override
public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(canvas);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="1dp" />
<solid android:color="#d8d8d9" />
</shape>
\ No newline at end of file
......@@ -54,7 +54,15 @@
android:layout_marginStart="32dp"
android:text="@string/terms_limits"
android:textAlignment="center"
android:textSize="16sp"/>
android:textSize="16sp"
android:layout_marginBottom="10dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:background="@drawable/item_divider"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_term_sectors"
......@@ -62,8 +70,18 @@
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="5dp"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:background="@drawable/item_divider"
android:layout_marginBottom="15dp"/>
<Button
android:id="@+id/btn_term_refusal"
android:layout_width="wrap_content"
......@@ -72,7 +90,7 @@
android:layout_gravity="center_horizontal"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:layout_marginTop="45dp"
android:layout_marginTop="30dp"
android:text="@string/not_accept"/>
<Button
android:id="@+id/btn_term_accept"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment