parent
8bf0bd9b4a
commit
5e7e4d69d1
Binary file not shown.
@ -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,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;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package com.diary.showme.diary.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chanven.lib.cptr.PtrClassicFrameLayout;
|
||||
import com.chanven.lib.cptr.PtrDefaultHandler;
|
||||
import com.chanven.lib.cptr.PtrFrameLayout;
|
||||
import com.chanven.lib.cptr.recyclerview.RecyclerAdapterWithHF;
|
||||
import com.diary.showme.R;
|
||||
import com.diary.showme.diary.bean.QuestionBean;
|
||||
import com.idealist.calendarview.SpaceItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QuestionActivity extends AppCompatActivity {
|
||||
|
||||
private Button back;
|
||||
|
||||
private RecyclerView question_view;
|
||||
|
||||
private QuestionAdapter questionAdapter;
|
||||
|
||||
private List<QuestionBean> mData = new ArrayList<>();
|
||||
|
||||
private RecyclerAdapterWithHF mQuestionAdapter;
|
||||
|
||||
private PtrClassicFrameLayout frameLayout;
|
||||
|
||||
private Handler handler;
|
||||
|
||||
private int page = 0;
|
||||
|
||||
private String date;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_question);
|
||||
frameLayout = findViewById(R.id.question_frame);
|
||||
handler = new Handler();
|
||||
initBtn();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initBtn() {
|
||||
back = findViewById(R.id.back_calendar);
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
Intent intent = getIntent();
|
||||
date = intent.getStringExtra("date");
|
||||
|
||||
question_view = findViewById(R.id.question_list);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
question_view.setLayoutManager(layoutManager);
|
||||
question_view.addItemDecoration(new SpaceItemDecoration(20));
|
||||
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
|
||||
questionAdapter = new QuestionAdapter(this, mData);
|
||||
mQuestionAdapter = new RecyclerAdapterWithHF(questionAdapter);
|
||||
question_view.setAdapter(mQuestionAdapter);
|
||||
|
||||
frameLayout.postDelayed(() -> frameLayout.autoRefresh(true), 150);
|
||||
|
||||
frameLayout.setPtrHandler(new PtrDefaultHandler() {
|
||||
@Override
|
||||
public void onRefreshBegin(PtrFrameLayout frame) {
|
||||
handler.postDelayed(() -> {
|
||||
page = 0;
|
||||
mData.clear();
|
||||
for (int i=0; i<10; i++) {
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
}
|
||||
mQuestionAdapter.notifyDataSetChanged();
|
||||
frameLayout.refreshComplete();
|
||||
frameLayout.setLoadMoreEnable(true);
|
||||
}, 1500);
|
||||
}
|
||||
});
|
||||
|
||||
frameLayout.setOnLoadMoreListener(() -> handler.postDelayed(() -> {
|
||||
mData.add(new QuestionBean("test", "curr", "test"));
|
||||
mQuestionAdapter.notifyDataSetChanged();
|
||||
frameLayout.loadMoreComplete(true);
|
||||
page++;
|
||||
Toast.makeText(QuestionActivity.this, "loading more complete", Toast.LENGTH_SHORT).show();
|
||||
}, 1000));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.diary.showme.diary.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.diary.showme.R;
|
||||
import com.diary.showme.diary.bean.QuestionBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class QuestionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener {
|
||||
private Context context;
|
||||
private List<QuestionBean> items;
|
||||
|
||||
public QuestionAdapter(Context context, List<QuestionBean> items) {
|
||||
super();
|
||||
this.items = items;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.question_item, parent, false);
|
||||
return new QuestionViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (!(holder instanceof QuestionViewHolder))
|
||||
return;
|
||||
QuestionBean item = items.get(position);
|
||||
((QuestionViewHolder) holder).question_content.setText(item.getContent());
|
||||
((QuestionViewHolder) holder).question_content.setOnClickListener(this::onClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, AddDiaryActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.diary.showme.diary.ui;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.diary.showme.R;
|
||||
|
||||
public class QuestionViewHolder extends RecyclerView.ViewHolder{
|
||||
public TextView question_content;
|
||||
|
||||
public QuestionViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
question_content = itemView.findViewById(R.id.question_content);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".diary.ui.QuestionActivity"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/teal_200">
|
||||
|
||||
<Button
|
||||
android:id="@+id/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"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.chanven.lib.cptr.PtrClassicFrameLayout
|
||||
android:id="@+id/question_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/question_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</com.chanven.lib.cptr.PtrClassicFrameLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/question_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="24sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in new issue