Commit 87d78777 authored by mengcuiguang's avatar mengcuiguang
parents 2a784bb5 c60209a8
package com.mints.goodnews.main package com.mints.goodnews.main
import android.app.Activity
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.bumptech.glide.Glide
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
import com.fry.base.utils.ImageLoader
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
import com.mints.goodnews.BR import com.mints.goodnews.BR
import com.mints.goodnews.R import com.mints.goodnews.R
import com.mints.goodnews.databinding.ActivityMainBinding import com.mints.goodnews.databinding.ActivityMainBinding
import com.mints.goodnews.main.home.HomeFragment
import com.mints.goodnews.main.my.MyFragment
import com.mints.goodnews.main.square.SquareFragment
import com.mints.goodnews.main.take_photo.TakePhotoFragment
import com.mints.goodnews.main.task.TakeFragment
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
class MainActivity : BaseActivity<ActivityMainBinding,MainViewModel>() { class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_main override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_main
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initData() { override fun initData() {
super.initData() super.initData()
//初始化底部Button //初始化viewpager2
binding.mainViewpager.initMain(this)
//初始化 bottomBarF
binding.mainBottom.init {
when (it) {
R.id.menu_home -> binding.mainViewpager.setCurrentItem(0, false)
R.id.menu_square -> binding.mainViewpager.setCurrentItem(1, false)
R.id.menu_empty -> binding.mainViewpager.setCurrentItem(2, false)
R.id.menu_task -> binding.mainViewpager.setCurrentItem(3, false)
R.id.menu_my -> {
binding.mainViewpager.setCurrentItem(4, false)
// stopAnim()
}
}
}
//加载本地GIF动图
ImageLoader.ImageBuilder.with(this)
.setDrawable(R.mipmap.ic_eye_tokephone)
.setTargetView(binding.ivTakephoto).start()
binding.mainBottom.interceptLongClick(
R.id.menu_home,
R.id.menu_square,
R.id.menu_empty,
R.id.menu_task,
R.id.menu_my
)
} }
}
private fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> Unit): BottomNavigationViewEx {
enableAnimation(true)
enableShiftingMode(false)
enableItemShiftingMode(true)
setTextSize(12F)
setOnNavigationItemSelectedListener {
navigationItemSelectedAction.invoke(it.itemId)
true
}
return this
}
private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
//是否可滑动
this.isUserInputEnabled = false
this.offscreenPageLimit = 5
//设置适配器
adapter = object : FragmentStateAdapter(activity) {
override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> {
//首页
HomeFragment()
}
1 -> {
//广场
SquareFragment()
}
2 -> {
//拍照
TakePhotoFragment()
}
3 -> {
//任务中心
TakeFragment()
}
4 -> {
//个人中心
MyFragment()
}
else -> {
//首页
HomeFragment()
}
}
}
} override fun getItemCount() = 5
\ No newline at end of file }
return this
}
/**
* 拦截BottomNavigation长按事件 防止长按时出现Toast ---- 追求完美的大屌群友提的bug
* @receiver BottomNavigationViewEx
* @param ids IntArray
*/
private fun BottomNavigationViewEx.interceptLongClick(vararg ids: Int) {
val bottomNavigationMenuView: ViewGroup = (this.getChildAt(0) as ViewGroup)
for (index in ids.indices) {
bottomNavigationMenuView.getChildAt(index).findViewById<View>(ids[index])
.setOnLongClickListener {
true
}
}
}
package com.mints.goodnews.main.home
import android.app.Activity
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.ActivityMainBinding
import com.mints.goodnews.databinding.FragmentHomeBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
*/
class HomeFragment: BaseFragment<FragmentHomeBinding, HomeViewModel>() {
override fun initContentView(
inflater: LayoutInflater?, container: ViewGroup?,
savedInstanceState: Bundle?) =
R.layout.fragment_home
override fun initVariableId() = BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.home
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class HomeViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodnews.main.my
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentMyBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 个人中心页面
*/
class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?) = R.layout.fragment_my
override fun initVariableId() = BR.viewModel
}
package com.mints.goodnews.main.my
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class MyViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodnews.main.square
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentSquareBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 广场页面
*/
class SquareFragment:BaseFragment<FragmentSquareBinding,SquareViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?)= R.layout.fragment_square
override fun initVariableId()=BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.square
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class SquareViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodnews.main.take_photo
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentTakePhotoBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakePhotoFragment:BaseFragment<FragmentTakePhotoBinding,TakePhotoViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?)= R.layout.fragment_take_photo
override fun initVariableId() = BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.take_photo
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakePhotoViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodnews.main.task
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentTakeBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 任务中心页面
*/
class TakeFragment:BaseFragment<FragmentTakeBinding,TakeViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?) = R.layout.fragment_take
override fun initVariableId()=BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.task
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakeViewModel(application:Application):BaseViewModel(application) {
}
\ No newline at end of file
...@@ -11,5 +11,83 @@ ...@@ -11,5 +11,83 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".main.MainActivity"> tools:context=".main.MainActivity">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/mainViewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/flMainBootom"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/flMainBootom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="MissingConstraints">
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:id="@+id/mainBottom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F9F9F9"
app:itemIconSize="20dp"
app:itemTextColor="@color/bottom_selector"
app:menu="@menu/menu_navigation" />
</FrameLayout>
<FrameLayout
android:id="@+id/flTakephoto"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginBottom="20dp"
android:background="@mipmap/bg_tab_takephone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:id="@+id/ivTakephoto"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:scaleType="fitXY" />
</FrameLayout>
<TextView
android:id="@+id/tv_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:background="@mipmap/ic_hint"
android:gravity="center"
android:paddingStart="18dp"
android:paddingTop="2dp"
android:paddingEnd="10dp"
android:paddingBottom="10dp"
android:text="30次"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintCircle="@+id/flTakephoto"
app:layout_constraintCircleAngle="65"
app:layout_constraintCircleRadius="60dp"
tools:ignore="MissingConstraints" />
<TextView
android:id="@+id/tv_just"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:background="@mipmap/ic_hint"
android:gravity="center"
android:paddingStart="12dp"
android:paddingTop="2dp"
android:paddingEnd="6dp"
android:paddingBottom="6dp"
android:text="领金币"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@id/flMainBootom"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.home.HomeViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="首页"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.my.MyViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="个人中心"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.square.SquareViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="广场"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.task.TakeViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="任务中心"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.take_photo.TakePhotoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="拍照"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
...@@ -63,4 +63,7 @@ dependencies { ...@@ -63,4 +63,7 @@ dependencies {
// 依赖协程核心库 // 依赖协程核心库
api rootProject.ext.kotlin["coroutine"] api rootProject.ext.kotlin["coroutine"]
api rootProject.ext.kotlin["coroutine-android"] api rootProject.ext.kotlin["coroutine-android"]
//底部bottomBar
api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
} }
package com.fry.base.utils; package com.fry.base.utils;
import android.app.Activity; import android.app.Activity;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
...@@ -27,30 +29,32 @@ import me.goldze.mvvmhabit.utils.CornerTransform; ...@@ -27,30 +29,32 @@ import me.goldze.mvvmhabit.utils.CornerTransform;
public class ImageLoader { public class ImageLoader {
private ImageBuilder builder; private ImageBuilder builder;
private ImageLoader(ImageBuilder builder){
private ImageLoader(ImageBuilder builder) {
this.builder = builder; this.builder = builder;
} }
private void load(){
if(builder == null){ private void load() {
if (builder == null) {
throw new RuntimeException("you need create ImageLoader with ImageBuilder"); throw new RuntimeException("you need create ImageLoader with ImageBuilder");
} }
RequestOptions options = new RequestOptions(); RequestOptions options = new RequestOptions();
Transformation tormation = null; Transformation tormation = null;
if(builder.scaleType != null){ if (builder.scaleType != null) {
builder.targetView.setScaleType(builder.scaleType); builder.targetView.setScaleType(builder.scaleType);
} }
if(ImageView.ScaleType.CENTER_CROP == builder.getScaleType() && builder.getCornerDp() > 0){ if (ImageView.ScaleType.CENTER_CROP == builder.getScaleType() && builder.getCornerDp() > 0) {
CornerTransform cornerTransform = new CornerTransform(builder.getTargetView().getContext(),AppUtils.dp2Px(builder.getTargetView().getContext(), builder.getCornerDp())); CornerTransform cornerTransform = new CornerTransform(builder.getTargetView().getContext(), AppUtils.dp2Px(builder.getTargetView().getContext(), builder.getCornerDp()));
cornerTransform.setExceptCorner(!builder.startTopCorner,!builder.endTopCorner,!builder.startBottomCorner,!builder.endBottomCorner); cornerTransform.setExceptCorner(!builder.startTopCorner, !builder.endTopCorner, !builder.startBottomCorner, !builder.endBottomCorner);
tormation = new MultiTransformation<>(new CenterCrop(),cornerTransform); tormation = new MultiTransformation<>(new CenterCrop(), cornerTransform);
}else{ } else {
if(builder.getCornerDp() > 0) { if (builder.getCornerDp() > 0) {
CornerTransform cornerTransform = new CornerTransform(builder.getTargetView().getContext(),AppUtils.dp2Px(builder.getTargetView().getContext(), builder.getCornerDp())); CornerTransform cornerTransform = new CornerTransform(builder.getTargetView().getContext(), AppUtils.dp2Px(builder.getTargetView().getContext(), builder.getCornerDp()));
cornerTransform.setExceptCorner(!builder.startTopCorner,!builder.endTopCorner,!builder.startBottomCorner,!builder.endBottomCorner); cornerTransform.setExceptCorner(!builder.startTopCorner, !builder.endTopCorner, !builder.startBottomCorner, !builder.endBottomCorner);
if(ImageView.ScaleType.FIT_CENTER == builder.getScaleType()){ if (ImageView.ScaleType.FIT_CENTER == builder.getScaleType()) {
tormation = new MultiTransformation<>( new FitCenter(),cornerTransform); tormation = new MultiTransformation<>(new FitCenter(), cornerTransform);
}else{ } else {
tormation = new MultiTransformation<>(cornerTransform); tormation = new MultiTransformation<>(cornerTransform);
} }
...@@ -59,30 +63,43 @@ public class ImageLoader { ...@@ -59,30 +63,43 @@ public class ImageLoader {
options = options.placeholder(builder.getPlaceHolder() >= 0 ? builder.getPlaceHolder() : R.mipmap.empty_placeholder_small); options = options.placeholder(builder.getPlaceHolder() >= 0 ? builder.getPlaceHolder() : R.mipmap.empty_placeholder_small);
RequestManager requestManager; RequestManager requestManager;
if(builder.fragment != null){ if (builder.fragment != null) {
requestManager = Glide.with(builder.fragment); requestManager = Glide.with(builder.fragment);
}else if(builder.activity != null){ } else if (builder.activity != null) {
requestManager = Glide.with(builder.activity); requestManager = Glide.with(builder.activity);
}else if(builder.context != null){ } else if (builder.context != null) {
requestManager = Glide.with(builder.context); requestManager = Glide.with(builder.context);
}else{ } else {
requestManager = Glide.with(this.builder.getTargetView().getContext()); requestManager = Glide.with(this.builder.getTargetView().getContext());
} }
RequestBuilder requestBuilder = requestManager RequestBuilder requestBuilder;
.load(this.builder.getUrl()) //加载网络的
.error(builder.errorHolder) if (this.builder.url!=null && !this.builder.url.equals("")){
.addListener(this.builder.requestListener) requestBuilder = requestManager
.apply(options); .load(this.builder.getUrl())
if(tormation != null){ .error(builder.errorHolder)
requestBuilder.transform(tormation); .addListener(this.builder.requestListener)
.apply(options);
}else {
//加载本地的
requestBuilder = requestManager
.load(this.builder.getDrawable())
.error(builder.errorHolder)
.addListener(this.builder.requestListener)
.apply(options);
} }
requestBuilder.into(builder.getTargetView()); if (tormation != null) {
requestBuilder.transform(tormation);
}
requestBuilder.into(builder.getTargetView());
} }
public static class ImageBuilder {
public static class ImageBuilder{ //加载网络的
private String url; private String url;
//加载本地的
private int drawable;
private Fragment fragment; private Fragment fragment;
private Activity activity; private Activity activity;
private Context context; private Context context;
...@@ -91,7 +108,7 @@ public class ImageLoader { ...@@ -91,7 +108,7 @@ public class ImageLoader {
private int placeHolder; private int placeHolder;
private int errorHolder; private int errorHolder;
private ImageView.ScaleType scaleType; private ImageView.ScaleType scaleType;
private RequestListener requestListener; private RequestListener requestListener;
/*** /***
* 图片宽,配合阿里云oss使用,返回固定宽度,高度等比例的图片 * 图片宽,配合阿里云oss使用,返回固定宽度,高度等比例的图片
*/ */
...@@ -101,22 +118,25 @@ public class ImageLoader { ...@@ -101,22 +118,25 @@ public class ImageLoader {
private boolean endTopCorner = true; private boolean endTopCorner = true;
private boolean endBottomCorner = true; private boolean endBottomCorner = true;
public static ImageBuilder with(Fragment fragment){ public static ImageBuilder with(Fragment fragment) {
ImageBuilder builder = new ImageBuilder(); ImageBuilder builder = new ImageBuilder();
builder.fragment = fragment; builder.fragment = fragment;
return builder; return builder;
} }
public static ImageBuilder with(Activity activity){
public static ImageBuilder with(Activity activity) {
ImageBuilder builder = new ImageBuilder(); ImageBuilder builder = new ImageBuilder();
builder.activity = activity; builder.activity = activity;
return builder; return builder;
} }
public static ImageBuilder with(Context context){
public static ImageBuilder with(Context context) {
ImageBuilder builder = new ImageBuilder(); ImageBuilder builder = new ImageBuilder();
builder.context = context; builder.context = context;
return builder; return builder;
} }
public static ImageBuilder with(){
public static ImageBuilder with() {
return new ImageBuilder(); return new ImageBuilder();
} }
...@@ -133,16 +153,19 @@ public class ImageLoader { ...@@ -133,16 +153,19 @@ public class ImageLoader {
return url; return url;
} }
public ImageBuilder setUrl(String url) { public ImageBuilder setUrl(String url) {
//后端要求,不返回协议头,自己添加 this.url = url;
if(url != null && !url.startsWith("http")){ return this;
url = String.format("https:%s",url); }
}
if(limitWidth > 0){ public int getDrawable() {
this.url = String.format("%s?x-oss-process=image/resize,w_%s",url,limitWidth); return drawable;
}else { }
this.url = url;
}
public ImageBuilder setDrawable(int drawable) {
this.drawable = drawable;
return this; return this;
} }
...@@ -182,10 +205,11 @@ public class ImageLoader { ...@@ -182,10 +205,11 @@ public class ImageLoader {
return this; return this;
} }
public ImageView.ScaleType getScaleType(){ public ImageView.ScaleType getScaleType() {
return scaleType; return scaleType;
} }
public ImageBuilder setScaleType(ImageView.ScaleType scaleType){
public ImageBuilder setScaleType(ImageView.ScaleType scaleType) {
this.scaleType = scaleType; this.scaleType = scaleType;
return this; return this;
} }
...@@ -235,7 +259,7 @@ public class ImageLoader { ...@@ -235,7 +259,7 @@ public class ImageLoader {
return this; return this;
} }
public void start(){ public void start() {
new ImageLoader(this).load(); new ImageLoader(this).load();
} }
} }
......
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/main_color" android:state_checked="true"/>
<item android:color="@color/main_color" android:state_pressed="true"/>
<item android:color="@color/main_blue_color"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_tab_main_enable" android:state_selected="true" />
<item android:drawable="@mipmap/ic_tab_main_none" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_tab_my_enable" android:state_selected="true" />
<item android:drawable="@mipmap/ic_tab_my_none" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_tab_square_enable" android:state_selected="true" />
<item android:drawable="@mipmap/ic_tab_square_none" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_tab_task_enable" android:state_selected="true" />
<item android:drawable="@mipmap/ic_tab_task_none" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_home"
android:checked="true"
android:icon="@drawable/menu_main"
android:title="@string/bottom_name_home" />
<item
android:id="@+id/menu_square"
android:icon="@drawable/menu_square"
android:title="@string/bottom_name_square" />
<item
android:id="@+id/menu_empty"
android:title="@string/bottom_name_takephoto" />
<item
android:id="@+id/menu_task"
android:icon="@drawable/menu_task"
android:title="@string/bottom_name_task" />
<item
android:id="@+id/menu_my"
android:icon="@drawable/menu_my"
android:title="@string/bottom_name_my" />
</menu>
\ No newline at end of file
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
<resources> <resources>
<color name="colorPrimary">#ffffffff</color> <color name="colorPrimary">#ffffffff</color>
<color name="colorPrimaryDark">#ffffffff</color> <color name="colorPrimaryDark">#ffffffff</color>
<color name="main_color">#FB673E</color>
<color name="main_blue_color">#536792</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>
<color name="textColor">#222222</color> <color name="textColor">#222222</color>
<color name="textColorHint">#888888</color> <color name="textColorHint">#888888</color>
...@@ -9,5 +13,75 @@ ...@@ -9,5 +13,75 @@
<color name="viewLineColor">#EEEEEE</color> <color name="viewLineColor">#EEEEEE</color>
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="translucent">#00000000</color> <color name="translucent">#00000000</color>
<color name="main_color">#B88855</color>
<color name="transparent">#00000000</color>
<color name="trans20">#20000000</color>
<color name="trans30">#30000000</color>
<color name="trans40">#40000000</color>
<color name="color_E6E6E6">#E6E6E6</color>
<color name="color_E6E2E2">#E6E2E2</color>
<color name="color_121B32">#121B32</color>
<color name="color_FF9837">#FF9837</color>
<color name="color_50FF9837">#50FF9837</color>
<color name="color_3D5AFE">#3D5AFE</color>
<color name="color_cb4a39">#cb4a39</color>
<color name="color_0000FF">#0000FF</color>
<color name="color_ccc">#cccccc</color>
<color name="color_AAA">#AAAAAA</color>
<color name="color_0000">#00000000</color>
<color name="color_20000000">#20000000</color>
<color name="color_60000000">#60000000</color>
<color name="color_50000000">#50000000</color>
<color name="color_2B3238">#2B3238</color>
<color name="color_002444">#002444</color>
<color name="color_600c224b">#600c224b</color>
<color name="color_fcf16e">#fcf16e</color>
<color name="color_F18542">#F18542</color>
<color name="color_FEEBC8">#FEEBC8</color>
<color name="color_63A0B9">#63A0B9</color>
<color name="color_7EE2FF">#7EE2FF</color>
<color name="color_255186">#255186</color>
<color name="color_A7BCFE">#A7BCFE</color>
<color name="color_666">#666666</color>
<color name="color_454A69">#454A69</color>
<color name="color_333">#333333</color>
<color name="color_4BB93F">#4BB93F</color>
<color name="color_556A97">#556A97</color>
<color name="color_FEB63D">#FEB63D</color>
<color name="color_FF5E5E">#FF5E5E</color>
<color name="color_172B54">#172B54</color>
<color name="color_707A8D">#707A8D</color>
<color name="color_F9F9F9">#F9F9F9</color>
<color name="color_63677E">#63677E</color>
<color name="color_BEC2CC">#BEC2CC</color>
<color name="color_50E8E8E8">#50E8E8E8</color>
<color name="color_FF2326">#FF2326</color>
<color name="color_93B7D9">#93B7D9</color>
<color name="color_F9FAFB">#F9FAFB</color>
<color name="color_F8F8F8">#F8F8F8</color>
<color name="color_343C4F">#343C4F</color>
<color name="color_FB560C">#FB560C</color>
<color name="color_EBB20D">#EBB20D</color>
<color name="color_999">#999999</color>
<color name="color_555">#555555</color>
<color name="color_F5F">#F5F5F5</color>
<color name="color_F8F">#F8F8F8</color>
<color name="color_D81B60">#D81B60</color>
<color name="color_00895B">#00895B</color>
<color name="color_8F6D21">#8F6D21</color>
<color name="color_FFDD0C">#FFDD0C</color>
<color name="color_CF7E7E">#CF7E7E</color>
<color name="color_FF4A4A">#FF4A4A</color>
<color name="color_AF6F36">#AF6F36</color>
<color name="color_912C36">#912C36</color>
<color name="color_E72C2B">#E72C2B</color>
<color name="color_FFC7C7">#FFC7C7</color>
<color name="color_FF7C00">#FF7C00</color>
<color name="color_FAF6E8">#FAF6E8</color>
<color name="color_F3E7C5">#F3E7C5</color>
<color name="color_E1B867">#E1B867</color>
<color name="color_FCCCAC">#FCCCAC</color>
<color name="color_994B23">#994B23</color>
<color name="color_F28335">#F28335</color>
</resources> </resources>
\ No newline at end of file
...@@ -3,4 +3,50 @@ ...@@ -3,4 +3,50 @@
<string name="rmb_tag">¥</string> <string name="rmb_tag">¥</string>
<string name="rmb_tag_normal_format">¥%s</string> <string name="rmb_tag_normal_format">¥%s</string>
<string name="ask">\?</string> <string name="ask">\?</string>
<string name="bottom_name_home">首页</string>
<string name="bottom_name_square">广场</string>
<string name="bottom_name_takephoto">拍照</string>
<string name="bottom_name_task">任务中心</string>
<string name="bottom_name_my">个人中心</string>
<string name="app_sign">5932d26a</string>
<string name="dot">--</string>
<string name="str_logout">退出登录</string>
<string name="str_hot_style">热门特效</string>
<string name="str_agree_register">注册协议</string>
<string name="str_agree_privacy">隐私协议</string>
<string name="str_copyright">Copyright © 2021 Inc..</string>
<string name="str_wx_login">微信登录</string>
<string name="str_other_login">其他登录方式</string>
<string name="str_immediately_login">立即登录</string>
<string name="str_bind_mobile">绑定手机号</string>
<string name="str_sms_code_1">验证码:</string>
<string name="str_phone_num_1">手机号:</string>
<string name="str_input_phone">请输入手机号</string>
<string name="str_input_sms">请输入验证码</string>
<string name="str_send_sms">发送验证码</string>
<string name="str_login_tint">你需要先用微信登录,在【个人中心】-【设置】中绑定手机号码,才能使用手机号登录</string>
<string name="str_invite_friend_get_bonus">邀请好友 奖励现金</string>
<string name="str_invite_friend">邀请亲友</string>
<string name="str_detail_1"><![CDATA[详情 >]]></string>
<string name="str_withdrawal">提现</string>
<string name="str_coin_detail">明细</string>
<string name="str_platform_bonus">平台分红</string>
<string name="str_no_login">未登录</string>
<string name="str_feedback">请留下您的批评、表扬或者建议,我们会虚心听取, 认真改正。(请保持在5-150字内)</string>
<string name="str_submit">提交</string>
<string name="str_immediately_use">立即体验</string>
<string name="str_wechat">微信</string>
<string name="str_jd_loan">京东金融</string>
<string name="str_style_contrast">效果对比</string>
<string name="str_plat_earning">分红收益</string>
<string name="register_name">用户注册协议</string>
<string name="privacy_name">用户隐私协议</string>
<string name="strategy_name">平台攻略</string>
<string name="str_cancel">取消</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment