-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from huttneab/voter_declaration
disclosure agreement
- Loading branch information
Showing
13 changed files
with
276 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../main/java/com/rockthevote/grommet/ui/registration/DisclosureAgreementDialogFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.rockthevote.grommet.ui.registration; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.DialogFragment; | ||
import android.text.Html; | ||
import android.text.Spanned; | ||
import android.text.method.LinkMovementMethod; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.rockthevote.grommet.R; | ||
import com.rockthevote.grommet.util.ListTagHandler; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
import butterknife.OnClick; | ||
|
||
public class DisclosureAgreementDialogFragment extends DialogFragment { | ||
|
||
@BindView(R.id.text_content) TextView content; | ||
|
||
private DisclosureListener listener; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
setCancelable(false); | ||
View v = inflater.inflate(R.layout.dialog_disclosure_agreement, container); | ||
ButterKnife.bind(this, v); | ||
|
||
Spanned result; | ||
|
||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { | ||
result = Html.fromHtml(getString(R.string.disclosure_agreement), | ||
Html.FROM_HTML_MODE_LEGACY, null, new ListTagHandler()); | ||
} else { | ||
result = Html.fromHtml(getString(R.string.disclosure_agreement), | ||
null, new ListTagHandler()); | ||
} | ||
|
||
content.setText(result); | ||
content.setMovementMethod(LinkMovementMethod.getInstance()); | ||
return v; | ||
} | ||
|
||
public void setListener(DisclosureListener listener) { | ||
this.listener = listener; | ||
} | ||
|
||
@OnClick(R.id.disclosure_decline_button) | ||
public void onDeclineClick(View v) { | ||
if (null != listener) { | ||
listener.onDeclineClick(); | ||
} | ||
} | ||
|
||
@OnClick(R.id.disclosure_accept_button) | ||
public void onAcceptClick(View v) { | ||
if (null != listener) { | ||
listener.onAcceptClick(); | ||
} | ||
} | ||
|
||
public interface DisclosureListener { | ||
|
||
void onDeclineClick(); | ||
|
||
void onAcceptClick(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:paddingEnd="24dp" | ||
android:paddingStart="24dp" | ||
android:paddingTop="24dp"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:paddingEnd="@dimen/content_area_padding" | ||
android:text="@string/disclosure_agreement_title" | ||
android:textAppearance="@android:style/TextAppearance.Material.DialogWindowTitle"/> | ||
|
||
|
||
<TextView | ||
android:id="@+id/text_content" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:paddingBottom="24dp" | ||
android:paddingTop="8dp" | ||
tools:text="@string/disclosure_agreement"/> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom" | ||
android:gravity="end" | ||
android:orientation="horizontal" | ||
android:paddingBottom="8dp"> | ||
|
||
<Button | ||
android:id="@+id/disclosure_decline_button" | ||
style="@android:style/Widget.Material.Button.Borderless.Colored" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/action_decline" | ||
/> | ||
|
||
<Button | ||
android:id="@+id/disclosure_accept_button" | ||
style="@android:style/Widget.Material.Button.Borderless.Colored" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/action_accept" | ||
/> | ||
</LinearLayout> | ||
|
||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.