Commit 07874c1c authored by Robert Hitt's avatar Robert Hitt

Merge branch 'material-spec' into 'master'

modify facility item to material spec, remove card views from notification dialog and rearrange buttons

See merge request !7
parents 32be32ca 795ca81d
Pipeline #876 passed with stages
in 4 minutes and 57 seconds
......@@ -41,3 +41,6 @@ captures/
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# OSX
.DS_Store
\ No newline at end of file
......@@ -2,7 +2,7 @@ image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "25"
ANDROID_BUILD_TOOLS: "23.0.2"
ANDROID_BUILD_TOOLS: "25.0.2"
ANDROID_SDK_TOOLS: "24.4.1"
before_script:
......
......@@ -5,7 +5,7 @@ apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '23.0.2'
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "srct.whatsopen"
minSdkVersion 16
......@@ -50,8 +50,5 @@ dependencies {
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.github.daniel-stoneuk:material-about-library:1.3.0'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.2.0'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'io.reactivex:rxjava:1.1.4'
compile 'com.takisoft.fix:preference-v7:25.1.1.0'
}
......@@ -2,35 +2,31 @@ package srct.whatsopen.views.activities;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import com.astuetz.PagerSlidingTabStrip;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.castorflex.android.circularprogressbar.CircularProgressBar;
import io.realm.Realm;
import srct.whatsopen.MyApplication;
import srct.whatsopen.R;
import srct.whatsopen.views.MainView;
import srct.whatsopen.presenters.MainPresenter;
import srct.whatsopen.views.MainView;
import srct.whatsopen.views.adapters.FacilityListFragmentPagerAdapter;
public class MainActivity extends AppCompatActivity implements MainView {
@BindView(R.id.progress_bar) CircularProgressBar mProgressBar;
@BindView(R.id.view_pager) ViewPager mViewPager;
@BindView(R.id.progress_bar)
ProgressBar mProgressBar;
@BindView(R.id.view_pager)
ViewPager mViewPager;
private MainPresenter mPresenter;
......@@ -52,6 +48,8 @@ public class MainActivity extends AppCompatActivity implements MainView {
// Configure toolbar
Toolbar toolbar = ButterKnife.findById(this, R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbar.setLogo(R.drawable.wo_clock_toolbar);
setUpTabStrip();
}
......@@ -76,7 +74,7 @@ public class MainActivity extends AppCompatActivity implements MainView {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
switch (item.getItemId()) {
case R.id.action_refresh:
mPresenter.loadFacilities();
return true;
......
......@@ -62,19 +62,27 @@ public class FacilityListAdapter extends
displayStatusDurationText(facility, holder);
// highlight the open facilities
if(facility.isOpen()) {
if (facility.isOpen()) {
// set the RV cell to be highlighted
holder.itemView.setBackgroundColor(ContextCompat
.getColor(context, R.color.facilityOpen));
// show the duration that the facility will be open
// setItemPaddingInDp(holder.textLayout, 8);
holder.durationTextView.setVisibility(View.VISIBLE);
//holder.nameTextView.setTypeface(null, Typeface.BOLD);
} else {
holder.itemView.setBackgroundColor(ContextCompat
.getColor(context, R.color.facilityClosed));
// setItemPaddingInDp(holder.textLayout, 15);
holder.durationTextView.setVisibility(View.GONE);
//holder.nameTextView.setTypeface(null, Typeface.NORMAL);
}
if(facility.isFavorited()) {
if (facility.isFavorited()) {
holder.favoriteButton.setImageResource(R.drawable.ic_fav_button_on_24dp);
}
else {
} else {
holder.favoriteButton.setImageResource(R.drawable.ic_fav_button_off_24dp);
}
......@@ -89,7 +97,7 @@ public class FacilityListAdapter extends
String setting = preferences.getString("list_view_information_preference",
"display_duration_both");
switch(setting) {
switch (setting) {
case "display_duration_open":
setStatusDurationText(holder, facility.isOpen());
break;
......@@ -99,7 +107,8 @@ public class FacilityListAdapter extends
case "display_duration_none":
setStatusDurationText(holder, false);
break;
case "display_duration_both":default:
case "display_duration_both":
default:
setStatusDurationText(holder, true);
break;
}
......@@ -107,7 +116,7 @@ public class FacilityListAdapter extends
}
private void setStatusDurationText(ViewHolder holder, boolean showDuration) {
if(showDuration) {
if (showDuration) {
// display the duration text
setItemPaddingInDp(holder.textLayout, 8);
holder.durationTextView.setVisibility(View.VISIBLE);
......@@ -123,8 +132,8 @@ public class FacilityListAdapter extends
// Have to convert from pixels to dp
private void setItemPaddingInDp(LinearLayout layout, int paddingPx) {
float scale = context.getResources().getDisplayMetrics().density;
int paddingTop = (int) (paddingPx*scale + 0.5f);
int paddingBottom = (int) (paddingPx*scale + 0.5f);
int paddingTop = (int) (paddingPx * scale + 0.5f);
int paddingBottom = (int) (paddingPx * scale + 0.5f);
layout.setPadding(0, paddingTop, 0, paddingBottom);
}
......@@ -132,10 +141,14 @@ public class FacilityListAdapter extends
// Set up for the Recycler View cells
public class ViewHolder extends RecyclerView.ViewHolder implements FacilityView {
@BindView(R.id.facility_name) TextView nameTextView;
@BindView(R.id.favorite_button) ImageButton favoriteButton;
@BindView(R.id.facility_duration) TextView durationTextView;
@BindView(R.id.text_layout) LinearLayout textLayout;
@BindView(R.id.facility_name)
TextView nameTextView;
@BindView(R.id.favorite_button)
ImageButton favoriteButton;
@BindView(R.id.facility_duration)
TextView durationTextView;
@BindView(R.id.text_layout)
LinearLayout textLayout;
private FacilityPresenter mPresenter;
private Facility data;
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="8dp"
<size android:height="1px"
android:width="8dp" />
<solid android:color="#80FFFFFF"/>
<solid android:color="#aaaaaa"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/wo_clock"
android:right="10dp" />
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<android.support.v7.widget.CardView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:text="Notification Type"
android:paddingStart="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingStart="2dp"
android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:text="Notification Type" />
<CheckBox
android:id="@+id/type_opening_check"
android:text="Opening"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="Opening" />
<CheckBox
android:id="@+id/type_closing_check"
android:text="Closing"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="Closing" />
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:orientation="vertical"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingTop="2dp">
<Button
android:id="@+id/save_button"
android:text="Save"
android:textColor="@color/colorPrimary"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
style="?android:borderlessButtonStyle"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/save_button"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
android:text="Save"
android:textColor="@color/colorPrimary" />
<Button
android:id="@+id/cancel_button"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="Cancel"
android:textColor="@color/colorPrimary" />
</LinearLayout>
<Button
android:id="@+id/cancel_button"
android:text="Cancel"
android:textColor="@color/colorPrimary"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:id="@+id/remove_button"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Remove"
android:textColor="@color/colorPrimary"
android:visibility="gone" />
</LinearLayout>
<Button
android:id="@+id/remove_button"
android:text="Remove All"
android:textColor="@color/colorPrimary"
android:layout_gravity="center_horizontal"
android:visibility="gone"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:text="Notification Interval"
android:textAlignment="center"
android:paddingStart="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingStart="2dp"
android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:text="Notification Interval"
android:textAlignment="center" />
<CheckBox
android:id="@+id/interval_on_check"
android:text="On opening/closing"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="On opening/closing" />
<CheckBox
android:id="@+id/interval_15_check"
android:text="15 minutes before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="15 minutes before" />
<CheckBox
android:id="@+id/interval_30_check"
android:text="30 minutes before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="30 minutes before" />
<CheckBox
android:id="@+id/interval_hour_check"
android:text="An hour before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="An hour before" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="srct.whatsopen.views.activities.MainActivity">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="srct.whatsopen.views.activities.MainActivity">
<LinearLayout
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<include
layout="@layout/toolbar_main"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
app:pstsShouldExpand="true"
android:layout_width="match_parent"
android:layout_height="48dp"
app:pstsIndicatorColor="@color/colorPrimary"
app:pstsIndicatorHeight="6dp"
app:pstsTabBackground="@drawable/button_bg"
android:layout_width="match_parent"
android:layout_height="48dp"/>
app:pstsShouldExpand="true"
app:pstsTabBackground="@drawable/button_bg" />
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"/>
android:background="@android:color/white" />
</LinearLayout>
<fr.castorflex.android.circularprogressbar.CircularProgressBar
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminate="true"
android:visibility="gone"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cpb_color="@color/colorPrimary"
app:cpb_rotation_speed="1.0"
app:cpb_sweep_speed="1.0"
app:cpb_stroke_width="6dp"
app:cpb_max_sweep_angle="300"
app:cpb_min_sweep_angle="10"
android:layout_width="80dp"
android:layout_height="80dp"/>
android:visibility="gone" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#FFFFFF"
tools:context="srct.whatsopen.views.fragments.FacilityListFragment">
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:text="Notification Type"
android:paddingStart="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingStart="2dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:text="Notification Type" />
<View
android:layout_width="fill_parent"
......@@ -37,41 +32,33 @@
<CheckBox
android:id="@+id/type_opening_check"
android:text="Opening"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="Opening" />
<CheckBox
android:id="@+id/type_closing_check"
android:text="Closing"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="Closing" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:text="Notification Interval"
android:paddingStart="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingStart="2dp"