parent
6ad88e61ce
commit
d22f5257c7
16 changed files with 197 additions and 114 deletions
@ -1,51 +1,76 @@ |
|||||||
package com.project.survey.ui.project |
package com.project.survey.ui.project |
||||||
|
|
||||||
|
import android.view.Menu |
||||||
|
import android.view.MenuItem |
||||||
|
import androidx.core.content.ContextCompat |
||||||
import androidx.fragment.app.Fragment |
import androidx.fragment.app.Fragment |
||||||
import com.bingce.ui.TabEntity |
import com.bingce.ui.TabEntity |
||||||
import com.flyco.tablayout.listener.CustomTabEntity |
import com.flyco.tablayout.listener.CustomTabEntity |
||||||
|
import com.gyf.immersionbar.ImmersionBar |
||||||
import com.project.survey.R |
import com.project.survey.R |
||||||
import com.project.survey.ui.base.BaseBindingActivity |
import com.project.survey.ui.base.BaseBindingActivity |
||||||
import com.project.survey.databinding.ActivityProjectListBinding |
import com.project.survey.databinding.ActivityProjectListBinding |
||||||
import com.project.survey.util.ActivityNavUtil |
import com.project.survey.util.ActivityNavUtil |
||||||
|
|
||||||
class ProjectListActivity : BaseBindingActivity<ActivityProjectListBinding>() { |
class ProjectListActivity : BaseBindingActivity<ActivityProjectListBinding>() { |
||||||
override fun getBinding(): ActivityProjectListBinding { |
|
||||||
return ActivityProjectListBinding.inflate(layoutInflater) |
companion object { |
||||||
|
fun start() { |
||||||
|
ActivityNavUtil.startActivity<ProjectListActivity> { } |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
|
override fun getBinding(): ActivityProjectListBinding = |
||||||
|
ActivityProjectListBinding.inflate(layoutInflater) |
||||||
|
|
||||||
override fun initView() { |
override fun initView() { |
||||||
|
ImmersionBar.with(this) |
||||||
|
.statusBarDarkFont(true) |
||||||
|
.titleBarMarginTop(mBinding.ilToolBar.toolbar) |
||||||
|
.init() |
||||||
|
setSupportActionBar(mBinding.ilToolBar.toolbar) |
||||||
|
|
||||||
|
mBinding.ilToolBar.toolbar.setBackgroundColor(0) |
||||||
|
mBinding.ilToolBar.toolbar.setTitle("项目列表") |
||||||
|
mBinding.ilToolBar.toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.text_color_main)) |
||||||
initTabLayout() |
initTabLayout() |
||||||
} |
} |
||||||
|
|
||||||
|
override fun initData() { |
||||||
|
} |
||||||
|
|
||||||
private fun initTabLayout() { |
private fun initTabLayout() { |
||||||
val mTabEntities = ArrayList<CustomTabEntity>() |
mBinding.tabLayout.setTabData( |
||||||
mTabEntities.add( |
arrayListOf( |
||||||
TabEntity( |
TabEntity( |
||||||
"最近打开", |
"最近打开", |
||||||
R.drawable.ic_project_recently, |
R.drawable.ic_project_recently_selected, |
||||||
R.drawable.ic_project_recently |
R.drawable.ic_project_recently_unselected |
||||||
) |
), |
||||||
) |
TabEntity( |
||||||
mTabEntities.add( |
"全部", |
||||||
TabEntity( |
R.drawable.ic_project_all_selected, |
||||||
"全部", |
R.drawable.ic_project_all_unselected |
||||||
R.drawable.ic_project_all, |
) |
||||||
R.drawable.ic_project_all |
), |
||||||
|
this, |
||||||
|
R.id.container, |
||||||
|
arrayListOf( |
||||||
|
ProjectListFragment.newInstance(ProjectListFragment.TYPE_RECENTLY), |
||||||
|
ProjectListFragment.newInstance(ProjectListFragment.TYPE_ALL) |
||||||
) |
) |
||||||
) |
) |
||||||
val fragmentList = ArrayList<Fragment>() |
|
||||||
fragmentList.add(ProjectListFragment.newInstance(ProjectListFragment.TYPE_RECENTLY)) |
|
||||||
fragmentList.add(ProjectListFragment.newInstance(ProjectListFragment.TYPE_ALL)) |
|
||||||
|
|
||||||
mBinding.tabLayout.setTabData(mTabEntities, this, R.id.container, fragmentList) |
|
||||||
} |
} |
||||||
|
|
||||||
override fun initData() { |
override fun onCreateOptionsMenu(menu: Menu?): Boolean { |
||||||
|
menuInflater.inflate(R.menu.menu_activity_project_list, menu) |
||||||
|
return super.onCreateOptionsMenu(menu) |
||||||
} |
} |
||||||
|
|
||||||
companion object { |
override fun onOptionsItemSelected(item: MenuItem): Boolean { |
||||||
fun start(){ |
if (item.itemId == R.id.menu_activity_project_list_exit) { |
||||||
ActivityNavUtil.startActivity<ProjectListActivity> { } |
finish() |
||||||
} |
} |
||||||
|
return super.onOptionsItemSelected(item) |
||||||
} |
} |
||||||
} |
} |
@ -0,0 +1,27 @@ |
|||||||
|
package com.project.survey.ui.project.adapter |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.view.ViewGroup |
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter |
||||||
|
import com.chad.library.adapter4.viewholder.QuickViewHolder |
||||||
|
import com.project.survey.R |
||||||
|
import com.project.survey.model.ProjectBean |
||||||
|
|
||||||
|
class ProjectListAdapter : BaseQuickAdapter<ProjectBean, QuickViewHolder>() { |
||||||
|
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: ProjectBean?) { |
||||||
|
|
||||||
|
item?.let { bean -> |
||||||
|
holder.setText(R.id.tvProjectName, bean.XMXX_INDUSTRYTYPE) |
||||||
|
.setText(R.id.tvProjectNum, bean.XMXX_PILENO) |
||||||
|
.setText(R.id.tvProjectArea, "上海市长宁区") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override fun onCreateViewHolder( |
||||||
|
context: Context, |
||||||
|
parent: ViewGroup, |
||||||
|
viewType: Int |
||||||
|
): QuickViewHolder { |
||||||
|
return QuickViewHolder(R.layout.item_project_list, parent) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="16.5dp" |
||||||
|
android:height="16.5dp" |
||||||
|
android:viewportWidth="16.5" |
||||||
|
android:viewportHeight="16.5"> |
||||||
|
<path |
||||||
|
android:pathData="M0,0L7.333,0L7.333,9.167L0,9.167L0,0ZM9.167,0L16.5,0L16.5,5.5L9.167,5.5L9.167,0ZM5.5,7.333L5.5,1.833L1.833,1.833L1.833,7.333L5.5,7.333ZM14.667,3.667L14.667,1.833L11,1.833L11,3.667L14.667,3.667ZM9.167,7.333L16.5,7.333L16.5,16.5L9.167,16.5L9.167,7.333ZM14.667,14.667L14.667,9.167L11,9.167L11,14.667L14.667,14.667ZM0,11L7.333,11L7.333,16.5L0,16.5L0,11ZM5.5,14.667L5.5,12.833L1.833,12.833L1.833,14.667L5.5,14.667Z" |
||||||
|
android:fillColor="#396BD0" |
||||||
|
android:fillType="evenOdd"/> |
||||||
|
</vector> |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="18.333dp" |
||||||
|
android:height="18.333dp" |
||||||
|
android:viewportWidth="18.333" |
||||||
|
android:viewportHeight="18.333"> |
||||||
|
<path |
||||||
|
android:pathData="M9.167,0C4.125,0 0,4.125 0,9.167C0,14.208 4.125,18.333 9.167,18.333C14.208,18.333 18.333,14.208 18.333,9.167C18.333,4.125 14.208,0 9.167,0ZM1.833,9.167C1.833,13.209 5.124,16.5 9.167,16.5C13.209,16.5 16.5,13.209 16.5,9.167C16.5,5.124 13.209,1.833 9.167,1.833C5.124,1.833 1.833,5.124 1.833,9.167ZM9.625,4.583L8.25,4.583L8.25,10.083L13.017,13.017L13.75,11.825L9.625,9.35L9.625,4.583Z" |
||||||
|
android:fillColor="#5B5A5E" |
||||||
|
android:fillType="evenOdd"/> |
||||||
|
</vector> |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="16dp" |
||||||
|
android:height="16dp" |
||||||
|
android:viewportWidth="16" |
||||||
|
android:viewportHeight="16"> |
||||||
|
<path |
||||||
|
android:pathData="M8,3.333L2.667,3.333L2.667,12.667L8,12.667L8,14L2.667,14C1.933,14 1.333,13.4 1.333,12.667L1.333,3.333C1.333,2.6 1.933,2 2.667,2L8,2L8,3.333ZM10.393,5.607L11.333,4.667L14.667,8L11.333,11.333L10.393,10.387L12.113,8.667L5.333,8.667L5.333,7.333L12.113,7.333L10.393,5.607Z" |
||||||
|
android:fillColor="#396BD0" |
||||||
|
android:fillType="evenOdd"/> |
||||||
|
</vector> |
@ -1,57 +1,53 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
<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" |
xmlns:tools="http://schemas.android.com/tools" |
||||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||||
android:layout_height="wrap_content" |
android:layout_height="wrap_content" |
||||||
android:gravity="center_vertical" |
android:paddingVertical="18dp"> |
||||||
android:orientation="horizontal" |
|
||||||
android:paddingVertical="@dimen/sw_18dp"> |
|
||||||
|
|
||||||
<ImageView |
<ImageView |
||||||
|
android:id="@+id/ivIcon" |
||||||
android:layout_width="wrap_content" |
android:layout_width="wrap_content" |
||||||
android:layout_height="wrap_content" |
android:layout_height="wrap_content" |
||||||
android:src="@drawable/ic_project_list" /> |
android:src="@drawable/ic_project_list" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" /> |
||||||
|
|
||||||
<LinearLayout |
<TextView |
||||||
android:layout_width="match_parent" |
android:id="@+id/tvProjectName" |
||||||
|
android:layout_width="wrap_content" |
||||||
android:layout_height="wrap_content" |
android:layout_height="wrap_content" |
||||||
android:layout_marginStart="@dimen/sw_14dp" |
android:layout_marginStart="14dp" |
||||||
android:orientation="vertical"> |
android:textColor="@color/text_color_20" |
||||||
|
android:textSize="15sp" |
||||||
<TextView |
android:textStyle="bold" |
||||||
android:id="@+id/tvProjectName" |
app:layout_constraintStart_toEndOf="@id/ivIcon" |
||||||
android:layout_width="wrap_content" |
app:layout_constraintTop_toTopOf="parent" |
||||||
android:layout_height="wrap_content" |
tools:text="xx工程" /> |
||||||
android:textColor="@color/text_color_1" |
|
||||||
android:textSize="@dimen/sw_15sp" |
<TextView |
||||||
android:textStyle="bold" |
android:id="@+id/tvProjectNum" |
||||||
android:text="xx工程" /> |
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
<LinearLayout |
android:layout_marginStart="14dp" |
||||||
android:layout_width="match_parent" |
android:layout_marginTop="3dp" |
||||||
android:layout_height="wrap_content" |
android:textColor="@color/text_color_727778" |
||||||
android:layout_marginTop="@dimen/sw_3dp" |
android:textSize="12sp" |
||||||
android:orientation="horizontal"> |
app:layout_constraintStart_toEndOf="@id/ivIcon" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvProjectName" |
||||||
<TextView |
tools:text="XMBH2021-00001" /> |
||||||
android:id="@+id/tvProjectNum" |
|
||||||
android:layout_width="wrap_content" |
<TextView |
||||||
android:layout_height="wrap_content" |
android:id="@+id/tvProjectArea" |
||||||
android:textColor="@color/text_color_2" |
android:layout_width="wrap_content" |
||||||
android:textSize="@dimen/sw_11sp" |
android:layout_height="wrap_content" |
||||||
android:text="XMBH2021-00001" /> |
android:textColor="@color/text_color_727778" |
||||||
|
android:textSize="12sp" |
||||||
<TextView |
app:layout_constraintBottom_toBottomOf="@id/tvProjectNum" |
||||||
android:id="@+id/tvProjectArea" |
app:layout_constraintStart_toEndOf="@id/tvProjectNum" |
||||||
android:layout_width="wrap_content" |
app:layout_constraintTop_toTopOf="@id/tvProjectNum" |
||||||
android:layout_height="wrap_content" |
tools:text="上海市长宁区" /> |
||||||
android:textColor="@color/text_color_2" |
|
||||||
android:textSize="@dimen/sw_11sp" |
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
android:text="上海市长宁区" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -0,0 +1,8 @@ |
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||||
|
<item |
||||||
|
android:id="@+id/menu_activity_project_list_exit" |
||||||
|
android:icon="@drawable/icon_toolbar_exit" |
||||||
|
app:showAsAction="withText|always" |
||||||
|
android:title="@string/exit"/> |
||||||
|
</menu> |
Loading…
Reference in new issue