之前的最初运行版本存在问题,因此更新src文件 #14

Merged
p28679143 merged 1 commits from p86231950/ShowMe:master into master 4 years ago

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,24 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="PLATFORM" /> <option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/CalendarView" /> <option value="$PROJECT_DIR$/CalendarView" />
<option value="$PROJECT_DIR$/Database" /> <option value="$PROJECT_DIR$/Database" />
<option value="$PROJECT_DIR$/Zone" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" /> <option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>

@ -11,6 +11,11 @@
<option name="name" value="JBoss Community repository" /> <option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository> <remote-repository>
<option name="id" value="BintrayJCenter" /> <option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" /> <option name="name" value="BintrayJCenter" />
@ -21,15 +26,5 @@
<option name="name" value="Google" /> <option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" /> <option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
</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,14 +1,13 @@
plugins { plugins {
id 'com.android.library' id 'com.android.library'
} }
android { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion "30.0.2" buildToolsVersion "30.0.3"
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 17
targetSdkVersion 30 targetSdkVersion 30
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@ -31,10 +30,10 @@ android {
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.android.material:material:1.4.0'
implementation project(path: ':Database') implementation project(path: ':Database')
testImplementation 'junit:junit:4.+' testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
} }

@ -1,26 +0,0 @@
package com.diary.calendarview;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.diary.calendarview.test", appContext.getPackageName());
}
}

@ -1,66 +0,0 @@
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);
}
}

@ -1,141 +0,0 @@
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);
}
}

@ -1,20 +0,0 @@
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);
}
}

@ -1,30 +0,0 @@
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;
}
}
}

@ -1,15 +0,0 @@
<?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>

@ -1,41 +0,0 @@
<?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>

@ -1,7 +0,0 @@
<?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>

@ -1,11 +0,0 @@
<?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>

@ -1,17 +0,0 @@
package com.diary.calendarview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

@ -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

