Skip to content

Commit

Permalink
Merge pull request #126 from Crazy-Marvin/development
Browse files Browse the repository at this point in the history
Vacation Days v10.0
  • Loading branch information
CrazyMarvin authored Nov 13, 2022
2 parents e4b39b6 + 847ad7d commit 4be9e16
Show file tree
Hide file tree
Showing 37 changed files with 373 additions and 195 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
applicationId "rocks.poopjournal.vacationdays"
minSdkVersion 21
targetSdkVersion 33
versionCode 9
versionName "9.0"
versionCode 10
versionName "10.0"


testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -65,13 +65,13 @@ testOptions {
dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.squareup:android-times-square:1.7.11@aar'
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.github.sundeepk:compact-calendar-view:3.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.ornach.nobobutton:nobobutton:1.6'
Expand Down
8 changes: 1 addition & 7 deletions app/src/main/java/rocks/poopjournal/vacationdays/About.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
TextView appVersion = findViewById(R.id.version);
//version.setText(BuildConfig.VERSION_NAME+" "+this.getString(R.string.apache) );

//@SuppressLint({"StringFormatInvalid", "LocalSuppress"}) String version =
@SuppressLint({"StringFormatInvalid", "LocalSuppress"}) String version =
String.format(getResources().getString(R.string.version),
BuildConfig.VERSION_NAME);
appVersion.setText(version);
appVersion.setText(BuildConfig.VERSION_NAME+" "+getString(R.string.apache));
}

public void contact_codeaquaria(View view) {
Expand Down
120 changes: 103 additions & 17 deletions app/src/main/java/rocks/poopjournal/vacationdays/FragmentCalendar.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
package rocks.poopjournal.vacationdays;

import android.icu.text.SimpleDateFormat;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.icu.text.SimpleDateFormat;
import android.media.Image;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;

import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.lang.reflect.Array;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;


@RequiresApi(api = Build.VERSION_CODES.N)
Expand All @@ -36,6 +45,44 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
final Calendar lastYear = Calendar.getInstance();
lastYear.add(Calendar.YEAR, -10);

int cyear = lastYear.get(Calendar.YEAR);





ArrayList<String> years= new ArrayList<>();
for(int i =10;i>0;i--){
Calendar prevYear = Calendar.getInstance();
prevYear.add(Calendar.YEAR, -i);
int iyear = prevYear.get(Calendar.YEAR);
years.add("" + iyear);
}

for(int i =0;i<11;i++){
Calendar prevYear = Calendar.getInstance();
prevYear.add(Calendar.YEAR, i);
int iyear = prevYear.get(Calendar.YEAR);
years.add( "" + iyear);
}

Toast.makeText(getActivity(), "current year "+ cyear, Toast.LENGTH_SHORT).show();


Spinner spinner = v.findViewById(R.id.yearspinner);

ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getContext(), R.layout.spinner_layout, years);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(arrayAdapter);
Calendar prevYear = Calendar.getInstance();
int iyear = prevYear.get(Calendar.YEAR);
String obj = "" + iyear;
spinner.setSelection(years.indexOf(obj));





calendar = v.findViewById(R.id.calendar_view);
db.show_data();

Expand All @@ -60,14 +107,53 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");
Date newdate = dateformat.parse(dates.get(i));
arrayList.add(newdate);
}
arrayList.add(newdate);
}
} catch (ParseException e) {
e.printStackTrace();
}
calendar.init(lastYear.getTime(), nextYear.getTime(), new java.text.SimpleDateFormat("MMMM yyyy"))
.withHighlightedDates(arrayList);
.withHighlightedDates(arrayList)
.displayOnly();
calendar.scrollToDate(new Date());


v.findViewById(R.id.spinner_drop).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
spinner.performClick();
}
});
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String tutorialsName = parent.getItemAtPosition(position).toString();
Toast.makeText(parent.getContext(), "Selected: " + tutorialsName, Toast.LENGTH_LONG).show();

if(!tutorialsName.equals("" + iyear)){
String dtStart = tutorialsName+"-01-01";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = format.parse(dtStart);
System.out.println(date);
calendar.scrollToDate(date);

} catch (ParseException e) {
e.printStackTrace();
}


}

}
@Override
public void onNothingSelected(AdapterView <?> parent) {
}
});




return v;
}
}
}
74 changes: 32 additions & 42 deletions app/src/main/java/rocks/poopjournal/vacationdays/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void onCreate(Bundle savedInstanceState) {
count+=Integer.parseInt(Helper.data.get(i)[4]);
}
remaining=Helper.totalHolidays-count;
holidayscount.setText("Total Vacations:"+Helper.totalHolidays+"Remaining Vacations:"+remaining);
holidayscount.setText("Total Vacations: "+Helper.totalHolidays+"\n"+"Remaining Vacations: "+remaining);

db.getMode();
switch (rocks.poopjournal.vacationdays.Helper.isnightmodeon) {
Expand Down Expand Up @@ -84,34 +84,27 @@ else if(Helper.whichTabSelected==1){
ft.commit();
}

timeline.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Helper.whichTabSelected=0;
timeline.setBackgroundColor(getResources().getColor(R.color.tabs));
timeline.setTextColor(getResources().getColor(R.color.textcolorblack));
calendar.setBackgroundColor(Color.TRANSPARENT);
calendar.setTextColor(getResources().getColor(R.color.textcolorwhite));
FragmentTransaction ft = getSupportFragmentManager().beginTransaction().setCustomAnimations(
R.anim.fade_in,R.anim.fade_out
);
ft.replace(R.id.container, new FragmentTimeline());
ft.commit();
}
timeline.setOnClickListener(view -> {
Helper.whichTabSelected=0;
timeline.setBackgroundColor(getResources().getColor(R.color.tabs));
timeline.setTextColor(getResources().getColor(R.color.textcolorblack));
calendar.setBackgroundColor(Color.TRANSPARENT);
calendar.setTextColor(getResources().getColor(R.color.textcolorwhite));
FragmentTransaction ft = getSupportFragmentManager().beginTransaction().setCustomAnimations(
R.anim.fade_in,R.anim.fade_out
);
ft.replace(R.id.container, new FragmentTimeline());
ft.commit();
});
calendar.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View view) {
Helper.whichTabSelected=1;
calendar.setBackgroundColor(getResources().getColor(R.color.tabs));
calendar.setTextColor(getResources().getColor(R.color.textcolorblack));
timeline.setBackgroundColor(Color.TRANSPARENT);
timeline.setTextColor(getResources().getColor(R.color.textcolorwhite));
FragmentTransaction ft = getSupportFragmentManager().beginTransaction().setCustomAnimations(0,0);
ft.replace(R.id.container, new FragmentCalendar());
ft.commit();
}
calendar.setOnClickListener(view -> {
Helper.whichTabSelected=1;
calendar.setBackgroundColor(getResources().getColor(R.color.tabs));
calendar.setTextColor(getResources().getColor(R.color.textcolorblack));
timeline.setBackgroundColor(Color.TRANSPARENT);
timeline.setTextColor(getResources().getColor(R.color.textcolorwhite));
FragmentTransaction ft = getSupportFragmentManager().beginTransaction().setCustomAnimations(0,0);
ft.replace(R.id.container, new FragmentCalendar());
ft.commit();
});
}
public void floatingbuttonclicked(View view) {
Expand All @@ -125,21 +118,18 @@ public void floatingbuttonclicked(View view) {
lp.dimAmount=0.9f;
d.getWindow().setAttributes(lp);
d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
btnsave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(editText.getText().toString().equals("")){
editText.setError("Can't be empty");
}
else{
Helper.holidayTitle=""+editText.getText().toString();
d.dismiss();
Intent i = new Intent(MainActivity.this, DatePicker.class);
finishAffinity();
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
btnsave.setOnClickListener(view1 -> {
if(editText.getText().toString().equals("")){
editText.setError("Can't be empty");
}
else{
Helper.holidayTitle=""+editText.getText().toString();
d.dismiss();
Intent i = new Intent(MainActivity.this, DatePicker.class);
finishAffinity();
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

}
}
});d.show();

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable-night/day_text_color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<item android:color="#FF9800" android:state_selected="true" app:tsquare_state_range_middle="false"/>
<item android:color="@android:color/transparent" app:tsquare_state_current_month="false"/>
<item android:color="#FFC107" app:tsquare_state_today="true" app:tsquare_state_highlighted="false" app:tsquare_state_unavailable="false"/>
<item android:color="@color/orangeTowhite" app:tsquare_state_highlighted="true"/>
<item android:color="@android:color/black" app:tsquare_state_highlighted="true"/>
<item android:color="@color/subitem_text"/>
</selector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/day_text_color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<item android:color="#FF9800" android:state_selected="true" app:tsquare_state_range_middle="false"/>
<item android:color="@android:color/transparent" app:tsquare_state_current_month="false"/>
<item android:color="#FFC107" app:tsquare_state_today="true" app:tsquare_state_highlighted="false" app:tsquare_state_unavailable="false"/>
<item android:color="@color/orangeTowhite" app:tsquare_state_highlighted="true"/>
<item android:color="@color/mdtp_white" app:tsquare_state_highlighted="true"/>
<item android:color="@color/subitem_text"/>
</selector>
29 changes: 4 additions & 25 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_height="wrap_content"
android:layout_below="@+id/appbar"
android:gravity="center"
android:background="@color/apptheme"
Expand Down Expand Up @@ -71,7 +71,7 @@
<TextView
android:id="@+id/holidayscount"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@android:color/white"
/>
Expand All @@ -95,7 +95,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:background="@android:color/transparent">

<LinearLayout
Expand All @@ -105,38 +105,17 @@
android:gravity="center"
android:orientation="horizontal">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="15dp"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical">

<TextView
android:id="@+id/toolbartext"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/textcolorwhite"
android:textSize="18sp"
android:textStyle="bold" />

<TextView
android:id="@+id/toolbartext2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/textcolorwhite"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>

<!-- <ImageView-->
<!-- android:id="@+id/label"-->
<!-- android:layout_width="25dp"-->
Expand Down
Loading

0 comments on commit 4be9e16

Please sign in to comment.