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

Issue AGILE#175: [WIP] Integrating Material Calendar View

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent 5fc0f8c3
......@@ -32,5 +32,6 @@ dependencies {
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
testCompile 'junit:junit:4.12'
}
......@@ -6,40 +6,38 @@ import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
import java.util.Objects;
import java.util.Calendar;
import br.ufpr.c3sl.agendador.agendador.helpers.HintAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.ObscuredSharedPreferences;
import br.ufpr.c3sl.agendador.agendador.helpers.UserPhotoHelper;
import br.ufpr.c3sl.agendador.agendador.models.UserUpdate;
import br.ufpr.c3sl.agendador.agendador.views.SchedulingView;
/**
* Created by Lucas B. Cunha on 12/4/17.
*/
public class SchedulingActivity extends AppCompatActivity implements SchedulingView, NavigationView.OnNavigationItemSelectedListener{
public class SchedulingActivity extends AppCompatActivity implements SchedulingView, NavigationView.OnNavigationItemSelectedListener {
private MenuBuilder menuBuilder;
......@@ -57,10 +55,13 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
private LinearLayout ll_fields;
private TextView tv_year, tv_day_month;
//TODO: create class "ConfirmationDialog"
private ConfirmationDialog confirmationDialog;
//requisição /citizens
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -105,7 +106,7 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
NavigationView navigationView = (NavigationView) findViewById(R.id.home_navigation_view);
View headerView = navigationView.getHeaderView(0);
View headerView = navigationView.getHeaderView(0);
drawerProfilePicture = (ImageView) headerView.findViewById(R.id.img_drawerheader_citizen_photo);
......@@ -132,26 +133,26 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
confirmationDialog = new ConfirmationDialog();
if(userPhotoHelper.existsPhoto()){
if (userPhotoHelper.existsPhoto()) {
userPhotoHelper.updateImgView(drawerProfilePicture, userPhotoHelper.getPhotoFileUri());
}
navigationView.setNavigationItemSelectedListener(this);
// TODO: 17/04/17 example on how to set hint to spinner
String[] citizens = {"Lucas","Selecione um cidadão"};
String[] citizens = {"Lucas", "Selecione um cidadão"};
HintAdapter hintAdapterCitizen = new HintAdapter(this, android.R.layout.simple_list_item_1, citizens);
spnr_citizen.setAdapter(hintAdapterCitizen);
// show hint
spnr_citizen.setSelection(hintAdapterCitizen.getCount());
String[] sector = {"Saúde","Selecione um setor"};
String[] sector = {"Saúde", "Selecione um setor"};
HintAdapter hintAdapterSector = new HintAdapter(this, android.R.layout.simple_list_item_1, sector);
spnr_sector.setAdapter(hintAdapterSector);
spnr_sector.setSelection(hintAdapterSector.getCount());
String[] types = {"Texto1","Selecione o tipo"};
String[] types = {"Texto1", "Selecione o tipo"};
HintAdapter hintAdapterType = new HintAdapter(this, android.R.layout.simple_list_item_1, types);
spnr_type.setAdapter(hintAdapterType);
spnr_type.setSelection(hintAdapterType.getCount());
......@@ -162,6 +163,20 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
spnr_location.setSelection(hintAdapterLocation.getCount());
//end of example
View v = ll_fields.findViewById(R.id.ll_scheduling_calendar).findViewById(R.id.ll_scheduling_calendar_header);
tv_year = (TextView) v.findViewById(R.id.tv_calendar_year_scheduling);
tv_day_month = (TextView) v.findViewById(R.id.tv_calendar_day_month_scheduling);
Calendar calendar = Calendar.getInstance();
// TODO: 24/05/17 Arrumar a apresentação da data
String s = calendar.get(Calendar.YEAR) + "";
tv_year.setText(s);
tv_day_month.setText(calendar.get(Calendar.DAY_OF_WEEK) + ", " +
calendar.get(Calendar.MONTH) + " " + calendar.get(Calendar.DAY_OF_MONTH));
}
......@@ -228,7 +243,6 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
}
public static class ConfirmationDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
......@@ -254,5 +268,4 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
}
}
......@@ -115,15 +115,56 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<DatePicker
android:id="@+id/dpicker_scheduling_date"
<LinearLayout
android:id="@+id/ll_scheduling_calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginEnd="54dp"
android:layout_marginStart="54dp"
android:layout_marginTop="21dp" />
android:layout_marginTop="21dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_scheduling_calendar_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorGreen">
<TextView
android:id="@+id/tv_calendar_year_scheduling"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:textSize="16sp"
android:textColor="@color/colorGray" />
<TextView
android:id="@+id/tv_calendar_day_month_scheduling"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:textColor="@color/colorWhite"
android:textSize="32sp"
android:textStyle="bold" />
</LinearLayout>
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mcv_scheduling_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:mcv_selectionColor="@color/colorGreen"
app:mcv_showOtherDates="all"
app:mcv_monthLabels="@array/months_pt"
app:mcv_weekDayLabels="@array/days_pt"/>
</LinearLayout>
</LinearLayout>
......
......@@ -107,4 +107,27 @@
<string name="scheduling_sector">1.Escolha o setor:</string>
<string name="scheduling_type">2.Escolha o tipo de atendimento:</string>
<string name="scheduling_location">3.Escolha o local de atendimento:</string>
<string-array name="months_pt">
<item>Janeiro</item>
<item>Fevereiro</item>
<item>Março</item>
<item>Abril</item>
<item>Maio</item>
<item>Junho</item>
<item>Julho</item>
<item>Agosto</item>
<item>Setembro</item>
<item>Outubro</item>
<item>Novembro</item>
<item>Dezembro</item>
</string-array>
<string-array name="days_pt">
<item>Seg</item>
<item>Ter</item>
<item>Qua</item>
<item>Qui</item>
<item>Sex</item>
<item>Sab</item>
<item>Dom</item>
</string-array>
</resources>
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
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