forked from p28679143/ShowMe
Compare commits
72 Commits
@ -1,3 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
@ -1 +0,0 @@
|
|||||||
My Application
|
|
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.showme.myapplication">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/Theme.MyApplication">
|
|
||||||
<activity android:name=".MainActivity">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
@ -1,115 +0,0 @@
|
|||||||
package com.showme.myapplication;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.idealist.calendarview.CalendarAttr;
|
|
||||||
import com.idealist.calendarview.CalendarDay;
|
|
||||||
import com.idealist.calendarview.CalendarPager;
|
|
||||||
import com.idealist.calendarview.CalendarUtils;
|
|
||||||
import com.idealist.calendarview.CalendarView;
|
|
||||||
import com.idealist.calendarview.CalendarViewAdapter;
|
|
||||||
import com.idealist.calendarview.State;
|
|
||||||
import com.idealist.calendarview.interf.OnSelectDateListener;
|
|
||||||
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private TextView tvMonth;
|
|
||||||
private TextView tvYear;
|
|
||||||
|
|
||||||
private CalendarDay currentDay;
|
|
||||||
|
|
||||||
private CalendarView currentView;
|
|
||||||
|
|
||||||
private CalendarPager pager;
|
|
||||||
|
|
||||||
private CalendarViewAdapter viewAdapter;
|
|
||||||
|
|
||||||
private CalendarAttr attr;
|
|
||||||
|
|
||||||
private OnSelectDateListener onSelectDateListener;
|
|
||||||
|
|
||||||
private CalendarView.OnCalendarClickListener clickListener;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
|
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
|
||||||
getWindowManager().getDefaultDisplay().getRealMetrics(dm);
|
|
||||||
int height = dm.heightPixels;
|
|
||||||
State.setDefaultItemHeightFull((height - 42 - 3*State.DEFAULT_ITEM_HEIGHT) / 6);
|
|
||||||
|
|
||||||
initCalendar();
|
|
||||||
|
|
||||||
attr = new CalendarAttr();
|
|
||||||
attr.setCalendarType(State.VIEW_MONTH);
|
|
||||||
attr.setScrollLevel(State.LEVEL_MEDIUM);
|
|
||||||
|
|
||||||
initListener();
|
|
||||||
viewAdapter = new CalendarViewAdapter(this, attr, onSelectDateListener,
|
|
||||||
clickListener);
|
|
||||||
initPager();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initCalendar() {
|
|
||||||
tvMonth = findViewById(R.id.custom_month_view);
|
|
||||||
tvYear = findViewById(R.id.custom_year_view);
|
|
||||||
currentDay = CalendarUtils.getCurrDay();
|
|
||||||
updateCalendar();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initPager() {
|
|
||||||
pager = findViewById(R.id.custom_vp);
|
|
||||||
pager.setAttr(attr);
|
|
||||||
pager.setAdapter(viewAdapter);
|
|
||||||
|
|
||||||
pager.setmOnPageChangeListener(new CalendarPager.OnPageChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageSelected(int position) {
|
|
||||||
currentView = viewAdapter.getViews().get(position % 3);
|
|
||||||
currentDay = currentView.getSeedDay();
|
|
||||||
updateCalendar();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initListener() {
|
|
||||||
onSelectDateListener = offset -> pager.selectOtherMonth(offset);
|
|
||||||
clickListener = new CalendarView.OnCalendarClickListener() {
|
|
||||||
@Override
|
|
||||||
public void OnClick(CalendarDay day) {
|
|
||||||
// updateSchedule(day);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void OnLongClick(CalendarDay day) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
private void updateCalendar() {
|
|
||||||
tvMonth.setText(currentDay.getMonth() + "");
|
|
||||||
tvYear.setText(currentDay.getYear() + "");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">My Application</string>
|
|
||||||
</resources>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<paths>
|
|
||||||
<root-path
|
|
||||||
name="root"
|
|
||||||
path="" />
|
|
||||||
<files-path
|
|
||||||
name="files"
|
|
||||||
path="" />
|
|
||||||
|
|
||||||
<cache-path
|
|
||||||
name="cache"
|
|
||||||
path="" />
|
|
||||||
|
|
||||||
<external-path
|
|
||||||
name="camera_photos"
|
|
||||||
path="" />
|
|
||||||
|
|
||||||
<external-files-path
|
|
||||||
name="external_file_path"
|
|
||||||
path="" />
|
|
||||||
<external-cache-path
|
|
||||||
name="external_cache_path"
|
|
||||||
path="" />
|
|
||||||
</paths>
|
|
||||||
</resources>
|
|
@ -1,4 +0,0 @@
|
|||||||
include ':DataBase'
|
|
||||||
include ':app'
|
|
||||||
rootProject.name = "My Application"
|
|
||||||
include ':CalendarView'
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="14">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
|
||||||
|
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="13">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,62 @@
|
|||||||
|
Index: app/src/main/java/com/diary/showme/diary/ui/CardActivity.java
|
||||||
|
IDEA additional info:
|
||||||
|
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||||
|
<+>package com.diary.showme.diary.ui;\r\n\r\nimport android.app.Activity;\r\nimport android.content.Intent;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.content.Context;\r\nimport android.graphics.Color;\r\nimport android.os.Environment;\r\nimport android.widget.EditText;\r\nimport android.widget.Toast;\r\n\r\nimport androidx.annotation.Nullable;\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\nimport com.diary.showme.Course.AddCourseActivity;\r\nimport com.diary.showme.Course.Course;\r\nimport com.diary.showme.Course.CourseActivity;\r\nimport com.diary.showme.R;\r\n\r\n\r\npublic class CardActivity extends AppCompatActivity {\r\n\r\n private Button card1;\r\n\r\n private Button card2;\r\n\r\n private Button card3;\r\n\r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.card);\r\n\r\n card1 = findViewById(R.id.card1);\r\n card2 = findViewById(R.id.card2);\r\n card3 = findViewById(R.id.card3);\r\n card1.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);\r\n }\r\n });\r\n card2.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);\r\n }\r\n });\r\n card3.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);\r\n }\r\n });\r\n }\r\n\r\n public static void startActivity(Context context) {\r\n Intent intent = new Intent(context, CardActivity.class);\r\n context.startActivity(intent);\r\n }\r\n\r\n\r\n}\r\n
|
||||||
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||||
|
<+>UTF-8
|
||||||
|
===================================================================
|
||||||
|
--- app/src/main/java/com/diary/showme/diary/ui/CardActivity.java (revision c7e2ad49109864f6c4a19759f6af43db764bb204)
|
||||||
|
+++ app/src/main/java/com/diary/showme/diary/ui/CardActivity.java (date 1626049324133)
|
||||||
|
@@ -39,19 +39,22 @@
|
||||||
|
card1.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
- startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);
|
||||||
|
+ Intent intent = new Intent(CardActivity.this, AddDiaryActivity.class);
|
||||||
|
+ startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
card2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
- startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);
|
||||||
|
+ Intent intent = new Intent(CardActivity.this, AddDiaryActivity.class);
|
||||||
|
+ startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
card3.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
- startActivityForResult(new Intent(CardActivity.this, AddDiaryActivity.class), 0);
|
||||||
|
+ Intent intent = new Intent(CardActivity.this, AddDiaryActivity.class);
|
||||||
|
+ startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Index: app/src/main/res/layout/question_item.xml
|
||||||
|
IDEA additional info:
|
||||||
|
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||||
|
<+><?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n android:layout_width=\"match_parent\"\r\n android:layout_height=\"wrap_content\">\r\n\r\n <LinearLayout\r\n android:layout_width=\"match_parent\"\r\n android:layout_height=\"match_parent\"\r\n android:orientation=\"horizontal\">\r\n\r\n <TextView\r\n android:id=\"@+id/question_content\"\r\n android:layout_width=\"match_parent\"\r\n android:layout_height=\"wrap_content\"\r\n android:gravity=\"center\"\r\n android:textSize=\"24sp\"/>\r\n\r\n </LinearLayout>\r\n\r\n</FrameLayout>
|
||||||
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||||
|
<+>UTF-8
|
||||||
|
===================================================================
|
||||||
|
--- app/src/main/res/layout/question_item.xml (revision c7e2ad49109864f6c4a19759f6af43db764bb204)
|
||||||
|
+++ app/src/main/res/layout/question_item.xml (date 1626048966859)
|
||||||
|
@@ -8,12 +8,14 @@
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
- <TextView
|
||||||
|
+ <Button
|
||||||
|
android:id="@+id/question_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
- android:gravity="center"
|
||||||
|
- android:textSize="24sp"/>
|
||||||
|
+ android:layout_weight="1"
|
||||||
|
+ android:background="#A4CF2626"
|
||||||
|
+ android:text="今天有遇到什么开心的事情吗?"
|
||||||
|
+ />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
<changelist name="Uncommitted_changes_before_Update_at_2021_7_12_8_40_[Default_Changelist]" date="1626050458233" recycled="true" deleted="true">
|
||||||
|
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_7_12_8_40_[Default_Changelist]/shelved.patch" />
|
||||||
|
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2021/7/12 8:40 [Default Changelist]" />
|
||||||
|
</changelist>
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,14 @@
|
|||||||
|
<changelist name="Uncommitted_changes_before_Update_at_2021_7_12_9_04_[Default_Changelist]" date="1626051883392" recycled="true" deleted="true">
|
||||||
|
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_7_12_9_04_[Default_Changelist]/shelved.patch" />
|
||||||
|
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2021/7/12 9:04 [Default Changelist]" />
|
||||||
|
<binary>
|
||||||
|
<option name="BEFORE_PATH" value="../app-release.apk" />
|
||||||
|
<option name="AFTER_PATH" value="../app-release.apk" />
|
||||||
|
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_7_12_9_04_[Default_Changelist]/app-release.apk" />
|
||||||
|
</binary>
|
||||||
|
<binary>
|
||||||
|
<option name="BEFORE_PATH" value="app/release/app-release.apk" />
|
||||||
|
<option name="AFTER_PATH" />
|
||||||
|
<option name="SHELVED_PATH" />
|
||||||
|
</binary>
|
||||||
|
</changelist>
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>showme</name>
|
||||||
|
<comment>Project showme created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1625906374722</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,13 @@
|
|||||||
|
arguments=
|
||||||
|
auto.sync=false
|
||||||
|
build.scans.enabled=false
|
||||||
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
||||||
|
connection.project.dir=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
gradle.user.home=
|
||||||
|
java.home=C\:/Software/StayHungry/JDK15
|
||||||
|
jvm.arguments=
|
||||||
|
offline.mode=false
|
||||||
|
override.workspace.settings=true
|
||||||
|
show.console.view=true
|
||||||
|
show.executions.view=true
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15/"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>CalendarView</name>
|
||||||
|
<comment>Project CalendarView created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1625906374711</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=..
|
||||||
|
eclipse.preferences.version=1
|
@ -1,5 +1,6 @@
|
|||||||
package com.idealist.calendarview;
|
package com.idealist.calendarview;
|
||||||
|
|
||||||
|
|
||||||
public class CalendarAttr {
|
public class CalendarAttr {
|
||||||
|
|
||||||
static int RecTop;
|
static int RecTop;
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.idealist.calendarview;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.diary.database.utils.ScheduleSQLUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements
|
||||||
|
View.OnClickListener{
|
||||||
|
private List<String> mDatabase;
|
||||||
|
|
||||||
|
private OnItemClickListener onItemClickListener = null;
|
||||||
|
|
||||||
|
public RecyclerViewAdapter(List<String> mDatabase) {
|
||||||
|
super();
|
||||||
|
this.mDatabase = mDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = View.inflate(parent.getContext(), R.layout.schedule_item, null);
|
||||||
|
view.setOnClickListener(this);
|
||||||
|
return new RecyclerViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
if (!(holder instanceof RecyclerViewHolder))
|
||||||
|
return;
|
||||||
|
holder.itemView.setTag(position);
|
||||||
|
String text = mDatabase.get(position);
|
||||||
|
((RecyclerViewHolder) holder).timeTextView.setText(ScheduleSQLUtils.extractScheduleTime(text));
|
||||||
|
((RecyclerViewHolder) holder).titleTextView.setText(ScheduleSQLUtils.extractScheduleName(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDatabase.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onItemClickListener != null) {
|
||||||
|
onItemClickListener.onItemClick(v, (int) v.getTag());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setmDatabase(List<String> mDatabase) {
|
||||||
|
this.mDatabase = mDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
||||||
|
this.onItemClickListener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(View view, int position);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,141 @@
|
|||||||
|
package com.idealist.calendarview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import static android.content.ContentValues.TAG;
|
||||||
|
|
||||||
|
public class RecyclerViewBehavior extends CoordinatorLayout.Behavior<RecyclerView> {
|
||||||
|
|
||||||
|
private int initOffset = -1;
|
||||||
|
private int minOffset = -1;
|
||||||
|
private int bottomOffset = -1;
|
||||||
|
private Context context;
|
||||||
|
private boolean initiated = false;
|
||||||
|
boolean hidingTop = false;
|
||||||
|
boolean showingTop = false;
|
||||||
|
|
||||||
|
public RecyclerViewBehavior(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLayoutChild(@NonNull CoordinatorLayout parent, @NonNull RecyclerView child, int layoutDirection) {
|
||||||
|
parent.onLayoutChild(child, layoutDirection);
|
||||||
|
CalendarPager calendarPager = getCalendarPager(parent);
|
||||||
|
initMinOffsetAndInitOffset(parent, child, calendarPager);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMinOffsetAndInitOffset(CoordinatorLayout parent, RecyclerView child, CalendarPager pager) {
|
||||||
|
if (pager.getBottom() > 0 && initOffset == -1) {
|
||||||
|
initOffset = pager.getMeasuredHeight();
|
||||||
|
CalendarAttr.setRecTop(initOffset);
|
||||||
|
}
|
||||||
|
if (pager.getBottom() > 0 && bottomOffset == -1) {
|
||||||
|
bottomOffset = State.DEFAULT_ITEM_HEIGHT_FULL * 6;
|
||||||
|
}
|
||||||
|
if (!initiated) {
|
||||||
|
initOffset = pager.getMeasuredHeight();
|
||||||
|
CalendarAttr.setRecTop(initOffset);
|
||||||
|
initiated = true;
|
||||||
|
}
|
||||||
|
child.offsetTopAndBottom(CalendarAttr.getRecTop());
|
||||||
|
minOffset = getCalendarPager(parent).getItemHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull RecyclerView child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
|
||||||
|
return (axes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull RecyclerView child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
|
||||||
|
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
|
||||||
|
child.setVerticalScrollBarEnabled(true);
|
||||||
|
|
||||||
|
CalendarPager pager = (CalendarPager) coordinatorLayout.getChildAt(0);
|
||||||
|
if (pager.getPageScrollState() != ViewPager.SCROLL_STATE_IDLE) {
|
||||||
|
consumed[1] = dy;
|
||||||
|
Log.w("ldf", "onNestedPreScroll: MonthPager dragging");
|
||||||
|
Toast.makeText(context, "loading month data", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上滑,正在隐藏顶部的日历
|
||||||
|
hidingTop = dy > 0;
|
||||||
|
// 下滑,正在展示顶部的日历
|
||||||
|
showingTop = dy < 0 && !target.canScrollVertically(-1);
|
||||||
|
Log.i("recycleBehavior", "hidingTop: " + hidingTop + " showingTop: " + showingTop);
|
||||||
|
if (hidingTop || showingTop) {
|
||||||
|
if (pager.getScrollLevel() == State.LEVEL_TOP) {
|
||||||
|
consumed[1] = CalendarUtils.scroll(child, dy,
|
||||||
|
State.DEFAULT_ITEM_HEIGHT,
|
||||||
|
State.DEFAULT_ITEM_HEIGHT * 6 + 10);
|
||||||
|
} else if (pager.getScrollLevel() == State.LEVEL_MEDIUM) {
|
||||||
|
consumed[1] = CalendarUtils.scroll(child, dy,
|
||||||
|
State.DEFAULT_ITEM_HEIGHT,
|
||||||
|
State.DEFAULT_ITEM_HEIGHT_FULL * 6);
|
||||||
|
}
|
||||||
|
CalendarAttr.setRecTop(child.getTop());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull RecyclerView child, @NonNull View target, int type) {
|
||||||
|
super.onStopNestedScroll(coordinatorLayout, child, target, type);
|
||||||
|
CalendarPager pager = (CalendarPager) getCalendarPager(coordinatorLayout);
|
||||||
|
CalendarViewAdapter adapter = (CalendarViewAdapter) pager.getAdapter();
|
||||||
|
|
||||||
|
if (pager.getScrollLevel() == State.LEVEL_TOP) {
|
||||||
|
if (CalendarAttr.getRecTop() - minOffset > CalendarUtils.getTouchSlop(context) && showingTop
|
||||||
|
&& CalendarAttr.getRecTop() < initOffset + 110) {
|
||||||
|
pager.setScrollLevel(State.LEVEL_MEDIUM);
|
||||||
|
adapter.changeCalendarType(State.VIEW_MONTH);
|
||||||
|
CalendarUtils.scrollTo(coordinatorLayout, child, getCalendarPager(coordinatorLayout).getViewHeight(), 500);
|
||||||
|
CalendarUtils.forceStopRecyclerViewScroll(child);
|
||||||
|
} else {
|
||||||
|
CalendarUtils.scrollTo(coordinatorLayout, child, getCalendarPager(coordinatorLayout).getItemHeight(), 150);
|
||||||
|
}
|
||||||
|
} else if (pager.getScrollLevel() == State.LEVEL_MEDIUM) {
|
||||||
|
if (initOffset - CalendarAttr.getRecTop() > CalendarUtils.getTouchSlop(context) && hidingTop) {
|
||||||
|
pager.setScrollLevel(State.LEVEL_TOP);
|
||||||
|
adapter.changeCalendarType(State.VIEW_WEEK);
|
||||||
|
CalendarUtils.scrollTo(coordinatorLayout, child, getCalendarPager(coordinatorLayout).getItemHeight(), 500);
|
||||||
|
CalendarUtils.forceStopRecyclerViewScroll(child);
|
||||||
|
} else if (CalendarAttr.getRecTop() - initOffset > CalendarUtils.getTouchSlop(context) && showingTop) {
|
||||||
|
pager.setScrollLevel(State.LEVEL_BOTTOM);
|
||||||
|
adapter.changeCalendarType(State.VIEW_FULL);
|
||||||
|
CalendarUtils.scrollTo(coordinatorLayout, child, getCalendarPager(coordinatorLayout).getViewHeight(), 500);
|
||||||
|
CalendarUtils.forceStopRecyclerViewScroll(child);
|
||||||
|
} else {
|
||||||
|
CalendarUtils.scrollTo(coordinatorLayout, child, getCalendarPager(coordinatorLayout).getViewHeight(), 150);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onNestedFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull RecyclerView child, @NonNull View target, float velocityX, float velocityY, boolean consumed) {
|
||||||
|
return super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onNestedPreFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull RecyclerView child, @NonNull View target, float velocityX, float velocityY) {
|
||||||
|
return super.onNestedPreFling(coordinatorLayout, child, target, velocityX, velocityY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CalendarPager getCalendarPager(CoordinatorLayout parent) {
|
||||||
|
return (CalendarPager) parent.getChildAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.idealist.calendarview;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
public class RecyclerViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public TextView timeTextView;
|
||||||
|
public TextView titleTextView;
|
||||||
|
|
||||||
|
public RecyclerViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
timeTextView = itemView.findViewById(R.id.schedule_time);
|
||||||
|
titleTextView = itemView.findViewById(R.id.schedule_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.idealist.calendarview;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
private int mSpace;
|
||||||
|
|
||||||
|
public SpaceItemDecoration(int mSpace) {
|
||||||
|
this.mSpace = mSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state);
|
||||||
|
outRect.left = mSpace;
|
||||||
|
outRect.right = mSpace;
|
||||||
|
outRect.bottom = mSpace;
|
||||||
|
if (parent.getChildAdapterPosition(view) == 0) {
|
||||||
|
outRect.top = mSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#000000"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:left="1dp">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#ffffff"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingEnd="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/schedule_time"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="1:00\n7:00"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/schedule_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_toEndOf="@+id/schedule_time"
|
||||||
|
android:layout_toRightOf="@+id/schedule_time"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:text="schedule"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:background="@drawable/schedule_border"/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="MyView">
|
||||||
|
<attr name="item_height" format="dimension"/>
|
||||||
|
<attr name="text_size" format="dimension"/>
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="weekIndicatorStyle">
|
||||||
|
<item name="android:layout_width">0dp</item>
|
||||||
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
<item name="android:layout_weight">1</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
|
<item name="android:textSize">13sp</item>
|
||||||
|
<item name="android:textColor">#ff25adff</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15/"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Database</name>
|
||||||
|
<comment>Project Database created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1625906374715</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=..
|
||||||
|
eclipse.preferences.version=1
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.showme.database">
|
package="com.diary.database">
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,4 +1,4 @@
|
|||||||
package com.showme.database.DatabaseHelper;
|
package com.diary.database.DatabaseHelper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
@ -1,4 +1,4 @@
|
|||||||
package com.showme.database.DatabaseHelper;
|
package com.diary.database.DatabaseHelper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
@ -1,7 +1,9 @@
|
|||||||
package com.showme.database;
|
package com.diary.database;
|
||||||
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MySQLiteDatabase {
|
public class MySQLiteDatabase {
|
||||||
public static SQLiteDatabase scheduleSQL;
|
public static SQLiteDatabase scheduleSQL;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package com.showme.database.utils;
|
package com.diary.database.utils;
|
||||||
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import com.showme.database.MySQLiteDatabase;
|
import com.diary.database.MySQLiteDatabase;
|
||||||
|
|
||||||
public class CourseSQLUtils {
|
public class CourseSQLUtils {
|
||||||
private static SQLiteDatabase courseSQL = MySQLiteDatabase.courseSQL;
|
private static SQLiteDatabase courseSQL = MySQLiteDatabase.courseSQL;
|
@ -1,9 +1,9 @@
|
|||||||
package com.showme.database.utils;
|
package com.diary.database.utils;
|
||||||
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import com.showme.database.MySQLiteDatabase;
|
import com.diary.database.MySQLiteDatabase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,4 +1,4 @@
|
|||||||
package com.showme.database;
|
package com.diary.database;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15/"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>app</name>
|
||||||
|
<comment>Project app created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1625906374719</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=..
|
||||||
|
eclipse.preferences.version=1
|
Binary file not shown.
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "com.diary.showme",
|
||||||
|
"variantName": "release",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"versionCode": 1,
|
||||||
|
"versionName": "1.0",
|
||||||
|
"outputFile": "app-release.apk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.diary.showme">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Showme">
|
||||||
|
<activity android:name=".diary.ui.UpdateDiaryActivity" />
|
||||||
|
<activity android:name=".diary.ui.DiaryActivity" />
|
||||||
|
<activity android:name=".diary.ui.AddDiaryActivity" />
|
||||||
|
<activity android:name=".diary.ui.CardActivity" />
|
||||||
|
<activity android:name=".diary.ui.QuestionActivity"/>
|
||||||
|
<activity android:name=".Course.AddCourseActivity" />
|
||||||
|
<activity android:name=".Course.CourseActivity" />
|
||||||
|
<activity android:name=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".Schedule.AddScheduleActivity" />
|
||||||
|
<activity android:name=".Schedule.EditScheduleActivity" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,225 @@
|
|||||||
|
package com.diary.showme;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.diary.database.DatabaseHelper.CourseSQLHelper;
|
||||||
|
import com.diary.database.DatabaseHelper.ScheduleSQLHelper;
|
||||||
|
import com.diary.database.MySQLiteDatabase;
|
||||||
|
import com.diary.database.utils.ScheduleSQLUtils;
|
||||||
|
import com.diary.showme.Course.CourseActivity;
|
||||||
|
import com.diary.showme.Schedule.AddScheduleActivity;
|
||||||
|
import com.diary.showme.Schedule.EditScheduleActivity;
|
||||||
|
import com.diary.showme.diary.ui.QuestionActivity;
|
||||||
|
import com.diary.showme.diary.ui.DiaryActivity;
|
||||||
|
import com.idealist.calendarview.CalendarAttr;
|
||||||
|
import com.idealist.calendarview.CalendarDay;
|
||||||
|
import com.idealist.calendarview.CalendarPager;
|
||||||
|
import com.idealist.calendarview.CalendarUtils;
|
||||||
|
import com.idealist.calendarview.CalendarView;
|
||||||
|
import com.idealist.calendarview.CalendarViewAdapter;
|
||||||
|
//import com.idealist.calendarview.RecyclerViewAdapter;
|
||||||
|
//import com.idealist.calendarview.SpaceItemDecoration;
|
||||||
|
import com.idealist.calendarview.RecyclerViewAdapter;
|
||||||
|
import com.idealist.calendarview.SpaceItemDecoration;
|
||||||
|
import com.idealist.calendarview.State;
|
||||||
|
import com.idealist.calendarview.interf.OnSelectDateListener;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import cc.trity.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private TextView tvMonth;
|
||||||
|
private TextView tvYear;
|
||||||
|
|
||||||
|
private CalendarDay currentDay;
|
||||||
|
|
||||||
|
private CalendarView currentView;
|
||||||
|
|
||||||
|
private CalendarPager pager;
|
||||||
|
|
||||||
|
private RecyclerView schedule;
|
||||||
|
|
||||||
|
private CalendarViewAdapter viewAdapter;
|
||||||
|
|
||||||
|
private CalendarAttr attr;
|
||||||
|
|
||||||
|
private OnSelectDateListener onSelectDateListener;
|
||||||
|
|
||||||
|
private CalendarView.OnCalendarClickListener clickListener;
|
||||||
|
|
||||||
|
private FloatingActionButton scheduleFAB, courseFAB, diaryFAB;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
|
||||||
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getRealMetrics(dm);
|
||||||
|
int height = dm.heightPixels;
|
||||||
|
State.setDefaultItemHeightFull((height - 42 - 3*State.DEFAULT_ITEM_HEIGHT) / 6);
|
||||||
|
|
||||||
|
initSQL();
|
||||||
|
initCalendar();
|
||||||
|
initFAB();
|
||||||
|
initCourseB();
|
||||||
|
initDiaryB();
|
||||||
|
|
||||||
|
attr = new CalendarAttr();
|
||||||
|
attr.setCalendarType(State.VIEW_MONTH);
|
||||||
|
attr.setScrollLevel(State.LEVEL_MEDIUM);
|
||||||
|
|
||||||
|
initListener();
|
||||||
|
|
||||||
|
viewAdapter = new CalendarViewAdapter(this, attr, onSelectDateListener,
|
||||||
|
clickListener);
|
||||||
|
initPager();
|
||||||
|
initSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSQL() {
|
||||||
|
ScheduleSQLHelper myScheduleSQLHelper = new ScheduleSQLHelper(this);
|
||||||
|
SQLiteDatabase scheduleSQL = myScheduleSQLHelper.getWritableDatabase();
|
||||||
|
CourseSQLHelper myCourseSQLHelper = new CourseSQLHelper(this);
|
||||||
|
SQLiteDatabase courseSQL = myCourseSQLHelper.getWritableDatabase();
|
||||||
|
|
||||||
|
MySQLiteDatabase.scheduleSQL = scheduleSQL;
|
||||||
|
MySQLiteDatabase.courseSQL = courseSQL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFAB() {
|
||||||
|
scheduleFAB = findViewById(R.id.add_schedule);
|
||||||
|
scheduleFAB.setOnClickListener(v -> {
|
||||||
|
Toast.makeText(getApplicationContext(), viewAdapter.getSelectDay().toString(), Toast.LENGTH_SHORT).show();
|
||||||
|
Intent intent = new Intent(MainActivity.this, AddScheduleActivity.class);
|
||||||
|
intent.putExtra("date", viewAdapter.getSelectDay().toString());
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCourseB() {
|
||||||
|
courseFAB = findViewById(R.id.course_entry);
|
||||||
|
courseFAB.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(MainActivity.this, CourseActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDiaryB() {
|
||||||
|
diaryFAB = findViewById(R.id.diary_entry);
|
||||||
|
diaryFAB.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(MainActivity.this, DiaryActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initCalendar() {
|
||||||
|
tvMonth = findViewById(R.id.custom_month_view);
|
||||||
|
tvYear = findViewById(R.id.custom_year_view);
|
||||||
|
currentDay = CalendarUtils.getCurrDay();
|
||||||
|
updateCalendar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPager() {
|
||||||
|
pager = findViewById(R.id.custom_vp);
|
||||||
|
pager.setAttr(attr);
|
||||||
|
pager.setAdapter(viewAdapter);
|
||||||
|
|
||||||
|
pager.setmOnPageChangeListener(new CalendarPager.OnPageChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
currentView = viewAdapter.getViews().get(position % 3);
|
||||||
|
currentDay = currentView.getSeedDay();
|
||||||
|
updateCalendar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initListener() {
|
||||||
|
onSelectDateListener = offset -> pager.selectOtherMonth(offset);
|
||||||
|
clickListener = new CalendarView.OnCalendarClickListener() {
|
||||||
|
@Override
|
||||||
|
public void OnClick(CalendarDay day) {
|
||||||
|
updateSchedule(day);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void OnLongClick(CalendarDay day) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, QuestionActivity.class);
|
||||||
|
intent.putExtra("date", viewAdapter.getSelectDay().toString());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSchedule() {
|
||||||
|
|
||||||
|
schedule = findViewById(R.id.list_item);
|
||||||
|
List<String> mData = ScheduleSQLUtils.queryByDate(currentDay.toString());
|
||||||
|
|
||||||
|
RecyclerViewAdapter adapter = new RecyclerViewAdapter(mData);
|
||||||
|
adapter.setOnItemClickListener((view, position) -> {
|
||||||
|
Intent intent = new Intent(MainActivity.this, EditScheduleActivity.class);
|
||||||
|
intent.putExtra("date", viewAdapter.getSelectDay().toString());
|
||||||
|
String name = ((TextView) view.findViewById(R.id.schedule_title)).getText().toString();
|
||||||
|
intent.putExtra("scheduleName", name);
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
});
|
||||||
|
schedule.setAdapter(adapter);
|
||||||
|
|
||||||
|
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||||
|
schedule.setLayoutManager(layoutManager);
|
||||||
|
schedule.addItemDecoration(new SpaceItemDecoration(30));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private void updateCalendar() {
|
||||||
|
tvMonth.setText(currentDay.getMonth() + "");
|
||||||
|
tvYear.setText(currentDay.getYear() + "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSchedule(CalendarDay day) {
|
||||||
|
ScheduleSQLUtils.queryByDate(day.toString());
|
||||||
|
List<String> mData = ScheduleSQLUtils.queryByDate(day.toString());
|
||||||
|
RecyclerViewAdapter adapter = (RecyclerViewAdapter) schedule.getAdapter();
|
||||||
|
adapter.setmDatabase(mData);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == 0 && resultCode == Activity.RESULT_OK) {
|
||||||
|
updateSchedule(viewAdapter.getSelectDay());
|
||||||
|
viewAdapter.updateViewScheduleChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.diary.showme.diary.bean;
|
||||||
|
|
||||||
|
public class QuestionBean {
|
||||||
|
private String content;
|
||||||
|
private String tag;
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
public QuestionBean(String content, String category, String tagz) {
|
||||||
|
this.content = content;
|
||||||
|
this.category = category;
|
||||||
|
this.tag = tagz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag() {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTag(String tag) {
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(String category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue