Skip to content

Instantly share code, notes, and snippets.

@wviana
Created April 27, 2016 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wviana/ca83b6404f1957ba30947e0d47adf180 to your computer and use it in GitHub Desktop.
Save wviana/ca83b6404f1957ba30947e0d47adf180 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:elevation="4dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#293a4a"
android:gravity="center_vertical"
>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@mipmap/ic_close_white_24dp"
android:background="@android:color/transparent"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Periodo"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@android:color/white"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@mipmap/ic_check_white_24dp"
android:background="@android:color/transparent"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginTop="4dp"
android:elevation="2dp"
android:background="@android:color/darker_gray"
android:gravity="center_vertical"
>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@mipmap/ic_keyboard_arrow_left_white_24dp"
android:background="@android:color/transparent"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2015"
android:textSize="22sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@android:color/white"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@mipmap/ic_keyboard_arrow_right_white_24dp"
android:background="@android:color/transparent"
/>
</LinearLayout>
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Jan"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Fev"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Mar"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Abr"
/>
</TableRow>
<TableRow>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Mai"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Jun"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Jul"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Ago"
/>
</TableRow>
<TableRow>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="SET"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="OUT"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Nov"
/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="12sp"
android:text="Dez"
/>
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:textStyle="bold"
android:text="De:"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="01/2015"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:textStyle="bold"
android:text="Até:"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="12/2015"/>
</LinearLayout>
</LinearLayout>
package neocom.dealerbook.fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import neocom.dealerbook.R;
/**
* Created by wviana on 4/27/16.
*/
public class MonthSelectDialog extends DialogFragment {
public static final String INITIAL_MONTH = "initial_month";
public static final String FINAL_MONTH = "final_month";
public static final String YEAR = "year";
private int initialMonth;
private int finalMonth;
private int year;
public static MonthSelectDialog getInstance(int initialMonth, int finalMonth, int year){
MonthSelectDialog dialog = new MonthSelectDialog();
Bundle args = new Bundle();
args.putInt(INITIAL_MONTH, initialMonth);
args.putInt(FINAL_MONTH, finalMonth);
args.putInt(YEAR, year);
dialog.setArguments(args);
return dialog;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
initialMonth = getArguments().getInt(INITIAL_MONTH);
finalMonth = getArguments().getInt(FINAL_MONTH);
year = getArguments().getInt(YEAR);
LayoutInflater inflater = getActivity().getLayoutInflater();
View rootView = inflater.inflate(R.layout.dialog_month_period, null);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(rootView);
return builder.create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment