土地违法相关
This commit is contained in:
parent
62cfa3937b
commit
881cd72134
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,4 +13,5 @@
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
.cxx
|
||||
/TimePickerDialog/build
|
0
TimePickerDialog/.gitignore
vendored
Normal file
0
TimePickerDialog/.gitignore
vendored
Normal file
0
TimePickerDialog/bintray.gradle
Normal file
0
TimePickerDialog/bintray.gradle
Normal file
31
TimePickerDialog/build.gradle
Normal file
31
TimePickerDialog/build.gradle
Normal file
@ -0,0 +1,31 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
}
|
17
TimePickerDialog/proguard-rules.pro
vendored
Normal file
17
TimePickerDialog/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/jzxiang/Library/Android/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
11
TimePickerDialog/src/main/AndroidManifest.xml
Normal file
11
TimePickerDialog/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<manifest package="com.jzxiang.pickerview"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:supportsRtl="true"
|
||||
>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,243 @@
|
||||
package com.jzxiang.pickerview;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
import com.jzxiang.pickerview.data.WheelCalendar;
|
||||
import com.jzxiang.pickerview.listener.OnDateSetListener;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/19.
|
||||
*/
|
||||
public class TimePickerDialog extends DialogFragment implements View.OnClickListener {
|
||||
PickerConfig mPickerConfig;
|
||||
private TimeWheel mTimeWheel;
|
||||
private long mCurrentMillSeconds;
|
||||
|
||||
private static TimePickerDialog newIntance(PickerConfig pickerConfig) {
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog();
|
||||
timePickerDialog.initialize(pickerConfig);
|
||||
return timePickerDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Activity activity = getActivity();
|
||||
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
int height = getResources().getDimensionPixelSize(R.dimen.picker_height);
|
||||
|
||||
Window window = getDialog().getWindow();
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, height);//Here!
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
private void initialize(PickerConfig pickerConfig) {
|
||||
mPickerConfig = pickerConfig;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Dialog dialog = new Dialog(getActivity(), R.style.Dialog_NoTitle);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setContentView(initView());
|
||||
return dialog;
|
||||
}
|
||||
|
||||
View initView() {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
View view = inflater.inflate(R.layout.timepicker_layout, null);
|
||||
TextView cancel = (TextView) view.findViewById(R.id.tv_cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
TextView sure = (TextView) view.findViewById(R.id.tv_sure);
|
||||
sure.setOnClickListener(this);
|
||||
TextView title = (TextView) view.findViewById(R.id.tv_title);
|
||||
|
||||
title.setText(mPickerConfig.mTitleString);
|
||||
cancel.setText(mPickerConfig.mCancelString);
|
||||
sure.setText(mPickerConfig.mSureString);
|
||||
|
||||
mTimeWheel = new TimeWheel(view, mPickerConfig);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.tv_cancel) {
|
||||
dismiss();
|
||||
} else if (i == R.id.tv_sure) {
|
||||
sureClicked();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @desc This method returns the current milliseconds. If current milliseconds is not set,
|
||||
* this will return the system milliseconds.
|
||||
* @param none
|
||||
* @return long - the current milliseconds.
|
||||
*/
|
||||
public long getCurrentMillSeconds() {
|
||||
if (mCurrentMillSeconds == 0) {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
return mCurrentMillSeconds;
|
||||
}
|
||||
|
||||
/*
|
||||
* @desc This method is called when onClick method is invoked by sure button. A Calendar instance is created and
|
||||
* initialized.
|
||||
* @param none
|
||||
* @return none
|
||||
*/
|
||||
void sureClicked() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.clear();
|
||||
|
||||
calendar.set(Calendar.YEAR, mTimeWheel.getCurrentYear());
|
||||
calendar.set(Calendar.MONTH, mTimeWheel.getCurrentMonth() - 1);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, mTimeWheel.getCurrentDay());
|
||||
calendar.set(Calendar.HOUR_OF_DAY, mTimeWheel.getCurrentHour());
|
||||
calendar.set(Calendar.MINUTE, mTimeWheel.getCurrentMinute());
|
||||
|
||||
mCurrentMillSeconds = calendar.getTimeInMillis();
|
||||
if (mPickerConfig.mCallBack != null) {
|
||||
mPickerConfig.mCallBack.onDateSet(this, mCurrentMillSeconds);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
PickerConfig mPickerConfig;
|
||||
|
||||
public Builder() {
|
||||
mPickerConfig = new PickerConfig();
|
||||
}
|
||||
|
||||
public Builder setType(Type type) {
|
||||
mPickerConfig.mType = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setThemeColor(int color) {
|
||||
mPickerConfig.mThemeColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCancelStringId(String left) {
|
||||
mPickerConfig.mCancelString = left;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSureStringId(String right) {
|
||||
mPickerConfig.mSureString = right;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTitleStringId(String title) {
|
||||
mPickerConfig.mTitleString = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setToolBarTextColor(int color) {
|
||||
mPickerConfig.mToolBarTVColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setWheelItemTextNormalColor(int color) {
|
||||
mPickerConfig.mWheelTVNormalColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setWheelItemTextSelectorColor(int color) {
|
||||
mPickerConfig.mWheelTVSelectorColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setWheelItemTextSize(int size) {
|
||||
mPickerConfig.mWheelTVSize = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCyclic(boolean cyclic) {
|
||||
mPickerConfig.cyclic = cyclic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinMillseconds(long millseconds) {
|
||||
mPickerConfig.mMinCalendar = new WheelCalendar(millseconds);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxMillseconds(long millseconds) {
|
||||
mPickerConfig.mMaxCalendar = new WheelCalendar(millseconds);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCurrentMillseconds(long millseconds) {
|
||||
mPickerConfig.mCurrentCalendar = new WheelCalendar(millseconds);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setYearText(String year) {
|
||||
mPickerConfig.mYear = year;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMonthText(String month) {
|
||||
mPickerConfig.mMonth = month;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDayText(String day) {
|
||||
mPickerConfig.mDay = day;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHourText(String hour) {
|
||||
mPickerConfig.mHour = hour;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinuteText(String minute) {
|
||||
mPickerConfig.mMinute = minute;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCallBack(OnDateSetListener listener) {
|
||||
mPickerConfig.mCallBack = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimePickerDialog build() {
|
||||
return newIntance(mPickerConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,276 @@
|
||||
package com.jzxiang.pickerview;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.jzxiang.pickerview.adapters.NumericWheelAdapter;
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
import com.jzxiang.pickerview.data.source.TimeRepository;
|
||||
import com.jzxiang.pickerview.utils.PickerContants;
|
||||
import com.jzxiang.pickerview.utils.Utils;
|
||||
import com.jzxiang.pickerview.wheel.OnWheelChangedListener;
|
||||
import com.jzxiang.pickerview.wheel.WheelView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/20.
|
||||
*/
|
||||
public class TimeWheel {
|
||||
Context mContext;
|
||||
|
||||
WheelView year, month, day, hour, minute;
|
||||
NumericWheelAdapter mYearAdapter, mMonthAdapter, mDayAdapter, mHourAdapter, mMinuteAdapter;
|
||||
|
||||
PickerConfig mPickerConfig;
|
||||
TimeRepository mRepository;
|
||||
OnWheelChangedListener yearListener = new OnWheelChangedListener() {
|
||||
@Override
|
||||
public void onChanged(WheelView wheel, int oldValue, int newValue) {
|
||||
updateMonths();
|
||||
}
|
||||
};
|
||||
OnWheelChangedListener monthListener = new OnWheelChangedListener() {
|
||||
@Override
|
||||
public void onChanged(WheelView wheel, int oldValue, int newValue) {
|
||||
updateDays();
|
||||
}
|
||||
};
|
||||
OnWheelChangedListener dayListener = new OnWheelChangedListener() {
|
||||
@Override
|
||||
public void onChanged(WheelView wheel, int oldValue, int newValue) {
|
||||
updateHours();
|
||||
}
|
||||
};
|
||||
OnWheelChangedListener minuteListener = new OnWheelChangedListener() {
|
||||
@Override
|
||||
public void onChanged(WheelView wheel, int oldValue, int newValue) {
|
||||
updateMinutes();
|
||||
}
|
||||
};
|
||||
|
||||
public TimeWheel(View view, PickerConfig pickerConfig) {
|
||||
mPickerConfig = pickerConfig;
|
||||
|
||||
mRepository = new TimeRepository(pickerConfig);
|
||||
mContext = view.getContext();
|
||||
initialize(view);
|
||||
}
|
||||
|
||||
public void initialize(View view) {
|
||||
initView(view);
|
||||
initYear();
|
||||
initMonth();
|
||||
initDay();
|
||||
initHour();
|
||||
initMinute();
|
||||
}
|
||||
|
||||
|
||||
void initView(View view) {
|
||||
year = (WheelView) view.findViewById(R.id.year);
|
||||
month = (WheelView) view.findViewById(R.id.month);
|
||||
day = (WheelView) view.findViewById(R.id.day);
|
||||
hour = (WheelView) view.findViewById(R.id.hour);
|
||||
minute = (WheelView) view.findViewById(R.id.minute);
|
||||
|
||||
switch (mPickerConfig.mType) {
|
||||
case ALL:
|
||||
|
||||
break;
|
||||
case YEAR_MONTH_DAY:
|
||||
Utils.hideViews(hour, minute);
|
||||
break;
|
||||
case YEAR_MONTH:
|
||||
Utils.hideViews(day, hour, minute);
|
||||
break;
|
||||
case MONTH_DAY_HOUR_MIN:
|
||||
Utils.hideViews(year);
|
||||
break;
|
||||
case HOURS_MINS:
|
||||
Utils.hideViews(year, month, day);
|
||||
break;
|
||||
case YEAR:
|
||||
Utils.hideViews(month, day, hour, minute);
|
||||
break;
|
||||
}
|
||||
|
||||
year.addChangingListener(yearListener);
|
||||
year.addChangingListener(monthListener);
|
||||
year.addChangingListener(dayListener);
|
||||
year.addChangingListener(minuteListener);
|
||||
month.addChangingListener(monthListener);
|
||||
month.addChangingListener(dayListener);
|
||||
month.addChangingListener(minuteListener);
|
||||
day.addChangingListener(dayListener);
|
||||
day.addChangingListener(minuteListener);
|
||||
hour.addChangingListener(minuteListener);
|
||||
}
|
||||
|
||||
void initYear() {
|
||||
int minYear = mRepository.getMinYear();
|
||||
int maxYear = mRepository.getMaxYear();
|
||||
|
||||
mYearAdapter = new NumericWheelAdapter(mContext, minYear, maxYear, PickerContants.FORMAT, mPickerConfig.mYear);
|
||||
mYearAdapter.setConfig(mPickerConfig);
|
||||
year.setViewAdapter(mYearAdapter);
|
||||
year.setCurrentItem(mRepository.getDefaultCalendar().year - minYear);
|
||||
}
|
||||
|
||||
void initMonth() {
|
||||
updateMonths();
|
||||
int curYear = getCurrentYear();
|
||||
int minMonth = mRepository.getMinMonth(curYear);
|
||||
month.setCurrentItem(mRepository.getDefaultCalendar().month - minMonth);
|
||||
month.setCyclic(mPickerConfig.cyclic);
|
||||
}
|
||||
|
||||
void initDay() {
|
||||
updateDays();
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
|
||||
int minDay = mRepository.getMinDay(curYear, curMonth);
|
||||
day.setCurrentItem(mRepository.getDefaultCalendar().day - minDay);
|
||||
day.setCyclic(mPickerConfig.cyclic);
|
||||
}
|
||||
|
||||
void initHour() {
|
||||
updateHours();
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
|
||||
int minHour = mRepository.getMinHour(curYear, curMonth, curDay);
|
||||
hour.setCurrentItem(mRepository.getDefaultCalendar().hour - minHour);
|
||||
hour.setCyclic(mPickerConfig.cyclic);
|
||||
}
|
||||
|
||||
void initMinute() {
|
||||
updateMinutes();
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
int curHour = getCurrentHour();
|
||||
int minMinute = mRepository.getMinMinute(curYear, curMonth, curDay, curHour);
|
||||
|
||||
minute.setCurrentItem(mRepository.getDefaultCalendar().minute - minMinute);
|
||||
minute.setCyclic(mPickerConfig.cyclic);
|
||||
|
||||
}
|
||||
|
||||
void updateMonths() {
|
||||
if (month.getVisibility() == View.GONE)
|
||||
return;
|
||||
|
||||
int curYear = getCurrentYear();
|
||||
int minMonth = mRepository.getMinMonth(curYear);
|
||||
int maxMonth = mRepository.getMaxMonth(curYear);
|
||||
mMonthAdapter = new NumericWheelAdapter(mContext, minMonth, maxMonth, PickerContants.FORMAT, mPickerConfig.mMonth);
|
||||
mMonthAdapter.setConfig(mPickerConfig);
|
||||
month.setViewAdapter(mMonthAdapter);
|
||||
|
||||
if (mRepository.isMinYear(curYear)) {
|
||||
month.setCurrentItem(0, false);
|
||||
}
|
||||
}
|
||||
|
||||
void updateDays() {
|
||||
if (day.getVisibility() == View.GONE)
|
||||
return;
|
||||
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + year.getCurrentItem());
|
||||
calendar.set(Calendar.MONTH, curMonth);
|
||||
|
||||
int maxDay = mRepository.getMaxDay(curYear, curMonth);
|
||||
int minDay = mRepository.getMinDay(curYear, curMonth);
|
||||
mDayAdapter = new NumericWheelAdapter(mContext, minDay, maxDay, PickerContants.FORMAT, mPickerConfig.mDay);
|
||||
mDayAdapter.setConfig(mPickerConfig);
|
||||
day.setViewAdapter(mDayAdapter);
|
||||
|
||||
if (mRepository.isMinMonth(curYear, curMonth)) {
|
||||
day.setCurrentItem(0, true);
|
||||
}
|
||||
|
||||
int dayCount = mDayAdapter.getItemsCount();
|
||||
if (day.getCurrentItem() >= dayCount) {
|
||||
day.setCurrentItem(dayCount - 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
void updateHours() {
|
||||
if (hour.getVisibility() == View.GONE)
|
||||
return;
|
||||
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
|
||||
int minHour = mRepository.getMinHour(curYear, curMonth, curDay);
|
||||
int maxHour = mRepository.getMaxHour(curYear, curMonth, curDay);
|
||||
|
||||
mHourAdapter = new NumericWheelAdapter(mContext, minHour, maxHour, PickerContants.FORMAT, mPickerConfig.mHour);
|
||||
mHourAdapter.setConfig(mPickerConfig);
|
||||
hour.setViewAdapter(mHourAdapter);
|
||||
|
||||
if (mRepository.isMinDay(curYear, curMonth, curDay))
|
||||
hour.setCurrentItem(0, false);
|
||||
}
|
||||
|
||||
void updateMinutes() {
|
||||
if (minute.getVisibility() == View.GONE)
|
||||
return;
|
||||
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
int curHour = getCurrentHour();
|
||||
|
||||
int minMinute = mRepository.getMinMinute(curYear, curMonth, curDay, curHour);
|
||||
int maxMinute = mRepository.getMaxMinute(curYear, curMonth, curDay, curHour);
|
||||
|
||||
mMinuteAdapter = new NumericWheelAdapter(mContext, minMinute, maxMinute, PickerContants.FORMAT, mPickerConfig.mMinute);
|
||||
mMinuteAdapter.setConfig(mPickerConfig);
|
||||
minute.setViewAdapter(mMinuteAdapter);
|
||||
|
||||
if (mRepository.isMinHour(curYear, curMonth, curDay, curHour))
|
||||
minute.setCurrentItem(0, false);
|
||||
}
|
||||
|
||||
public int getCurrentYear() {
|
||||
return year.getCurrentItem() + mRepository.getMinYear();
|
||||
}
|
||||
|
||||
public int getCurrentMonth() {
|
||||
int curYear = getCurrentYear();
|
||||
return month.getCurrentItem() + +mRepository.getMinMonth(curYear);
|
||||
}
|
||||
|
||||
public int getCurrentDay() {
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
return day.getCurrentItem() + mRepository.getMinDay(curYear, curMonth);
|
||||
}
|
||||
|
||||
public int getCurrentHour() {
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
return hour.getCurrentItem() + mRepository.getMinHour(curYear, curMonth, curDay);
|
||||
}
|
||||
|
||||
public int getCurrentMinute() {
|
||||
int curYear = getCurrentYear();
|
||||
int curMonth = getCurrentMonth();
|
||||
int curDay = getCurrentDay();
|
||||
int curHour = getCurrentHour();
|
||||
|
||||
return minute.getCurrentItem() + mRepository.getMinMinute(curYear, curMonth, curDay, curHour);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.adapters;
|
||||
|
||||
import android.database.DataSetObserver;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Abstract Wheel adapter.
|
||||
*/
|
||||
public abstract class AbstractWheelAdapter implements WheelViewAdapter {
|
||||
// Observers
|
||||
private List<DataSetObserver> datasetObservers;
|
||||
|
||||
@Override
|
||||
public View getEmptyItem(View convertView, ViewGroup parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDataSetObserver(DataSetObserver observer) {
|
||||
if (datasetObservers == null) {
|
||||
datasetObservers = new LinkedList<DataSetObserver>();
|
||||
}
|
||||
datasetObservers.add(observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||
if (datasetObservers != null) {
|
||||
datasetObservers.remove(observer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies observers about data changing
|
||||
*/
|
||||
protected void notifyDataChangedEvent() {
|
||||
if (datasetObservers != null) {
|
||||
for (DataSetObserver observer : datasetObservers) {
|
||||
observer.onChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies observers about invalidating data
|
||||
*/
|
||||
protected void notifyDataInvalidatedEvent() {
|
||||
if (datasetObservers != null) {
|
||||
for (DataSetObserver observer : datasetObservers) {
|
||||
observer.onInvalidated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jzxiang.pickerview.adapters;
|
||||
|
||||
import com.jzxiang.pickerview.R;
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Abstract wheel adapter provides common functionality for adapters.
|
||||
*/
|
||||
public abstract class AbstractWheelTextAdapter extends AbstractWheelAdapter {
|
||||
|
||||
/**
|
||||
* Text view resource. Used as a default view for adapter.
|
||||
*/
|
||||
public static final int TEXT_VIEW_ITEM_RESOURCE = -1;
|
||||
|
||||
/**
|
||||
* Default text color
|
||||
*/
|
||||
public static final int LABEL_COLOR = 0xFF700070;
|
||||
/**
|
||||
* Default text size
|
||||
*/
|
||||
public static final int DEFAULT_TEXT_SIZE = 24;
|
||||
/**
|
||||
* No resource constant.
|
||||
*/
|
||||
protected static final int NO_RESOURCE = 0;
|
||||
// Current context
|
||||
protected Context context;
|
||||
// Layout inflater
|
||||
protected LayoutInflater inflater;
|
||||
// Items resources
|
||||
protected int itemResourceId;
|
||||
protected int itemTextResourceId;
|
||||
// Empty items resources
|
||||
protected int emptyItemResourceId;
|
||||
|
||||
private int padding = 0;
|
||||
|
||||
private PickerConfig mPickerConfig;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
*/
|
||||
protected AbstractWheelTextAdapter(Context context) {
|
||||
this(context, TEXT_VIEW_ITEM_RESOURCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
|
||||
*/
|
||||
protected AbstractWheelTextAdapter(Context context, int itemResource) {
|
||||
this(context, itemResource, NO_RESOURCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
|
||||
* @param itemTextResource the resource ID for a text view in the item layout
|
||||
*/
|
||||
protected AbstractWheelTextAdapter(Context context, int itemResource, int itemTextResource) {
|
||||
this.context = context;
|
||||
itemResourceId = itemResource;
|
||||
itemTextResourceId = itemTextResource;
|
||||
padding = context.getResources().getDimensionPixelSize(R.dimen.textview_default_padding);
|
||||
|
||||
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets resource Id for items views
|
||||
*
|
||||
* @return the item resource Id
|
||||
*/
|
||||
public int getItemResource() {
|
||||
return itemResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets resource Id for items views
|
||||
*
|
||||
* @param itemResourceId the resource Id to set
|
||||
*/
|
||||
public void setItemResource(int itemResourceId) {
|
||||
this.itemResourceId = itemResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets resource Id for text view in item layout
|
||||
*
|
||||
* @return the item text resource Id
|
||||
*/
|
||||
public int getItemTextResource() {
|
||||
return itemTextResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets resource Id for text view in item layout
|
||||
*
|
||||
* @param itemTextResourceId the item text resource Id to set
|
||||
*/
|
||||
public void setItemTextResource(int itemTextResourceId) {
|
||||
this.itemTextResourceId = itemTextResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets resource Id for empty items views
|
||||
*
|
||||
* @return the empty item resource Id
|
||||
*/
|
||||
public int getEmptyItemResource() {
|
||||
return emptyItemResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets resource Id for empty items views
|
||||
*
|
||||
* @param emptyItemResourceId the empty item resource Id to set
|
||||
*/
|
||||
public void setEmptyItemResource(int emptyItemResourceId) {
|
||||
this.emptyItemResourceId = emptyItemResourceId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns text for specified item
|
||||
*
|
||||
* @param index the item index
|
||||
* @return the text of specified items
|
||||
*/
|
||||
protected abstract CharSequence getItemText(int index);
|
||||
|
||||
@Override
|
||||
public View getItem(int index, View convertView, ViewGroup parent) {
|
||||
if (index >= 0 && index < getItemsCount()) {
|
||||
if (convertView == null) {
|
||||
convertView = getView(itemResourceId, parent);
|
||||
}
|
||||
TextView textView = getTextView(convertView, itemTextResourceId);
|
||||
if (textView != null) {
|
||||
CharSequence text = getItemText(index);
|
||||
if (text == null) {
|
||||
text = "";
|
||||
}
|
||||
textView.setText(text);
|
||||
if (itemResourceId == TEXT_VIEW_ITEM_RESOURCE) {
|
||||
configureTextView(textView);
|
||||
}
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getEmptyItem(View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = getView(emptyItemResourceId, parent);
|
||||
}
|
||||
if (emptyItemResourceId == TEXT_VIEW_ITEM_RESOURCE && convertView instanceof TextView) {
|
||||
configureTextView((TextView) convertView);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
|
||||
*
|
||||
* @param view the text view to be configured
|
||||
*/
|
||||
protected void configureTextView(TextView view) {
|
||||
if (mPickerConfig == null)
|
||||
mPickerConfig = new PickerConfig();
|
||||
view.setTextColor(mPickerConfig.mWheelTVNormalColor);
|
||||
|
||||
view.setGravity(Gravity.CENTER);
|
||||
view.setPadding(0, padding, 0, padding);
|
||||
view.setTextSize(mPickerConfig.mWheelTVSize);
|
||||
view.setLines(1);
|
||||
// view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a text view from view
|
||||
*
|
||||
* @param view the text view or layout containing it
|
||||
* @param textResource the text resource Id in layout
|
||||
* @return the loaded text view
|
||||
*/
|
||||
private TextView getTextView(View view, int textResource) {
|
||||
TextView text = null;
|
||||
try {
|
||||
if (textResource == NO_RESOURCE && view instanceof TextView) {
|
||||
text = (TextView) view;
|
||||
} else if (textResource != NO_RESOURCE) {
|
||||
text = (TextView) view.findViewById(textResource);
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
Log.e("AbstractWheelAdapter", "You must supply a resource ID for a TextView");
|
||||
throw new IllegalStateException(
|
||||
"AbstractWheelAdapter requires the resource ID to be a TextView", e);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads view from resources
|
||||
*
|
||||
* @param resource the resource Id
|
||||
* @return the loaded view or null if resource is not set
|
||||
*/
|
||||
private View getView(int resource, ViewGroup parent) {
|
||||
switch (resource) {
|
||||
case NO_RESOURCE:
|
||||
return null;
|
||||
case TEXT_VIEW_ITEM_RESOURCE:
|
||||
return new TextView(context);
|
||||
default:
|
||||
return inflater.inflate(resource, parent, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PickerConfig getConfig() {
|
||||
if (mPickerConfig == null)
|
||||
mPickerConfig = new PickerConfig();
|
||||
return mPickerConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(PickerConfig config) {
|
||||
mPickerConfig = config;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jzxiang.pickerview.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* The simple Array wheel adapter
|
||||
*
|
||||
* @param <T> the element type
|
||||
*/
|
||||
public class ArrayWheelAdapter<T> extends AbstractWheelTextAdapter {
|
||||
|
||||
// items
|
||||
private T items[];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param items the items
|
||||
*/
|
||||
public ArrayWheelAdapter(Context context, T items[]) {
|
||||
super(context);
|
||||
|
||||
//setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE);
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getItemText(int index) {
|
||||
if (index >= 0 && index < items.length) {
|
||||
T item = items[index];
|
||||
if (item instanceof CharSequence) {
|
||||
return (CharSequence) item;
|
||||
}
|
||||
return item.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemsCount() {
|
||||
return items.length;
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* Numeric Wheel adapter.
|
||||
*/
|
||||
public class NumericWheelAdapter extends AbstractWheelTextAdapter {
|
||||
|
||||
/**
|
||||
* The default min value
|
||||
*/
|
||||
public static final int DEFAULT_MAX_VALUE = 9;
|
||||
|
||||
/**
|
||||
* The default max value
|
||||
*/
|
||||
private static final int DEFAULT_MIN_VALUE = 0;
|
||||
|
||||
// Values
|
||||
private int minValue;
|
||||
private int maxValue;
|
||||
|
||||
// format
|
||||
private String format;
|
||||
//unit
|
||||
private String unit;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
*/
|
||||
public NumericWheelAdapter(Context context) {
|
||||
this(context, DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param minValue the wheel min value
|
||||
* @param maxValue the wheel max value
|
||||
*/
|
||||
public NumericWheelAdapter(Context context, int minValue, int maxValue) {
|
||||
this(context, minValue, maxValue, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param minValue the wheel min value
|
||||
* @param maxValue the wheel max value
|
||||
* @param format the format string
|
||||
*/
|
||||
public NumericWheelAdapter(Context context, int minValue, int maxValue, String format) {
|
||||
this(context, minValue, maxValue, format, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context the current context
|
||||
* @param minValue the wheel min value
|
||||
* @param maxValue the wheel max value
|
||||
* @param format the format string
|
||||
* @param unit the wheel unit value
|
||||
*/
|
||||
public NumericWheelAdapter(Context context, int minValue, int maxValue, String format, String unit) {
|
||||
super(context);
|
||||
this.minValue = minValue;
|
||||
this.maxValue = maxValue;
|
||||
this.format = format;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getItemText(int index) {
|
||||
if (index >= 0 && index < getItemsCount()) {
|
||||
int value = minValue + index;
|
||||
String text = !TextUtils.isEmpty(format) ? String.format(format, value) : Integer.toString(value);
|
||||
text = TextUtils.isEmpty(unit) ? text : text + unit;
|
||||
|
||||
return text;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemsCount() {
|
||||
return maxValue - minValue + 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.adapters;
|
||||
|
||||
import android.database.DataSetObserver;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
|
||||
/**
|
||||
* Wheel items adapter interface
|
||||
*/
|
||||
public interface WheelViewAdapter {
|
||||
/**
|
||||
* Gets items count
|
||||
*
|
||||
* @return the count of wheel items
|
||||
*/
|
||||
int getItemsCount();
|
||||
|
||||
/**
|
||||
* Get a View that displays the data at the specified position in the data set
|
||||
*
|
||||
* @param index the item index
|
||||
* @param convertView the old view to reuse if possible
|
||||
* @param parent the parent that this view will eventually be attached to
|
||||
* @return the wheel item View
|
||||
*/
|
||||
View getItem(int index, View convertView, ViewGroup parent);
|
||||
|
||||
/**
|
||||
* Get a View that displays an empty wheel item placed before the first or after
|
||||
* the last wheel item.
|
||||
*
|
||||
* @param convertView the old view to reuse if possible
|
||||
* @param parent the parent that this view will eventually be attached to
|
||||
* @return the empty item View
|
||||
*/
|
||||
View getEmptyItem(View convertView, ViewGroup parent);
|
||||
|
||||
/**
|
||||
* Register an observer that is called when changes happen to the data used by this adapter.
|
||||
*
|
||||
* @param observer the observer to be registered
|
||||
*/
|
||||
void registerDataSetObserver(DataSetObserver observer);
|
||||
|
||||
/**
|
||||
* Unregister an observer that has previously been registered
|
||||
*
|
||||
* @param observer the observer to be unregistered
|
||||
*/
|
||||
void unregisterDataSetObserver(DataSetObserver observer);
|
||||
|
||||
PickerConfig getConfig();
|
||||
|
||||
void setConfig(PickerConfig config);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.jzxiang.pickerview.config;
|
||||
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/5/15.
|
||||
*/
|
||||
public class DefaultConfig {
|
||||
public static final Type TYPE = Type.ALL;
|
||||
public static final int COLOR = 0XFF007AFF;
|
||||
public static final int TOOLBAR_TV_COLOR = 0xFFFFFFFF;
|
||||
public static final int TV_NORMAL_COLOR = 0xFF999999;
|
||||
public static final int TV_SELECTOR_COLOR = 0XFF404040;
|
||||
public static final int TV_SIZE = 12;
|
||||
public static final boolean CYCLIC = true;
|
||||
public static String CANCEL = "取消";
|
||||
public static String SURE = "确定";
|
||||
public static String TITLE = "TimePicker";
|
||||
public static String YEAR = "年";
|
||||
public static String MONTH = "月";
|
||||
public static String DAY = "日";
|
||||
public static String HOUR = "时";
|
||||
public static String MINUTE = "分";
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.jzxiang.pickerview.config;
|
||||
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
import com.jzxiang.pickerview.data.WheelCalendar;
|
||||
import com.jzxiang.pickerview.listener.OnDateSetListener;
|
||||
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/5/15.
|
||||
*/
|
||||
public class PickerConfig {
|
||||
|
||||
public Type mType = DefaultConfig.TYPE;
|
||||
public int mThemeColor = DefaultConfig.COLOR;
|
||||
|
||||
public String mCancelString = DefaultConfig.CANCEL;
|
||||
public String mSureString = DefaultConfig.SURE;
|
||||
public String mTitleString = DefaultConfig.TITLE;
|
||||
public int mToolBarTVColor = DefaultConfig.TOOLBAR_TV_COLOR;
|
||||
|
||||
public int mWheelTVNormalColor = DefaultConfig.TV_NORMAL_COLOR;
|
||||
public int mWheelTVSelectorColor = DefaultConfig.TV_SELECTOR_COLOR;
|
||||
public int mWheelTVSize = DefaultConfig.TV_SIZE;
|
||||
public boolean cyclic = DefaultConfig.CYCLIC;
|
||||
|
||||
public String mYear = DefaultConfig.YEAR;
|
||||
public String mMonth = DefaultConfig.MONTH;
|
||||
public String mDay = DefaultConfig.DAY;
|
||||
public String mHour = DefaultConfig.HOUR;
|
||||
public String mMinute = DefaultConfig.MINUTE;
|
||||
|
||||
/**
|
||||
* The min timeMillseconds
|
||||
*/
|
||||
public WheelCalendar mMinCalendar = new WheelCalendar(0);
|
||||
|
||||
/**
|
||||
* The max timeMillseconds
|
||||
*/
|
||||
public WheelCalendar mMaxCalendar = new WheelCalendar(0);
|
||||
|
||||
/**
|
||||
* The default selector timeMillseconds
|
||||
*/
|
||||
public WheelCalendar mCurrentCalendar = new WheelCalendar(System.currentTimeMillis());
|
||||
|
||||
public OnDateSetListener mCallBack;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.jzxiang.pickerview.data;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/21.
|
||||
*/
|
||||
public enum Type {
|
||||
// 五种选择模式,年月日时分,年月日,时分,月日时分,年月
|
||||
ALL,
|
||||
YEAR_MONTH_DAY,
|
||||
HOURS_MINS,
|
||||
MONTH_DAY_HOUR_MIN,
|
||||
YEAR_MONTH,
|
||||
YEAR
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.jzxiang.pickerview.data;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/19.
|
||||
*/
|
||||
public class WheelCalendar {
|
||||
|
||||
public int year, month, day, hour, minute;
|
||||
|
||||
private boolean noRange;
|
||||
|
||||
public WheelCalendar(long millseconds) {
|
||||
initData(millseconds);
|
||||
}
|
||||
|
||||
private void initData(long millseconds) {
|
||||
if (millseconds == 0) {
|
||||
noRange = true;
|
||||
return;
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.clear();
|
||||
calendar.setTimeInMillis(millseconds);
|
||||
|
||||
year = calendar.get(Calendar.YEAR);
|
||||
month = calendar.get(Calendar.MONTH) + 1;
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
minute = calendar.get(Calendar.MINUTE);
|
||||
}
|
||||
|
||||
public boolean isNoRange() {
|
||||
return noRange;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.jzxiang.pickerview.data.source;
|
||||
|
||||
import com.jzxiang.pickerview.data.WheelCalendar;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/6/13.
|
||||
*/
|
||||
public interface TimeDataSource {
|
||||
|
||||
int getMinYear();
|
||||
|
||||
int getMaxYear();
|
||||
|
||||
int getMinMonth(int currentYear);
|
||||
|
||||
int getMaxMonth(int currentYear);
|
||||
|
||||
int getMinDay(int year, int month);
|
||||
|
||||
int getMaxDay(int year, int month);
|
||||
|
||||
int getMinHour(int year, int month, int day);
|
||||
|
||||
int getMaxHour(int year, int month, int day);
|
||||
|
||||
int getMinMinute(int year, int month, int day, int hour);
|
||||
|
||||
int getMaxMinute(int year, int month, int day, int hour);
|
||||
|
||||
boolean isMinYear(int year);
|
||||
|
||||
boolean isMinMonth(int year, int month);
|
||||
|
||||
boolean isMinDay(int year, int month, int day);
|
||||
|
||||
boolean isMinHour(int year, int month, int day, int hour);
|
||||
//
|
||||
// boolean isMaxYear(int year);
|
||||
//
|
||||
// boolean isMaxMonth(int year, int month);
|
||||
//
|
||||
// boolean isMaxDay(int year, int month, int day);
|
||||
//
|
||||
// boolean isMaxMinute(int year, int month, int day, int hour);
|
||||
|
||||
WheelCalendar getDefaultCalendar();
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package com.jzxiang.pickerview.data.source;
|
||||
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
import com.jzxiang.pickerview.data.WheelCalendar;
|
||||
import com.jzxiang.pickerview.utils.PickerContants;
|
||||
import com.jzxiang.pickerview.utils.Utils;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/6/13.
|
||||
*/
|
||||
public class TimeRepository implements TimeDataSource {
|
||||
PickerConfig mPickerConfig;
|
||||
WheelCalendar mCalendarMin, mCalendarMax;
|
||||
|
||||
boolean mIsMinNoRange, mIsMaxNoRange;
|
||||
|
||||
public TimeRepository(PickerConfig pickerConfig) {
|
||||
mPickerConfig = pickerConfig;
|
||||
mCalendarMin = pickerConfig.mMinCalendar;
|
||||
mCalendarMax = pickerConfig.mMaxCalendar;
|
||||
|
||||
mIsMinNoRange = mCalendarMin.isNoRange();
|
||||
mIsMaxNoRange = mCalendarMax.isNoRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinYear() {
|
||||
if (mIsMinNoRange)
|
||||
return PickerContants.DEFAULT_MIN_YEAR;
|
||||
else
|
||||
return mCalendarMin.year;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxYear() {
|
||||
if (mIsMaxNoRange)
|
||||
return getMinYear() + PickerContants.YEAR_COUNT;
|
||||
|
||||
return mCalendarMax.year;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinMonth(int year) {
|
||||
if (!mIsMinNoRange && Utils.isTimeEquals(mCalendarMin, year))
|
||||
return mCalendarMin.month;
|
||||
|
||||
return PickerContants.MIN_MONTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMonth(int year) {
|
||||
if (!mIsMaxNoRange && Utils.isTimeEquals(mCalendarMax, year))
|
||||
return mCalendarMax.month;
|
||||
|
||||
return PickerContants.MAX_MONTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinDay(int year, int month) {
|
||||
if (!mIsMinNoRange && Utils.isTimeEquals(mCalendarMin, year, month))
|
||||
return mCalendarMin.day;
|
||||
|
||||
return PickerContants.MIN_DAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDay(int year, int month) {
|
||||
if (!mIsMaxNoRange && Utils.isTimeEquals(mCalendarMax, year, month))
|
||||
return mCalendarMax.day;
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, year);
|
||||
calendar.set(Calendar.DATE, 1);
|
||||
calendar.set(Calendar.MONTH, month - 1);
|
||||
|
||||
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinHour(int year, int month, int day) {
|
||||
if (!mIsMinNoRange && Utils.isTimeEquals(mCalendarMin, year, month, day))
|
||||
return mCalendarMin.hour;
|
||||
else
|
||||
return PickerContants.MIN_HOUR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHour(int year, int month, int day) {
|
||||
if (!mIsMaxNoRange && Utils.isTimeEquals(mCalendarMax, year, month, day))
|
||||
return mCalendarMax.hour;
|
||||
|
||||
return PickerContants.MAX_HOUR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinMinute(int year, int month, int day, int hour) {
|
||||
if (!mIsMinNoRange && Utils.isTimeEquals(mCalendarMin, year, month, day, hour))
|
||||
return mCalendarMin.minute + 1;
|
||||
else
|
||||
return PickerContants.MIN_MINUTE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMinute(int year, int month, int day, int hour) {
|
||||
if (!mIsMaxNoRange && Utils.isTimeEquals(mCalendarMax, year, month, day, hour))
|
||||
return mCalendarMax.minute;
|
||||
|
||||
return PickerContants.MAX_MINUTE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinYear(int year) {
|
||||
return Utils.isTimeEquals(mCalendarMin, year);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinMonth(int year, int month) {
|
||||
return Utils.isTimeEquals(mCalendarMin, year, month);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinDay(int year, int month, int day) {
|
||||
return Utils.isTimeEquals(mCalendarMin, year, month, day);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinHour(int year, int month, int day, int hour) {
|
||||
return Utils.isTimeEquals(mCalendarMin, year, month, day, hour);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WheelCalendar getDefaultCalendar() {
|
||||
return mPickerConfig.mCurrentCalendar;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.jzxiang.pickerview.listener;
|
||||
|
||||
import com.jzxiang.pickerview.TimePickerDialog;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/20.
|
||||
*/
|
||||
public interface OnDateSetListener {
|
||||
|
||||
void onDateSet(TimePickerDialog timePickerView, long millseconds);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.jzxiang.pickerview.utils;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/20.
|
||||
*/
|
||||
public class PickerContants {
|
||||
public static final String FORMAT = "%02d";
|
||||
|
||||
public static final int DEFAULT_MIN_YEAR = 2015;
|
||||
public static final int YEAR_COUNT = 50;
|
||||
public static final int MIN_MONTH = 1;
|
||||
public static final int MAX_MONTH = 12;
|
||||
public static final int MIN_DAY = MIN_MONTH;
|
||||
public static final int MIN_HOUR = 0;
|
||||
public static final int MAX_HOUR = 23;
|
||||
public static final int MIN_MINUTE = 0;
|
||||
public static final int MAX_MINUTE = 59;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.jzxiang.pickerview.utils;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.jzxiang.pickerview.data.WheelCalendar;
|
||||
|
||||
/**
|
||||
* Created by jzxiang on 16/4/20.
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static boolean isTimeEquals(WheelCalendar calendar, int... params) {
|
||||
switch (params.length) {
|
||||
case 1:
|
||||
return calendar.year == params[0];
|
||||
case 2:
|
||||
return calendar.year == params[0] &&
|
||||
calendar.month == params[1];
|
||||
case 3:
|
||||
return calendar.year == params[0] &&
|
||||
calendar.month == params[1] &&
|
||||
calendar.day == params[2];
|
||||
case 4:
|
||||
return calendar.year == params[0] &&
|
||||
calendar.month == params[1] &&
|
||||
calendar.day == params[2] &&
|
||||
calendar.hour == params[3];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void hideViews(View... views) {
|
||||
for (int i = 0; i < views.length; i++) {
|
||||
views[i].setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Android Wheel Control.
|
||||
* https://code.google.com/p/android-wheel/
|
||||
*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
/**
|
||||
* Range for visible items.
|
||||
*/
|
||||
public class ItemsRange {
|
||||
// First item number
|
||||
private int first;
|
||||
|
||||
// Items count
|
||||
private int count;
|
||||
|
||||
/**
|
||||
* Default constructor. Creates an empty range
|
||||
*/
|
||||
public ItemsRange() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param first the number of first item
|
||||
* @param count the count of items
|
||||
*/
|
||||
public ItemsRange(int first, int count) {
|
||||
this.first = first;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of first item
|
||||
*
|
||||
* @return the number of the first item
|
||||
*/
|
||||
public int getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of last item
|
||||
*
|
||||
* @return the number of last item
|
||||
*/
|
||||
public int getLast() {
|
||||
return getFirst() + getCount() - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get items count
|
||||
*
|
||||
* @return the count of items
|
||||
*/
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether item is contained by range
|
||||
*
|
||||
* @param index the item number
|
||||
* @return true if item is contained
|
||||
*/
|
||||
public boolean contains(int index) {
|
||||
return index >= getFirst() && index <= getLast();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
/**
|
||||
* Wheel changed listener interface.
|
||||
* The onChanged() method is called whenever current wheel positions is changed:
|
||||
* New Wheel position is set
|
||||
* Wheel view is scrolled
|
||||
*/
|
||||
public interface OnWheelChangedListener {
|
||||
/**
|
||||
* Callback method to be invoked when current item changed
|
||||
*
|
||||
* @param wheel the wheel view whose state has changed
|
||||
* @param oldValue the old value of current item
|
||||
* @param newValue the new value of current item
|
||||
*/
|
||||
void onChanged(WheelView wheel, int oldValue, int newValue);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
/**
|
||||
* Wheel clicked listener interface.
|
||||
* <p>The onItemClicked() method is called whenever a wheel item is clicked
|
||||
* New Wheel position is set
|
||||
* Wheel view is scrolled
|
||||
*/
|
||||
public interface OnWheelClickedListener {
|
||||
/**
|
||||
* Callback method to be invoked when current item clicked
|
||||
*
|
||||
* @param wheel the wheel view
|
||||
* @param itemIndex the index of clicked item
|
||||
*/
|
||||
void onItemClicked(WheelView wheel, int itemIndex);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
/**
|
||||
* Wheel scrolled listener interface.
|
||||
*/
|
||||
public interface OnWheelScrollListener {
|
||||
/**
|
||||
* Callback method to be invoked when scrolling started.
|
||||
*
|
||||
* @param wheel the wheel view whose state has changed.
|
||||
*/
|
||||
void onScrollingStarted(WheelView wheel);
|
||||
|
||||
/**
|
||||
* Callback method to be invoked when scrolling ended.
|
||||
*
|
||||
* @param wheel the wheel view whose state has changed.
|
||||
*/
|
||||
void onScrollingFinished(WheelView wheel);
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Recycle stores wheel items to reuse.
|
||||
*/
|
||||
public class WheelRecycle {
|
||||
// Cached items
|
||||
private List<View> items;
|
||||
|
||||
// Cached empty items
|
||||
private List<View> emptyItems;
|
||||
|
||||
// Wheel view
|
||||
private WheelView wheel;
|
||||
|
||||
|
||||
public WheelRecycle(WheelView wheel) {
|
||||
this.wheel = wheel;
|
||||
}
|
||||
|
||||
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range, int currentItem) {
|
||||
int index = firstItem;
|
||||
for (int i = 0; i < layout.getChildCount(); ) {
|
||||
if (!range.contains(index)) {
|
||||
recycleView(layout.getChildAt(i), index, currentItem);
|
||||
layout.removeViewAt(i);
|
||||
if (i == 0) { // first item
|
||||
firstItem++;
|
||||
}
|
||||
} else {
|
||||
i++; // go to next item
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return firstItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets item view
|
||||
*
|
||||
* @return the cached view
|
||||
*/
|
||||
public View getItem() {
|
||||
return getCachedView(items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets empty item view
|
||||
*
|
||||
* @return the cached empty view
|
||||
*/
|
||||
public View getEmptyItem() {
|
||||
return getCachedView(emptyItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all views
|
||||
*/
|
||||
public void clearAll() {
|
||||
if (items != null) {
|
||||
items.clear();
|
||||
}
|
||||
if (emptyItems != null) {
|
||||
emptyItems.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds view to specified cache. Creates a cache list if it is null.
|
||||
*
|
||||
* @param view the view to be cached
|
||||
* @param cache the cache list
|
||||
* @return the cache list
|
||||
*/
|
||||
private List<View> addView(View view, List<View> cache) {
|
||||
if (cache == null) {
|
||||
cache = new LinkedList<View>();
|
||||
}
|
||||
|
||||
cache.add(view);
|
||||
return cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds view to cache. Determines view type (item view or empty one) by index.
|
||||
*
|
||||
* @param view the view to be cached
|
||||
* @param index the index of view
|
||||
*/
|
||||
private void recycleView(View view, int index, int current) {
|
||||
int count = wheel.getViewAdapter().getItemsCount();
|
||||
|
||||
|
||||
if ((index < 0 || index >= count) && !wheel.isCyclic()) {
|
||||
// empty view
|
||||
emptyItems = addView(view, emptyItems);
|
||||
} else {
|
||||
while (index < 0) {
|
||||
index = count + index;
|
||||
}
|
||||
index %= count;
|
||||
items = addView(view, items);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets view from specified cache.
|
||||
*
|
||||
* @param cache the cache
|
||||
* @return the first view from cache.
|
||||
*/
|
||||
private View getCachedView(List<View> cache) {
|
||||
if (cache != null && cache.size() > 0) {
|
||||
View view = cache.get(0);
|
||||
cache.remove(0);
|
||||
return view;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.GestureDetector.SimpleOnGestureListener;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.Scroller;
|
||||
|
||||
public class WheelScroller {
|
||||
|
||||
public static final int MIN_DELTA_FOR_SCROLLING = 1;
|
||||
private static final int SCROLLING_DURATION = 400;
|
||||
// Messages
|
||||
private final int MESSAGE_SCROLL = 0;
|
||||
private final int MESSAGE_JUSTIFY = 1;
|
||||
private ScrollingListener listener;
|
||||
// Context
|
||||
private Context context;
|
||||
// Scrolling
|
||||
private GestureDetector gestureDetector;
|
||||
private Scroller scroller;
|
||||
private int lastScrollY;
|
||||
private float lastTouchedY;
|
||||
private boolean isScrollingPerformed;
|
||||
// animation handler
|
||||
private Handler animationHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
scroller.computeScrollOffset();
|
||||
int currY = scroller.getCurrY();
|
||||
int delta = lastScrollY - currY;
|
||||
lastScrollY = currY;
|
||||
if (delta != 0) {
|
||||
listener.onScroll(delta);
|
||||
}
|
||||
|
||||
// scrolling is not finished when it comes to final Y
|
||||
// so, finish it manually
|
||||
if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) {
|
||||
currY = scroller.getFinalY();
|
||||
scroller.forceFinished(true);
|
||||
}
|
||||
if (!scroller.isFinished()) {
|
||||
animationHandler.sendEmptyMessage(msg.what);
|
||||
} else if (msg.what == MESSAGE_SCROLL) {
|
||||
justify();
|
||||
} else {
|
||||
finishScrolling();
|
||||
}
|
||||
}
|
||||
};
|
||||
// gesture listener
|
||||
private SimpleOnGestureListener gestureListener = new SimpleOnGestureListener() {
|
||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||
// Do scrolling in onTouchEvent() since onScroll() are not call immediately
|
||||
// when user touch and move the wheel
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
lastScrollY = 0;
|
||||
final int maxY = 0x7FFFFFFF;
|
||||
final int minY = -maxY;
|
||||
scroller.fling(0, lastScrollY, 0, (int) -velocityY, 0, 0, minY, maxY);
|
||||
setNextMessage(MESSAGE_SCROLL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public WheelScroller(Context context, ScrollingListener listener) {
|
||||
gestureDetector = new GestureDetector(context, gestureListener);
|
||||
gestureDetector.setIsLongpressEnabled(false);
|
||||
|
||||
scroller = new Scroller(context);
|
||||
|
||||
this.listener = listener;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
public void setInterpolator(Interpolator interpolator) {
|
||||
scroller.forceFinished(true);
|
||||
scroller = new Scroller(context, interpolator);
|
||||
}
|
||||
|
||||
public void scroll(int distance, int time) {
|
||||
scroller.forceFinished(true);
|
||||
|
||||
lastScrollY = 0;
|
||||
|
||||
scroller.startScroll(0, 0, 0, distance, time != 0 ? time : SCROLLING_DURATION);
|
||||
setNextMessage(MESSAGE_SCROLL);
|
||||
|
||||
startScrolling();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops scrolling
|
||||
*/
|
||||
public void stopScrolling() {
|
||||
scroller.forceFinished(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles Touch event
|
||||
*
|
||||
* @param event the motion event
|
||||
* @return
|
||||
*/
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
lastTouchedY = event.getY();
|
||||
scroller.forceFinished(true);
|
||||
clearMessages();
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// perform scrolling
|
||||
int distanceY = (int) (event.getY() - lastTouchedY);
|
||||
if (distanceY != 0) {
|
||||
startScrolling();
|
||||
listener.onScroll(distanceY);
|
||||
lastTouchedY = event.getY();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!gestureDetector.onTouchEvent(event) && event.getAction() == MotionEvent.ACTION_UP) {
|
||||
justify();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set next message to queue. Clears queue before.
|
||||
*
|
||||
* @param message the message to set
|
||||
*/
|
||||
private void setNextMessage(int message) {
|
||||
clearMessages();
|
||||
animationHandler.sendEmptyMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears messages from queue
|
||||
*/
|
||||
private void clearMessages() {
|
||||
animationHandler.removeMessages(MESSAGE_SCROLL);
|
||||
animationHandler.removeMessages(MESSAGE_JUSTIFY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Justifies wheel
|
||||
*/
|
||||
private void justify() {
|
||||
listener.onJustify();
|
||||
setNextMessage(MESSAGE_JUSTIFY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts scrolling
|
||||
*/
|
||||
private void startScrolling() {
|
||||
if (!isScrollingPerformed) {
|
||||
isScrollingPerformed = true;
|
||||
listener.onStarted();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes scrolling
|
||||
*/
|
||||
void finishScrolling() {
|
||||
if (isScrollingPerformed) {
|
||||
listener.onFinished();
|
||||
isScrollingPerformed = false;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ScrollingListener {
|
||||
/**
|
||||
* Scrolling callback called when scrolling is performed.
|
||||
*
|
||||
* @param distance the distance to scroll
|
||||
*/
|
||||
void onScroll(int distance);
|
||||
|
||||
/**
|
||||
* Starting callback called when scrolling is started
|
||||
*/
|
||||
void onStarted();
|
||||
|
||||
/**
|
||||
* Finishing callback called after justifying
|
||||
*/
|
||||
void onFinished();
|
||||
|
||||
/**
|
||||
* Justifying callback called to justify a view when scrolling is ended
|
||||
*/
|
||||
void onJustify();
|
||||
}
|
||||
}
|
@ -0,0 +1,942 @@
|
||||
/*
|
||||
* Android Wheel Control.
|
||||
* https://code.google.com/p/android-wheel/
|
||||
*
|
||||
* Copyright 2011 Yuri Kanivets
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jzxiang.pickerview.wheel;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jzxiang.pickerview.R;
|
||||
import com.jzxiang.pickerview.adapters.WheelViewAdapter;
|
||||
import com.jzxiang.pickerview.config.DefaultConfig;
|
||||
import com.jzxiang.pickerview.config.PickerConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
/**
|
||||
* Numeric wheel view.
|
||||
*
|
||||
* @author Yuri Kanivets
|
||||
*/
|
||||
public class WheelView extends View {
|
||||
|
||||
/**
|
||||
* Top and bottom items offset (to hide that)
|
||||
*/
|
||||
private static final int ITEM_OFFSET_PERCENT = 10;
|
||||
|
||||
/**
|
||||
* Left and right padding value
|
||||
*/
|
||||
private static final int PADDING = 10;
|
||||
|
||||
/**
|
||||
* Default count of visible items
|
||||
*/
|
||||
private static final int DEF_VISIBLE_ITEMS = 5;
|
||||
// Cyclic
|
||||
boolean isCyclic = false;
|
||||
int defaultColor, selectorColor;
|
||||
// Wheel Values
|
||||
private int currentItem = 0;
|
||||
// Count of visible items
|
||||
private int visibleItems = DEF_VISIBLE_ITEMS;
|
||||
// Item height
|
||||
private int itemHeight = 0;
|
||||
// Scrolling
|
||||
private WheelScroller scroller;
|
||||
private boolean isScrollingPerformed;
|
||||
private int scrollingOffset;
|
||||
// Items layout
|
||||
private LinearLayout itemsLayout;
|
||||
// The number of first item in layout
|
||||
private int firstItem;
|
||||
// View adapter
|
||||
private WheelViewAdapter viewAdapter;
|
||||
|
||||
// Recycle
|
||||
private WheelRecycle recycle = new WheelRecycle(this);
|
||||
private Paint mPaintLineCenter, mPaintLineRight, mPaintRectCenter;
|
||||
private int mLineRightMar;
|
||||
// Listeners
|
||||
private List<OnWheelChangedListener> changingListeners = new LinkedList<OnWheelChangedListener>();
|
||||
private List<OnWheelScrollListener> scrollingListeners = new LinkedList<OnWheelScrollListener>();
|
||||
// Scrolling listener
|
||||
WheelScroller.ScrollingListener scrollingListener = new WheelScroller.ScrollingListener() {
|
||||
public void onStarted() {
|
||||
isScrollingPerformed = true;
|
||||
notifyScrollingListenersAboutStart();
|
||||
}
|
||||
|
||||
public void onScroll(int distance) {
|
||||
doScroll(distance);
|
||||
|
||||
int height = getHeight();
|
||||
if (scrollingOffset > height) {
|
||||
scrollingOffset = height;
|
||||
scroller.stopScrolling();
|
||||
} else if (scrollingOffset < -height) {
|
||||
scrollingOffset = -height;
|
||||
scroller.stopScrolling();
|
||||
}
|
||||
}
|
||||
|
||||
public void onFinished() {
|
||||
if (isScrollingPerformed) {
|
||||
notifyScrollingListenersAboutEnd();
|
||||
isScrollingPerformed = false;
|
||||
}
|
||||
|
||||
scrollingOffset = 0;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void onJustify() {
|
||||
if (Math.abs(scrollingOffset) > WheelScroller.MIN_DELTA_FOR_SCROLLING) {
|
||||
scroller.scroll(scrollingOffset, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
private List<OnWheelClickedListener> clickingListeners = new LinkedList<OnWheelClickedListener>();
|
||||
// Adapter listener
|
||||
private DataSetObserver dataObserver = new DataSetObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
invalidateWheel(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInvalidated() {
|
||||
invalidateWheel(true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public WheelView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
initData(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public WheelView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initData(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public WheelView(Context context) {
|
||||
super(context);
|
||||
initData(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes class data
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
private void initData(Context context) {
|
||||
scroller = new WheelScroller(getContext(), scrollingListener);
|
||||
|
||||
mPaintLineCenter = new Paint();
|
||||
mPaintLineCenter.setColor(DefaultConfig.COLOR);
|
||||
mPaintLineCenter.setAntiAlias(true);
|
||||
mPaintLineCenter.setStrokeWidth(1);
|
||||
mPaintLineCenter.setStyle(Paint.Style.FILL);
|
||||
|
||||
mPaintLineRight = new Paint();
|
||||
mPaintLineRight.setColor(0xffe8e8e8);
|
||||
mPaintLineRight.setAntiAlias(true);
|
||||
// mPaintLineRight.setStrokeWidth(context.getResources().getDimensionPixelSize(R.dimen.picker_line_width));
|
||||
mPaintLineRight.setStrokeWidth(1);
|
||||
mPaintLineRight.setStyle(Paint.Style.FILL);
|
||||
|
||||
mPaintRectCenter = new Paint();
|
||||
mPaintRectCenter.setColor(DefaultConfig.COLOR);
|
||||
mPaintRectCenter.setAlpha((int) (0.1 * 255));
|
||||
mPaintRectCenter.setAntiAlias(true);
|
||||
mPaintRectCenter.setStyle(Paint.Style.FILL);
|
||||
|
||||
mLineRightMar = context.getResources().getDimensionPixelSize(R.dimen.picker_line_mar);
|
||||
|
||||
|
||||
defaultColor = DefaultConfig.TV_NORMAL_COLOR;
|
||||
selectorColor = DefaultConfig.TV_SELECTOR_COLOR;
|
||||
|
||||
}
|
||||
|
||||
public void setConfig(PickerConfig config) {
|
||||
mPaintLineCenter.setColor(config.mThemeColor);
|
||||
|
||||
mPaintRectCenter.setColor(config.mThemeColor);
|
||||
mPaintRectCenter.setAlpha((int) (0.1 * 255));
|
||||
|
||||
defaultColor = config.mWheelTVNormalColor;
|
||||
selectorColor = config.mWheelTVSelectorColor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the the specified scrolling interpolator
|
||||
*
|
||||
* @param interpolator the interpolator
|
||||
*/
|
||||
public void setInterpolator(Interpolator interpolator) {
|
||||
scroller.setInterpolator(interpolator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets count of visible items
|
||||
*
|
||||
* @return the count of visible items
|
||||
*/
|
||||
public int getVisibleItems() {
|
||||
return visibleItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the desired count of visible items.
|
||||
* Actual amount of visible items depends on wheel layout parameters.
|
||||
* To apply changes and rebuild view call measure().
|
||||
*
|
||||
* @param count the desired count for visible items
|
||||
*/
|
||||
public void setVisibleItems(int count) {
|
||||
visibleItems = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets view adapter
|
||||
*
|
||||
* @return the view adapter
|
||||
*/
|
||||
public WheelViewAdapter getViewAdapter() {
|
||||
return viewAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets view adapter. Usually new adapters contain different views, so
|
||||
* it needs to rebuild view by calling measure().
|
||||
*
|
||||
* @param viewAdapter the view adapter
|
||||
*/
|
||||
public void setViewAdapter(WheelViewAdapter viewAdapter) {
|
||||
if (this.viewAdapter != null) {
|
||||
this.viewAdapter.unregisterDataSetObserver(dataObserver);
|
||||
}
|
||||
this.viewAdapter = viewAdapter;
|
||||
if (this.viewAdapter != null) {
|
||||
this.viewAdapter.registerDataSetObserver(dataObserver);
|
||||
}
|
||||
|
||||
setConfig(viewAdapter.getConfig());
|
||||
invalidateWheel(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds wheel changing listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void addChangingListener(OnWheelChangedListener listener) {
|
||||
changingListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes wheel changing listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void removeChangingListener(OnWheelChangedListener listener) {
|
||||
changingListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies changing listeners
|
||||
*
|
||||
* @param oldValue the old wheel value
|
||||
* @param newValue the new wheel value
|
||||
*/
|
||||
protected void notifyChangingListeners(int oldValue, int newValue) {
|
||||
for (OnWheelChangedListener listener : changingListeners) {
|
||||
listener.onChanged(this, oldValue, newValue);
|
||||
}
|
||||
|
||||
if (oldValue < 0 || newValue < 0 || itemsLayout == null)
|
||||
return;
|
||||
|
||||
View oldView = itemsLayout.getChildAt(oldValue - firstItem);
|
||||
View newView = itemsLayout.getChildAt(newValue - firstItem);
|
||||
|
||||
refreshTextStatus(oldView, oldValue);
|
||||
refreshTextStatus(newView, newValue);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds wheel scrolling listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void addScrollingListener(OnWheelScrollListener listener) {
|
||||
scrollingListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes wheel scrolling listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void removeScrollingListener(OnWheelScrollListener listener) {
|
||||
scrollingListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies listeners about starting scrolling
|
||||
*/
|
||||
protected void notifyScrollingListenersAboutStart() {
|
||||
for (OnWheelScrollListener listener : scrollingListeners) {
|
||||
listener.onScrollingStarted(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies listeners about ending scrolling
|
||||
*/
|
||||
protected void notifyScrollingListenersAboutEnd() {
|
||||
for (OnWheelScrollListener listener : scrollingListeners) {
|
||||
listener.onScrollingFinished(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds wheel clicking listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void addClickingListener(OnWheelClickedListener listener) {
|
||||
clickingListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes wheel clicking listener
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void removeClickingListener(OnWheelClickedListener listener) {
|
||||
clickingListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies listeners about clicking
|
||||
*/
|
||||
protected void notifyClickListenersAboutClick(int item) {
|
||||
for (OnWheelClickedListener listener : clickingListeners) {
|
||||
listener.onItemClicked(this, item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current value
|
||||
*
|
||||
* @return the current value
|
||||
*/
|
||||
public int getCurrentItem() {
|
||||
return currentItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current item w/o animation. Does nothing when index is wrong.
|
||||
*
|
||||
* @param index the item index
|
||||
*/
|
||||
public void setCurrentItem(int index) {
|
||||
setCurrentItem(index, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current item. Does nothing when index is wrong.
|
||||
*
|
||||
* @param index the item index
|
||||
* @param animated the animation flag
|
||||
*/
|
||||
public void setCurrentItem(int index, boolean animated) {
|
||||
if (viewAdapter == null || viewAdapter.getItemsCount() == 0) {
|
||||
return; // throw?
|
||||
}
|
||||
|
||||
int itemCount = viewAdapter.getItemsCount();
|
||||
if (index < 0 || index >= itemCount) {
|
||||
if (isCyclic) {
|
||||
while (index < 0) {
|
||||
index += itemCount;
|
||||
}
|
||||
index %= itemCount;
|
||||
} else {
|
||||
return; // throw?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index != currentItem) {
|
||||
if (animated) {
|
||||
int itemsToScroll = index - currentItem;
|
||||
if (isCyclic) {
|
||||
int scroll = itemCount + Math.min(index, currentItem) - Math.max(index, currentItem);
|
||||
if (scroll < Math.abs(itemsToScroll)) {
|
||||
itemsToScroll = itemsToScroll < 0 ? scroll : -scroll;
|
||||
}
|
||||
}
|
||||
scroll(itemsToScroll, 0);
|
||||
} else {
|
||||
scrollingOffset = 0;
|
||||
|
||||
int old = currentItem;
|
||||
currentItem = index;
|
||||
|
||||
notifyChangingListeners(old, currentItem);
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if wheel is cyclic. That means before the 1st item there is shown the last one
|
||||
*
|
||||
* @return true if wheel is cyclic
|
||||
*/
|
||||
public boolean isCyclic() {
|
||||
return isCyclic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set wheel cyclic flag
|
||||
*
|
||||
* @param isCyclic the flag to set
|
||||
*/
|
||||
public void setCyclic(boolean isCyclic) {
|
||||
this.isCyclic = isCyclic;
|
||||
invalidateWheel(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates wheel
|
||||
*
|
||||
* @param clearCaches if true then cached views will be clear
|
||||
*/
|
||||
public void invalidateWheel(boolean clearCaches) {
|
||||
if (clearCaches) {
|
||||
recycle.clearAll();
|
||||
if (itemsLayout != null) {
|
||||
itemsLayout.removeAllViews();
|
||||
}
|
||||
scrollingOffset = 0;
|
||||
} else if (itemsLayout != null) {
|
||||
// cache all items
|
||||
recycle.recycleItems(itemsLayout, firstItem, new ItemsRange(), currentItem);
|
||||
}
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes resources
|
||||
*/
|
||||
private void initResourcesIfNecessary() {
|
||||
setBackgroundResource(android.R.color.white);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates desired height for layout
|
||||
*
|
||||
* @param layout the source layout
|
||||
* @return the desired layout height
|
||||
*/
|
||||
private int getDesiredHeight(LinearLayout layout) {
|
||||
if (layout != null && layout.getChildAt(0) != null) {
|
||||
itemHeight = layout.getChildAt(0).getMeasuredHeight();
|
||||
}
|
||||
|
||||
int desired = itemHeight * visibleItems - itemHeight * ITEM_OFFSET_PERCENT / 50;
|
||||
|
||||
return Math.max(desired, getSuggestedMinimumHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns height of wheel item
|
||||
*
|
||||
* @return the item height
|
||||
*/
|
||||
private int getItemHeight() {
|
||||
if (itemHeight != 0) {
|
||||
return itemHeight;
|
||||
}
|
||||
|
||||
if (itemsLayout != null && itemsLayout.getChildAt(0) != null) {
|
||||
itemHeight = itemsLayout.getChildAt(0).getHeight();
|
||||
return itemHeight;
|
||||
}
|
||||
|
||||
return getHeight() / visibleItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates control width and creates text layouts
|
||||
*
|
||||
* @param widthSize the input layout width
|
||||
* @param mode the layout mode
|
||||
* @return the calculated control width
|
||||
*/
|
||||
private int calculateLayoutWidth(int widthSize, int mode) {
|
||||
initResourcesIfNecessary();
|
||||
|
||||
// TODO: make it static
|
||||
itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
||||
itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.UNSPECIFIED),
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
int width = itemsLayout.getMeasuredWidth();
|
||||
|
||||
if (mode == MeasureSpec.EXACTLY) {
|
||||
width = widthSize;
|
||||
} else {
|
||||
width += 2 * PADDING;
|
||||
|
||||
// Check against our minimum width
|
||||
width = Math.max(width, getSuggestedMinimumWidth());
|
||||
|
||||
if (mode == MeasureSpec.AT_MOST && widthSize < width) {
|
||||
width = widthSize;
|
||||
}
|
||||
}
|
||||
|
||||
itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
buildViewForMeasuring();
|
||||
|
||||
int width = calculateLayoutWidth(widthSize, widthMode);
|
||||
|
||||
int height;
|
||||
if (heightMode == MeasureSpec.EXACTLY) {
|
||||
height = heightSize;
|
||||
} else {
|
||||
height = getDesiredHeight(itemsLayout);
|
||||
|
||||
if (heightMode == MeasureSpec.AT_MOST) {
|
||||
height = Math.min(height, heightSize);
|
||||
}
|
||||
}
|
||||
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
layout(r - l, b - t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets layouts width and height
|
||||
*
|
||||
* @param width the layout width
|
||||
* @param height the layout height
|
||||
*/
|
||||
private void layout(int width, int height) {
|
||||
int itemsWidth = width - 2 * PADDING;
|
||||
|
||||
itemsLayout.layout(0, 0, itemsWidth, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (viewAdapter != null && viewAdapter.getItemsCount() > 0) {
|
||||
updateView();
|
||||
drawItems(canvas);
|
||||
drawCenterRect(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws items
|
||||
*
|
||||
* @param canvas the canvas for drawing
|
||||
*/
|
||||
private void drawItems(Canvas canvas) {
|
||||
canvas.save();
|
||||
|
||||
int top = (currentItem - firstItem) * getItemHeight() + (getItemHeight() - getHeight()) / 2;
|
||||
canvas.translate(PADDING, -top + scrollingOffset);
|
||||
|
||||
itemsLayout.draw(canvas);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws rect for current value
|
||||
*
|
||||
* @param canvas the canvas for drawing
|
||||
*/
|
||||
private void drawCenterRect(Canvas canvas) {
|
||||
int center = getHeight() / 2;
|
||||
int offset = (int) (getItemHeight() / 2 * 1.2);
|
||||
// centerDrawable.setBounds(0, center - offset, getWidth(), center + offset);
|
||||
// centerDrawable.draw(canvas);
|
||||
canvas.drawRect(0, center - offset, getWidth(), center + offset, mPaintRectCenter);
|
||||
|
||||
canvas.drawLine(0, center - offset, getWidth(), center - offset, mPaintLineCenter);
|
||||
canvas.drawLine(0, center + offset, getWidth(), center + offset, mPaintLineCenter);
|
||||
|
||||
int x = getWidth() - 1;
|
||||
canvas.drawLine(x, mLineRightMar, x, getHeight() - mLineRightMar, mPaintLineRight);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (!isEnabled() || getViewAdapter() == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (getParent() != null) {
|
||||
getParent().requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (!isScrollingPerformed) {
|
||||
int distance = (int) event.getY() - getHeight() / 2;
|
||||
if (distance > 0) {
|
||||
distance += getItemHeight() / 2;
|
||||
} else {
|
||||
distance -= getItemHeight() / 2;
|
||||
}
|
||||
int items = distance / getItemHeight();
|
||||
if (items != 0 && isValidItemIndex(currentItem + items)) {
|
||||
notifyClickListenersAboutClick(currentItem + items);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return scroller.onTouchEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls the wheel
|
||||
*
|
||||
* @param delta the scrolling value
|
||||
*/
|
||||
private void doScroll(int delta) {
|
||||
scrollingOffset += delta;
|
||||
|
||||
int itemHeight = getItemHeight();
|
||||
int count = scrollingOffset / itemHeight;
|
||||
|
||||
int pos = currentItem - count;
|
||||
int itemCount = viewAdapter.getItemsCount();
|
||||
|
||||
int fixPos = scrollingOffset % itemHeight;
|
||||
if (Math.abs(fixPos) <= itemHeight / 2) {
|
||||
fixPos = 0;
|
||||
}
|
||||
if (isCyclic && itemCount > 0) {
|
||||
if (fixPos > 0) {
|
||||
pos--;
|
||||
count++;
|
||||
} else if (fixPos < 0) {
|
||||
pos++;
|
||||
count--;
|
||||
}
|
||||
// fix position by rotating
|
||||
while (pos < 0) {
|
||||
pos += itemCount;
|
||||
}
|
||||
pos %= itemCount;
|
||||
} else {
|
||||
//
|
||||
if (pos < 0) {
|
||||
count = currentItem;
|
||||
pos = 0;
|
||||
} else if (pos >= itemCount) {
|
||||
count = currentItem - itemCount + 1;
|
||||
pos = itemCount - 1;
|
||||
} else if (pos > 0 && fixPos > 0) {
|
||||
pos--;
|
||||
count++;
|
||||
} else if (pos < itemCount - 1 && fixPos < 0) {
|
||||
pos++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
int offset = scrollingOffset;
|
||||
if (pos != currentItem) {
|
||||
setCurrentItem(pos, false);
|
||||
} else {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// update offset
|
||||
scrollingOffset = offset - count * itemHeight;
|
||||
if (scrollingOffset > getHeight()) {
|
||||
scrollingOffset = scrollingOffset % getHeight() + getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the wheel
|
||||
*
|
||||
* @param itemsToScroll items to scroll
|
||||
* @param time scrolling duration
|
||||
*/
|
||||
public void scroll(int itemsToScroll, int time) {
|
||||
int distance = itemsToScroll * getItemHeight() - scrollingOffset;
|
||||
scroller.scroll(distance, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates range for wheel items
|
||||
*
|
||||
* @return the items range
|
||||
*/
|
||||
private ItemsRange getItemsRange() {
|
||||
if (getItemHeight() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int first = currentItem;
|
||||
int count = 1;
|
||||
|
||||
while (count * getItemHeight() < getHeight()) {
|
||||
first--;
|
||||
count += 2; // top + bottom items
|
||||
}
|
||||
|
||||
if (scrollingOffset != 0) {
|
||||
if (scrollingOffset > 0) {
|
||||
first--;
|
||||
}
|
||||
count++;
|
||||
|
||||
// process empty items above the first or below the second
|
||||
int emptyItems = scrollingOffset / getItemHeight();
|
||||
first -= emptyItems;
|
||||
count += Math.asin(emptyItems);
|
||||
}
|
||||
return new ItemsRange(first, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds wheel items if necessary. Caches all unused items.
|
||||
*
|
||||
* @return true if items are rebuilt
|
||||
*/
|
||||
private boolean rebuildItems() {
|
||||
boolean updated = false;
|
||||
ItemsRange range = getItemsRange();
|
||||
if (itemsLayout != null) {
|
||||
int first = recycle.recycleItems(itemsLayout, firstItem, range, currentItem);
|
||||
updated = firstItem != first;
|
||||
firstItem = first;
|
||||
} else {
|
||||
createItemsLayout();
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (!updated) {
|
||||
updated = firstItem != range.getFirst() || itemsLayout.getChildCount() != range.getCount();
|
||||
}
|
||||
|
||||
if (firstItem > range.getFirst() && firstItem <= range.getLast()) {
|
||||
for (int i = firstItem - 1; i >= range.getFirst(); i--) {
|
||||
if (!addViewItem(i, true)) {
|
||||
break;
|
||||
}
|
||||
firstItem = i;
|
||||
}
|
||||
} else {
|
||||
firstItem = range.getFirst();
|
||||
}
|
||||
|
||||
int first = firstItem;
|
||||
for (int i = itemsLayout.getChildCount(); i < range.getCount(); i++) {
|
||||
if (!addViewItem(firstItem + i, false) && itemsLayout.getChildCount() == 0) {
|
||||
first++;
|
||||
}
|
||||
}
|
||||
firstItem = first;
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates view. Rebuilds items and label if necessary, recalculate items sizes.
|
||||
*/
|
||||
private void updateView() {
|
||||
if (rebuildItems()) {
|
||||
calculateLayoutWidth(getWidth(), MeasureSpec.EXACTLY);
|
||||
layout(getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates item layouts if necessary
|
||||
*/
|
||||
private void createItemsLayout() {
|
||||
if (itemsLayout == null) {
|
||||
itemsLayout = new LinearLayout(getContext());
|
||||
itemsLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds view for measuring
|
||||
*/
|
||||
private void buildViewForMeasuring() {
|
||||
// clear all items
|
||||
if (itemsLayout != null) {
|
||||
recycle.recycleItems(itemsLayout, firstItem, new ItemsRange(), currentItem);
|
||||
} else {
|
||||
createItemsLayout();
|
||||
}
|
||||
|
||||
// add views
|
||||
int addItems = visibleItems / 2;
|
||||
for (int i = currentItem + addItems; i >= currentItem - addItems; i--) {
|
||||
if (addViewItem(i, true)) {
|
||||
firstItem = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds view for item to items layout
|
||||
*
|
||||
* @param index the item index
|
||||
* @param first the flag indicates if view should be first
|
||||
* @return true if corresponding item exists and is added
|
||||
*/
|
||||
private boolean addViewItem(int index, boolean first) {
|
||||
View view = getItemView(index);
|
||||
refreshTextStatus(view, index);
|
||||
if (view != null) {
|
||||
if (first) {
|
||||
itemsLayout.addView(view, 0);
|
||||
} else {
|
||||
itemsLayout.addView(view);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void refreshTextStatus(View view, int index) {
|
||||
if (!(view instanceof TextView))
|
||||
return;
|
||||
TextView textView = (TextView) view;
|
||||
if (index == currentItem) {
|
||||
textView.setTextColor(selectorColor);
|
||||
} else {
|
||||
textView.setTextColor(defaultColor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether intem index is valid
|
||||
*
|
||||
* @param index the item index
|
||||
* @return true if item index is not out of bounds or the wheel is cyclic
|
||||
*/
|
||||
private boolean isValidItemIndex(int index) {
|
||||
return viewAdapter != null && viewAdapter.getItemsCount() > 0 &&
|
||||
(isCyclic || index >= 0 && index < viewAdapter.getItemsCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns view for specified item
|
||||
*
|
||||
* @param index the item index
|
||||
* @return item view or empty view if index is out of bounds
|
||||
*/
|
||||
private View getItemView(int index) {
|
||||
if (viewAdapter == null || viewAdapter.getItemsCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
int count = viewAdapter.getItemsCount();
|
||||
if (!isValidItemIndex(index)) {
|
||||
return viewAdapter.getEmptyItem(recycle.getEmptyItem(), itemsLayout);
|
||||
} else {
|
||||
while (index < 0) {
|
||||
index = count + index;
|
||||
}
|
||||
}
|
||||
|
||||
index %= count;
|
||||
|
||||
View view = viewAdapter.getItem(index, recycle.getItem(), itemsLayout);
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops scrolling
|
||||
*/
|
||||
public void stopScrolling() {
|
||||
scroller.stopScrolling();
|
||||
}
|
||||
}
|
16
TimePickerDialog/src/main/res/anim/slide_in_bottom.xml
Normal file
16
TimePickerDialog/src/main/res/anim/slide_in_bottom.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"/>
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0%"
|
||||
android:fromYDelta="100%"
|
||||
android:toXDelta="0%"
|
||||
android:toYDelta="0%"/>
|
||||
</set>
|
14
TimePickerDialog/src/main/res/anim/slide_out_bottom.xml
Normal file
14
TimePickerDialog/src/main/res/anim/slide_out_bottom.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:shareInterpolator="false">
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.5"/>
|
||||
<translate
|
||||
android:fromXDelta="0%"
|
||||
android:fromYDelta="0%"
|
||||
android:toXDelta="0%"
|
||||
android:toYDelta="100%"/>
|
||||
</set>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="line">
|
||||
|
||||
<solid android:color="@color/timepicker_line"/>
|
||||
<size
|
||||
android:width="@dimen/picker_line_width"
|
||||
/>
|
||||
<padding
|
||||
android:bottom="@dimen/picker_line_mar"
|
||||
android:top="@dimen/picker_line_mar"/>
|
||||
</shape>
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<color android:color="#33000000"/>
|
||||
</item>
|
||||
<item>
|
||||
<color android:color="@android:color/transparent"/>
|
||||
</item>
|
||||
|
||||
</selector>
|
48
TimePickerDialog/src/main/res/drawable/wheel_bg.xml
Normal file
48
TimePickerDialog/src/main/res/drawable/wheel_bg.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Android Wheel Control.
|
||||
http://android-devblog.blogspot.com/2010/05/wheel-ui-contol.html
|
||||
|
||||
Copyright 2010 Yuri Kanivets
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:centerColor="#DDD"
|
||||
android:endColor="#333"
|
||||
android:startColor="#333"/>
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#FF333333"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="1dp"
|
||||
android:left="4dp"
|
||||
android:right="4dp"
|
||||
android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:centerColor="#FFF"
|
||||
android:endColor="#AAA"
|
||||
android:startColor="#AAA"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
23
TimePickerDialog/src/main/res/drawable/wheel_val.xml
Normal file
23
TimePickerDialog/src/main/res/drawable/wheel_val.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Android Wheel Control.
|
||||
http://android-devblog.blogspot.com/2010/05/wheel-ui-contol.html
|
||||
|
||||
Copyright 2010 Yuri Kanivets
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#10ff0000"/>
|
||||
</shape>
|
104
TimePickerDialog/src/main/res/layout/timepicker_layout.xml
Normal file
104
TimePickerDialog/src/main/res/layout/timepicker_layout.xml
Normal file
@ -0,0 +1,104 @@
|
||||
<?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:gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/picker_toolbar_height"
|
||||
android:background="#ffffff"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/timepicker_sel_text_item"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/picker_cancel"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center"
|
||||
android:text="@string/picker_title"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sure"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/timepicker_sel_text_item"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/picker_sure"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/picker_dialog_height">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_wheel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<com.jzxiang.pickerview.wheel.WheelView
|
||||
android:id="@+id/year"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.3" />
|
||||
|
||||
|
||||
<com.jzxiang.pickerview.wheel.WheelView
|
||||
android:id="@+id/month"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0" />
|
||||
|
||||
|
||||
<com.jzxiang.pickerview.wheel.WheelView
|
||||
android:id="@+id/day"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0" />
|
||||
|
||||
|
||||
<com.jzxiang.pickerview.wheel.WheelView
|
||||
android:id="@+id/hour"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0" />
|
||||
|
||||
<com.jzxiang.pickerview.wheel.WheelView
|
||||
android:id="@+id/minute"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
8
TimePickerDialog/src/main/res/layout/timepicker_line.xml
Normal file
8
TimePickerDialog/src/main/res/layout/timepicker_line.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<View
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/picker_line_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="@dimen/picker_line_mar"
|
||||
android:layout_marginTop="@dimen/picker_line_mar"
|
||||
android:background="@color/timepicker_line"/>
|
7
TimePickerDialog/src/main/res/values/colors.xml
Normal file
7
TimePickerDialog/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="timetimepicker_default_text_color">#999999</color>
|
||||
<color name="timepicker_toolbar_bg">#e60012</color>
|
||||
<color name="timepicker_dialog_bg">#80000000</color>
|
||||
<color name="timepicker_line">#e8e8e8</color>
|
||||
</resources>
|
10
TimePickerDialog/src/main/res/values/dimens.xml
Normal file
10
TimePickerDialog/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="picker_default_text_size">12sp</dimen>
|
||||
<dimen name="picker_toolbar_height">60dp</dimen>
|
||||
<dimen name="picker_dialog_height">220dp</dimen>
|
||||
<dimen name="textview_default_padding">5dp</dimen>
|
||||
<dimen name="picker_line_width">1dp</dimen>
|
||||
<dimen name="picker_line_mar">15dp</dimen>
|
||||
<dimen name="picker_height">280dp</dimen>
|
||||
</resources>
|
12
TimePickerDialog/src/main/res/values/strings.xml
Normal file
12
TimePickerDialog/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<string name="picker_sure">确定</string>
|
||||
<string name="picker_cancel">取消</string>
|
||||
<string name="picker_title">选择时间</string>
|
||||
|
||||
<string name="picker_year">年</string>
|
||||
<string name="picker_month">月</string>
|
||||
<string name="picker_day">日</string>
|
||||
<string name="picker_hour">时</string>
|
||||
<string name="picker_minute">分</string>
|
||||
|
||||
</resources>
|
17
TimePickerDialog/src/main/res/values/style.xml
Normal file
17
TimePickerDialog/src/main/res/values/style.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Dialog.NoTitle" parent="Theme.AppCompat.Dialog">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@style/AnimationPicker</item>
|
||||
</style>
|
||||
|
||||
<style name="AnimationPicker" mce_bogus="1" parent="android:Animation">
|
||||
<item name="android:windowEnterAnimation">@anim/slide_in_bottom</item>
|
||||
<item name="android:windowExitAnimation">@anim/slide_out_bottom</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -59,8 +59,8 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.release
|
||||
// buildConfigField "String", "DOMAIN", '"http://192.168.18.74:8080"'x
|
||||
buildConfigField "String", "DOMAIN", '"http://47.109.205.240:8080"'
|
||||
buildConfigField "String", "DOMAIN", '"http://192.168.18.74:8080"'
|
||||
// buildConfigField "String", "DOMAIN", '"http://47.109.205.240:8080"'
|
||||
jniDebuggable false
|
||||
zipAlignEnabled false
|
||||
}
|
||||
@ -130,4 +130,5 @@ dependencies {
|
||||
implementation 'com.github.li-xiaojun:XPopup:v2.2.23'
|
||||
|
||||
implementation project(path: ':AlbumDialog')
|
||||
implementation project(path: ':TimePickerDialog')
|
||||
}
|
||||
|
@ -178,6 +178,26 @@
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.land.EditInspectionActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.land.AddIllegalInformationActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.land.IllegalDetailActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.land.IllegalListActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.photoview.PhotoViewActivty"
|
||||
|
@ -29,6 +29,7 @@ public class Api {
|
||||
public static final String STR_AUTHORIZATION = "Authorization";
|
||||
|
||||
public static final String LOGIN = BASE_HOST + "/auth/app/login";
|
||||
public static final String LOGOUT = BASE_HOST + "/auth/logout";
|
||||
public static final String FILE_UPLOAD = BASE_HOST + "/uploadApis/upload";
|
||||
public static final String CAPTCHA = BASE_HOST + "/auth/app/captcha";
|
||||
public static final String HOME = BASE_HOST + "/app/home/data";
|
||||
@ -56,11 +57,19 @@ public class Api {
|
||||
public static final String PLANT_PLAN_ACTUAL = BASE_HOST + "/land-resource/annualManage/save-actual";
|
||||
|
||||
/* 土地巡查 */
|
||||
public static final String INSPECTION_STATUS = BASE_HOST + "/system/dict/data/type/land_inspection_status";
|
||||
public static final String INSPECTION_TYPE = BASE_HOST + "/system/dict/data/type/land_res_patrol_type";
|
||||
public static final String INSPECTION_LIST_ADMIN = BASE_HOST + "/land-resource/landInspection/page";
|
||||
public static final String INSPECTION_LIST_GENERAL = BASE_HOST + "/land-resource/landInspection/page/general";
|
||||
public static final String INSPECTION_DETAIL = BASE_HOST + "/land-resource/landInspection/";
|
||||
public static final String INSPECTION_ADD = BASE_HOST + "/land-resource/landInspection/save";
|
||||
public static final String INSPECTION_EDIT = BASE_HOST + "/land-resource/landInspection/update";
|
||||
public static final String INSPECTION_EDIT_STATUS = BASE_HOST + "/land-resource/landInspection/updateStatus";
|
||||
public static final String GRID_MEMBER = BASE_HOST + "/land-resource/grid-member/current-user";
|
||||
public static final String LAND_ILLEGAL_TYPE = BASE_HOST + "/system/dict/data/type/land_inspection_illegal_type";
|
||||
/* 土地违法 */
|
||||
public static final String ILLEGAL_ADD = BASE_HOST + "/land-resource/inspection/result/save";
|
||||
public static final String ILLEGAL_DETAIL = BASE_HOST + "/land-resource/inspection/result/";
|
||||
public static final String ILLEGAL_LIST = BASE_HOST + "/land-resource/inspection/illegal/list";
|
||||
|
||||
|
||||
}
|
||||
|
@ -113,6 +113,10 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> {
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
AppConfig.getInstance().setUserInfo(data);
|
||||
setText(binding.userNameTv, data.getLandUserInfo().getGridMemberInfo().getMemberName());
|
||||
setText(binding.userDepartmentTv, data.getDepartmental());
|
||||
setText(binding.userTelTv, data.getPhone() + " " + data.getNo());
|
||||
GlideLoader.loadCircle(binding.userHeadIv, data.getHeadPic());
|
||||
}, (OnError) error -> {
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
@ -120,13 +124,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> {
|
||||
|
||||
private void initView(HomeEntity data) {
|
||||
setText(binding.tvTodoCount, data.getTodoCount().toString());
|
||||
setText(binding.userNameTv, data.getUserInfo().getUsername());
|
||||
setText(binding.userDepartmentTv, data.getUserInfo().getDepartmental());
|
||||
// setText(binding.userDepartmentTv, data.getUserInfo().getOrganization() + " - " + data.getUserInfo().getDepartmental());
|
||||
setText(binding.userTelTv, data.getUserInfo().getPhone() + " " + data.getUserInfo().getNo());
|
||||
GlideLoader.loadCircle(binding.userHeadIv, data.getUserInfo().getHeadPic());
|
||||
funcAdapter.setNewData(data.getFunction());
|
||||
|
||||
setText(binding.tudiCount, data.getDatas().getLandArea().getTotal().toString());
|
||||
List<PieBean> datalist = new ArrayList<>();
|
||||
for (HomeEntity.DatasEntity.LandAreaEntity.ListEntity entity : data.getDatas().getLandArea().getList()) {
|
||||
@ -150,10 +148,9 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding> {
|
||||
//TODO
|
||||
setText(binding.zhutiCount, data.getDatas().getBusiness().getTotal().toString());
|
||||
datalist.clear();
|
||||
datalist.add(new PieBean(24, "农企合作社"));
|
||||
datalist.add(new PieBean(12, "农资企业"));
|
||||
datalist.add(new PieBean(20, "加工企业"));
|
||||
datalist.add(new PieBean(5, "种源企业"));
|
||||
for (HomeEntity.DatasEntity.BusinessEntity.ListEntityXX entity : data.getDatas().getBusiness().getList()) {
|
||||
datalist.add(new PieBean(entity.getCount(), entity.getName()));
|
||||
}
|
||||
binding.zhutiChart.setLoading(false);
|
||||
binding.zhutiChart.setChartData(PieBean.class, "Numner", "Name", datalist, null);
|
||||
|
||||
|
@ -4,14 +4,11 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.tairui.gov_affairs_cloud.ui.my.entity.UserInfoEntity;
|
||||
|
||||
public class HomeEntity implements Serializable {
|
||||
|
||||
@SerializedName("todoCount")
|
||||
private Integer todoCount;
|
||||
@SerializedName("userInfo")
|
||||
private UserInfoEntity userInfo;
|
||||
@SerializedName("datas")
|
||||
private DatasEntity datas;
|
||||
@SerializedName("function")
|
||||
@ -25,14 +22,6 @@ public class HomeEntity implements Serializable {
|
||||
this.todoCount = todoCount;
|
||||
}
|
||||
|
||||
public UserInfoEntity getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(UserInfoEntity userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public DatasEntity getDatas() {
|
||||
return datas;
|
||||
}
|
||||
@ -49,7 +38,6 @@ public class HomeEntity implements Serializable {
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
|
||||
public static class DatasEntity {
|
||||
@SerializedName("landArea")
|
||||
private LandAreaEntity landArea;
|
||||
|
@ -0,0 +1,291 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
import com.jzxiang.pickerview.TimePickerDialog;
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
import com.jzxiang.pickerview.listener.OnDateSetListener;
|
||||
import com.kongzue.albumdialog.PhotoAlbumDialog;
|
||||
import com.kongzue.albumdialog.util.SelectPhotoCallback;
|
||||
import com.kongzue.dialogx.dialogs.PopMenu;
|
||||
import com.kongzue.dialogx.dialogs.PopTip;
|
||||
import com.kongzue.dialogx.util.ItemDivider;
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.config.AppConfig;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityAddIllegalInformationBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventConstant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.entity.UploadEntity;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.DictDataEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.my.entity.UserInfoEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.DateUtils;
|
||||
import com.tairui.gov_affairs_cloud.util.DensityUtils;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
import com.tairui.gov_affairs_cloud.util.glide.GlideLoader;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import rxhttp.RxHttp;
|
||||
import rxhttp.RxHttpFormParam;
|
||||
import rxhttp.RxHttpJsonParam;
|
||||
|
||||
public class AddIllegalInformationActivity extends BaseActivity<ActivityAddIllegalInformationBinding> implements OnDateSetListener {
|
||||
|
||||
private List<DictDataEntity> typeData;
|
||||
private DictDataEntity selectType;
|
||||
private TimePickerDialog mDialogMonthDayHourMinute;
|
||||
private OptionsPickerView landPickerView;
|
||||
private OptionsPickerView landTypePickerView;
|
||||
private UserInfoEntity.LandUserInfoEntity.LandListEntity selectLand;
|
||||
private UserInfoEntity userInfo;
|
||||
private String landImgPath;
|
||||
private UploadEntity landImgEntity;
|
||||
private String illegalTime;
|
||||
private int isIllegal = -1;
|
||||
private String inspectionId;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityAddIllegalInformationBinding> getBindingClass() {
|
||||
return ActivityAddIllegalInformationBinding.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
inspectionId = getIntent().getStringExtra("id");
|
||||
userInfo = AppConfig.getInstance().getUserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
mDialogMonthDayHourMinute = new TimePickerDialog.Builder()
|
||||
.setType(Type.MONTH_DAY_HOUR_MIN)
|
||||
.setTitleStringId("选择违法时间")
|
||||
.setWheelItemTextSize(14)
|
||||
.setCallBack(this)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindListener() {
|
||||
binding.btnBack.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.btnSubmit.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
checkSubmit();
|
||||
}
|
||||
});
|
||||
binding.layoutAction.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showLandTypeDialog();
|
||||
}
|
||||
});
|
||||
binding.layoutTime.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
mDialogMonthDayHourMinute.show(getSupportFragmentManager(), "month_day_hour_minute");
|
||||
}
|
||||
});
|
||||
binding.layoutRegion.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showLandDialog();
|
||||
}
|
||||
});
|
||||
binding.btnSelectImg.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
selectImg();
|
||||
}
|
||||
});
|
||||
binding.layoutIsIllegal.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showIsIllegalMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showIsIllegalMenu() {
|
||||
List<CharSequence> menus = new ArrayList<>();
|
||||
menus.add("否");
|
||||
menus.add("是");
|
||||
PopMenu.show(binding.tvIsIllegal, menus)
|
||||
.setBackgroundColorRes(R.color.white)
|
||||
.setWidth(DensityUtils.dp2px(mContext, 100))
|
||||
.setOnMenuItemClickListener((dialog, text, index) -> {
|
||||
isIllegal = index;
|
||||
setText(binding.tvIsIllegal, text.toString());
|
||||
setGone(binding.illegalLayout, index == 1);
|
||||
return false;
|
||||
}).setItemDivider(new ItemDivider(15, 15, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateSet(TimePickerDialog timePickerView, long millseconds) {
|
||||
illegalTime = DateUtils.getDateToString(millseconds);
|
||||
setText(binding.tvTime, illegalTime);
|
||||
}
|
||||
|
||||
private void showLandDialog() {
|
||||
if (landPickerView == null) {
|
||||
landPickerView = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
|
||||
selectLand = userInfo.getLandUserInfo().getLandList().get(options1);
|
||||
setText(binding.tvRegion, selectLand.getLandName());
|
||||
}).setTitleText("地块选择").setContentTextSize(20)
|
||||
.setSelectOptions(0)
|
||||
.setTitleBgColor(Color.WHITE)
|
||||
.isRestoreItem(true)
|
||||
.isCenterLabel(false)
|
||||
.setOutSideColor(0x00000000)
|
||||
.build();
|
||||
|
||||
landPickerView.setPicker(userInfo.getLandUserInfo().getLandList());
|
||||
}
|
||||
landPickerView.show();
|
||||
}
|
||||
|
||||
private void showLandTypeDialog() {
|
||||
if (landTypePickerView == null) {
|
||||
landTypePickerView = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
|
||||
selectType = typeData.get(options1);
|
||||
setText(binding.tvAction, selectType.getDictLabel());
|
||||
}).setTitleText("违法行为选择").setContentTextSize(20)
|
||||
.setSelectOptions(0)
|
||||
.setTitleBgColor(Color.WHITE)
|
||||
.isRestoreItem(true)
|
||||
.isCenterLabel(false)
|
||||
.setOutSideColor(0x00000000)
|
||||
.build();
|
||||
|
||||
landTypePickerView.setPicker(typeData);
|
||||
}
|
||||
landTypePickerView.show();
|
||||
}
|
||||
|
||||
private void selectImg() {
|
||||
PhotoAlbumDialog.build()
|
||||
.setCompressQuality(90) //开启压缩并指定质量 90%
|
||||
.setCompressPhoto(false) //是否压缩(开启回调格式为 jpg,不开启回调格式为 png)
|
||||
.setMaxSelectPhotoCount(1) //最多选择三张照片
|
||||
.setClip(false) //开启裁剪模式
|
||||
.setMaxSize(1000) //最高分辨率 1000(宽或高大于 1000会被等比缩小到 1000内)
|
||||
.setMaxWidth(1000) //最大宽度
|
||||
.setMaxHeight(1000) //最大高度
|
||||
.setCallback(new SelectPhotoCallback() {
|
||||
@Override
|
||||
public void selectedPhoto(String selectedPhotos) {
|
||||
landImgPath = selectedPhotos;
|
||||
GlideLoader.loadOriginal(binding.imgLand, selectedPhotos);
|
||||
setGone(binding.imgLand, true);
|
||||
setGone(binding.btnReSelectImg, true);
|
||||
}
|
||||
})
|
||||
.setDialogDialogImplCallback(dialog -> dialog.setRadius(DensityUtils.dp2px(mContext, 25)))
|
||||
.show(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
getIllegalTypeData();
|
||||
}
|
||||
|
||||
private void getIllegalTypeData() {
|
||||
RxHttp.get(Api.LAND_ILLEGAL_TYPE)
|
||||
.asResponseList(DictDataEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
typeData = data;
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void checkSubmit() {
|
||||
if (selectLand == null) {
|
||||
showError("请选择地块");
|
||||
return;
|
||||
}
|
||||
if (isIllegal == -1) {
|
||||
showError("请选择是否违法");
|
||||
return;
|
||||
}
|
||||
if (isIllegal == 1) {
|
||||
if (TextUtils.isEmpty(illegalTime)) {
|
||||
showError("请选择违法时间");
|
||||
return;
|
||||
}
|
||||
if (selectType == null) {
|
||||
showError("请选择违法行为");
|
||||
return;
|
||||
}
|
||||
String desc = binding.inputDesc.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(desc)) {
|
||||
showError("请填写违法行为描述");
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(landImgPath)) {
|
||||
showError("请选择巡查相片");
|
||||
return;
|
||||
}
|
||||
showLoading();
|
||||
uploadLandImg();
|
||||
} else {
|
||||
showLoading();
|
||||
doAddIllegal();
|
||||
}
|
||||
}
|
||||
|
||||
private void uploadLandImg() {
|
||||
RxHttpFormParam http = RxHttp.postForm(Api.FILE_UPLOAD);
|
||||
http.addFile("file", new File(landImgPath));
|
||||
http.asSingleUpload(UploadEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
landImgEntity = data;
|
||||
doAddIllegal();
|
||||
}, (OnError) error -> {
|
||||
PopTip.show("图片上传失败:" + error.getErrorMsg()).iconError();
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
private void doAddIllegal() {
|
||||
RxHttpJsonParam http = RxHttp.postJson(Api.ILLEGAL_ADD);
|
||||
http.add("inspectionId", inspectionId).add("landId", selectLand.getId()).add("illegalFlag", isIllegal);
|
||||
if (isIllegal == 1) {
|
||||
http.add("illegalDate", illegalTime);
|
||||
http.add("illegalTypeCode", selectType.getDictValue());
|
||||
String desc = binding.inputDesc.getText().toString().trim();
|
||||
http.add("desc", desc);
|
||||
http.add("img", landImgEntity.getUrl());
|
||||
}
|
||||
http.asResponse(Boolean.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
PopTip.show("巡查结果登记成功").iconSuccess();
|
||||
EventBus.getDefault().post(new EventMessage(EventConstant.REFRESH_LIST));
|
||||
binding.btnSubmit.postDelayed(() -> finish(), 1000);
|
||||
}, (OnError) error -> {
|
||||
PopTip.show(error.getErrorMsg()).iconError();
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -24,6 +24,7 @@ import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.DictDataEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.GridMemberEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.MemberListEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.ArrayUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.DensityUtils;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
@ -38,8 +39,8 @@ import rxhttp.RxHttp;
|
||||
|
||||
public class AddInspectionActivity extends BaseActivity<ActivityAddInspectionBinding> {
|
||||
|
||||
private List<GridMemberEntity.MemberListEntity> membersData;
|
||||
private List<GridMemberEntity.MemberListEntity> selectMembersData;
|
||||
private List<MemberListEntity> membersData;
|
||||
private List<MemberListEntity> selectMembersData;
|
||||
private List<CharSequence> multiSelectMenuText;
|
||||
private int[] cacheSelectMenuIndexArray;
|
||||
private List<Integer> selectMenuIndexArray = new ArrayList<>();
|
||||
@ -196,7 +197,7 @@ public class AddInspectionActivity extends BaseActivity<ActivityAddInspectionBin
|
||||
}
|
||||
String taskNotes = binding.inputTaskNotes.getText().toString().trim();
|
||||
JsonArray memeberIds = new JsonArray();
|
||||
for (GridMemberEntity.MemberListEntity selectMembersDatum : selectMembersData) {
|
||||
for (MemberListEntity selectMembersDatum : selectMembersData) {
|
||||
memeberIds.add(selectMembersDatum.getId());
|
||||
}
|
||||
showLoading();
|
||||
@ -220,14 +221,14 @@ public class AddInspectionActivity extends BaseActivity<ActivityAddInspectionBin
|
||||
});
|
||||
}
|
||||
|
||||
private class MemberAdapter extends BaseQuickAdapter<GridMemberEntity.MemberListEntity, BaseViewHolder> {
|
||||
private class MemberAdapter extends BaseQuickAdapter<MemberListEntity, BaseViewHolder> {
|
||||
|
||||
public MemberAdapter() {
|
||||
super(R.layout.item_select_member);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder holder, GridMemberEntity.MemberListEntity entity) {
|
||||
protected void convert(@NonNull BaseViewHolder holder, MemberListEntity entity) {
|
||||
holder.setText(R.id.tvName, entity.getMemberName());
|
||||
holder.addOnClickListener(R.id.btnDelete);
|
||||
}
|
||||
|
@ -0,0 +1,276 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.kongzue.dialogx.dialogs.BottomMenu;
|
||||
import com.kongzue.dialogx.dialogs.MessageDialog;
|
||||
import com.kongzue.dialogx.dialogs.PopMenu;
|
||||
import com.kongzue.dialogx.dialogs.PopTip;
|
||||
import com.kongzue.dialogx.interfaces.OnMenuButtonClickListener;
|
||||
import com.kongzue.dialogx.interfaces.OnMenuItemSelectListener;
|
||||
import com.kongzue.dialogx.util.ItemDivider;
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityEditInspectionBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventConstant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.DictDataEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.GridMemberEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.InspectionListEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.MemberListEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.ArrayUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.DensityUtils;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import rxhttp.RxHttp;
|
||||
import rxhttp.RxHttpJsonParam;
|
||||
|
||||
public class EditInspectionActivity extends BaseActivity<ActivityEditInspectionBinding> {
|
||||
|
||||
private List<MemberListEntity> membersData;
|
||||
private List<MemberListEntity> selectMembersData;
|
||||
private List<CharSequence> multiSelectMenuText;
|
||||
private int[] cacheSelectMenuIndexArray;
|
||||
private List<Integer> selectMenuIndexArray = new ArrayList<>();
|
||||
private MemberAdapter memberAdapter;
|
||||
private List<DictDataEntity> typeData;
|
||||
private DictDataEntity selectType;
|
||||
|
||||
private InspectionListEntity.RecordsEntity mData;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityEditInspectionBinding> getBindingClass() {
|
||||
return ActivityEditInspectionBinding.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
mData = (InspectionListEntity.RecordsEntity) getIntent().getSerializableExtra("data");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
binding.inputTaskCode.setHint(mData.getTaskCode());
|
||||
binding.inputTaskName.setHint(mData.getTaskName());
|
||||
binding.tvType.setHint(mData.getInspectionType());
|
||||
binding.tvMembers.setHint(mData.getTaskMembers());
|
||||
binding.inputTaskTarget.setHint(mData.getInspectionTarget());
|
||||
binding.inputTaskNotes.setHint(mData.getNotes());
|
||||
binding.membersRecycler.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, true));
|
||||
binding.membersRecycler.setHasFixedSize(true);
|
||||
memberAdapter = new MemberAdapter();
|
||||
binding.membersRecycler.setAdapter(memberAdapter);
|
||||
setGone(binding.membersRecycler, false);
|
||||
setGone(binding.tvMembers, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindListener() {
|
||||
binding.btnBack.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.btnAddMember.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showMemeberDialog();
|
||||
}
|
||||
});
|
||||
binding.layoutType.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showTypeMenu();
|
||||
}
|
||||
});
|
||||
binding.btnSubmit.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
MessageDialog.show("修改", "确定执行修改吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
checkSubmit();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
memberAdapter.setOnItemChildClickListener((baseQuickAdapter, view, i) -> {
|
||||
if (view.getId() == R.id.btnDelete) {
|
||||
memberAdapter.remove(i);
|
||||
selectMenuIndexArray.remove(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
getMemberList();
|
||||
getInspectionTypeData();
|
||||
}
|
||||
|
||||
private void showTypeMenu() {
|
||||
List<CharSequence> menus = new ArrayList<>();
|
||||
for (DictDataEntity item : typeData) {
|
||||
menus.add(item.getDictLabel());
|
||||
}
|
||||
PopMenu.show(binding.tvType, menus)
|
||||
.setBackgroundColorRes(R.color.white)
|
||||
.setWidth(DensityUtils.dp2px(mContext, 100))
|
||||
.setOnMenuItemClickListener((dialog, text, index) -> {
|
||||
selectType = typeData.get(index);
|
||||
setText(binding.tvType, selectType.getDictLabel());
|
||||
return false;
|
||||
}).setItemDivider(new ItemDivider(15, 15, 1));
|
||||
}
|
||||
|
||||
private void getInspectionTypeData() {
|
||||
RxHttp.get(Api.INSPECTION_TYPE)
|
||||
.asResponseList(DictDataEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
typeData = data;
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void getMemberList() {
|
||||
RxHttp.get(Api.GRID_MEMBER)
|
||||
.asResponse(GridMemberEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
membersData = data.getMemberList();
|
||||
multiSelectMenuText = new ArrayList<>();
|
||||
for (int i = 0; i < membersData.size(); i++) {
|
||||
multiSelectMenuText.add(membersData.get(i).getMemberName());
|
||||
}
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void showMemeberDialog() {
|
||||
BottomMenu.show(multiSelectMenuText).setTitle("请选择任务成员")
|
||||
.setOnMenuItemClickListener(new OnMenuItemSelectListener<BottomMenu>() {
|
||||
@Override
|
||||
public void onMultiItemSelect(BottomMenu dialog, CharSequence[] text, int[] indexArray) {
|
||||
cacheSelectMenuIndexArray = indexArray;
|
||||
}
|
||||
}).setOkButton("确定", (OnMenuButtonClickListener<BottomMenu>) (dialog, v) -> {
|
||||
if (cacheSelectMenuIndexArray.length > 3) {
|
||||
showError("最多允许选择3名任务成员");
|
||||
} else if (cacheSelectMenuIndexArray.length <= 0) {
|
||||
showError("至少选择1名任务成员");
|
||||
} else {
|
||||
selectMenuIndexArray.clear();
|
||||
selectMembersData = new ArrayList<>();
|
||||
for (int i : cacheSelectMenuIndexArray) {
|
||||
selectMenuIndexArray.add(i);
|
||||
selectMembersData.add(membersData.get(i));
|
||||
}
|
||||
cacheSelectMenuIndexArray = new int[1];
|
||||
memberAdapter.setNewData(selectMembersData);
|
||||
setGone(binding.membersRecycler, true);
|
||||
setGone(binding.tvMembers, false);
|
||||
}
|
||||
return false;
|
||||
}).setSelection(selectMenuIndexArray);
|
||||
}
|
||||
|
||||
private void checkSubmit() {
|
||||
boolean hasChanged = false;
|
||||
RxHttpJsonParam http = RxHttp.putJson(Api.INSPECTION_EDIT);
|
||||
http.add("id", mData.getId());
|
||||
String taskCode = binding.inputTaskCode.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(taskCode)) {
|
||||
hasChanged = true;
|
||||
http.add("taskCode", taskCode);
|
||||
}
|
||||
String taskName = binding.inputTaskName.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(taskName)) {
|
||||
hasChanged = true;
|
||||
http.add("taskName", taskName);
|
||||
}
|
||||
if (selectMembersData != null) {
|
||||
if (ArrayUtil.size(selectMembersData) <= 0) {
|
||||
showError("任务成员不能为空");
|
||||
return;
|
||||
} else {
|
||||
JsonArray memeberIds = new JsonArray();
|
||||
for (MemberListEntity selectMembersDatum : selectMembersData) {
|
||||
memeberIds.add(selectMembersDatum.getId());
|
||||
}
|
||||
hasChanged = true;
|
||||
http.add("taskUserIds", memeberIds);
|
||||
}
|
||||
}
|
||||
if (selectType != null) {
|
||||
hasChanged = true;
|
||||
http.add("inspectionTypeCode", selectType.getDictValue());
|
||||
}
|
||||
String taskTarget = binding.inputTaskTarget.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(taskTarget)) {
|
||||
hasChanged = true;
|
||||
http.add("inspectionTarget", taskTarget);
|
||||
}
|
||||
String taskNotes = binding.inputTaskNotes.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(taskNotes)) {
|
||||
hasChanged = true;
|
||||
http.add("notes", taskNotes);
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
showLoading();
|
||||
http.asResponse(Boolean.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> doChangeStatus(), (OnError) error -> {
|
||||
PopTip.show(error.getErrorMsg()).iconError();
|
||||
hideLoading();
|
||||
});
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void doChangeStatus() {
|
||||
RxHttp.putJson(Api.INSPECTION_EDIT_STATUS)
|
||||
.add("status", "-1")
|
||||
.add("id", mData.getId())
|
||||
.asResponse(Object.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
PopTip.show("土地巡查信息修改成功").iconSuccess();
|
||||
EventBus.getDefault().post(new EventMessage(EventConstant.REFRESH_LIST));
|
||||
binding.btnSubmit.postDelayed(() -> finish(), 1000);
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
private class MemberAdapter extends BaseQuickAdapter<MemberListEntity, BaseViewHolder> {
|
||||
|
||||
public MemberAdapter() {
|
||||
super(R.layout.item_select_member);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder holder, MemberListEntity entity) {
|
||||
holder.setText(R.id.tvName, entity.getMemberName());
|
||||
holder.addOnClickListener(R.id.btnDelete);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land;
|
||||
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityIllegalDetailBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.IllegalDetailEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.AppUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
import com.tairui.gov_affairs_cloud.util.glide.GlideLoader;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import rxhttp.RxHttp;
|
||||
|
||||
public class IllegalDetailActivity extends BaseActivity<ActivityIllegalDetailBinding> {
|
||||
|
||||
private IllegalDetailEntity mData;
|
||||
private String illegalId;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityIllegalDetailBinding> getBindingClass() {
|
||||
return ActivityIllegalDetailBinding.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
illegalId = getIntent().getStringExtra("id");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindListener() {
|
||||
binding.btnBack.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
RxHttp.get(Api.ILLEGAL_DETAIL + illegalId)
|
||||
.asResponse(IllegalDetailEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
mData = data;
|
||||
initView();
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setText(binding.tvStatus, mData.getStatus().equals("0") ? "待处理" : "已处理");
|
||||
binding.tvStatus.setTextColor(getResColor(mData.getStatus().equals("0") ? R.color.color_txt_green : R.color.color_txt_orange));
|
||||
setText(binding.tvTitle, mData.getLandName());
|
||||
setText(binding.tvIsIllegal, mData.getIllegalFlag().equals("0") ? "否" : "是");
|
||||
setText(binding.tvTime, mData.getIllegalDate());
|
||||
setText(binding.tvAction, mData.getIllegalTypeName());
|
||||
setText(binding.inputDesc, mData.getDesc());
|
||||
GlideLoader.loadOriginal(binding.imgLand, AppUtil.getImageUrl(mData.getImg()));
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.kongzue.dialogx.dialogs.PopMenu;
|
||||
import com.kongzue.dialogx.util.ItemDivider;
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityIllegalListBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventConstant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.IllegalListEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.IllegalListParentEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.ArrayUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.DensityUtils;
|
||||
import com.tairui.gov_affairs_cloud.util.IntentUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
import com.tairui.gov_affairs_cloud.util.ToastUtil;
|
||||
import com.tairui.gov_affairs_cloud.widget.RefreshRecyclerView;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import rxhttp.RxHttp;
|
||||
import rxhttp.RxHttpNoBodyParam;
|
||||
|
||||
public class IllegalListActivity extends BaseActivity<ActivityIllegalListBinding> {
|
||||
|
||||
private IllegalListAdapter mAdapter;
|
||||
private int currentPageIndex = 1;
|
||||
private int status = -1;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityIllegalListBinding> getBindingClass() {
|
||||
return ActivityIllegalListBinding.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
binding.refreshRecycler.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mAdapter = new IllegalListAdapter();
|
||||
binding.refreshRecycler.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindListener() {
|
||||
binding.btnBack.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.refreshRecycler.setRefreshRecyclerListener(new RefreshRecyclerView.RefreshRecyclerListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadmore() {
|
||||
requestData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlankClick() {
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
});
|
||||
mAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
|
||||
IllegalListEntity item = mAdapter.getItem(i);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("id", item.getId());
|
||||
IntentUtil.startActivity(mContext, IllegalDetailActivity.class, bundle);
|
||||
});
|
||||
binding.layoutType.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showStatusMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
|
||||
private void showStatusMenu() {
|
||||
List<CharSequence> menus = new ArrayList<>();
|
||||
menus.add("全部");
|
||||
menus.add("待处理");
|
||||
menus.add("已处理");
|
||||
PopMenu.show(binding.layoutType, menus)
|
||||
.setBackgroundColorRes(R.color.white)
|
||||
.setWidth(DensityUtils.dp2px(mContext, 100))
|
||||
.setOnMenuItemClickListener((dialog, text, index) -> {
|
||||
status = index;
|
||||
setText(binding.tvType, text.toString());
|
||||
// binding.refreshRecycler.showLoading();
|
||||
// currentPageIndex = 1;
|
||||
// requestData(false);
|
||||
return false;
|
||||
}).setItemDivider(new ItemDivider(15, 15, 1));
|
||||
}
|
||||
|
||||
private void requestData(boolean loadmore) {
|
||||
RxHttpNoBodyParam http = RxHttp.get(Api.ILLEGAL_LIST);
|
||||
if (status != -1) {
|
||||
// http.add("inspectionTypeCode", selectType.getDictValue());
|
||||
}
|
||||
http.add("current", currentPageIndex)
|
||||
.add("size", Api.SIZE_PAGE)
|
||||
.asResponse(IllegalListParentEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
if (loadmore) {
|
||||
binding.refreshRecycler.finishLoadMore();
|
||||
}
|
||||
if (!ArrayUtil.isEmpty(data.getRecords())) {
|
||||
if (loadmore) {
|
||||
mAdapter.addData(data.getRecords());
|
||||
} else {
|
||||
mAdapter.setNewData(data.getRecords());
|
||||
}
|
||||
currentPageIndex += 1;
|
||||
if (ArrayUtil.size(data.getRecords()) < Api.SIZE_PAGE) {
|
||||
binding.refreshRecycler.setNoMoreData(true);
|
||||
} else {
|
||||
binding.refreshRecycler.setNoMoreData(false);
|
||||
}
|
||||
binding.refreshRecycler.showContent();
|
||||
} else {
|
||||
binding.refreshRecycler.showError();
|
||||
binding.refreshRecycler.setNoMoreData(true);
|
||||
}
|
||||
}, (OnError) error -> {
|
||||
binding.refreshRecycler.showError();
|
||||
binding.refreshRecycler.setNoMoreData(true);
|
||||
ToastUtil.showLongToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
private class IllegalListAdapter extends BaseQuickAdapter<IllegalListEntity, BaseViewHolder> {
|
||||
|
||||
public IllegalListAdapter() {
|
||||
super(R.layout.item_illegal_2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder holder, IllegalListEntity entity) {
|
||||
holder.setText(R.id.tvLandName,entity.getLandName());
|
||||
holder.setText(R.id.tvIllegalType,entity.getIllegalTypeName());
|
||||
holder.setText(R.id.tvDate,entity.getIllegalDate());
|
||||
|
||||
if (entity.getStatus().equals("0")) {
|
||||
holder.setText(R.id.tvStatus, "待处理");
|
||||
holder.setBackgroundRes(R.id.tvStatus, R.drawable.bg_container_light_green_raduis_2);
|
||||
holder.setTextColor(R.id.tvStatus, getResColor(R.color.color_txt_green));
|
||||
} else {
|
||||
holder.setText(R.id.tvStatus, "已处理");
|
||||
holder.setBackgroundRes(R.id.tvStatus, R.drawable.bg_container_light_orange_raduis_2);
|
||||
holder.setTextColor(R.id.tvStatus, getResColor(R.color.color_txt_orange));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceive(EventMessage message) {
|
||||
if (null != message && !TextUtils.isEmpty(message.getLabel())) {
|
||||
if (EventConstant.REFRESH_LIST.equals(message.getLabel())) {
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -1,17 +1,35 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import com.kongzue.dialogx.dialogs.MessageDialog;
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.config.AppConfig;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityInspectionDetailBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventConstant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.adapter.IllegalListAdapter;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.InspectionListEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.my.entity.UserInfoEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.ArrayUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.IntentUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import rxhttp.RxHttp;
|
||||
|
||||
public class InspectionDetailActivity extends BaseActivity<ActivityInspectionDetailBinding> {
|
||||
|
||||
private InspectionListEntity.RecordsEntity mData;
|
||||
private String mId;
|
||||
private UserInfoEntity userInfo;
|
||||
private IllegalListAdapter illegalListAdapter;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityInspectionDetailBinding> getBindingClass() {
|
||||
@ -20,11 +38,38 @@ public class InspectionDetailActivity extends BaseActivity<ActivityInspectionDet
|
||||
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
mData = (InspectionListEntity.RecordsEntity) getIntent().getSerializableExtra("data");
|
||||
mId = getIntent().getStringExtra("id");
|
||||
userInfo = AppConfig.getInstance().getUserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
binding.resultRecycler.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
binding.resultRecycler.setHasFixedSize(true);
|
||||
illegalListAdapter = new IllegalListAdapter();
|
||||
binding.resultRecycler.setAdapter(illegalListAdapter);
|
||||
illegalListAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("id", illegalListAdapter.getData().get(i).getId());
|
||||
IntentUtil.startActivity(mContext, IllegalDetailActivity.class, bundle);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
RxHttp.get(Api.INSPECTION_DETAIL + mId)
|
||||
.asResponse(InspectionListEntity.RecordsEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
mData = data;
|
||||
initView();
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setText(binding.tvTaskStatus, mData.getInspectionStatusName());
|
||||
setText(binding.tvTaskCode, mData.getTaskCode());
|
||||
setText(binding.tvTaskName, mData.getTaskName());
|
||||
@ -32,14 +77,41 @@ public class InspectionDetailActivity extends BaseActivity<ActivityInspectionDet
|
||||
setText(binding.tvTaskType, mData.getInspectionType());
|
||||
setText(binding.tvTaskTarget, mData.getInspectionTarget());
|
||||
setText(binding.tvTaskNotes, mData.getNotes());
|
||||
if (mData.getInspectionStatus().equals("-1")) {
|
||||
setGone(binding.btnEdit, false);
|
||||
setGone(binding.btnPublish, false);
|
||||
setGone(binding.btnRePublish, false);
|
||||
setGone(binding.btnUndo, false);
|
||||
setGone(binding.btnSubmit, false);
|
||||
setGone(binding.btnRegisty, false);
|
||||
if (mData.getInspectionStatus().equals("-1")) {//待发布
|
||||
binding.tvTaskStatus.setTextColor(getResColor(R.color.color_txt_green));
|
||||
} else if (mData.getInspectionStatus().equals("00")) {
|
||||
if (userInfo.isAdmin()) {
|
||||
setGone(binding.btnEdit, true);
|
||||
setGone(binding.btnPublish, true);
|
||||
}
|
||||
} else if (mData.getInspectionStatus().equals("00")) {//进行中
|
||||
binding.tvTaskStatus.setTextColor(getResColor(R.color.color_txt_blue));
|
||||
} else if (mData.getInspectionStatus().equals("01")) {
|
||||
if (userInfo.isAdmin()) {
|
||||
setGone(binding.btnUndo, true);
|
||||
} else {//登记,提交
|
||||
setGone(binding.btnSubmit, true);
|
||||
setGone(binding.btnRegisty, true);
|
||||
}
|
||||
} else if (mData.getInspectionStatus().equals("01")) {//已结束
|
||||
binding.tvTaskStatus.setTextColor(getResColor(R.color.color_txt_orange));
|
||||
} else if (mData.getInspectionStatus().equals("02")) {
|
||||
} else if (mData.getInspectionStatus().equals("02")) {//已撤销
|
||||
binding.tvTaskStatus.setTextColor(getResColor(R.color.color_tv_content));
|
||||
if (userInfo.isAdmin()) {
|
||||
setGone(binding.btnEdit, true);
|
||||
setGone(binding.btnRePublish, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ArrayUtil.isEmpty(mData.getInspectionResults())) {
|
||||
setGone(binding.resultRecycler, false);
|
||||
} else {
|
||||
setGone(binding.resultRecycler, true);
|
||||
illegalListAdapter.setNewData(mData.getInspectionResults());
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +123,122 @@ public class InspectionDetailActivity extends BaseActivity<ActivityInspectionDet
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.btnUndo.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
MessageDialog.show("撤销", "确定要撤销当前任务吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
doUndo();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
binding.btnEdit.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("data", mData);
|
||||
IntentUtil.startActivity(mContext, EditInspectionActivity.class, bundle);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.btnPublish.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
noticePublish();
|
||||
}
|
||||
});
|
||||
binding.btnRePublish.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
noticePublish();
|
||||
}
|
||||
});
|
||||
binding.btnRegisty.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("id", mData.getId());
|
||||
IntentUtil.startActivity(mContext, AddIllegalInformationActivity.class, bundle);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.btnSubmit.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
MessageDialog.show("完成", "确定要结束当前任务吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
doFinish();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void noticePublish() {
|
||||
MessageDialog.show("发布", "确定要发布当前任务吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
doPublish();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void doUndo() {
|
||||
showLoading();
|
||||
RxHttp.putJson(Api.INSPECTION_EDIT_STATUS)
|
||||
.add("status", "02")
|
||||
.add("id", mData.getId())
|
||||
.asResponse(Object.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
mData.setInspectionStatusName("已撤销");
|
||||
mData.setInspectionStatus("02");
|
||||
initView();
|
||||
EventBus.getDefault().post(new EventMessage(EventConstant.REFRESH_LIST));
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
private void doFinish() {
|
||||
showLoading();
|
||||
RxHttp.putJson(Api.INSPECTION_EDIT_STATUS)
|
||||
.add("status", "01")
|
||||
.add("id", mData.getId())
|
||||
.asResponse(Object.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
mData.setInspectionStatusName("已结束");
|
||||
mData.setInspectionStatus("01");
|
||||
initView();
|
||||
EventBus.getDefault().post(new EventMessage(EventConstant.REFRESH_LIST));
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
private void doPublish() {
|
||||
showLoading();
|
||||
RxHttp.putJson(Api.INSPECTION_EDIT_STATUS)
|
||||
.add("status", "00")
|
||||
.add("id", mData.getId())
|
||||
.asResponse(Object.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
mData.setInspectionStatusName("已发布");
|
||||
mData.setInspectionStatus("00");
|
||||
initView();
|
||||
EventBus.getDefault().post(new EventMessage(EventConstant.REFRESH_LIST));
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,28 +7,21 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.kongzue.dialogx.dialogs.MessageDialog;
|
||||
import com.kongzue.dialogx.dialogs.PopMenu;
|
||||
import com.kongzue.dialogx.util.ItemDivider;
|
||||
import com.orhanobut.hawk.Hawk;
|
||||
import com.rxjava.rxlife.RxLife;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseActivity;
|
||||
import com.tairui.gov_affairs_cloud.config.AppConfig;
|
||||
import com.tairui.gov_affairs_cloud.databinding.ActivityInspectionListBinding;
|
||||
import com.tairui.gov_affairs_cloud.entity.Api;
|
||||
import com.tairui.gov_affairs_cloud.entity.Constant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventConstant;
|
||||
import com.tairui.gov_affairs_cloud.entity.EventMessage;
|
||||
import com.tairui.gov_affairs_cloud.http.OnError;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.DictDataEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.InspectionListEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.LandAreaRegionEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.LandGridEntity;
|
||||
import com.tairui.gov_affairs_cloud.ui.my.entity.UserInfoEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.ArrayUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.DensityUtils;
|
||||
@ -37,7 +30,6 @@ import com.tairui.gov_affairs_cloud.util.SingleClickListener;
|
||||
import com.tairui.gov_affairs_cloud.util.ToastUtil;
|
||||
import com.tairui.gov_affairs_cloud.widget.RefreshRecyclerView;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@ -48,20 +40,11 @@ import rxhttp.RxHttpNoBodyParam;
|
||||
|
||||
public class InspectionListActivity extends BaseActivity<ActivityInspectionListBinding> {
|
||||
|
||||
private LandAreaRegionEntity selectRegion;
|
||||
private LandGridEntity.RecordsEntity selectGrid;
|
||||
private DictDataEntity selectType;
|
||||
|
||||
private List<LandAreaRegionEntity> landAreaRegionData;
|
||||
private LandGridEntity landGridData;
|
||||
|
||||
private OptionsPickerView landRegionPickerView;
|
||||
private OptionsPickerView landGridPickerView;
|
||||
|
||||
private InspectionListAdapter mAdapter;
|
||||
private int currentPageIndex = 1;
|
||||
|
||||
private List<DictDataEntity> typeData;
|
||||
private UserInfoEntity userInfo;
|
||||
|
||||
@Override
|
||||
protected Class<ActivityInspectionListBinding> getBindingClass() {
|
||||
@ -71,12 +54,7 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
@Override
|
||||
protected void onQueryArguments() {
|
||||
EventBus.getDefault().register(this);
|
||||
if (Hawk.contains(Constant.SELECT_REGION)) {
|
||||
selectRegion = Hawk.get(Constant.SELECT_REGION);
|
||||
}
|
||||
if (Hawk.contains(Constant.SELECT_GRID)) {
|
||||
selectGrid = Hawk.get(Constant.SELECT_GRID);
|
||||
}
|
||||
userInfo = AppConfig.getInstance().getUserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,9 +62,7 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
binding.refreshRecycler.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mAdapter = new InspectionListAdapter();
|
||||
binding.refreshRecycler.setAdapter(mAdapter);
|
||||
if (selectRegion != null && selectGrid != null) {
|
||||
setText(binding.tvRegion, selectRegion.getAreaName() + "-" + selectGrid.getGridName());
|
||||
}
|
||||
setGone(binding.btnAdd, userInfo.isAdmin());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,12 +73,6 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
finish();
|
||||
}
|
||||
});
|
||||
binding.layoutRegion.setOnClickListener(new SingleClickListener() {
|
||||
@Override
|
||||
protected void onSingleClick(View v) {
|
||||
showRegionDialog();
|
||||
}
|
||||
});
|
||||
binding.refreshRecycler.setRefreshRecyclerListener(new RefreshRecyclerView.RefreshRecyclerListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
@ -125,7 +95,7 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
mAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
|
||||
InspectionListEntity.RecordsEntity item = mAdapter.getItem(i);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("data", item);
|
||||
bundle.putString("id", item.getId());
|
||||
IntentUtil.startActivity(mContext, InspectionDetailActivity.class, bundle);
|
||||
});
|
||||
binding.layoutType.setOnClickListener(new SingleClickListener() {
|
||||
@ -145,36 +115,9 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
getInspectionTypeData();
|
||||
getRegionData();
|
||||
if (selectRegion != null && selectGrid != null) {
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void getRegionData() {
|
||||
RxHttp.get(Api.LAND_AREA_REGION)
|
||||
.add("areaCode", "530926")
|
||||
.asResponseList(LandAreaRegionEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
landAreaRegionData = data;
|
||||
if (selectRegion == null || selectGrid == null) {
|
||||
showRegionNoticeMsg();
|
||||
}
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void showRegionNoticeMsg() {
|
||||
MessageDialog.show("选择区域", "请先选择网格区域信息", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
showRegionDialog();
|
||||
return false;
|
||||
}).setCancelButton((dialog, v) -> {
|
||||
finish();
|
||||
return false;
|
||||
});
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}
|
||||
|
||||
private void getInspectionTypeData() {
|
||||
@ -207,84 +150,6 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
}).setItemDivider(new ItemDivider(15, 15, 1));
|
||||
}
|
||||
|
||||
private void getGridData() {
|
||||
RxHttp.get(Api.LAND_GRID_LIST)
|
||||
.add("regionCode", selectRegion.getAreaCode())
|
||||
.asResponse(LandGridEntity.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
hideLoading();
|
||||
if (ArrayUtil.isEmpty(data.getRecords())) {
|
||||
showToast("当前区域下没有网格,请重新选择");
|
||||
binding.layoutRegion.postDelayed(() -> showRegionDialog(), 500);
|
||||
} else {
|
||||
landGridData = data;
|
||||
showLandGridDialog();
|
||||
}
|
||||
}, (OnError) error -> showToast(error.getErrorMsg()));
|
||||
}
|
||||
|
||||
private void showRegionDialog() {
|
||||
if (landRegionPickerView == null) {
|
||||
List<List<LandAreaRegionEntity>> subLandData = new ArrayList<>();
|
||||
for (LandAreaRegionEntity itemData : landAreaRegionData.get(0).getAreaChildVOS()) {
|
||||
subLandData.add(itemData.getAreaChildVOS());
|
||||
}
|
||||
|
||||
landRegionPickerView = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
|
||||
selectRegion = landAreaRegionData.get(0).getAreaChildVOS().get(options1).getAreaChildVOS().get(options2);
|
||||
Hawk.put(Constant.SELECT_REGION, selectRegion);
|
||||
selectGrid = null;
|
||||
Hawk.delete(Constant.SELECT_GRID);
|
||||
getGridData();
|
||||
}).setTitleText("土地区域选择").setContentTextSize(20)
|
||||
.setSelectOptions(0, 0)
|
||||
.setTitleBgColor(Color.WHITE)
|
||||
.isRestoreItem(true)
|
||||
.isCenterLabel(false)
|
||||
.setOutSideColor(0x00000000) //设置外部遮罩颜色
|
||||
.addOnCancelClickListener(view -> finish())
|
||||
.build();
|
||||
|
||||
landRegionPickerView.setPicker(landAreaRegionData.get(0).getAreaChildVOS(), subLandData);//二级选择器
|
||||
}
|
||||
landRegionPickerView.show();
|
||||
}
|
||||
|
||||
private void showGridNoticeMsg() {
|
||||
MessageDialog.show("选择网格", "不继续选择网格信息了吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
finish();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void showLandGridDialog() {
|
||||
if (landGridPickerView == null) {
|
||||
landGridPickerView = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
|
||||
selectGrid = landGridData.getRecords().get(options1);
|
||||
Hawk.put(Constant.SELECT_GRID, selectGrid);
|
||||
setText(binding.tvRegion, selectRegion.getAreaName() + "-" + selectGrid.getGridName());
|
||||
binding.refreshRecycler.showLoading();
|
||||
currentPageIndex = 1;
|
||||
requestData(false);
|
||||
}).setTitleText("土地网格选择").setContentTextSize(20)
|
||||
.setSelectOptions(0)
|
||||
.setTitleBgColor(Color.WHITE)
|
||||
.isRestoreItem(true)
|
||||
.isCenterLabel(false)
|
||||
.setOutSideColor(0x00000000)
|
||||
.addOnCancelClickListener(view -> {
|
||||
if (selectGrid == null) {
|
||||
showGridNoticeMsg();
|
||||
}
|
||||
}).build();
|
||||
|
||||
landGridPickerView.setPicker(landGridData.getRecords());
|
||||
}
|
||||
landGridPickerView.show();
|
||||
}
|
||||
|
||||
private void requestData(boolean loadmore) {
|
||||
UserInfoEntity userInfo = AppConfig.getInstance().getUserInfo();
|
||||
RxHttpNoBodyParam http;
|
||||
@ -296,7 +161,7 @@ public class InspectionListActivity extends BaseActivity<ActivityInspectionListB
|
||||
if (selectType != null && !TextUtils.isEmpty(selectType.getDictValue())) {
|
||||
http.add("inspectionTypeCode", selectType.getDictValue());
|
||||
}
|
||||
http.add("gridId", selectGrid.getId())
|
||||
http.add("gridId", userInfo.getLandUserInfo().getGridMemberInfo().getGridId())
|
||||
.add("current", currentPageIndex)
|
||||
.add("size", Api.SIZE_PAGE)
|
||||
.asResponse(InspectionListEntity.class)
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.adapter;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.entity.IllegalListEntity;
|
||||
import com.tairui.gov_affairs_cloud.util.AppUtil;
|
||||
import com.tairui.gov_affairs_cloud.util.glide.GlideLoader;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class IllegalListAdapter extends BaseQuickAdapter<IllegalListEntity, BaseViewHolder> {
|
||||
|
||||
public IllegalListAdapter() {
|
||||
super(R.layout.item_illegal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder holder, IllegalListEntity entity) {
|
||||
ImageView img = holder.getView(R.id.img);
|
||||
GlideLoader.loadOriginal(img, AppUtil.getImageUrl(entity.getImg()));
|
||||
holder.setText(R.id.tvLandName, entity.getLandName());
|
||||
holder.setText(R.id.tvIllegalType, entity.getIllegalTypeName());
|
||||
holder.setText(R.id.tvIllegalTag, entity.getIllegalFlag().equals("0") ? "未违法" : "违法");
|
||||
holder.setTextColor(R.id.tvIllegalTag,
|
||||
entity.getIllegalFlag().equals("0") ? mContext.getResources().getColor(R.color.color_txt_green)
|
||||
: mContext.getResources().getColor(R.color.color_txt_red));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import com.contrarywind.interfaces.IPickerViewData;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class DictDataEntity {
|
||||
public class DictDataEntity implements IPickerViewData {
|
||||
|
||||
@SerializedName("createBy")
|
||||
private String createBy;
|
||||
@ -94,4 +95,9 @@ public class DictDataEntity {
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickerViewText() {
|
||||
return dictLabel;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class GridMemberEntity {
|
||||
public class GridMemberEntity implements Serializable {
|
||||
|
||||
@SerializedName("gridMemberInfo")
|
||||
private Object gridMemberInfo;
|
||||
@ -37,98 +38,6 @@ public class GridMemberEntity {
|
||||
this.landList = landList;
|
||||
}
|
||||
|
||||
public static class MemberListEntity {
|
||||
@SerializedName("gridId")
|
||||
private String gridId;
|
||||
@SerializedName("memberName")
|
||||
private String memberName;
|
||||
@SerializedName("adminFlag")
|
||||
private String adminFlag;
|
||||
@SerializedName("phone")
|
||||
private String phone;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("gridName")
|
||||
private Object gridName;
|
||||
@SerializedName("gridAreaName")
|
||||
private Object gridAreaName;
|
||||
@SerializedName("gridAreaCode")
|
||||
private Object gridAreaCode;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getAdminFlag() {
|
||||
return adminFlag;
|
||||
}
|
||||
|
||||
public void setAdminFlag(String adminFlag) {
|
||||
this.adminFlag = adminFlag;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Object getGridName() {
|
||||
return gridName;
|
||||
}
|
||||
|
||||
public void setGridName(Object gridName) {
|
||||
this.gridName = gridName;
|
||||
}
|
||||
|
||||
public Object getGridAreaName() {
|
||||
return gridAreaName;
|
||||
}
|
||||
|
||||
public void setGridAreaName(Object gridAreaName) {
|
||||
this.gridAreaName = gridAreaName;
|
||||
}
|
||||
|
||||
public Object getGridAreaCode() {
|
||||
return gridAreaCode;
|
||||
}
|
||||
|
||||
public void setGridAreaCode(Object gridAreaCode) {
|
||||
this.gridAreaCode = gridAreaCode;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LandListEntity {
|
||||
@SerializedName("id")
|
||||
|
@ -0,0 +1,127 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class IllegalDetailEntity {
|
||||
|
||||
@SerializedName("inspectionId")
|
||||
private String inspectionId;
|
||||
@SerializedName("landId")
|
||||
private String landId;
|
||||
@SerializedName("illegalFlag")
|
||||
private String illegalFlag;
|
||||
@SerializedName("illegalDate")
|
||||
private String illegalDate;
|
||||
@SerializedName("illegalTypeCode")
|
||||
private String illegalTypeCode;
|
||||
@SerializedName("desc")
|
||||
private String desc;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("landName")
|
||||
private String landName;
|
||||
@SerializedName("illegalTypeName")
|
||||
private String illegalTypeName;
|
||||
@SerializedName("inspectionTaskName")
|
||||
private String inspectionTaskName;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
|
||||
public String getInspectionId() {
|
||||
return inspectionId;
|
||||
}
|
||||
|
||||
public void setInspectionId(String inspectionId) {
|
||||
this.inspectionId = inspectionId;
|
||||
}
|
||||
|
||||
public String getLandId() {
|
||||
return landId;
|
||||
}
|
||||
|
||||
public void setLandId(String landId) {
|
||||
this.landId = landId;
|
||||
}
|
||||
|
||||
public String getIllegalFlag() {
|
||||
return illegalFlag;
|
||||
}
|
||||
|
||||
public void setIllegalFlag(String illegalFlag) {
|
||||
this.illegalFlag = illegalFlag;
|
||||
}
|
||||
|
||||
public String getIllegalDate() {
|
||||
return illegalDate;
|
||||
}
|
||||
|
||||
public void setIllegalDate(String illegalDate) {
|
||||
this.illegalDate = illegalDate;
|
||||
}
|
||||
|
||||
public String getIllegalTypeCode() {
|
||||
return illegalTypeCode;
|
||||
}
|
||||
|
||||
public void setIllegalTypeCode(String illegalTypeCode) {
|
||||
this.illegalTypeCode = illegalTypeCode;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLandName() {
|
||||
return landName;
|
||||
}
|
||||
|
||||
public void setLandName(String landName) {
|
||||
this.landName = landName;
|
||||
}
|
||||
|
||||
public String getIllegalTypeName() {
|
||||
return illegalTypeName;
|
||||
}
|
||||
|
||||
public void setIllegalTypeName(String illegalTypeName) {
|
||||
this.illegalTypeName = illegalTypeName;
|
||||
}
|
||||
|
||||
public String getInspectionTaskName() {
|
||||
return inspectionTaskName;
|
||||
}
|
||||
|
||||
public void setInspectionTaskName(String inspectionTaskName) {
|
||||
this.inspectionTaskName = inspectionTaskName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class IllegalListEntity implements Serializable {
|
||||
|
||||
@SerializedName("inspectionId")
|
||||
private String inspectionId;
|
||||
@SerializedName("landId")
|
||||
private String landId;
|
||||
@SerializedName("illegalFlag")
|
||||
private String illegalFlag;
|
||||
@SerializedName("illegalDate")
|
||||
private String illegalDate;
|
||||
@SerializedName("illegalTypeCode")
|
||||
private String illegalTypeCode;
|
||||
@SerializedName("desc")
|
||||
private String desc;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("landName")
|
||||
private String landName;
|
||||
@SerializedName("illegalTypeName")
|
||||
private String illegalTypeName;
|
||||
@SerializedName("inspectionTaskName")
|
||||
private String inspectionTaskName;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
|
||||
public String getInspectionId() {
|
||||
return inspectionId;
|
||||
}
|
||||
|
||||
public void setInspectionId(String inspectionId) {
|
||||
this.inspectionId = inspectionId;
|
||||
}
|
||||
|
||||
public String getLandId() {
|
||||
return landId;
|
||||
}
|
||||
|
||||
public void setLandId(String landId) {
|
||||
this.landId = landId;
|
||||
}
|
||||
|
||||
public String getIllegalFlag() {
|
||||
return illegalFlag;
|
||||
}
|
||||
|
||||
public void setIllegalFlag(String illegalFlag) {
|
||||
this.illegalFlag = illegalFlag;
|
||||
}
|
||||
|
||||
public String getIllegalDate() {
|
||||
return illegalDate;
|
||||
}
|
||||
|
||||
public void setIllegalDate(String illegalDate) {
|
||||
this.illegalDate = illegalDate;
|
||||
}
|
||||
|
||||
public String getIllegalTypeCode() {
|
||||
return illegalTypeCode;
|
||||
}
|
||||
|
||||
public void setIllegalTypeCode(String illegalTypeCode) {
|
||||
this.illegalTypeCode = illegalTypeCode;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLandName() {
|
||||
return landName;
|
||||
}
|
||||
|
||||
public void setLandName(String landName) {
|
||||
this.landName = landName;
|
||||
}
|
||||
|
||||
public String getIllegalTypeName() {
|
||||
return illegalTypeName;
|
||||
}
|
||||
|
||||
public void setIllegalTypeName(String illegalTypeName) {
|
||||
this.illegalTypeName = illegalTypeName;
|
||||
}
|
||||
|
||||
public String getInspectionTaskName() {
|
||||
return inspectionTaskName;
|
||||
}
|
||||
|
||||
public void setInspectionTaskName(String inspectionTaskName) {
|
||||
this.inspectionTaskName = inspectionTaskName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class IllegalListParentEntity implements Serializable {
|
||||
|
||||
@SerializedName("total")
|
||||
private Integer total;
|
||||
@SerializedName("size")
|
||||
private Integer size;
|
||||
@SerializedName("current")
|
||||
private Integer current;
|
||||
@SerializedName("optimizeCountSql")
|
||||
private Boolean optimizeCountSql;
|
||||
@SerializedName("searchCount")
|
||||
private Boolean searchCount;
|
||||
@SerializedName("maxLimit")
|
||||
private Object maxLimit;
|
||||
@SerializedName("countId")
|
||||
private Object countId;
|
||||
@SerializedName("pages")
|
||||
private Integer pages;
|
||||
@SerializedName("records")
|
||||
private List<IllegalListEntity> records;
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(Integer current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public Boolean isOptimizeCountSql() {
|
||||
return optimizeCountSql;
|
||||
}
|
||||
|
||||
public void setOptimizeCountSql(Boolean optimizeCountSql) {
|
||||
this.optimizeCountSql = optimizeCountSql;
|
||||
}
|
||||
|
||||
public Boolean isSearchCount() {
|
||||
return searchCount;
|
||||
}
|
||||
|
||||
public void setSearchCount(Boolean searchCount) {
|
||||
this.searchCount = searchCount;
|
||||
}
|
||||
|
||||
public Object getMaxLimit() {
|
||||
return maxLimit;
|
||||
}
|
||||
|
||||
public void setMaxLimit(Object maxLimit) {
|
||||
this.maxLimit = maxLimit;
|
||||
}
|
||||
|
||||
public Object getCountId() {
|
||||
return countId;
|
||||
}
|
||||
|
||||
public void setCountId(Object countId) {
|
||||
this.countId = countId;
|
||||
}
|
||||
|
||||
public Integer getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(Integer pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public List<IllegalListEntity> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<IllegalListEntity> records) {
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
}
|
@ -7,340 +7,350 @@ import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class InspectionListEntity {
|
||||
|
||||
@SerializedName("total")
|
||||
private Integer total;
|
||||
@SerializedName("size")
|
||||
private Integer size;
|
||||
@SerializedName("current")
|
||||
private Integer current;
|
||||
@SerializedName("optimizeCountSql")
|
||||
private Boolean optimizeCountSql;
|
||||
@SerializedName("searchCount")
|
||||
private Boolean searchCount;
|
||||
@SerializedName("maxLimit")
|
||||
private Object maxLimit;
|
||||
@SerializedName("countId")
|
||||
private Object countId;
|
||||
@SerializedName("pages")
|
||||
private Integer pages;
|
||||
@SerializedName("records")
|
||||
private List<RecordsEntity> records;
|
||||
@SerializedName("orders")
|
||||
private List<?> orders;
|
||||
@SerializedName("total")
|
||||
private Integer total;
|
||||
@SerializedName("size")
|
||||
private Integer size;
|
||||
@SerializedName("current")
|
||||
private Integer current;
|
||||
@SerializedName("optimizeCountSql")
|
||||
private Boolean optimizeCountSql;
|
||||
@SerializedName("searchCount")
|
||||
private Boolean searchCount;
|
||||
@SerializedName("maxLimit")
|
||||
private Object maxLimit;
|
||||
@SerializedName("countId")
|
||||
private Object countId;
|
||||
@SerializedName("pages")
|
||||
private Integer pages;
|
||||
@SerializedName("records")
|
||||
private List<RecordsEntity> records;
|
||||
@SerializedName("orders")
|
||||
private List<?> orders;
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getCurrent() {
|
||||
return current;
|
||||
}
|
||||
public Integer getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(Integer current) {
|
||||
this.current = current;
|
||||
}
|
||||
public void setCurrent(Integer current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public Boolean isOptimizeCountSql() {
|
||||
return optimizeCountSql;
|
||||
}
|
||||
public Boolean isOptimizeCountSql() {
|
||||
return optimizeCountSql;
|
||||
}
|
||||
|
||||
public void setOptimizeCountSql(Boolean optimizeCountSql) {
|
||||
this.optimizeCountSql = optimizeCountSql;
|
||||
}
|
||||
public void setOptimizeCountSql(Boolean optimizeCountSql) {
|
||||
this.optimizeCountSql = optimizeCountSql;
|
||||
}
|
||||
|
||||
public Boolean isSearchCount() {
|
||||
return searchCount;
|
||||
}
|
||||
public Boolean isSearchCount() {
|
||||
return searchCount;
|
||||
}
|
||||
|
||||
public void setSearchCount(Boolean searchCount) {
|
||||
this.searchCount = searchCount;
|
||||
}
|
||||
public void setSearchCount(Boolean searchCount) {
|
||||
this.searchCount = searchCount;
|
||||
}
|
||||
|
||||
public Object getMaxLimit() {
|
||||
return maxLimit;
|
||||
}
|
||||
public Object getMaxLimit() {
|
||||
return maxLimit;
|
||||
}
|
||||
|
||||
public void setMaxLimit(Object maxLimit) {
|
||||
this.maxLimit = maxLimit;
|
||||
}
|
||||
public void setMaxLimit(Object maxLimit) {
|
||||
this.maxLimit = maxLimit;
|
||||
}
|
||||
|
||||
public Object getCountId() {
|
||||
return countId;
|
||||
}
|
||||
public Object getCountId() {
|
||||
return countId;
|
||||
}
|
||||
|
||||
public void setCountId(Object countId) {
|
||||
this.countId = countId;
|
||||
}
|
||||
public void setCountId(Object countId) {
|
||||
this.countId = countId;
|
||||
}
|
||||
|
||||
public Integer getPages() {
|
||||
return pages;
|
||||
}
|
||||
public Integer getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(Integer pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
public void setPages(Integer pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public List<RecordsEntity> getRecords() {
|
||||
return records;
|
||||
}
|
||||
public List<RecordsEntity> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<RecordsEntity> records) {
|
||||
this.records = records;
|
||||
}
|
||||
public void setRecords(List<RecordsEntity> records) {
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
public List<?> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
public List<?> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(List<?> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
public void setOrders(List<?> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
|
||||
public static class RecordsEntity implements Serializable {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("taskCode")
|
||||
private String taskCode;
|
||||
@SerializedName("taskName")
|
||||
private String taskName;
|
||||
@SerializedName("taskMembers")
|
||||
private String taskMembers;
|
||||
@SerializedName("inspectionTypeCode")
|
||||
private String inspectionTypeCode;
|
||||
@SerializedName("inspectionType")
|
||||
private String inspectionType;
|
||||
@SerializedName("notes")
|
||||
private String notes;
|
||||
@SerializedName("inspectionTarget")
|
||||
private String inspectionTarget;
|
||||
@SerializedName("isIllegal")
|
||||
private Object isIllegal;
|
||||
@SerializedName("inspectionStatus")
|
||||
private String inspectionStatus;
|
||||
@SerializedName("inspectionStatusName")
|
||||
private String inspectionStatusName;
|
||||
@SerializedName("inspectionSituation")
|
||||
private Object inspectionSituation;
|
||||
@SerializedName("inspectionUsers")
|
||||
private List<InspectionUsersEntity> inspectionUsers;
|
||||
public static class RecordsEntity implements Serializable {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("taskCode")
|
||||
private String taskCode;
|
||||
@SerializedName("taskName")
|
||||
private String taskName;
|
||||
@SerializedName("taskMembers")
|
||||
private String taskMembers;
|
||||
@SerializedName("inspectionTypeCode")
|
||||
private String inspectionTypeCode;
|
||||
@SerializedName("inspectionType")
|
||||
private String inspectionType;
|
||||
@SerializedName("notes")
|
||||
private String notes;
|
||||
@SerializedName("inspectionTarget")
|
||||
private String inspectionTarget;
|
||||
@SerializedName("isIllegal")
|
||||
private Object isIllegal;
|
||||
@SerializedName("inspectionStatus")
|
||||
private String inspectionStatus;
|
||||
@SerializedName("inspectionStatusName")
|
||||
private String inspectionStatusName;
|
||||
@SerializedName("inspectionSituation")
|
||||
private Object inspectionSituation;
|
||||
@SerializedName("inspectionUsers")
|
||||
private List<InspectionUsersEntity> inspectionUsers;
|
||||
@SerializedName("inspectionResults")
|
||||
private List<IllegalListEntity> inspectionResults;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public List<IllegalListEntity> getInspectionResults() {
|
||||
return inspectionResults;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setInspectionResults(List<IllegalListEntity> inspectionResults) {
|
||||
this.inspectionResults = inspectionResults;
|
||||
}
|
||||
|
||||
public String getTaskCode() {
|
||||
return taskCode;
|
||||
}
|
||||
|
||||
public void setTaskCode(String taskCode) {
|
||||
this.taskCode = taskCode;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getTaskMembers() {
|
||||
return taskMembers;
|
||||
}
|
||||
|
||||
public void setTaskMembers(String taskMembers) {
|
||||
this.taskMembers = taskMembers;
|
||||
}
|
||||
|
||||
public String getInspectionTypeCode() {
|
||||
return inspectionTypeCode;
|
||||
}
|
||||
|
||||
public void setInspectionTypeCode(String inspectionTypeCode) {
|
||||
this.inspectionTypeCode = inspectionTypeCode;
|
||||
}
|
||||
|
||||
public String getInspectionType() {
|
||||
return inspectionType;
|
||||
}
|
||||
|
||||
public void setInspectionType(String inspectionType) {
|
||||
this.inspectionType = inspectionType;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public String getInspectionTarget() {
|
||||
return inspectionTarget;
|
||||
}
|
||||
|
||||
public void setInspectionTarget(String inspectionTarget) {
|
||||
this.inspectionTarget = inspectionTarget;
|
||||
}
|
||||
|
||||
public Object getIsIllegal() {
|
||||
return isIllegal;
|
||||
}
|
||||
|
||||
public void setIsIllegal(Object isIllegal) {
|
||||
this.isIllegal = isIllegal;
|
||||
}
|
||||
|
||||
public String getInspectionStatus() {
|
||||
return inspectionStatus;
|
||||
}
|
||||
|
||||
public void setInspectionStatus(String inspectionStatus) {
|
||||
this.inspectionStatus = inspectionStatus;
|
||||
}
|
||||
|
||||
public String getInspectionStatusName() {
|
||||
return inspectionStatusName;
|
||||
}
|
||||
|
||||
public void setInspectionStatusName(String inspectionStatusName) {
|
||||
this.inspectionStatusName = inspectionStatusName;
|
||||
}
|
||||
|
||||
public Object getInspectionSituation() {
|
||||
return inspectionSituation;
|
||||
}
|
||||
|
||||
public void setInspectionSituation(Object inspectionSituation) {
|
||||
this.inspectionSituation = inspectionSituation;
|
||||
}
|
||||
|
||||
public List<InspectionUsersEntity> getInspectionUsers() {
|
||||
return inspectionUsers;
|
||||
}
|
||||
|
||||
public void setInspectionUsers(List<InspectionUsersEntity> inspectionUsers) {
|
||||
this.inspectionUsers = inspectionUsers;
|
||||
}
|
||||
|
||||
public static class InspectionUsersEntity implements Serializable{
|
||||
@SerializedName("createTime")
|
||||
private String createTime;
|
||||
@SerializedName("createUser")
|
||||
private String createUser;
|
||||
@SerializedName("updateTime")
|
||||
private Object updateTime;
|
||||
@SerializedName("updateUser")
|
||||
private Object updateUser;
|
||||
@SerializedName("tenantId")
|
||||
private Integer tenantId;
|
||||
@SerializedName("id")
|
||||
private Long id;
|
||||
@SerializedName("inspectionId")
|
||||
private Long inspectionId;
|
||||
@SerializedName("userId")
|
||||
private Long userId;
|
||||
@SerializedName("userName")
|
||||
private String userName;
|
||||
@SerializedName("deleteFlag")
|
||||
private String deleteFlag;
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateUser() {
|
||||
return createUser;
|
||||
}
|
||||
|
||||
public void setCreateUser(String createUser) {
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
public Object getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Object updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Object getUpdateUser() {
|
||||
return updateUser;
|
||||
}
|
||||
|
||||
public void setUpdateUser(Object updateUser) {
|
||||
this.updateUser = updateUser;
|
||||
}
|
||||
|
||||
public Integer getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Integer tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public Long getInspectionId() {
|
||||
return inspectionId;
|
||||
}
|
||||
public String getTaskCode() {
|
||||
return taskCode;
|
||||
}
|
||||
|
||||
public void setInspectionId(Long inspectionId) {
|
||||
this.inspectionId = inspectionId;
|
||||
}
|
||||
public void setTaskCode(String taskCode) {
|
||||
this.taskCode = taskCode;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public String getTaskMembers() {
|
||||
return taskMembers;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public void setTaskMembers(String taskMembers) {
|
||||
this.taskMembers = taskMembers;
|
||||
}
|
||||
|
||||
public String getDeleteFlag() {
|
||||
return deleteFlag;
|
||||
}
|
||||
public String getInspectionTypeCode() {
|
||||
return inspectionTypeCode;
|
||||
}
|
||||
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setInspectionTypeCode(String inspectionTypeCode) {
|
||||
this.inspectionTypeCode = inspectionTypeCode;
|
||||
}
|
||||
|
||||
public String getInspectionType() {
|
||||
return inspectionType;
|
||||
}
|
||||
|
||||
public void setInspectionType(String inspectionType) {
|
||||
this.inspectionType = inspectionType;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public String getInspectionTarget() {
|
||||
return inspectionTarget;
|
||||
}
|
||||
|
||||
public void setInspectionTarget(String inspectionTarget) {
|
||||
this.inspectionTarget = inspectionTarget;
|
||||
}
|
||||
|
||||
public Object getIsIllegal() {
|
||||
return isIllegal;
|
||||
}
|
||||
|
||||
public void setIsIllegal(Object isIllegal) {
|
||||
this.isIllegal = isIllegal;
|
||||
}
|
||||
|
||||
public String getInspectionStatus() {
|
||||
return inspectionStatus;
|
||||
}
|
||||
|
||||
public void setInspectionStatus(String inspectionStatus) {
|
||||
this.inspectionStatus = inspectionStatus;
|
||||
}
|
||||
|
||||
public String getInspectionStatusName() {
|
||||
return inspectionStatusName;
|
||||
}
|
||||
|
||||
public void setInspectionStatusName(String inspectionStatusName) {
|
||||
this.inspectionStatusName = inspectionStatusName;
|
||||
}
|
||||
|
||||
public Object getInspectionSituation() {
|
||||
return inspectionSituation;
|
||||
}
|
||||
|
||||
public void setInspectionSituation(Object inspectionSituation) {
|
||||
this.inspectionSituation = inspectionSituation;
|
||||
}
|
||||
|
||||
public List<InspectionUsersEntity> getInspectionUsers() {
|
||||
return inspectionUsers;
|
||||
}
|
||||
|
||||
public void setInspectionUsers(List<InspectionUsersEntity> inspectionUsers) {
|
||||
this.inspectionUsers = inspectionUsers;
|
||||
}
|
||||
|
||||
public static class InspectionUsersEntity implements Serializable {
|
||||
@SerializedName("createTime")
|
||||
private String createTime;
|
||||
@SerializedName("createUser")
|
||||
private String createUser;
|
||||
@SerializedName("updateTime")
|
||||
private Object updateTime;
|
||||
@SerializedName("updateUser")
|
||||
private Object updateUser;
|
||||
@SerializedName("tenantId")
|
||||
private Integer tenantId;
|
||||
@SerializedName("id")
|
||||
private Long id;
|
||||
@SerializedName("inspectionId")
|
||||
private Long inspectionId;
|
||||
@SerializedName("userId")
|
||||
private Long userId;
|
||||
@SerializedName("userName")
|
||||
private String userName;
|
||||
@SerializedName("deleteFlag")
|
||||
private String deleteFlag;
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateUser() {
|
||||
return createUser;
|
||||
}
|
||||
|
||||
public void setCreateUser(String createUser) {
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
public Object getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Object updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Object getUpdateUser() {
|
||||
return updateUser;
|
||||
}
|
||||
|
||||
public void setUpdateUser(Object updateUser) {
|
||||
this.updateUser = updateUser;
|
||||
}
|
||||
|
||||
public Integer getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Integer tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getInspectionId() {
|
||||
return inspectionId;
|
||||
}
|
||||
|
||||
public void setInspectionId(Long inspectionId) {
|
||||
this.inspectionId = inspectionId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getDeleteFlag() {
|
||||
return deleteFlag;
|
||||
}
|
||||
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,98 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.land.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class MemberListEntity implements Serializable {
|
||||
@SerializedName("gridId")
|
||||
private String gridId;
|
||||
@SerializedName("memberName")
|
||||
private String memberName;
|
||||
@SerializedName("adminFlag")
|
||||
private String adminFlag;
|
||||
@SerializedName("phone")
|
||||
private String phone;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("gridName")
|
||||
private Object gridName;
|
||||
@SerializedName("gridAreaName")
|
||||
private Object gridAreaName;
|
||||
@SerializedName("gridAreaCode")
|
||||
private Object gridAreaCode;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getAdminFlag() {
|
||||
return adminFlag;
|
||||
}
|
||||
|
||||
public void setAdminFlag(String adminFlag) {
|
||||
this.adminFlag = adminFlag;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Object getGridName() {
|
||||
return gridName;
|
||||
}
|
||||
|
||||
public void setGridName(Object gridName) {
|
||||
this.gridName = gridName;
|
||||
}
|
||||
|
||||
public Object getGridAreaName() {
|
||||
return gridAreaName;
|
||||
}
|
||||
|
||||
public void setGridAreaName(Object gridAreaName) {
|
||||
this.gridAreaName = gridAreaName;
|
||||
}
|
||||
|
||||
public Object getGridAreaCode() {
|
||||
return gridAreaCode;
|
||||
}
|
||||
|
||||
public void setGridAreaCode(Object gridAreaCode) {
|
||||
this.gridAreaCode = gridAreaCode;
|
||||
}
|
||||
}
|
@ -28,12 +28,8 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
|
||||
@Override
|
||||
protected void onFindView(Bundle savedInstanceState) {
|
||||
// GlideLoader.loadOriginal(binding.ivVerifyCode, Api.CAPTCHA, -1);
|
||||
// if (Hawk.contains(Constant.LOGIN_USER_NAME)) {
|
||||
// setText(binding.inputUserName, Hawk.get(Constant.LOGIN_USER_NAME));
|
||||
// }
|
||||
if (BuildConfig.DEBUG) {
|
||||
setText(binding.inputUserName, "admin");
|
||||
setText(binding.inputUserPass, "admin123");
|
||||
if (Hawk.contains(Constant.LOGIN_USER_NAME) && !BuildConfig.DEBUG) {
|
||||
setText(binding.inputUserName, Hawk.get(Constant.LOGIN_USER_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,25 +65,37 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
|
||||
}
|
||||
|
||||
private void checkLogin() {
|
||||
boolean agree = binding.agree.isChecked();
|
||||
String username = binding.inputUserName.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(username)) {
|
||||
showToast("用户名不能为空");
|
||||
return;
|
||||
}
|
||||
String userpass = binding.inputUserPass.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(userpass)) {
|
||||
showToast("密码不能为空");
|
||||
return;
|
||||
}
|
||||
String verifyCode = binding.inputVerifyCode.getText().toString().trim();
|
||||
// if (TextUtils.isEmpty(verifyCode)) {
|
||||
// showToast("验证码不能为空");
|
||||
// return;
|
||||
// }
|
||||
if (!agree) {
|
||||
showToast("请先阅读并同意《用户协议》和《隐私条款》");
|
||||
return;
|
||||
String username = "", userpass = "", verifyCode = "";
|
||||
if (!BuildConfig.DEBUG) {
|
||||
boolean agree = binding.agree.isChecked();
|
||||
username = binding.inputUserName.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(username)) {
|
||||
showToast("用户名不能为空");
|
||||
return;
|
||||
}
|
||||
userpass = binding.inputUserPass.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(userpass)) {
|
||||
showToast("密码不能为空");
|
||||
return;
|
||||
}
|
||||
verifyCode = binding.inputVerifyCode.getText().toString().trim();
|
||||
// if (TextUtils.isEmpty(verifyCode)) {
|
||||
// showToast("验证码不能为空");
|
||||
// return;
|
||||
// }
|
||||
if (!agree) {
|
||||
showToast("请先阅读并同意《用户协议》和《隐私条款》");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
username = binding.inputUserName.getText().toString().trim();
|
||||
if (username.equals("a")) {
|
||||
username = "admin";
|
||||
userpass = "admin123";
|
||||
} else if (username.equals("d")) {
|
||||
username = "dev";
|
||||
userpass = "dev123";
|
||||
}
|
||||
}
|
||||
showLoading();
|
||||
doLogin(username, userpass, verifyCode);
|
||||
|
@ -40,16 +40,29 @@ public class MyFragment extends BaseFragment<FragmentMyBinding> {
|
||||
protected void onSingleClick(View v) {
|
||||
MessageDialog.show("安全退出", "确定要退出登录吗?", "确定", "取消")
|
||||
.setOkButton((baseDialog, v1) -> {
|
||||
Hawk.delete(Constant.TOKEN);
|
||||
Hawk.delete(Constant.USER_INFO);
|
||||
IntentUtil.startActivity(mContext, LoginActivity.class, null);
|
||||
getActivity().finish();
|
||||
doLogout();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doLogout() {
|
||||
showLoading();
|
||||
RxHttp.deleteJson(Api.LOGOUT)
|
||||
.asResponse(String.class)
|
||||
.as(RxLife.asOnMain(this))
|
||||
.subscribe(data -> {
|
||||
Hawk.delete(Constant.TOKEN);
|
||||
Hawk.delete(Constant.USER_INFO);
|
||||
IntentUtil.startActivity(mContext, LoginActivity.class, null);
|
||||
getActivity().finish();
|
||||
}, (OnError) error -> {
|
||||
hideLoading();
|
||||
showToast(error.getErrorMsg());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyData() {
|
||||
if (AppConfig.getInstance().getUserInfo() == null) {
|
||||
@ -75,7 +88,7 @@ public class MyFragment extends BaseFragment<FragmentMyBinding> {
|
||||
|
||||
private void initView(UserInfoEntity data) {
|
||||
setText(binding.tvTodoCount, data.getTodoCount().toString());
|
||||
setText(binding.userNameTv, data.getUsername());
|
||||
setText(binding.userNameTv, data.getLandUserInfo().getGridMemberInfo().getMemberName());
|
||||
// setText(binding.userDepartmentTv, data.getOrganization() + " - " + data.getDepartmental());
|
||||
setText(binding.userDepartmentTv, data.getDepartmental());
|
||||
setText(binding.userTelTv, data.getPhone() + " " + data.getNo());
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.tairui.gov_affairs_cloud.ui.my.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.contrarywind.interfaces.IPickerViewData;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class UserInfoEntity implements Serializable {
|
||||
|
||||
@SerializedName("username")
|
||||
private String username;
|
||||
@SerializedName("organization")
|
||||
private Object organization;
|
||||
private String organization;
|
||||
@SerializedName("departmental")
|
||||
private String departmental;
|
||||
@SerializedName("phone")
|
||||
@ -25,29 +25,23 @@ public class UserInfoEntity implements Serializable {
|
||||
@SerializedName("todoCount")
|
||||
private Integer todoCount;
|
||||
@SerializedName("admin")
|
||||
private boolean admin;
|
||||
private Boolean admin;
|
||||
@SerializedName("birth")
|
||||
private String birth;
|
||||
@SerializedName("province")
|
||||
private String province;
|
||||
@SerializedName("city")
|
||||
private String city;
|
||||
@SerializedName("address")
|
||||
private String address;
|
||||
@SerializedName("landUserInfo")
|
||||
private LandUserInfoEntity landUserInfo;
|
||||
|
||||
public boolean isAdmin() {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(boolean admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Object getOrganization() {
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
|
||||
public void setOrganization(Object organization) {
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
|
||||
@ -106,4 +100,299 @@ public class UserInfoEntity implements Serializable {
|
||||
public void setTodoCount(Integer todoCount) {
|
||||
this.todoCount = todoCount;
|
||||
}
|
||||
|
||||
public Boolean isAdmin() {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(Boolean admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
public String getBirth() {
|
||||
return birth;
|
||||
}
|
||||
|
||||
public void setBirth(String birth) {
|
||||
this.birth = birth;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public LandUserInfoEntity getLandUserInfo() {
|
||||
return landUserInfo;
|
||||
}
|
||||
|
||||
public void setLandUserInfo(LandUserInfoEntity landUserInfo) {
|
||||
this.landUserInfo = landUserInfo;
|
||||
}
|
||||
|
||||
public static class LandUserInfoEntity {
|
||||
@SerializedName("gridMemberInfo")
|
||||
private GridMemberInfoEntity gridMemberInfo;
|
||||
@SerializedName("memberList")
|
||||
private List<MemberListEntity> memberList;
|
||||
@SerializedName("landList")
|
||||
private List<LandListEntity> landList;
|
||||
|
||||
public GridMemberInfoEntity getGridMemberInfo() {
|
||||
return gridMemberInfo;
|
||||
}
|
||||
|
||||
public void setGridMemberInfo(GridMemberInfoEntity gridMemberInfo) {
|
||||
this.gridMemberInfo = gridMemberInfo;
|
||||
}
|
||||
|
||||
public List<MemberListEntity> getMemberList() {
|
||||
return memberList;
|
||||
}
|
||||
|
||||
public void setMemberList(List<MemberListEntity> memberList) {
|
||||
this.memberList = memberList;
|
||||
}
|
||||
|
||||
public List<LandListEntity> getLandList() {
|
||||
return landList;
|
||||
}
|
||||
|
||||
public void setLandList(List<LandListEntity> landList) {
|
||||
this.landList = landList;
|
||||
}
|
||||
|
||||
public static class GridMemberInfoEntity {
|
||||
@SerializedName("gridId")
|
||||
private String gridId;
|
||||
@SerializedName("memberName")
|
||||
private String memberName;
|
||||
@SerializedName("adminFlag")
|
||||
private String adminFlag;
|
||||
@SerializedName("phone")
|
||||
private String phone;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("gridName")
|
||||
private String gridName;
|
||||
@SerializedName("gridAreaName")
|
||||
private String gridAreaName;
|
||||
@SerializedName("gridAreaCode")
|
||||
private String gridAreaCode;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getAdminFlag() {
|
||||
return adminFlag;
|
||||
}
|
||||
|
||||
public void setAdminFlag(String adminFlag) {
|
||||
this.adminFlag = adminFlag;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getGridName() {
|
||||
return gridName;
|
||||
}
|
||||
|
||||
public void setGridName(String gridName) {
|
||||
this.gridName = gridName;
|
||||
}
|
||||
|
||||
public String getGridAreaName() {
|
||||
return gridAreaName;
|
||||
}
|
||||
|
||||
public void setGridAreaName(String gridAreaName) {
|
||||
this.gridAreaName = gridAreaName;
|
||||
}
|
||||
|
||||
public String getGridAreaCode() {
|
||||
return gridAreaCode;
|
||||
}
|
||||
|
||||
public void setGridAreaCode(String gridAreaCode) {
|
||||
this.gridAreaCode = gridAreaCode;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MemberListEntity {
|
||||
@SerializedName("gridId")
|
||||
private String gridId;
|
||||
@SerializedName("memberName")
|
||||
private String memberName;
|
||||
@SerializedName("adminFlag")
|
||||
private String adminFlag;
|
||||
@SerializedName("phone")
|
||||
private String phone;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("gridName")
|
||||
private String gridName;
|
||||
@SerializedName("gridAreaName")
|
||||
private String gridAreaName;
|
||||
@SerializedName("gridAreaCode")
|
||||
private String gridAreaCode;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getAdminFlag() {
|
||||
return adminFlag;
|
||||
}
|
||||
|
||||
public void setAdminFlag(String adminFlag) {
|
||||
this.adminFlag = adminFlag;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getGridName() {
|
||||
return gridName;
|
||||
}
|
||||
|
||||
public void setGridName(String gridName) {
|
||||
this.gridName = gridName;
|
||||
}
|
||||
|
||||
public String getGridAreaName() {
|
||||
return gridAreaName;
|
||||
}
|
||||
|
||||
public void setGridAreaName(String gridAreaName) {
|
||||
this.gridAreaName = gridAreaName;
|
||||
}
|
||||
|
||||
public String getGridAreaCode() {
|
||||
return gridAreaCode;
|
||||
}
|
||||
|
||||
public void setGridAreaCode(String gridAreaCode) {
|
||||
this.gridAreaCode = gridAreaCode;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LandListEntity implements IPickerViewData {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("landName")
|
||||
private String landName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLandName() {
|
||||
return landName;
|
||||
}
|
||||
|
||||
public void setLandName(String landName) {
|
||||
this.landName = landName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickerViewText() {
|
||||
return landName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class TodoFragment extends BaseFragment<FragmentTodoBinding> {
|
||||
mAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
|
||||
InspectionListEntity.RecordsEntity item = mAdapter.getItem(i);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("data", item);
|
||||
bundle.putString("id", item.getId());
|
||||
IntentUtil.startActivity(mContext, InspectionDetailActivity.class, bundle);
|
||||
});
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.tairui.gov_affairs_cloud.R;
|
||||
import com.tairui.gov_affairs_cloud.base.BaseFragment;
|
||||
import com.tairui.gov_affairs_cloud.databinding.FragmentWorkspaceBinding;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.GridInfoActivity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.IllegalListActivity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.InspectionListActivity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.LandActivity;
|
||||
import com.tairui.gov_affairs_cloud.ui.land.LandResouceInfoActivity;
|
||||
@ -72,6 +73,8 @@ public class WorkSpaceFragment extends BaseFragment<FragmentWorkspaceBinding> {
|
||||
IntentUtil.startActivity(mContext, LandResouceInfoActivity.class);
|
||||
} else if (_id == 7) {
|
||||
IntentUtil.startActivity(mContext, InspectionListActivity.class);
|
||||
} else if (_id == 5) {
|
||||
IntentUtil.startActivity(mContext, IllegalListActivity.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.tairui.gov_affairs_cloud.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateUtils {
|
||||
|
||||
@ -8,5 +10,11 @@ public class DateUtils {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
public static String getDateToString(long time) {
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date d = new Date(time);
|
||||
return sf.format(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,3 +31,4 @@ public abstract class SingleClickListener implements View.OnClickListener {
|
||||
|
||||
//protected abstract void onFastClick();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="2dp"
|
||||
android:bottomRightRadius="2dp"
|
||||
android:topLeftRadius="2dp"
|
||||
android:topRightRadius="2dp" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_txt_red" />
|
||||
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
287
app/src/main/res/layout/activity_add_illegal_information.xml
Normal file
287
app/src/main/res/layout/activity_add_illegal_information.xml
Normal file
@ -0,0 +1,287 @@
|
||||
<?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:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="巡查结果登记"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_submit"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutRegion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="选择地块"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRegion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutIsIllegal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="是否违法"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIsIllegal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/illegalLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutTime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法时间"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法行为"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法行为描述"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputDesc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_white_raduis_5_border"
|
||||
android:gravity="start|top"
|
||||
android:hint="请输入"
|
||||
android:minHeight="120dp"
|
||||
android:padding="6dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="巡查相片"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnReSelectImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="right"
|
||||
android:gravity="center"
|
||||
android:text="重新上传"
|
||||
android:textColor="@color/color_blue"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/btnSelectImg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dashed_border">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_pic"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgLand"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/white"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintDimensionRatio="16:9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
268
app/src/main/res/layout/activity_edit_inspection.xml
Normal file
268
app/src/main/res/layout/activity_edit_inspection.xml
Normal file
@ -0,0 +1,268 @@
|
||||
<?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:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="新建巡查任务"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_submit"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="任务编号"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputTaskCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="任务名称"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputTaskName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="任务成员"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMembers"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right|center_vertical"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/membersRecycler"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnAddMember"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:src="@mipmap/ic_add" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="巡查类型"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
app:drawableEndCompat="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="巡查对象"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputTaskTarget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="end|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutCycle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="巡查注意事项"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputTaskNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_white_raduis_5_border"
|
||||
android:gravity="start|top"
|
||||
android:hint="请输入"
|
||||
android:minHeight="120dp"
|
||||
android:padding="6dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
228
app/src/main/res/layout/activity_illegal_detail.xml
Normal file
228
app/src/main/res/layout/activity_illegal_detail.xml
Normal file
@ -0,0 +1,228 @@
|
||||
<?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:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="巡查结果登记"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="状态"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:textColor="@color/color_txt_green"
|
||||
android:textSize="16sp"
|
||||
tools:text="待处理" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutIsIllegal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="是否违法"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIsIllegal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutTime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法时间"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法行为"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:gravity="end|center_vertical"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="违法行为描述"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/inputDesc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_white_raduis_5_border"
|
||||
android:gravity="start|top"
|
||||
android:minHeight="120dp"
|
||||
android:padding="6dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="巡查相片"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dashed_border">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgLand"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/white"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintDimensionRatio="16:9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
91
app/src/main/res/layout/activity_illegal_list.xml
Normal file
91
app/src/main/res/layout/activity_illegal_list.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?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:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="土地案件"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnSearch"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_search"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginRight="12dp"
|
||||
android:gravity="center"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@mipmap/ic_arrow_down"
|
||||
android:drawablePadding="4dp"
|
||||
android:text="全部"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<com.tairui.gov_affairs_cloud.widget.RefreshRecyclerView
|
||||
android:id="@+id/refreshRecycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -49,294 +49,378 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
android:scrollbars="none">
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务信息"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="20sp" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
tools:text="已撤销"
|
||||
android:textColor="@color/color_txt_label"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务信息"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_label"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="已撤销" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务编号"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请输入"
|
||||
tools:text="241012001"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务名称"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
tools:text="土地生产资料巡查"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务成员"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskMembers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:inputType="numberDecimal"
|
||||
tools:text="赵雨 周乐"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutMonth"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查类型"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
tools:text="定期巡查"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查对象"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskTarget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
tools:text="耿马镇全部地块"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:src="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutCycle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查注意事项"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_white_raduis_5_border"
|
||||
android:hint="请选择"
|
||||
android:minHeight="120dp"
|
||||
android:padding="6dp"
|
||||
tools:text="是否存在违法占地、乱搭乱建、未批先用、批而未用;是否存在改变土地用途(如耕地改为建设用地);检查耕地是否撂荒、弃耕或非法改变种植结构。"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="62dp"
|
||||
android:layout_marginBottom="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnEdit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_edit_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="修改"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintRight_toLeftOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHolder"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务编号"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="241012001" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务名称"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="土地生产资料巡查" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="任务成员"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskMembers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请输入"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="赵雨 周乐" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutMonth"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查类型"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="定期巡查" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查对象"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskTarget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="请选择"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="耿马镇全部地块" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:src="@mipmap/ic_arrow_right_gray" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#EDEDED" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layoutCycle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:text="巡查注意事项"
|
||||
android:textColor="@color/color_tv_content"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnRePublish"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/tvTaskNotes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_publish_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="重新发布"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:background="@drawable/bg_container_white_raduis_5_border"
|
||||
android:hint="请选择"
|
||||
android:minHeight="120dp"
|
||||
android:padding="6dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textColorHint="@color/color_txt_label"
|
||||
android:textSize="16sp"
|
||||
tools:text="是否存在违法占地、乱搭乱建、未批先用、批而未用;是否存在改变土地用途(如耕地改为建设用地);检查耕地是否撂荒、弃耕或非法改变种植结构。" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/resultRecycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnEdit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_edit_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="修改"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintRight_toLeftOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnRegisty"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_add_white_small"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="新增登记"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintRight_toLeftOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHolder"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnRePublish"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_publish_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="重新发布"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_submit_white_small"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="提交"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnPublish"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_publish_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="发布"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewHolder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnUndo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_blue_raduis_5"
|
||||
android:drawableLeft="@mipmap/ic_publish_white"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="撤销"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -49,68 +49,35 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutRegion"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center_vertical"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:src="@mipmap/ic_location" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRegion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:ellipsize="end"
|
||||
android:drawableRight="@mipmap/ic_arrow_down"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="4dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="14sp"
|
||||
tools:text="耿马镇白马社区耿马镇白马社区耿马镇白马社区耿马镇白马社区" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:gravity="center">
|
||||
|
||||
android:layout_marginRight="12dp"
|
||||
android:gravity="center"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvType"
|
||||
android:drawableRight="@mipmap/ic_arrow_down"
|
||||
android:drawablePadding="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@mipmap/ic_arrow_down"
|
||||
android:drawablePadding="4dp"
|
||||
android:text="全部"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
|
72
app/src/main/res/layout/item_illegal.xml
Normal file
72
app/src/main/res/layout/item_illegal.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_container_light_gray_raduis_5"
|
||||
android:padding="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/text_color_light_gray"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@mipmap/ic_arrow_right_blue"
|
||||
android:drawablePadding="2dp"
|
||||
android:text="更多"
|
||||
android:textColor="@color/color_txt_blue"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLandName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvIllegalType"
|
||||
app:layout_constraintLeft_toRightOf="@id/img"
|
||||
app:layout_constraintTop_toTopOf="@id/img"
|
||||
tools:text="菜籽地村一号地块" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIllegalTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/bg_container_red_border_raduis_2"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="违法"
|
||||
android:textColor="@color/color_txt_red"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvLandName"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvLandName"
|
||||
app:layout_constraintTop_toTopOf="@id/tvLandName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIllegalType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/img"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLandName"
|
||||
tools:text="未经批准占地" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
68
app/src/main/res/layout/item_illegal_2.xml
Normal file
68
app/src/main/res/layout/item_illegal_2.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
||||
android:background="@color/white"
|
||||
|
||||
android:paddingTop="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_container_light_green_raduis_2"
|
||||
android:padding="6dp"
|
||||
android:text="待发布"
|
||||
android:textColor="@color/color_txt_green"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvLandName"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tvLandName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLandName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvIllegalType"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="菜籽地村一号地块" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#E6E6E6"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIllegalType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="@color/color_txt_black"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLandName"
|
||||
tools:text="未经批准占地" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textColor="@color/color_txt_label"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvIllegalType"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLandName"
|
||||
tools:text="2024-05-02" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
app/src/main/res/mipmap-xxhdpi/ic_add_white_small.webp
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/ic_add_white_small.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 666 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_submit_white_small.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/ic_submit_white_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -3,3 +3,4 @@ include ':AlbumDialog'
|
||||
include ':DialogX'
|
||||
include ':DialogXInterface'
|
||||
include ':DialogXMaterialYou'
|
||||
include ':TimePickerDialog'
|
||||
|
Loading…
x
Reference in New Issue
Block a user