Commit 989fd6b2 authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Issue AGILE#152: Initial layout for Scheduling activity

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent 8f3bf05b
......@@ -24,12 +24,13 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
}
......@@ -4,9 +4,11 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
......@@ -14,8 +16,6 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -23,30 +23,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity">
</activity>
<activity android:name=".HomeActivity">
</activity>
<activity android:name=".CepActivity">
</activity>
<activity android:name=".CepNotFoundActivity">
</activity>
<activity android:name=".SignupActivity">
</activity>
<activity android:name=".AccountActivity">
</activity>
<activity android:name=".ForgotPasswordActivity">
</activity>
<activity android:name=".TermActivity">
</activity>
<activity android:name=".LoginActivity"></activity>
<activity android:name=".HomeActivity"></activity>
<activity android:name=".CepActivity"></activity>
<activity android:name=".CepNotFoundActivity"></activity>
<activity android:name=".SignupActivity"></activity>
<activity android:name=".AccountActivity"></activity>
<activity android:name=".ForgotPasswordActivity"></activity>
<activity android:name=".TermActivity"></activity>
<activity android:name=".SchedulingActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -48,11 +48,8 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
private NavigationView navigationView;
private TextView drawerCitizenName, drawerCityName, homeCitizenWelcome, tv_presentation;
private UserPhotoHelper userPhotoHelper;
private String citizenName, citizenCity;
private ConfirmationDialog confirmationDialog;
@Override
......@@ -71,8 +68,8 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
getSupportActionBar().setTitle(null);
osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
citizenName = osb.getString("name", null);
citizenCity = osb.getString("city.name", null);
String citizenName = osb.getString("name", null);
String citizenCity = osb.getString("city.name", null);
actionMenuView = (ActionMenuView) toolbar.findViewById(R.id.agendador_toolbar_menu);
menuBuilder = (MenuBuilder) actionMenuView.getMenu();
......
package br.ufpr.c3sl.agendador.agendador;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
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.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
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{
private MenuBuilder menuBuilder;
private ActionMenuView actionMenuView;
private ObscuredSharedPreferences osb;
private UserPhotoHelper userPhotoHelper;
private ImageView drawerProfilePicture;
private ProgressBar pb_scheduling;
//TODO: create class "ConfirmationDialog"
private ConfirmationDialog confirmationDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scheduling);
Toolbar toolbar = (Toolbar) findViewById(R.id.agendador_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(null);
actionMenuView = (ActionMenuView) toolbar.findViewById(R.id.agendador_toolbar_menu);
menuBuilder = (MenuBuilder) actionMenuView.getMenu();
//noinspection RestrictedApi
menuBuilder.setCallback(new MenuBuilder.Callback() {
@Override
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
public void onMenuModeChange(MenuBuilder menu) {
}
});
osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
String citizenName = osb.getString("name", null);
String citizenCity = osb.getString("city.name", null);
NavigationView navigationView = (NavigationView) findViewById(R.id.home_navigation_view);
View headerView = navigationView.getHeaderView(0);
drawerProfilePicture = (ImageView) headerView.findViewById(R.id.img_drawerheader_citizen_photo);
userPhotoHelper = new UserPhotoHelper(getBaseContext());
TextView drawerCitizenName = (TextView) headerView.findViewById(R.id.tv_drawerheader_citizen_name);
TextView drawerCityName = (TextView) headerView.findViewById(R.id.tv_drawerheader_city_name);
drawerCitizenName.setText(citizenName);
drawerCityName.setText(citizenCity);
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ImageView drawerHamburger = (ImageView) toolbar.findViewById(R.id.img_toolbar_hamburger);
drawerHamburger.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
drawer.openDrawer(Gravity.LEFT);
}
});
confirmationDialog = new ConfirmationDialog();
if(userPhotoHelper.existsPhoto()){
userPhotoHelper.updateImgView(drawerProfilePicture, userPhotoHelper.getPhotoFileUri());
}
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.logout_actionbtn:
confirmationDialog.show(getFragmentManager(), "Confirm");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.nav_my_info:
intent = new Intent(this, AccountActivity.class);
startActivity(intent);
return true;
case R.id.nav_schedule:
intent = new Intent(this, TermActivity.class);
item.setChecked(false);
startActivity(intent);
default:
}
return false;
}
//todo: correct code
@Override
public void setProgressBar(boolean enabled) {
if (enabled) {
pb_scheduling.setVisibility(View.VISIBLE);
/*btn_update.setEnabled(false);
btn_cancel.setEnabled(false);
enableAllFields(false);*/
} else {
pb_scheduling.setVisibility(View.INVISIBLE);
/*enableAllFields(true);
btn_update.setEnabled(true);
btn_cancel.setEnabled(true);*/
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menuBuilder);
return true;
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
public static class ConfirmationDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.signout_confirmation)
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//SchedulingActivity activity = (SchedulingActivity) getActivity();
//activity.presenter.onSignOutClicked();
}
})
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}
}
}
......@@ -29,7 +29,9 @@ public class TermActivity extends AppCompatActivity {
accept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(TermActivity.this, SchedulingActivity.class);
startActivity(intent);
finish();
}
});
}
......
package br.ufpr.c3sl.agendador.agendador.views;
/**
* Created by Lucas Braz Cunha on 13/04/17.
*/
public interface SchedulingView {
void setProgressBar(boolean enabled);
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/appbar_scheduling"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/home_navigation_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_drawer_header"
app:menu="@menu/activity_home_drawer" />
</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_scheduling" />
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
......@@ -10,7 +10,7 @@
android:id="@+id/tv_homeact_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="Bem vindo Nome do Cidadão"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="59dp"
android:background="@color/colorGray">
<TextView
android:id="@+id/tv_homeact_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:text="@string/schedule"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
android:textStyle="normal|bold"
android:typeface="normal" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@color/colorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:text="@string/scheduling_description"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
android:textStyle="normal|bold"
android:typeface="normal"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_gravity="left"
android:text="@string/scheduling_citizen"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
android:textStyle="normal|bold"
android:typeface="normal"/>
<Spinner
android:id="@+id/spnr_scheduling_citizen"
android:layout_marginEnd="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_gravity="left"
android:text="@string/scheduling_sector"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
android:textStyle="normal|bold"
android:typeface="normal"/>
<Spinner
android:id="@+id/spnr_scheduling_sector"
android:layout_marginEnd="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_gravity="left"
android:text="@string/scheduling_type"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
android:textStyle="normal|bold"
android:typeface="normal"/>
<Spinner
android:id="@+id/spnr_scheduling_type"
android:layout_marginEnd="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_gravity="left"
android:text="@string/scheduling_location"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
android:textStyle="normal|bold"
android:typeface="normal"/>
<Spinner
android:id="@+id/spnr_scheduling_location"
android:layout_marginEnd="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -102,4 +102,9 @@
<string name="prof_pic_dialog">Selecione (necessita confirmação):</string>
<string name="prof_pic_remove">Remover Foto</string>
<string name="prof_pic_update">Alterar Foto</string>
<string name="scheduling_description">Passo 2 de 3 - Agendamento</string>
<string name="scheduling_citizen">Escolha a pessoa para quem deseja marcar o horário:</string>
<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>
</resources>
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