Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hardcoded settings screen #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'org.naishadhparmar.zcustomcalendar:zcustomcalendar:1.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'de.hdodenhof:circleimageview:3.0.0'
}
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 75 additions & 1 deletion app/src/main/java/com/chenangela/vcare/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package com.chenangela.vcare;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import org.naishadhparmar.zcustomcalendar.CustomCalendar;
import org.naishadhparmar.zcustomcalendar.OnDateSelectedListener;
import org.naishadhparmar.zcustomcalendar.Property;

import java.util.Calendar;
import java.util.HashMap;

public class MainActivity extends AppCompatActivity {

//initalize variable
CustomCalendar customCalendar;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -25,6 +36,69 @@ protected void onCreate(Bundle savedInstanceState) {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);

//assign variable
customCalendar = findViewById(R.id.custom_calendar);

//initialize description hash map
HashMap<Object, Property> descHashMap = new HashMap<>();
//initilalize default property
Property defaultProperty = new Property();

defaultProperty.layoutResource = R.layout.default_view;

defaultProperty.dateTextViewResource = R.id.text_view;
descHashMap.put("default",defaultProperty);

//current date
Property currentProperty = new Property();
currentProperty.layoutResource = R.layout.current_view;
currentProperty.dateTextViewResource = R.id.text_view;
descHashMap.put("current",currentProperty);

//present date
Property presentProperty = new Property();
presentProperty.layoutResource = R.layout.present_view;
presentProperty.dateTextViewResource = R.id.text_view;
descHashMap.put("present", presentProperty);

//absent
Property absentProperty = new Property();
absentProperty.layoutResource = R.layout.absent_view;
absentProperty.dateTextViewResource = R.id.text_view;
descHashMap.put("absent", absentProperty);

customCalendar.setMapDescToProp(descHashMap);


HashMap<Integer,Object> dateHashMap = new HashMap<>();
Calendar calendar = Calendar.getInstance();
dateHashMap.put(calendar.get(Calendar.DAY_OF_MONTH), "current");

//testing
/*dateHashMap.put(1,"present");
dateHashMap.put(2, "absent");
dateHashMap.put(3, "present");
dateHashMap.put(4, "absent");
dateHashMap.put(20, "present");
dateHashMap.put(30, "absent"); */

//set date
customCalendar.setDate(calendar,dateHashMap);

customCalendar.setOnDateSelectedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(View view, Calendar selectedDate, Object desc) {
//get string date
String sDate = selectedDate.get(Calendar.DAY_OF_MONTH) +
"/" + (selectedDate.get(Calendar.MONTH)+1) +
"/" + selectedDate.get(Calendar.YEAR);
//display date in toast
Toast.makeText(getApplicationContext(),sDate, Toast.LENGTH_SHORT).show();
}
});


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
return inflater.inflate(R.layout.fragment_journal, container, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@
import androidx.lifecycle.ViewModelProviders;

import com.chenangela.vcare.R;
import com.chenangela.vcare.ui.journal.JournalViewModel;

public class SettingsFragment extends Fragment {

private SettingsViewModel settingsViewModel;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
settingsViewModel =
ViewModelProviders.of(this).get(SettingsViewModel.class);
View root = inflater.inflate(R.layout.fragment_settings, container, false);
final TextView textView = root.findViewById(R.id.text_settings);
settingsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
settingsViewModel = ViewModelProviders.of(this).get(SettingsViewModel.class);
return inflater.inflate(R.layout.fragment_settings, container, false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.chenangela.vcare.ui.settings.notifications;

import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chenangela.vcare.R;
import com.chenangela.vcare.ui.settings.SettingsFragment;

public class NotificationsFragment extends SettingsFragment {

private NotificationsViewModel mViewModel;

public static NotificationsFragment newInstance() {
return new NotificationsFragment();
}

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_settings_notifications, container, false);
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mViewModel = ViewModelProviders.of(this).get(NotificationsViewModel.class);
// TODO: Use the ViewModel
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.chenangela.vcare.ui.settings.notifications;

import androidx.lifecycle.ViewModel;

public class NotificationsViewModel extends ViewModel {
// TODO: Implement the ViewModel
}
Binary file added app/src/main/res/drawable-mdpi/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<path
android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:startX="42.9492"
android:endY="92.4963"
android:endX="85.84757"
android:type="linear">
<item
android:color="#44000000"
Expand All @@ -22,9 +23,9 @@
</aapt:attr>
</path>
<path
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
android:strokeColor="#00000000"/>
</vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/button_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="#00000000" />

<stroke
android:width="3dp"
android:color="#282828" />

</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_baseline_chevron_right_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>
Loading