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

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/ ...@@ -41,3 +41,6 @@ captures/
# External native build folder generated in Android Studio 2.2 and later # External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild .externalNativeBuild
# OSX
.DS_Store
\ No newline at end of file
...@@ -2,7 +2,7 @@ image: openjdk:8-jdk ...@@ -2,7 +2,7 @@ image: openjdk:8-jdk
variables: variables:
ANDROID_COMPILE_SDK: "25" ANDROID_COMPILE_SDK: "25"
ANDROID_BUILD_TOOLS: "23.0.2" ANDROID_BUILD_TOOLS: "25.0.2"
ANDROID_SDK_TOOLS: "24.4.1" ANDROID_SDK_TOOLS: "24.4.1"
before_script: before_script:
......
...@@ -5,7 +5,7 @@ apply plugin: 'me.tatarka.retrolambda' ...@@ -5,7 +5,7 @@ apply plugin: 'me.tatarka.retrolambda'
android { android {
compileSdkVersion 25 compileSdkVersion 25
buildToolsVersion '23.0.2' buildToolsVersion '25.0.2'
defaultConfig { defaultConfig {
applicationId "srct.whatsopen" applicationId "srct.whatsopen"
minSdkVersion 16 minSdkVersion 16
...@@ -50,8 +50,5 @@ dependencies { ...@@ -50,8 +50,5 @@ dependencies {
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile '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.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' compile 'com.takisoft.fix:preference-v7:25.1.1.0'
} }
...@@ -2,35 +2,31 @@ package srct.whatsopen.views.activities; ...@@ -2,35 +2,31 @@ package srct.whatsopen.views.activities;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.os.Bundle;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.ProgressBar;
import com.astuetz.PagerSlidingTabStrip; import com.astuetz.PagerSlidingTabStrip;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import fr.castorflex.android.circularprogressbar.CircularProgressBar;
import io.realm.Realm;
import srct.whatsopen.MyApplication; import srct.whatsopen.MyApplication;
import srct.whatsopen.R; import srct.whatsopen.R;
import srct.whatsopen.views.MainView;
import srct.whatsopen.presenters.MainPresenter; import srct.whatsopen.presenters.MainPresenter;
import srct.whatsopen.views.MainView;
import srct.whatsopen.views.adapters.FacilityListFragmentPagerAdapter; import srct.whatsopen.views.adapters.FacilityListFragmentPagerAdapter;
public class MainActivity extends AppCompatActivity implements MainView { public class MainActivity extends AppCompatActivity implements MainView {
@BindView(R.id.progress_bar) CircularProgressBar mProgressBar; @BindView(R.id.progress_bar)
@BindView(R.id.view_pager) ViewPager mViewPager; ProgressBar mProgressBar;
@BindView(R.id.view_pager)
ViewPager mViewPager;
private MainPresenter mPresenter; private MainPresenter mPresenter;
...@@ -52,6 +48,8 @@ public class MainActivity extends AppCompatActivity implements MainView { ...@@ -52,6 +48,8 @@ public class MainActivity extends AppCompatActivity implements MainView {
// Configure toolbar // Configure toolbar
Toolbar toolbar = ButterKnife.findById(this, R.id.toolbar); Toolbar toolbar = ButterKnife.findById(this, R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbar.setLogo(R.drawable.wo_clock_toolbar);
setUpTabStrip(); setUpTabStrip();
} }
...@@ -76,7 +74,7 @@ public class MainActivity extends AppCompatActivity implements MainView { ...@@ -76,7 +74,7 @@ public class MainActivity extends AppCompatActivity implements MainView {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) { switch (item.getItemId()) {
case R.id.action_refresh: case R.id.action_refresh:
mPresenter.loadFacilities(); mPresenter.loadFacilities();
return true; return true;
......
...@@ -62,19 +62,27 @@ public class FacilityListAdapter extends ...@@ -62,19 +62,27 @@ public class FacilityListAdapter extends
displayStatusDurationText(facility, holder); displayStatusDurationText(facility, holder);
// highlight the open facilities // highlight the open facilities
if(facility.isOpen()) { if (facility.isOpen()) {
// set the RV cell to be highlighted // set the RV cell to be highlighted
holder.itemView.setBackgroundColor(ContextCompat holder.itemView.setBackgroundColor(ContextCompat
.getColor(context, R.color.facilityOpen)); .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 { } else {
holder.itemView.setBackgroundColor(ContextCompat holder.itemView.setBackgroundColor(ContextCompat
.getColor(context, R.color.facilityClosed)); .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); holder.favoriteButton.setImageResource(R.drawable.ic_fav_button_on_24dp);
} } else {
else {
holder.favoriteButton.setImageResource(R.drawable.ic_fav_button_off_24dp); holder.favoriteButton.setImageResource(R.drawable.ic_fav_button_off_24dp);
} }
...@@ -89,7 +97,7 @@ public class FacilityListAdapter extends ...@@ -89,7 +97,7 @@ public class FacilityListAdapter extends
String setting = preferences.getString("list_view_information_preference", String setting = preferences.getString("list_view_information_preference",
"display_duration_both"); "display_duration_both");
switch(setting) { switch (setting) {
case "display_duration_open": case "display_duration_open":
setStatusDurationText(holder, facility.isOpen()); setStatusDurationText(holder, facility.isOpen());
break; break;
...@@ -99,7 +107,8 @@ public class FacilityListAdapter extends ...@@ -99,7 +107,8 @@ public class FacilityListAdapter extends
case "display_duration_none": case "display_duration_none":
setStatusDurationText(holder, false); setStatusDurationText(holder, false);
break; break;
case "display_duration_both":default: case "display_duration_both":
default:
setStatusDurationText(holder, true); setStatusDurationText(holder, true);
break; break;
} }
...@@ -107,7 +116,7 @@ public class FacilityListAdapter extends ...@@ -107,7 +116,7 @@ public class FacilityListAdapter extends
} }
private void setStatusDurationText(ViewHolder holder, boolean showDuration) { private void setStatusDurationText(ViewHolder holder, boolean showDuration) {
if(showDuration) { if (showDuration) {
// display the duration text // display the duration text
setItemPaddingInDp(holder.textLayout, 8); setItemPaddingInDp(holder.textLayout, 8);
holder.durationTextView.setVisibility(View.VISIBLE); holder.durationTextView.setVisibility(View.VISIBLE);
...@@ -123,8 +132,8 @@ public class FacilityListAdapter extends ...@@ -123,8 +132,8 @@ public class FacilityListAdapter extends
// Have to convert from pixels to dp // Have to convert from pixels to dp
private void setItemPaddingInDp(LinearLayout layout, int paddingPx) { private void setItemPaddingInDp(LinearLayout layout, int paddingPx) {
float scale = context.getResources().getDisplayMetrics().density; float scale = context.getResources().getDisplayMetrics().density;
int paddingTop = (int) (paddingPx*scale + 0.5f); int paddingTop = (int) (paddingPx * scale + 0.5f);
int paddingBottom = (int) (paddingPx*scale + 0.5f); int paddingBottom = (int) (paddingPx * scale + 0.5f);
layout.setPadding(0, paddingTop, 0, paddingBottom); layout.setPadding(0, paddingTop, 0, paddingBottom);
} }
...@@ -132,10 +141,14 @@ public class FacilityListAdapter extends ...@@ -132,10 +141,14 @@ public class FacilityListAdapter extends
// Set up for the Recycler View cells // Set up for the Recycler View cells
public class ViewHolder extends RecyclerView.ViewHolder implements FacilityView { public class ViewHolder extends RecyclerView.ViewHolder implements FacilityView {
@BindView(R.id.facility_name) TextView nameTextView; @BindView(R.id.facility_name)
@BindView(R.id.favorite_button) ImageButton favoriteButton; TextView nameTextView;
@BindView(R.id.facility_duration) TextView durationTextView; @BindView(R.id.favorite_button)
@BindView(R.id.text_layout) LinearLayout textLayout; ImageButton favoriteButton;
@BindView(R.id.facility_duration)
TextView durationTextView;
@BindView(R.id.text_layout)
LinearLayout textLayout;
private FacilityPresenter mPresenter; private FacilityPresenter mPresenter;
private Facility data; private Facility data;
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="8dp" <size android:height="1px"
android:width="8dp" /> android:width="8dp" />
<solid android:color="#80FFFFFF"/> <solid android:color="#aaaaaa"/>
</shape> </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"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="wrap_content"> android:orientation="horizontal">
<android.support.v7.widget.CardView <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="1dp" android:orientation="vertical">
android:layout_margin="6dp">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView <TextView
android:text="Notification Type" android:layout_width="match_parent"
android:paddingStart="2dp" android:layout_height="wrap_content"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingRight="2dp" android:paddingRight="2dp"
android:paddingStart="2dp"
android:paddingTop="2dp" android:paddingTop="2dp"
android:layout_width="match_parent" android:text="Notification Type" />
android:layout_height="wrap_content"/>
<CheckBox <CheckBox
android:id="@+id/type_opening_check" android:id="@+id/type_opening_check"
android:text="Opening"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="Opening" />
<CheckBox <CheckBox
android:id="@+id/type_closing_check" android:id="@+id/type_closing_check"
android:text="Closing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="Closing" />
</LinearLayout> </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 <LinearLayout
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content"> android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingTop="2dp">
<Button <LinearLayout
android:id="@+id/save_button"
android:text="Save"
android:textColor="@color/colorPrimary"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content" 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 <Button
android:id="@+id/cancel_button" android:id="@+id/remove_button"
android:text="Cancel"
android:textColor="@color/colorPrimary"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
style="?android:borderlessButtonStyle" style="?android:borderlessButtonStyle"
android:layout_width="wrap_content" 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> </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>
</LinearLayout>
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView <TextView
android:text="Notification Interval" android:layout_width="match_parent"
android:textAlignment="center" android:layout_height="wrap_content"
android:paddingStart="2dp"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingRight="2dp" android:paddingRight="2dp"
android:paddingStart="2dp"
android:paddingTop="2dp" android:paddingTop="2dp"
android:layout_width="match_parent" android:text="Notification Interval"
android:layout_height="wrap_content"/> android:textAlignment="center" />
<CheckBox <CheckBox
android:id="@+id/interval_on_check" android:id="@+id/interval_on_check"
android:text="On opening/closing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="On opening/closing" />
<CheckBox <CheckBox
android:id="@+id/interval_15_check" android:id="@+id/interval_15_check"
android:text="15 minutes before"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="15 minutes before" />
<CheckBox <CheckBox
android:id="@+id/interval_30_check" android:id="@+id/interval_30_check"
android:text="30 minutes before"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="30 minutes before" />
<CheckBox <CheckBox
android:id="@+id/interval_hour_check" android:id="@+id/interval_hour_check"
android:text="An hour before"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:text="An hour before" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </LinearLayout>
</LinearLayout>
</ScrollView> </ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <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"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="srct.whatsopen.views.activities.MainActivity"> tools:context="srct.whatsopen.views.activities.MainActivity">
<LinearLayout <LinearLayout
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="match_parent"