[function]基础功能
|
|
@ -28,6 +28,9 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -36,6 +39,13 @@ dependencies {
|
|||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation project(path: ':libs')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
package="com.skipping">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="true" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".APP"
|
||||
android:allowBackup="true"
|
||||
|
|
@ -16,18 +16,20 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".activity.MainActivity">
|
||||
|
||||
</activity>
|
||||
<activity android:name=".activity.MainActivity"></activity>
|
||||
<activity
|
||||
android:name=".activity.MainActivity2"
|
||||
android:exported="true" />
|
||||
<activity android:name=".activity.HostActivity" />
|
||||
<activity android:name=".activity.NetActivity" />
|
||||
<activity
|
||||
android:name=".activity.SplashActivity"
|
||||
android:name=".activity.splash.SplashActivity"
|
||||
android:theme="@style/AppTheme.SplashTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activity.grade.GradeActivity" />
|
||||
<activity android:name=".activity.clasz.ClassActivity" />
|
||||
|
|
@ -35,20 +37,26 @@
|
|||
<activity android:name=".activity.detail.DetailActivity" />
|
||||
<activity
|
||||
android:name=".activity.home.HomeActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
|
||||
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.setting.SettingActivity"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".activity.perform.PerformActivity"
|
||||
android:screenOrientation="landscape" />
|
||||
|
||||
<service
|
||||
android:name="com.loop.loopminisdk.LoopMini"
|
||||
android:enabled="true"></service>
|
||||
android:enabled="true" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -14,15 +14,27 @@ const val BASE_URL = "https://api.xintijiao.com/ijustjump/"
|
|||
const val CLASS = "class"
|
||||
const val GRADE = "grade"
|
||||
const val UNFINISHED = "未完成"
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
const val ACCOUNT = "account"
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
const val PASSWORD = "password"
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
const val TOKEN = "token"
|
||||
|
||||
/**
|
||||
* 定时计数
|
||||
*/
|
||||
const val TIMING = "timing"
|
||||
|
||||
const val TIMING_NAME = "定时计数(秒)"
|
||||
|
||||
const val NUMBER_NAME = "定数计数(个)"
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class HostActivity extends BaseActivity {
|
|||
};
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_host;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class MainActivity extends BaseActivity {
|
|||
private Button btn, btn2;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class NetActivity extends BaseActivity {
|
|||
private NetRecyclerAdapter adapter;
|
||||
private LinearLayoutManager linearLayoutManager;
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_net;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
package com.skipping.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.libs.fragment.BaseActivity;
|
||||
import com.libs.network.CallBack;
|
||||
import com.libs.network.Concise;
|
||||
import com.skipping.Contants;
|
||||
import com.skipping.R;
|
||||
import com.skipping.activity.grade.GradeActivity;
|
||||
import com.skipping.net.API;
|
||||
import com.skipping.net.BaseBean;
|
||||
import com.skipping.net.TokenBean;
|
||||
import com.skipping.net.TokenReqBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/18/22
|
||||
*/
|
||||
public class SplashActivity extends BaseActivity {
|
||||
private EditText key, value;
|
||||
private Button login;
|
||||
private Concise<API> tokenConcise;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
return R.layout.activity_splash;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
key = findViewById(R.id.key);
|
||||
value = findViewById(R.id.value);
|
||||
login = findViewById(R.id.login);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
login.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
login();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void login() {
|
||||
tokenConcise = new Concise<API>(Contants.BASE_URL) {
|
||||
}.build();
|
||||
TokenReqBean tokenReqBean = new TokenReqBean();
|
||||
tokenReqBean.setDeviceID("466e9c");
|
||||
tokenReqBean.setLogName(key.getText().toString());
|
||||
tokenReqBean.setLogPwd(value.getText().toString());
|
||||
tokenConcise.request(SplashActivity.this, tokenConcise.api.token(tokenReqBean), new CallBack<BaseBean<TokenBean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseBean<TokenBean> tokenBeanBaseBean) {
|
||||
MMKV kv = MMKV.defaultMMKV();
|
||||
kv.encode(Contants.ACCOUNT, key.getText().toString());
|
||||
kv.encode(Contants.PASSWORD, value.getText().toString());
|
||||
kv.encode(Contants.TOKEN, tokenBeanBaseBean.getData().getToken());
|
||||
Intent intent = new Intent(SplashActivity.this, GradeActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ public class ClassActivity extends BaseActivity {
|
|||
private ClassAdapter classAdapter;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_show;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class DetailActivity extends BaseActivity {
|
|||
private ConnectManager connectManager;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_detail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.libs.network.CallBack;
|
|||
import com.libs.network.Concise;
|
||||
import com.skipping.Contants;
|
||||
import com.skipping.R;
|
||||
import com.skipping.activity.SplashActivity;
|
||||
import com.skipping.activity.clasz.ClassActivity;
|
||||
import com.skipping.net.API;
|
||||
import com.skipping.net.BaseBean;
|
||||
|
|
@ -31,7 +30,7 @@ public class GradeActivity extends BaseActivity {
|
|||
private GradeAdapter gradeAdapter;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_show;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,27 @@
|
|||
package com.skipping.activity.home
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
import com.libs.fragment.BaseActivity
|
||||
import com.libs.utils.ActivityManager
|
||||
import com.libs.utils.LogUtil
|
||||
import com.skipping.R
|
||||
import com.skipping.activity.perform.PerformActivity
|
||||
import com.skipping.activity.setting.SettingActivity
|
||||
import com.skipping.net.ActivityBean
|
||||
import com.skipping.net.GradleBean
|
||||
import com.skipping.utils.DateUtils
|
||||
import com.skipping.utils.ScreenUtil
|
||||
import com.skipping.view.bubblewindow.BubbleWindow
|
||||
import com.skipping.view.bubblewindow.Direction
|
||||
import com.skipping.view.bubblewindow.OnItemClick
|
||||
import com.skipping.view.bubblewindow.itemview.TextItemView
|
||||
import kotlinx.android.synthetic.main.activity_detail.view.*
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
|
||||
/**
|
||||
|
|
@ -14,6 +30,17 @@ import kotlinx.android.synthetic.main.activity_home.*
|
|||
*
|
||||
*/
|
||||
class HomeActivity : BaseActivity<HomePresenter>() {
|
||||
lateinit var classList: List<GradleBean>
|
||||
lateinit var bubbleWindow: BubbleWindow
|
||||
|
||||
companion object {
|
||||
fun startHome(activity: Activity) {
|
||||
val intent = Intent(activity, HomeActivity::class.java)
|
||||
activity.startActivity(intent)
|
||||
ActivityManager.getInstance().popActivity(activity)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getContentViewResId(): Int {
|
||||
return R.layout.activity_home
|
||||
}
|
||||
|
|
@ -26,10 +53,46 @@ class HomeActivity : BaseActivity<HomePresenter>() {
|
|||
setting_btn.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, SettingActivity::class.java))
|
||||
}
|
||||
create_activity.setOnClickListener {
|
||||
drawerlayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
p.getActivityList()
|
||||
p.getClassList()
|
||||
choseClass.setOnClickListener {
|
||||
bubbleWindow.show(chooseIV)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initStart() {
|
||||
ScreenUtil.setCustomDensity(this)
|
||||
}
|
||||
|
||||
|
||||
fun showList(list: List<ActivityBean>) {
|
||||
recyclerview.layoutManager = GridLayoutManager(this, 3)
|
||||
val adaper = HomeGridAdaper(this, list)
|
||||
adaper.setOnItemClickListener {
|
||||
PerformActivity.startActivity(this, it.id.toString(), DateUtils.dealDateFormat(it.createdAt))
|
||||
}
|
||||
recyclerview.adapter = adaper
|
||||
}
|
||||
|
||||
fun showClassList(list: List<GradleBean>) {
|
||||
classList = list
|
||||
bubbleWindow = BubbleWindow.Builder(this).apply {
|
||||
classList.forEach {
|
||||
this.setItemView(TextItemView(this@HomeActivity, it.groupID, it.groupName + "班学生"))
|
||||
}
|
||||
}.setOnItemClick(object : OnItemClick {
|
||||
override fun onClick(tag: String?, position: Int, bubbleWindow: BubbleWindow?) {
|
||||
activityNameEdit?.setText(list[position].groupName + "班活动")
|
||||
bubbleWindow?.dismiss()
|
||||
}
|
||||
}).setMargining(com.libs.utils.ScreenUtil.getActionBarHeight(this))
|
||||
.setDirection(Direction.BOTTOM)
|
||||
.build()
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.skipping.activity.home
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.skipping.NUMBER_NAME
|
||||
import com.skipping.R
|
||||
import com.skipping.TIMING
|
||||
import com.skipping.TIMING_NAME
|
||||
import com.skipping.net.ActivityBean
|
||||
import com.skipping.utils.DateUtils
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/25/22
|
||||
*
|
||||
*/
|
||||
class HomeGridAdaper(context: Context, list: List<ActivityBean>) : RecyclerView.Adapter<HomeGridAdaper.Holder>() {
|
||||
var list = list
|
||||
var context = context
|
||||
lateinit var onClick: (bean: ActivityBean) -> Unit
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeGridAdaper.Holder {
|
||||
return Holder(LayoutInflater.from(context).inflate(R.layout.grid_item, parent, false))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: HomeGridAdaper.Holder, position: Int) {
|
||||
holder.name.text = list[position].name
|
||||
holder.time.text = DateUtils.dealDateFormat(list[position].createdAt)
|
||||
holder.className.text = list[position].id.toString()
|
||||
if (list[position].activityType == TIMING) {
|
||||
holder.status.text = TIMING_NAME
|
||||
} else {
|
||||
holder.status.text = NUMBER_NAME
|
||||
}
|
||||
if (onClick != null) {
|
||||
holder.itemView.setOnClickListener { onClick.invoke(list[position]) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return list.size
|
||||
}
|
||||
|
||||
class Holder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var name = itemView.findViewById<TextView>(R.id.name)
|
||||
var time = itemView.findViewById<TextView>(R.id.time)
|
||||
var className = itemView.findViewById<TextView>(R.id.className)
|
||||
var status = itemView.findViewById<TextView>(R.id.status)
|
||||
}
|
||||
|
||||
fun setOnItemClickListener(onClick: (bean: ActivityBean) -> Unit) {
|
||||
this.onClick = onClick
|
||||
}
|
||||
|
||||
interface OnClick {
|
||||
fun onClick(bean: ActivityBean)
|
||||
}
|
||||
}
|
||||
|
|
@ -3,13 +3,53 @@ package com.skipping.activity.home
|
|||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.libs.fragment.BasePresenter
|
||||
import com.libs.network.CallBack
|
||||
import com.libs.network.Concise
|
||||
import com.libs.utils.ToastUtil
|
||||
import com.skipping.ACCOUNT
|
||||
import com.skipping.BASE_URL
|
||||
import com.skipping.PASSWORD
|
||||
import com.skipping.TOKEN
|
||||
import com.skipping.activity.IView
|
||||
import com.skipping.net.*
|
||||
import com.tencent.mmkv.MMKV
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/24/22
|
||||
*
|
||||
*/
|
||||
class HomePresenter() :BasePresenter<IView>() {
|
||||
class HomePresenter() : BasePresenter<HomeActivity>() {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
val concise: Concise<API> = object : Concise<API>(BASE_URL) {}.addHeader("Token", mmkv?.decodeString(TOKEN)).build() as Concise<API>
|
||||
|
||||
fun getActivityList() {
|
||||
val bean = ActivityReqBean()
|
||||
bean.index = 1
|
||||
bean.pageSize = 9
|
||||
concise.request(v, concise.api.getActivityList(bean), object : CallBack<BaseBean<List<ActivityBean>>> {
|
||||
override fun onSuccess(k: BaseBean<List<ActivityBean>>?) {
|
||||
if (k != null) {
|
||||
v.showList(k.data)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailed(e: Throwable?) {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun getClassList() {
|
||||
concise.request(v, concise.api.getClass(null), object : CallBack<BaseBean<List<GradleBean>>> {
|
||||
override fun onSuccess(k: BaseBean<List<GradleBean>>?) {
|
||||
v.showClassList(k?.data!!)
|
||||
}
|
||||
|
||||
override fun onFailed(e: Throwable?) {
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ public class ListActivity extends BaseActivity {
|
|||
private ListAdapter listAdapter;
|
||||
|
||||
@Override
|
||||
protected int getContentViewResId() {
|
||||
protected Integer getContentViewResId() {
|
||||
return R.layout.activity_show;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.skipping.activity.perform
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.libs.fragment.BaseActivity
|
||||
import com.libs.utils.ActivityManager
|
||||
import com.skipping.NUMBER_NAME
|
||||
import com.skipping.R
|
||||
import com.skipping.TIMING
|
||||
import com.skipping.TIMING_NAME
|
||||
import com.skipping.activity.home.HomeActivity
|
||||
import com.skipping.activity.setting.SettingActivity
|
||||
import com.skipping.fragment.login.LoginFragment
|
||||
import com.skipping.fragment.pair.PairFragment
|
||||
import com.skipping.net.DetailActivityBean
|
||||
import com.skipping.utils.ScreenUtil
|
||||
import com.skipping.utils.StatusBarUtil
|
||||
import kotlinx.android.synthetic.main.activity_perform.*
|
||||
import kotlinx.android.synthetic.main.activity_setting.*
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/24/22
|
||||
*
|
||||
*/
|
||||
class PerformActivity : BaseActivity<PerformPresenter>() {
|
||||
lateinit var adaper: PerformAdaper
|
||||
|
||||
companion object {
|
||||
val DATA = "data"
|
||||
val TIME = "time"
|
||||
fun startActivity(activity: Activity, data: String, time: String) {
|
||||
val intent = Intent(activity, PerformActivity::class.java)
|
||||
val bundle = Bundle()
|
||||
bundle.putString(DATA, data)
|
||||
bundle.putString(TIME, time)
|
||||
intent.putExtra(DATA, bundle)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getContentViewResId(): Int {
|
||||
return R.layout.activity_perform
|
||||
}
|
||||
|
||||
override fun initStart() {
|
||||
ScreenUtil.setCustomDensity(this)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
initPresnter()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
p.getDetail(intent.getBundleExtra(DATA).getString(DATA))
|
||||
backBtn.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
fun showDetail(bean: DetailActivityBean) {
|
||||
name.text = bean.activityName
|
||||
if (bean.activityType == TIMING) {
|
||||
type.text = TIMING_NAME
|
||||
} else {
|
||||
type.text = NUMBER_NAME
|
||||
}
|
||||
time.text = intent.getBundleExtra(DATA).getString(TIME)
|
||||
recyclerview.layoutManager = LinearLayoutManager(this)
|
||||
adaper = PerformAdaper(this, bean)
|
||||
recyclerview.adapter = adaper
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.skipping.activity.perform
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.skipping.NUMBER_NAME
|
||||
import com.skipping.R
|
||||
import com.skipping.TIMING
|
||||
import com.skipping.TIMING_NAME
|
||||
import com.skipping.net.ActivityBean
|
||||
import com.skipping.net.DetailActivityBean
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/25/22
|
||||
*
|
||||
*/
|
||||
class PerformAdaper(context: Context, bean: DetailActivityBean) : RecyclerView.Adapter<PerformAdaper.Holder>() {
|
||||
var bean = bean
|
||||
var context = context
|
||||
lateinit var onClick: () -> Unit
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PerformAdaper.Holder {
|
||||
return Holder(LayoutInflater.from(context).inflate(R.layout.perform_item, parent, false))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: PerformAdaper.Holder, position: Int) {
|
||||
holder.name.text = bean.candidates[0].get(position).name
|
||||
holder.code.text = bean.candidates[0].get(position).studentID
|
||||
holder.time.text = bean.activityValue.toString()
|
||||
holder.num.text = bean.candidates[0].get(position).score.toString()
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return bean.candidates[0].size
|
||||
}
|
||||
|
||||
class Holder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var name = itemView.findViewById<TextView>(R.id.name)
|
||||
var code = itemView.findViewById<TextView>(R.id.code)
|
||||
var time = itemView.findViewById<TextView>(R.id.time)
|
||||
var num = itemView.findViewById<TextView>(R.id.num)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.skipping.activity.perform
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.libs.fragment.BasePresenter
|
||||
import com.libs.network.CallBack
|
||||
import com.libs.network.Concise
|
||||
import com.skipping.BASE_URL
|
||||
import com.skipping.TOKEN
|
||||
import com.skipping.activity.IView
|
||||
import com.skipping.net.API
|
||||
import com.skipping.net.ActivityBean
|
||||
import com.skipping.net.BaseBean
|
||||
import com.skipping.net.DetailActivityBean
|
||||
import com.tencent.mmkv.MMKV
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/24/22
|
||||
*
|
||||
*/
|
||||
class PerformPresenter() : BasePresenter<PerformActivity>() {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
val concise: Concise<API> = object : Concise<API>(BASE_URL) {}.addHeader("Token", mmkv?.decodeString(TOKEN)).build() as Concise<API>
|
||||
|
||||
|
||||
fun getDetail(id: String) {
|
||||
concise.request(v, concise.api.detailActivity(id), object : CallBack<BaseBean<DetailActivityBean>> {
|
||||
override fun onSuccess(k: BaseBean<DetailActivityBean>?) {
|
||||
v.showDetail(k?.data!!)
|
||||
}
|
||||
|
||||
override fun onFailed(e: Throwable?) {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
package com.skipping.activity.setting
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.libs.fragment.BaseActivity
|
||||
import com.libs.utils.ActivityManager
|
||||
import com.skipping.R
|
||||
import com.skipping.activity.home.HomeActivity
|
||||
import com.skipping.fragment.login.LoginFragment
|
||||
import com.skipping.fragment.pair.PairFragment
|
||||
import com.skipping.utils.ScreenUtil
|
||||
import com.skipping.utils.StatusBarUtil
|
||||
import kotlinx.android.synthetic.main.activity_setting.*
|
||||
|
||||
/**
|
||||
|
|
@ -16,15 +23,37 @@ class SettingActivity : BaseActivity<SettingPresenter>() {
|
|||
var position = -1;
|
||||
lateinit var fragment: Fragment
|
||||
|
||||
|
||||
companion object {
|
||||
val DATA = "data"
|
||||
fun startActivity(activity: Activity, data: String) {
|
||||
val intent = Intent(activity, SettingActivity::class.java)
|
||||
val bundle = Bundle()
|
||||
bundle.putString(data, data)
|
||||
intent.putExtra(data, bundle)
|
||||
activity.startActivity(intent)
|
||||
ActivityManager.getInstance().popActivity(activity)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getContentViewResId(): Int {
|
||||
return R.layout.activity_setting
|
||||
}
|
||||
|
||||
override fun initStart() {
|
||||
ScreenUtil.setCustomDensity(this)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
initPresnter()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
clickPair()
|
||||
if (intent.getBundleExtra(DATA) != null) {
|
||||
clickLogin()
|
||||
} else {
|
||||
clickPair()
|
||||
}
|
||||
pair.setOnClickListener {
|
||||
clickPair()
|
||||
}
|
||||
|
|
@ -32,11 +61,11 @@ class SettingActivity : BaseActivity<SettingPresenter>() {
|
|||
clickLogin()
|
||||
}
|
||||
back.setOnClickListener {
|
||||
finish()
|
||||
HomeActivity.startHome(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickPair(){
|
||||
private fun clickPair() {
|
||||
if (position == 0) {
|
||||
return
|
||||
}
|
||||
|
|
@ -46,7 +75,7 @@ class SettingActivity : BaseActivity<SettingPresenter>() {
|
|||
showFragment()
|
||||
}
|
||||
|
||||
private fun clickLogin(){
|
||||
private fun clickLogin() {
|
||||
if (position == 1) {
|
||||
return
|
||||
}
|
||||
|
|
@ -65,4 +94,5 @@ class SettingActivity : BaseActivity<SettingPresenter>() {
|
|||
}
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment, fragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.skipping.activity.splash
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import com.libs.fragment.BaseActivity
|
||||
import com.libs.utils.ActivityManager
|
||||
import com.skipping.ACCOUNT
|
||||
import com.skipping.PASSWORD
|
||||
import com.skipping.activity.home.HomeActivity
|
||||
import com.skipping.activity.setting.SettingActivity
|
||||
import com.skipping.utils.ScreenUtil
|
||||
import com.skipping.utils.StatusBarUtil
|
||||
import com.skipping.utils.ThreadPoolUtil
|
||||
import com.tencent.mmkv.MMKV
|
||||
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/25/22
|
||||
*
|
||||
*/
|
||||
class SplashActivity : BaseActivity<SplashPresenter>() {
|
||||
override fun getContentViewResId(): Int? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun initStart() {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
ScreenUtil.setCustomDensity(this)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
initPresnter()
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
ThreadPoolUtil.getSingleton().scheduleMain({
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
if (mmkv?.decodeString(ACCOUNT) == null || mmkv?.decodeString(PASSWORD) == null) {
|
||||
SettingActivity.startActivity(this, "1")
|
||||
} else {
|
||||
p.login(mmkv.decodeString(ACCOUNT)!!, mmkv.decodeString(PASSWORD)!!)
|
||||
}
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
fun loginResult(result: Int) {
|
||||
if (result == 0) {
|
||||
SettingActivity.startActivity(this, "1")
|
||||
} else {
|
||||
startActivity(Intent(this@SplashActivity, HomeActivity::class.java))
|
||||
ActivityManager.getInstance().popActivity(this)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.skipping.activity.splash
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.libs.fragment.BasePresenter
|
||||
import com.libs.network.CallBack
|
||||
import com.libs.network.Concise
|
||||
import com.libs.utils.ToastUtil
|
||||
import com.skipping.ACCOUNT
|
||||
import com.skipping.BASE_URL
|
||||
import com.skipping.PASSWORD
|
||||
import com.skipping.TOKEN
|
||||
import com.skipping.activity.IView
|
||||
import com.skipping.net.API
|
||||
import com.skipping.net.BaseBean
|
||||
import com.skipping.net.TokenBean
|
||||
import com.skipping.net.TokenReqBean
|
||||
import com.tencent.mmkv.MMKV
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/24/22
|
||||
*
|
||||
*/
|
||||
class SplashPresenter() :BasePresenter<SplashActivity>() {
|
||||
|
||||
fun login(key: String, value: String) {
|
||||
val tokenConcise: Concise<API> = object : Concise<API>(BASE_URL) {}.build() as Concise<API>
|
||||
val tokenReqBean = TokenReqBean()
|
||||
tokenReqBean.deviceID = "466e9c"
|
||||
tokenReqBean.logName = key
|
||||
tokenReqBean.logPwd = value
|
||||
tokenConcise.request(v, tokenConcise.api.token(tokenReqBean), object : CallBack<BaseBean<TokenBean>> {
|
||||
override fun onSuccess(k: BaseBean<TokenBean>?) {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
mmkv?.encode(ACCOUNT, key)
|
||||
mmkv?.encode(PASSWORD, value)
|
||||
mmkv?.encode(TOKEN, k?.data?.token)
|
||||
v.loginResult(1)
|
||||
}
|
||||
|
||||
override fun onFailed(e: Throwable?) {
|
||||
v.loginResult(0)
|
||||
ToastUtil.longToast("连接失败")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
package com.skipping.utils;
|
||||
|
||||
import android.util.LruCache;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-07-21
|
||||
* 按键防抖工具类
|
||||
*/
|
||||
public class AntiShakeUtil {
|
||||
private static LruCache<Integer, Long> clickCache = new LruCache<>(5);
|
||||
|
||||
/**
|
||||
* 按键防抖(通过监听设置)
|
||||
*
|
||||
* @param view 防抖的view
|
||||
* @param onClickListener 点击监听
|
||||
*/
|
||||
public static void setAntiShake(@NonNull View view, @Nullable OnClickListener onClickListener) {
|
||||
antiShakeInternal(view, onClickListener, Type.DEFAULT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按键防抖(通过监听设置)
|
||||
*
|
||||
* @param view 防抖的view
|
||||
* @param clickGapTime 间隔时间
|
||||
* @param onClickListener 点击监听
|
||||
*/
|
||||
public static void setAntiShake(@NonNull View view, @NonNull long clickGapTime, @Nullable OnClickListener onClickListener) {
|
||||
antiShakeInternal(view, onClickListener, Type.CUSTOMIZE, clickGapTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按键防抖传入view判断是否可点击
|
||||
*
|
||||
* @param view 防抖的view
|
||||
* @return true为可点击 false为不可点击
|
||||
*/
|
||||
public static boolean getAntiShakeStateByView(View view) {
|
||||
return getAntiShakeStateInternal(view.getId(), Type.DEFAULT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按键防抖传入view判断是否可点击
|
||||
*
|
||||
* @param view 防抖的view
|
||||
* @param clickGapTime 间隔时间
|
||||
* @return true为可点击 false为不可点击
|
||||
*/
|
||||
public static boolean getAntiShakeStateByView(View view, long clickGapTime) {
|
||||
return getAntiShakeStateInternal(view.getId(), Type.CUSTOMIZE, clickGapTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按键防抖传入viewId判断是否可点击
|
||||
*
|
||||
* @param viewId 防抖的view的Id
|
||||
* @return true为可点击 false为不可点击
|
||||
*/
|
||||
public static boolean getAntiShakeStateById(int viewId) {
|
||||
return getAntiShakeStateInternal(viewId, Type.DEFAULT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按键防抖传入viewId判断是否可点击
|
||||
*
|
||||
* @param viewId 防抖的view的Id
|
||||
* @param clickGapTime 间隔时间
|
||||
* @return true为可点击 false为不可点击
|
||||
*/
|
||||
public static boolean getAntiShakeStateById(int viewId, long clickGapTime) {
|
||||
return getAntiShakeStateInternal(viewId, Type.CUSTOMIZE, clickGapTime);
|
||||
}
|
||||
|
||||
private static boolean getAntiShakeStateInternal(int viewId, @Type int type, long clickGapTime) {
|
||||
long gapTime = 500;
|
||||
if (type == Type.CUSTOMIZE) {
|
||||
gapTime = clickGapTime;
|
||||
}
|
||||
if (clickCache.get(viewId) == null) {
|
||||
clickCache.put(viewId, System.currentTimeMillis());
|
||||
return true;
|
||||
} else {
|
||||
if ((System.currentTimeMillis() - clickCache.get(viewId) > gapTime)) {
|
||||
clickCache.put(viewId, System.currentTimeMillis());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void antiShakeInternal(View view, OnClickListener onClickListener, @Type int type, long clickGapTime) {
|
||||
long gapTime = 500;
|
||||
if (type == Type.CUSTOMIZE) {
|
||||
gapTime = clickGapTime;
|
||||
}
|
||||
final long[] lastClickTimeStamp = {0};
|
||||
if (onClickListener != null) {
|
||||
long finalGapTime = gapTime;
|
||||
view.setOnClickListener(v -> {
|
||||
if ((System.currentTimeMillis() - lastClickTimeStamp[0]) > finalGapTime) {
|
||||
lastClickTimeStamp[0] = System.currentTimeMillis();
|
||||
onClickListener.onClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({Type.DEFAULT, Type.CUSTOMIZE})
|
||||
private @interface Type {
|
||||
int DEFAULT = 0;
|
||||
int CUSTOMIZE = 1;
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
void onClick();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.skipping.utils
|
||||
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
* 3/26/22
|
||||
*
|
||||
*/
|
||||
class DateUtils {
|
||||
companion object {
|
||||
fun dealDateFormat(oldDateStr: String): String {
|
||||
var df: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
|
||||
val date: Date = df.parse(oldDateStr)
|
||||
val df2: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
return df2.format(date)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,9 +5,7 @@ import android.content.Intent;
|
|||
|
||||
import com.libs.network.Concise;
|
||||
import com.libs.network.interceptor.ErrorCodeCallBack;
|
||||
import com.skipping.Contants;
|
||||
import com.skipping.activity.SplashActivity;
|
||||
import com.skipping.net.API;
|
||||
import com.skipping.activity.splash.SplashActivity;
|
||||
|
||||
/**
|
||||
* @author Ming
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
package com.skipping.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-09-15
|
||||
*/
|
||||
public class StatusBarUtil {
|
||||
/**
|
||||
* 修改状态栏为全透明
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
@TargetApi(19)
|
||||
public static void transparencyBar(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = activity.getWindow();
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window window = activity.getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态栏颜色,支持4.4以上版本
|
||||
*
|
||||
* @param activity
|
||||
* @param colorId
|
||||
*/
|
||||
// public static void setStatusBarColor(Activity activity, int colorId) {
|
||||
//
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
// Window window = activity.getWindow();
|
||||
//// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
// window.setStatusBarColor(activity.getResources().getColor(colorId));
|
||||
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
// //使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明
|
||||
// transparencyBar(activity);
|
||||
// SystemBarTintManager tintManager = new SystemBarTintManager(activity);
|
||||
// tintManager.setStatusBarTintEnabled(true);
|
||||
// tintManager.setStatusBarTintResource(colorId);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 状态栏亮色模式,设置状态栏黑色文字、图标,
|
||||
* 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
|
||||
*
|
||||
* @param activity
|
||||
* @return 1:MIUUI 2:Flyme 3:android6.0
|
||||
*/
|
||||
public static int StatusBarLightMode(Activity activity) {
|
||||
int result = 0;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (MIUISetStatusBarLightMode(activity, true)) {
|
||||
result = 1;
|
||||
} else if (FlymeSetStatusBarLightMode(activity.getWindow(), true)) {
|
||||
result = 2;
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
result = 3;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已知系统类型时,设置状态栏黑色文字、图标。
|
||||
* 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
|
||||
*
|
||||
* @param activity
|
||||
* @param type 1:MIUUI 2:Flyme 3:android6.0
|
||||
*/
|
||||
public static void StatusBarLightMode(Activity activity, int type) {
|
||||
if (type == 1) {
|
||||
MIUISetStatusBarLightMode(activity, true);
|
||||
} else if (type == 2) {
|
||||
FlymeSetStatusBarLightMode(activity.getWindow(), true);
|
||||
} else if (type == 3) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态栏暗色模式,清除MIUI、flyme或6.0以上版本状态栏黑色文字、图标
|
||||
*/
|
||||
public static void StatusBarDarkMode(Activity activity, int type) {
|
||||
if (type == 1) {
|
||||
MIUISetStatusBarLightMode(activity, false);
|
||||
} else if (type == 2) {
|
||||
FlymeSetStatusBarLightMode(activity.getWindow(), false);
|
||||
} else if (type == 3) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置状态栏图标为深色和魅族特定的文字风格
|
||||
* 可以用来判断是否为Flyme用户
|
||||
*
|
||||
* @param window 需要设置的窗口
|
||||
* @param dark 是否把状态栏文字及图标颜色设置为深色
|
||||
* @return boolean 成功执行返回true
|
||||
*/
|
||||
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
|
||||
boolean result = false;
|
||||
if (window != null) {
|
||||
try {
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
Field darkFlag = WindowManager.LayoutParams.class
|
||||
.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
|
||||
Field meizuFlags = WindowManager.LayoutParams.class
|
||||
.getDeclaredField("meizuFlags");
|
||||
darkFlag.setAccessible(true);
|
||||
meizuFlags.setAccessible(true);
|
||||
int bit = darkFlag.getInt(null);
|
||||
int value = meizuFlags.getInt(lp);
|
||||
if (dark) {
|
||||
value |= bit;
|
||||
} else {
|
||||
value &= ~bit;
|
||||
}
|
||||
meizuFlags.setInt(lp, value);
|
||||
window.setAttributes(lp);
|
||||
result = true;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要MIUIV6以上
|
||||
*
|
||||
* @param activity
|
||||
* @param dark 是否把状态栏文字及图标颜色设置为深色
|
||||
* @return boolean 成功执行返回true
|
||||
*/
|
||||
public static boolean MIUISetStatusBarLightMode(Activity activity, boolean dark) {
|
||||
boolean result = false;
|
||||
Window window = activity.getWindow();
|
||||
if (window != null) {
|
||||
Class clazz = window.getClass();
|
||||
try {
|
||||
int darkModeFlag = 0;
|
||||
Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
|
||||
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
|
||||
darkModeFlag = field.getInt(layoutParams);
|
||||
Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
|
||||
if (dark) {
|
||||
extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
|
||||
} else {
|
||||
extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
|
||||
}
|
||||
result = true;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上
|
||||
if (dark) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
} else {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,417 @@
|
|||
package com.skipping.view.bubblewindow;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.libs.utils.ScreenUtil;
|
||||
import com.skipping.R;
|
||||
import com.skipping.utils.AntiShakeUtil;
|
||||
import com.skipping.view.bubblewindow.itemview.BaseItemView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-11
|
||||
* 气泡弹窗
|
||||
* todo 判断点击范围 出范围抬起时没有点击效果
|
||||
*/
|
||||
public class BubbleWindow {
|
||||
private List<BaseItemView> baseItemViewList = new ArrayList<>();
|
||||
private OnItemClick onItemClick;
|
||||
private View clickView;
|
||||
/**
|
||||
* 弹窗宽度
|
||||
*/
|
||||
private static int dialogWidth = 150;
|
||||
|
||||
private AlertDialog dialog;
|
||||
private Activity context;
|
||||
private View angleView;
|
||||
|
||||
/**
|
||||
* 弹窗方向 默认向下
|
||||
*/
|
||||
private int direction = Direction.TOP;
|
||||
|
||||
/**
|
||||
* 弹窗距离屏幕边距
|
||||
*/
|
||||
private int padding = 20;
|
||||
|
||||
/**
|
||||
* 弹出的view距离
|
||||
*/
|
||||
private int marging = 0;
|
||||
|
||||
/**
|
||||
* 点击selector
|
||||
*/
|
||||
private boolean selector = true;
|
||||
|
||||
/**
|
||||
* 主题颜色
|
||||
*/
|
||||
private @Theme
|
||||
int theme = Theme.LIGHT;
|
||||
|
||||
public static class Builder {
|
||||
private BubbleWindow bubbleWindow;
|
||||
|
||||
public Builder(Activity context) {
|
||||
bubbleWindow = new BubbleWindow();
|
||||
bubbleWindow.context = context;
|
||||
}
|
||||
|
||||
//弹窗距离屏幕距离
|
||||
public Builder setPadding(int padding) {
|
||||
bubbleWindow.padding = padding;
|
||||
return this;
|
||||
}
|
||||
|
||||
//弹窗距离弹出的view距离
|
||||
public Builder setMargining(int marging) {
|
||||
bubbleWindow.marging = marging;
|
||||
return this;
|
||||
}
|
||||
|
||||
//弹窗方向
|
||||
public Builder setDirection(@Direction int direction) {
|
||||
bubbleWindow.direction = direction;
|
||||
return this;
|
||||
}
|
||||
|
||||
//添加子item
|
||||
public Builder setItemView(BaseItemView itemView) {
|
||||
itemView.setView();
|
||||
bubbleWindow.baseItemViewList.add(itemView);
|
||||
return this;
|
||||
}
|
||||
|
||||
//弹窗item点击事件
|
||||
public Builder setOnItemClick(OnItemClick onItemClick) {
|
||||
bubbleWindow.onItemClick = onItemClick;
|
||||
return this;
|
||||
}
|
||||
|
||||
//弹窗主题白色黑色
|
||||
public Builder setTheme(@Theme int theme) {
|
||||
bubbleWindow.theme = theme;
|
||||
return this;
|
||||
}
|
||||
|
||||
//弹窗点击selector
|
||||
public Builder setSelector(Boolean selector) {
|
||||
bubbleWindow.selector = selector;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BubbleWindow build() {
|
||||
bubbleWindow.setBubbleWindow();
|
||||
return bubbleWindow;
|
||||
}
|
||||
}
|
||||
|
||||
private void setBubbleWindow() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.bubble_dialog_style);
|
||||
dialog = builder.create();
|
||||
View dialogView = View.inflate(context, R.layout.bubble_layout, null);
|
||||
if (direction == Direction.BOTTOM) {
|
||||
angleView = dialogView.findViewById(R.id.bubble_angle_top);
|
||||
dialogView.findViewById(R.id.bottom_rl).setVisibility(View.GONE);
|
||||
if (theme == Theme.DARK) {
|
||||
angleView.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_angle_top_dark));
|
||||
}
|
||||
} else if (direction == Direction.TOP) {
|
||||
angleView = dialogView.findViewById(R.id.bubble_angle_bottom);
|
||||
dialogView.findViewById(R.id.top_rl).setVisibility(View.GONE);
|
||||
if (theme == Theme.DARK) {
|
||||
angleView.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_angle_bottom_dark));
|
||||
}
|
||||
}
|
||||
|
||||
LinearLayout linearLayout = dialogView.findViewById(R.id.bubble_layout);
|
||||
if (baseItemViewList.size() > 0) {
|
||||
//设置item的selector
|
||||
switch (baseItemViewList.size()) {
|
||||
case 1:
|
||||
if (theme == Theme.LIGHT) {
|
||||
if (selector) {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_one_selector));
|
||||
} else {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_background));
|
||||
}
|
||||
} else {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_background_dark));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (theme == Theme.LIGHT) {
|
||||
if (selector) {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_top_selector));
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_bottom_selector));
|
||||
} else {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_top));
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_bottom));
|
||||
}
|
||||
} else {
|
||||
baseItemViewList.get(0).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_top_dark));
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_bottom_dark));
|
||||
}
|
||||
|
||||
|
||||
if (baseItemViewList.size() > 2) {
|
||||
for (int i = 1; i < baseItemViewList.size() - 1; i++) {
|
||||
if (theme == Theme.LIGHT) {
|
||||
if (selector) {
|
||||
baseItemViewList.get(i).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_center_selector));
|
||||
} else {
|
||||
baseItemViewList.get(i).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_center));
|
||||
}
|
||||
} else {
|
||||
baseItemViewList.get(i).view.setBackground(ContextCompat.getDrawable(context, R.drawable.bubblewindow_item_center_dark));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//设置角的selector
|
||||
if (direction == Direction.BOTTOM && selector && theme == Theme.LIGHT) {
|
||||
baseItemViewList.get(0).view.setOnTouchListener((v, event) -> {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
angleView.setPressed(true);
|
||||
baseItemViewList.get(0).view.setPressed(true);
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!isTouchPointInView(baseItemViewList.get(0).view, event.getRawX(), event.getRawY())) {
|
||||
angleView.setPressed(false);
|
||||
baseItemViewList.get(0).view.setPressed(false);
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (baseItemViewList.get(0).view.isPressed()) {
|
||||
angleView.setPressed(false);
|
||||
baseItemViewList.get(0).view.setPressed(false);
|
||||
if (onItemClick != null) {
|
||||
onItemClick.onClick(baseItemViewList.get(0).tag, 0, BubbleWindow.this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (direction == Direction.TOP && selector && theme == Theme.LIGHT) {
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setOnTouchListener((v, event) -> {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
angleView.setPressed(true);
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setPressed(true);
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!isTouchPointInView(baseItemViewList.get(baseItemViewList.size() - 1).view, event.getRawX(), event.getRawY())) {
|
||||
angleView.setPressed(false);
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setPressed(false);
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (baseItemViewList.get(baseItemViewList.size() - 1).view.isPressed()) {
|
||||
angleView.setPressed(false);
|
||||
baseItemViewList.get(baseItemViewList.size() - 1).view.setPressed(false);
|
||||
if (onItemClick != null) {
|
||||
onItemClick.onClick(baseItemViewList.get(baseItemViewList.size() - 1).tag, baseItemViewList.size() - 1, BubbleWindow.this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//设置点击事件以及item
|
||||
for (int i = 0; i < baseItemViewList.size(); i++) {
|
||||
//设置点击事件
|
||||
if (onItemClick != null) {
|
||||
int finalI = i;
|
||||
baseItemViewList.get(i).view.setOnClickListener(v -> {
|
||||
if (AntiShakeUtil.getAntiShakeStateByView(v)) {
|
||||
onItemClick.onClick(baseItemViewList.get(finalI).tag, finalI, BubbleWindow.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
//添加view
|
||||
linearLayout.addView(baseItemViewList.get(i).view, LinearLayout.LayoutParams.MATCH_PARENT, ScreenUtil.dp2px(context, 50));
|
||||
if (i != baseItemViewList.size() - 1) {
|
||||
linearLayout.addView(lineView(), LinearLayout.LayoutParams.MATCH_PARENT, ScreenUtil.dp2px(context, 0.5f));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
dialog.setView(dialogView);
|
||||
}
|
||||
|
||||
private View lineView() {
|
||||
View view = new View(context);
|
||||
view.setBackgroundColor(ContextCompat.getColor(context, R.color.color_DDDDDD));
|
||||
return view;
|
||||
}
|
||||
|
||||
//设置dialog位置
|
||||
private void setPosition(View view) {
|
||||
Window window = dialog.getWindow();
|
||||
window.setGravity(Gravity.TOP | Gravity.LEFT);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
int[] windowLocation = new int[2];
|
||||
view.getLocationOnScreen(windowLocation);
|
||||
if (direction == Direction.TOP) {
|
||||
int commonX = (int) (windowLocation[0] + view.getWidth() / 2 - ScreenUtil.dp2px(context, dialogWidth / 2));
|
||||
int commonY = 0;
|
||||
if (context instanceof AppCompatActivity && ((AppCompatActivity) context).getSupportActionBar() != null) {
|
||||
if (((AppCompatActivity) context).getSupportActionBar().isShowing()) {
|
||||
commonY = (int) windowLocation[1] - ScreenUtil.getStatusBarHeight(context) + ScreenUtil.getActionBarHeight(context) - getDialogHeight() - ScreenUtil.dp2px(context, marging);
|
||||
}
|
||||
} else {
|
||||
commonY = (int) windowLocation[1] - ScreenUtil.getStatusBarHeight(context) - getDialogHeight() - ScreenUtil.dp2px(context, marging);
|
||||
}
|
||||
//X方向限制
|
||||
if (commonX < ScreenUtil.dp2px(context, padding)) {
|
||||
lp.x = ScreenUtil.dp2px(context, padding);
|
||||
} else if ((int) (windowLocation[0] + ScreenUtil.dp2px(context, dialogWidth)) > ScreenUtil.getScreenWidth(context)) {
|
||||
lp.x = ScreenUtil.getScreenWidth(context) - ScreenUtil.dp2px(context, padding) - ScreenUtil.dp2px(context, dialogWidth);
|
||||
} else {
|
||||
lp.x = commonX;
|
||||
}
|
||||
//Y方向限制
|
||||
if (commonY < ScreenUtil.dp2px(context, padding)) {
|
||||
lp.y = ScreenUtil.dp2px(context, padding);
|
||||
} else {
|
||||
lp.y = commonY;
|
||||
}
|
||||
//移动角的位置
|
||||
float commonMove = windowLocation[0] + view.getWidth() / 2 - (lp.x + ScreenUtil.dp2px(context, dialogWidth / 2));
|
||||
if (commonMove > ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20)) {
|
||||
angleView.setTranslationX(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20));
|
||||
} else if (commonMove < -(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 10))) {
|
||||
angleView.setTranslationX(-(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20)));
|
||||
} else {
|
||||
angleView.setTranslationX(commonMove);
|
||||
}
|
||||
} else if (direction == Direction.BOTTOM) {
|
||||
int commonX = (int) (windowLocation[0] + view.getWidth() / 2 - ScreenUtil.dp2px(context, dialogWidth / 2));
|
||||
int commonY = 0;
|
||||
if (context instanceof AppCompatActivity && ((AppCompatActivity) context).getSupportActionBar() != null) {
|
||||
if (((AppCompatActivity) context).getSupportActionBar().isShowing()) {
|
||||
commonY = (int) windowLocation[1] - ScreenUtil.getStatusBarHeight(context) + ScreenUtil.getActionBarHeight(context) + view.getHeight() - ScreenUtil.dp2px(context, marging);
|
||||
}
|
||||
} else {
|
||||
commonY = (int) windowLocation[1] - ScreenUtil.getStatusBarHeight(context) + view.getHeight() - ScreenUtil.dp2px(context, marging);
|
||||
}
|
||||
//X方向限制
|
||||
if (commonX < ScreenUtil.dp2px(context, padding)) {
|
||||
lp.x = ScreenUtil.dp2px(context, padding);
|
||||
} else if ((int) (windowLocation[0] + ScreenUtil.dp2px(context, dialogWidth)) > ScreenUtil.getScreenWidth(context)) {
|
||||
lp.x = ScreenUtil.getScreenWidth(context) - ScreenUtil.dp2px(context, padding) - ScreenUtil.dp2px(context, dialogWidth);
|
||||
} else {
|
||||
lp.x = commonX;
|
||||
}
|
||||
//Y方向限制
|
||||
if (commonY > ScreenUtil.getScreenHeight(context) - getDialogHeight()) {
|
||||
lp.y = ScreenUtil.getScreenHeight(context) - ScreenUtil.dp2px(context, padding) - getDialogHeight();
|
||||
} else {
|
||||
lp.y = commonY;
|
||||
}
|
||||
//移动角的位置
|
||||
float commonMove = windowLocation[0] + view.getWidth() / 2 - (lp.x + ScreenUtil.dp2px(context, dialogWidth / 2));
|
||||
if (commonMove > ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20)) {
|
||||
angleView.setTranslationX(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20));
|
||||
} else if (commonMove < -(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 10))) {
|
||||
angleView.setTranslationX(-(ScreenUtil.dp2px(context, dialogWidth / 2) - ScreenUtil.dp2px(context, 20)));
|
||||
} else {
|
||||
angleView.setTranslationX(commonMove);
|
||||
}
|
||||
}
|
||||
|
||||
window.setAttributes(lp);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗的高度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int getDialogHeight() {
|
||||
return ScreenUtil.dp2px(context, (float) (50 * baseItemViewList.size() + 0.5 * (baseItemViewList.size() - 1) + 16 + marging));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否点击到view内
|
||||
*
|
||||
* @param view 需要判断的view
|
||||
* @param x 点击的x坐标 event.getRawX()
|
||||
* @param y 点击的y坐标 event.getRawY()
|
||||
* @return true在view内
|
||||
*/
|
||||
|
||||
private boolean isTouchPointInView(View view, float x, float y) {
|
||||
int location[] = new int[2];
|
||||
view.getLocationOnScreen(location);
|
||||
int left = location[0];
|
||||
int top = location[1];
|
||||
int right = left + view.getMeasuredWidth();
|
||||
int bottom = top + view.getMeasuredHeight();
|
||||
return y >= top && y <= bottom && x >= left && x <= right;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗实现类
|
||||
*/
|
||||
private void setWindowInternal() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示弹窗
|
||||
*/
|
||||
public void show(View view) {
|
||||
if (baseItemViewList.size() > 0) {
|
||||
clickView = view;
|
||||
setPosition(view);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回点击的View
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
@Nullable
|
||||
public View getView() {
|
||||
return clickView;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏弹窗
|
||||
*/
|
||||
public void dismiss() {
|
||||
dialog.cancel();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.skipping.view.bubblewindow;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-14
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({Direction.TOP, Direction.BOTTOM})
|
||||
public @interface Direction {
|
||||
int TOP = 0;
|
||||
int BOTTOM = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.skipping.view.bubblewindow;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-11
|
||||
*/
|
||||
public interface OnItemClick {
|
||||
void onClick(String tag, int position, BubbleWindow bubbleWindow);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.skipping.view.bubblewindow;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 12/29/20
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({Theme.LIGHT, Theme.DARK})
|
||||
public @interface Theme {
|
||||
int LIGHT = 0;
|
||||
int DARK = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.skipping.view.bubblewindow.itemview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-11
|
||||
*/
|
||||
public abstract class BaseItemView {
|
||||
|
||||
public View view;
|
||||
public String tag;
|
||||
public Context context;
|
||||
|
||||
public BaseItemView(Context context, String tag){
|
||||
this.tag = tag;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public abstract void setView();
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.skipping.view.bubblewindow.itemview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.skipping.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-11
|
||||
*/
|
||||
public class ImageTextItemView extends BaseItemView {
|
||||
private String text;
|
||||
private int img;
|
||||
|
||||
public ImageTextItemView(@NonNull Context context, @Nullable String tag, @Nullable String text, @DrawableRes int img) {
|
||||
super(context, tag);
|
||||
this.text = text;
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setView() {
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.bubble_item_layout_imgtext, null);
|
||||
TextView textView = itemView.findViewById(R.id.list_item_tv);
|
||||
ImageView imageView = itemView.findViewById(R.id.list_item_img);
|
||||
textView.setText(text);
|
||||
imageView.setImageDrawable(ContextCompat.getDrawable(context, img));
|
||||
view = itemView;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.skipping.view.bubblewindow.itemview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.skipping.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-11
|
||||
*/
|
||||
public class TextItemView extends BaseItemView {
|
||||
private String text;
|
||||
|
||||
public TextItemView(Context context, String tag, String text) {
|
||||
super(context, tag);
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setView() {
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.bubble_item_layout_text, null);
|
||||
TextView textView = itemView.findViewById(R.id.list_item_tv);
|
||||
textView.setText(text);
|
||||
view = itemView;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="135%"
|
||||
android:pivotY="15%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="135%"
|
||||
android:pivotY="15%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="135%"
|
||||
android:pivotY="15%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_angle_bottom_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_angle_bottom" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="-40%"
|
||||
android:pivotY="80%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="-40%"
|
||||
android:pivotY="80%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:pivotX="-40%"
|
||||
android:pivotY="80%">
|
||||
<shape android:shape="rectangle">
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_angle_top_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_angle_top" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_item_bottom_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_item_bottom" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_item_center_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_item_center" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp" />
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:bottomRightRadius="10dp" />
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp" />
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
<solid android:color="@color/color_white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
<solid android:color="@color/color_DDDDDD" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
<solid android:color="@color/color_black" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_item_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_background" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bubblewindow_item_top_clicked" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bubblewindow_item_top" android:state_pressed="false" />
|
||||
</selector>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:radius="30dp"/>
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
<solid android:color="@color/black"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/color_1296DB" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="30dp"/>
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/color_FFE6E6E6" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp"/>
|
||||
<solid android:color="@color/color_F7FFF300" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomLeftRadius="22.5dp"
|
||||
android:topLeftRadius="22.5dp" />
|
||||
<solid android:color="@color/color_FFF300"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomLeftRadius="22.5dp"
|
||||
android:topLeftRadius="22.5dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:radius="30dp"/>
|
||||
<solid android:color="@color/color_FFF300"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomRightRadius="22.5dp"
|
||||
android:topRightRadius="22.5dp" />
|
||||
<solid android:color="@color/color_FFF300"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomRightRadius="22.5dp"
|
||||
android:topRightRadius="22.5dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="#009688"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="#4DB6AC"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<item android:top="30dp">
|
||||
<bitmap
|
||||
android:gravity="top"
|
||||
android:gravity="left"
|
||||
android:src="@drawable/ic_launcher_round"></bitmap>
|
||||
</item>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +1,323 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.drawerlayout.widget.DrawerLayout 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:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activity.MainActivity">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbarlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
android:background="@color/color_2C2C2C"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxxxx学校"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/create_activity"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="85dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="创建活动"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="36dp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/setting_btn"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:src="@mipmap/setting" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F6F6F6"/>
|
||||
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="560dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@color/color_2C2C2C"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
android:fitsSystemWindows="true" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxxxx学校"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28dp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_2C2C2C"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
<TextView
|
||||
android:id="@+id/titleTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="活动创建"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="36dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/color_50_D8D8D8" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:text="活动信息"
|
||||
android:textColor="@color/color_70_E6E6E6"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/choseClass"
|
||||
android:padding="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chooseIV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="选择"
|
||||
android:textColor="@color/color_F4EA2A"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:src="@mipmap/down" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/activityNameEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:background="@null"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="101班活动"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/color_50_D8D8D8" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:text="每组学生数量"
|
||||
android:textColor="@color/color_70_E6E6E6"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="right"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="8"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:text="人"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/color_50_D8D8D8" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="85dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="创建活动"
|
||||
android:textSize="36dp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="每组学生数量"
|
||||
android:textColor="@color/color_70_E6E6E6"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/setting_btn"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:src="@mipmap/setting" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/left_clicked"
|
||||
android:gravity="center"
|
||||
android:text="定时计数"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/right_unclicked"
|
||||
android:gravity="center"
|
||||
android:text="定数计时"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="跳绳数量"
|
||||
android:textColor="@color/color_70_E6E6E6"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:background="@null"
|
||||
android:drawableRight="@mipmap/right"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="100"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/color_50_D8D8D8" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/cancel"
|
||||
android:gravity="center"
|
||||
android:text="取消"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/ok"
|
||||
android:gravity="center"
|
||||
android:text="保存"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.navigation.NavigationView>
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
android:background="@color/color_2C2C2C"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
<LinearLayout
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:id="@+id/backBtn"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="返回"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="二年级201班"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="跳绳测试"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:text="模式:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="定时计数"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:text="活动时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="2021-11-10 10:12:15"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="最高:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="100个"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:text="最低:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="100个"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:text="中位数"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="100个"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@color/color_FFE6E6E6"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="40dp"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:text="姓名"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="学号"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="跳绳时长(秒)"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="跳绳数量(个)"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?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="40dp"
|
||||
android:background="@color/whitePure"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_item_img"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_tv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_black"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?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="40dp"
|
||||
android:background="@color/whitePure"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_tv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_black"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<View
|
||||
android:id="@+id/bubble_angle_top"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bubblewindow_angle_top_selector"
|
||||
android:clickable="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bubble_layout"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bubblewindow_background"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottom_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<View
|
||||
android:id="@+id/bubble_angle_bottom"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bubblewindow_angle_bottom_selector"
|
||||
android:clickable="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
<?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="wrap_content"
|
||||
android:background="@color/color_F6F6F6"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="500dp"
|
||||
android:layout_height="240dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/grid_item_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingRight="32dp"
|
||||
android:paddingBottom="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="跳绳测试"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="28dp" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
android:background="@color/color_45_2C2C2C" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/className"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="二年级201班"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="定时计数(秒)"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="跳绳测试"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="180"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/grid_chengji"
|
||||
android:gravity="center"
|
||||
android:text="编辑"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/grid_right"
|
||||
android:gravity="center"
|
||||
android:text="开始"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/code"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/num"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_3d3d3d"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 472 B |
|
|
@ -7,7 +7,7 @@
|
|||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="main_color">#ffc20e</color>
|
||||
<color name="main_color">#2C2C2C</color>
|
||||
<color name="ffc20e">#ffc20e</color>
|
||||
<color name="color_2C2C2C">#2C2C2C</color>
|
||||
<color name="color_F7FFF300">#F7FFF300</color>
|
||||
|
|
@ -24,4 +24,8 @@
|
|||
<color name="color_D9D9D9">#D9D9D9</color>
|
||||
<color name="color_F4EA2A">#F4EA2A</color>
|
||||
<color name="color_00FF55">#00FF55</color>
|
||||
<color name="color_50_D8D8D8">#80D8D8D8</color>
|
||||
<color name="color_70_E6E6E6">#4DE6E6E6</color>
|
||||
<color name="color_45_2C2C2C">#8C2C2C2C</color>
|
||||
<color name="color_1296DB">#1296DB</color>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
||||
<dimen name="nav_header_height">176dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,3 +1,14 @@
|
|||
<resources>
|
||||
<string name="app_name">Skipping</string>
|
||||
<string name="title_activity_main3">MainActivity</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_title">Android Studio</string>
|
||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
<string name="menu_home">Home</string>
|
||||
<string name="menu_gallery">Gallery</string>
|
||||
<string name="menu_slideshow">Slideshow</string>
|
||||
</resources>
|
||||
|
|
@ -8,4 +8,12 @@
|
|||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowBackground">@drawable/splash_preview</item>
|
||||
</style>
|
||||
|
||||
<style name="bubble_dialog_style" parent="@android:style/Theme.DeviceDefault.Light.Dialog">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -26,4 +26,13 @@
|
|||
<item name="android:windowBackground">@drawable/splash_preview</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</resources>
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.4.31'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.concurrent.Callable;
|
|||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Created by Ming
|
||||
* 2020-08-20
|
||||
|
|
@ -53,7 +52,9 @@ public abstract class BaseActivity<P extends BasePresenter> extends RxFragmentAc
|
|||
method = "onCreate";
|
||||
super.onCreate(savedInstanceState);
|
||||
initStart();
|
||||
setContentView(getContentViewResId());
|
||||
if (getContentViewResId() != null) {
|
||||
setContentView(getContentViewResId());
|
||||
}
|
||||
toolBar = searchToolBar(findViewById(android.R.id.content));
|
||||
initView();
|
||||
initData();
|
||||
|
|
@ -62,7 +63,7 @@ public abstract class BaseActivity<P extends BasePresenter> extends RxFragmentAc
|
|||
/**
|
||||
* 获取布局
|
||||
*/
|
||||
protected abstract int getContentViewResId();
|
||||
protected abstract Integer getContentViewResId();
|
||||
|
||||
/**
|
||||
* 初始化P层
|
||||
|
|
@ -124,9 +125,11 @@ public abstract class BaseActivity<P extends BasePresenter> extends RxFragmentAc
|
|||
/**
|
||||
* 加载布局前
|
||||
*/
|
||||
public void initStart(){
|
||||
public void initStart() {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 初始布局
|
||||
|
|
|
|||
|
|
@ -104,10 +104,6 @@ public class Concise<I> {
|
|||
|
||||
|
||||
public Concise build() {
|
||||
Type s = getClass().getGenericSuperclass();
|
||||
LogUtil.e(s);
|
||||
ParameterizedType p = (ParameterizedType) s;
|
||||
Class<I> t = (Class<I>) p.getActualTypeArguments()[0];
|
||||
Class<I> tClass = (Class<I>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
api = new Retrofit.Builder()
|
||||
.client(createClient())
|
||||
|
|
|
|||