@ -4,7 +4,7 @@ plugins {
android { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion "30.0.2" buildToolsVersion "30.0.3"
defaultConfig { defaultConfig {
minSdkVersion 17 minSdkVersion 17
@ -30,9 +30,9 @@ android {
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+' testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
} }

@ -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

@ -4,7 +4,7 @@ plugins {
android { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion "30.0.2" buildToolsVersion "30.0.3"
defaultConfig { defaultConfig {
applicationId "com.diary.showme" applicationId "com.diary.showme"
@ -30,17 +30,15 @@ android {
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'cc.trity.floatingactionbutton:library:1.0.0' implementation 'cc.trity.floatingactionbutton:library:1.0.0'
implementation 'org.greenrobot:eventbus:3.0.0' implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.chanven.lib:cptr:1.1.0'
implementation 'com.jakewharton:butterknife:8.0.1' implementation 'com.jakewharton:butterknife:8.0.1'
implementation project(path: ':Database') implementation project(path: ':Database')
annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
implementation project(path: ':CalendarView') implementation project(path: ':CalendarView')
testImplementation 'junit:junit:4.+' testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
} }

@ -1,18 +0,0 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.diary.showme",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
]
}

@ -1,13 +1,7 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
package="com.diary.showme"> 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 <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
@ -15,15 +9,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Showme"> android:theme="@style/Theme.Showme">
<activity android:name=".Zone.AddZoneActivity"></activity>
<activity android:name=".Zone.ZoneActivity" />
<activity android:name=".Zone.VideoBrowerActivity" />
<activity android:name=".Zone.AddActivity" />
<activity android:name=".diary.ui.UpdateDiaryActivity" />
<activity android:name=".diary.ui.DiaryActivity" />
<activity android:name=".diary.ui.AddDiaryActivity" />
<activity android:name=".Course.AddCourseActivity" />
<activity android:name=".Course.CourseActivity" />
<activity android:name=".MainActivity"> <activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -31,8 +16,6 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".Schedule.AddScheduleActivity" />
<activity android:name=".Schedule.EditScheduleActivity" />
</application> </application>
</manifest> </manifest>

@ -29,8 +29,8 @@ import com.idealist.calendarview.CalendarPager;
import com.idealist.calendarview.CalendarUtils; import com.idealist.calendarview.CalendarUtils;
import com.idealist.calendarview.CalendarView; import com.idealist.calendarview.CalendarView;
import com.idealist.calendarview.CalendarViewAdapter; import com.idealist.calendarview.CalendarViewAdapter;
import com.idealist.calendarview.RecyclerViewAdapter; //import com.idealist.calendarview.RecyclerViewAdapter;
import com.idealist.calendarview.SpaceItemDecoration; //import com.idealist.calendarview.SpaceItemDecoration;
import com.idealist.calendarview.State; import com.idealist.calendarview.State;
import com.idealist.calendarview.interf.OnSelectDateListener; import com.idealist.calendarview.interf.OnSelectDateListener;
@ -75,9 +75,9 @@ public class MainActivity extends AppCompatActivity {
initSQL(); initSQL();
initCalendar(); initCalendar();
initFAB(); // initFAB();
initCourseB(); // initCourseB();
initDiaryB(); // initDiaryB();
attr = new CalendarAttr(); attr = new CalendarAttr();
attr.setCalendarType(State.VIEW_MONTH); attr.setCalendarType(State.VIEW_MONTH);
@ -88,7 +88,7 @@ public class MainActivity extends AppCompatActivity {
viewAdapter = new CalendarViewAdapter(this, attr, onSelectDateListener, viewAdapter = new CalendarViewAdapter(this, attr, onSelectDateListener,
clickListener); clickListener);
initPager(); initPager();
initSchedule(); // initSchedule();
} }
private void initSQL() { private void initSQL() {
@ -101,31 +101,31 @@ public class MainActivity extends AppCompatActivity {
MySQLiteDatabase.courseSQL = courseSQL; MySQLiteDatabase.courseSQL = courseSQL;
} }
private void initFAB() { // private void initFAB() {
scheduleFAB = findViewById(R.id.add_schedule); // scheduleFAB = findViewById(R.id.add_schedule);
scheduleFAB.setOnClickListener(v -> { // scheduleFAB.setOnClickListener(v -> {
Toast.makeText(getApplicationContext(), viewAdapter.getSelectDay().toString(), Toast.LENGTH_SHORT).show(); // Toast.makeText(getApplicationContext(), viewAdapter.getSelectDay().toString(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, AddScheduleActivity.class); // Intent intent = new Intent(MainActivity.this, AddScheduleActivity.class);
intent.putExtra("date", viewAdapter.getSelectDay().toString()); // intent.putExtra("date", viewAdapter.getSelectDay().toString());
startActivityForResult(intent, 0); // startActivityForResult(intent, 0);
}); // });
} // }
//
private void initCourseB() { // private void initCourseB() {
courseFAB = findViewById(R.id.course_entry); // courseFAB = findViewById(R.id.course_entry);
courseFAB.setOnClickListener(v -> { // courseFAB.setOnClickListener(v -> {
Intent intent = new Intent(MainActivity.this, CourseActivity.class); // Intent intent = new Intent(MainActivity.this, CourseActivity.class);
startActivity(intent); // startActivity(intent);
}); // });
} // }
//
private void initDiaryB() { // private void initDiaryB() {
diaryFAB = findViewById(R.id.diary_entry); // diaryFAB = findViewById(R.id.diary_entry);
diaryFAB.setOnClickListener(v -> { // diaryFAB.setOnClickListener(v -> {
Intent intent = new Intent(MainActivity.this, DiaryActivity.class); // Intent intent = new Intent(MainActivity.this, DiaryActivity.class);
startActivity(intent); // startActivity(intent);
}); // });
} // }
private void initCalendar() { private void initCalendar() {
@ -164,7 +164,7 @@ public class MainActivity extends AppCompatActivity {
clickListener = new CalendarView.OnCalendarClickListener() { clickListener = new CalendarView.OnCalendarClickListener() {
@Override @Override
public void OnClick(CalendarDay day) { public void OnClick(CalendarDay day) {
updateSchedule(day); // updateSchedule(day);
} }
@Override @Override
@ -174,25 +174,25 @@ public class MainActivity extends AppCompatActivity {
}; };
} }
private void initSchedule() { // private void initSchedule() {
//
schedule = findViewById(R.id.list_item); // schedule = findViewById(R.id.list_item);
List<String> mData = ScheduleSQLUtils.queryByDate(currentDay.toString()); // List<String> mData = ScheduleSQLUtils.queryByDate(currentDay.toString());
//
RecyclerViewAdapter adapter = new RecyclerViewAdapter(mData); // RecyclerViewAdapter adapter = new RecyclerViewAdapter(mData);
adapter.setOnItemClickListener((view, position) -> { // adapter.setOnItemClickListener((view, position) -> {
Intent intent = new Intent(MainActivity.this, EditScheduleActivity.class); // Intent intent = new Intent(MainActivity.this, EditScheduleActivity.class);
intent.putExtra("date", viewAdapter.getSelectDay().toString()); // intent.putExtra("date", viewAdapter.getSelectDay().toString());
String name = ((TextView) view.findViewById(R.id.schedule_title)).getText().toString(); // String name = ((TextView) view.findViewById(R.id.schedule_title)).getText().toString();
intent.putExtra("scheduleName", name); // intent.putExtra("scheduleName", name);
startActivityForResult(intent, 0); // startActivityForResult(intent, 0);
}); // });
schedule.setAdapter(adapter); // schedule.setAdapter(adapter);
//
LinearLayoutManager layoutManager = new LinearLayoutManager(this); // LinearLayoutManager layoutManager = new LinearLayoutManager(this);
schedule.setLayoutManager(layoutManager); // schedule.setLayoutManager(layoutManager);
schedule.addItemDecoration(new SpaceItemDecoration(30)); // schedule.addItemDecoration(new SpaceItemDecoration(30));
} // }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@ -201,20 +201,20 @@ public class MainActivity extends AppCompatActivity {
tvYear.setText(currentDay.getYear() + ""); tvYear.setText(currentDay.getYear() + "");
} }
private void updateSchedule(CalendarDay day) { // private void updateSchedule(CalendarDay day) {
ScheduleSQLUtils.queryByDate(day.toString()); // ScheduleSQLUtils.queryByDate(day.toString());
List<String> mData = ScheduleSQLUtils.queryByDate(day.toString()); // List<String> mData = ScheduleSQLUtils.queryByDate(day.toString());
RecyclerViewAdapter adapter = (RecyclerViewAdapter) schedule.getAdapter(); // RecyclerViewAdapter adapter = (RecyclerViewAdapter) schedule.getAdapter();
adapter.setmDatabase(mData); // adapter.setmDatabase(mData);
adapter.notifyDataSetChanged(); // adapter.notifyDataSetChanged();
} // }
@Override // @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { // protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); // super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0 && resultCode == Activity.RESULT_OK) { // if (requestCode == 0 && resultCode == Activity.RESULT_OK) {
updateSchedule(viewAdapter.getSelectDay()); // updateSchedule(viewAdapter.getSelectDay());
viewAdapter.updateViewScheduleChange(); // viewAdapter.updateViewScheduleChange();
} // }
} // }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Zone.AddZoneActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="起名: "
android:textSize="24sp"
android:gravity="center_vertical"
android:textColor="@color/black"/>
<EditText
android:id="@+id/add_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="enter your name"
/>
</LinearLayout>
<EditText
android:id="@+id/add_context"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@color/white"
android:gravity="start"
android:hint="输入内容"
android:textSize="14sp" />
<Button
android:id="@+id/add_ok"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="发布"/>
</LinearLayout>

@ -67,67 +67,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.idealist.calendarview.RecyclerViewBehavior"/>
<cc.trity.floatingactionbutton.FloatingActionButton
android:id="@+id/add_schedule"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="bottom|start"
app:fab_size="mini"
app:fab_title="FAB 0"
app:fab_colorNormal="#e41c1c"
app:fab_icon="@drawable/schedule"
/>
<cc.trity.floatingactionbutton.FloatingActionsMenu
android:id="@+id/right_labels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:fab_expandDirection="up"
app:fab_colorNormal="#f0f01a"
app:fab_icon = "@drawable/ic_baseline_add_24"
app:fab_addButtonSize="mini"
>
<cc.trity.floatingactionbutton.FloatingActionButton
android:id="@+id/diary_entry"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_baseline_add_24"
app:fab_size="normal"
app:fab_title="FAB 3"
app:fab_colorNormal="#09F7F7"
app:fab_icon="@drawable/diary"
/>
<cc.trity.floatingactionbutton.FloatingActionButton
android:id="@+id/course_entry"
android:layout_width="50dp"
android:layout_height="50dp"
app:fab_colorNormal="#24d63c"
app:fab_size="normal"
app:fab_icon="@drawable/course"
/>
</cc.trity.floatingactionbutton.FloatingActionsMenu>
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
<!-- android:id="@+id/addSchedule"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="end|bottom"-->
<!-- android:layout_margin="30dp"-->
<!-- android:backgroundTint="#7575EF"-->
<!-- android:src="@drawable/ic_baseline_add_24"-->
<!-- android:contentDescription="@string/add"-->
<!-- app:fabSize="normal"-->
<!-- />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" 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=".EditScheduleActivity"> tools:context=".Schedule.EditScheduleActivity">
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent" android:layout_width="match_parent"

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Zone.ZoneActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/teal_200">
<Button
android:id="@+id/zone_back_calendar"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_arrow_back_black_24dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="28"
android:textSize="28sp"
android:text="树洞"
android:textColor="@color/black"
android:gravity="center"/>
<Button
android:id="@+id/add_zone"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#00000000"
android:text="发布"
android:textSize="18sp"
android:paddingEnd="5dp"
android:gravity="center"
/>
</LinearLayout>
<com.chanven.lib.cptr.PtrClassicFrameLayout
android:id="@+id/zone_view_frame"
xmlns:cube_ptr="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f0f0"
cube_ptr:ptr_resistance="1.7"
cube_ptr:ptr_ratio_of_header_height_to_refresh="1.2"
cube_ptr:ptr_duration_to_close="200"
cube_ptr:ptr_duration_to_close_header="1000"
cube_ptr:ptr_keep_header_when_refresh="true"
cube_ptr:ptr_pull_to_fresh="false">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/zone_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.chanven.lib.cptr.PtrClassicFrameLayout>
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.DamnDiary" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.Showme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item> <item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>

@ -1,4 +1,3 @@
<resources> <resources>
<string name="app_name">showme</string> <string name="app_name">showme</string>
<string name="add">Add</string>
</resources> </resources>

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.Showme" parent="Theme.AppCompat.DayNight.NoActionBar"> <style name="Theme.Showme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item> <item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>

@ -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>

@ -2,10 +2,10 @@
buildscript { buildscript {
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:4.1.1" classpath "com.android.tools.build:gradle:4.2.1"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -15,7 +15,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
} }
} }

@ -15,5 +15,3 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Android operating system, and which are packaged with your app"s APK # Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn # https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

@ -1,6 +1,6 @@
#Thu Jan 14 17:23:24 CST 2021 #Sat Jul 10 16:29:07 CST 2021
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip zipStoreBase=GRADLE_USER_HOME

@ -1,5 +1,4 @@
include ':Zone'
include ':Database'
include ':CalendarView'
include ':app'
rootProject.name = "showme" rootProject.name = "showme"
include ':app'
include ':CalendarView'
include ':Database'

Loading…
Cancel
Save