Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StatInfo_1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenyuling
StatInfo_1
Commits
ddc2d232
Commit
ddc2d232
authored
Oct 16, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"修改为8个组"
parent
215bcfd8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
114 additions
and
67 deletions
+114
-67
GroupConst.java
...main/java/com/srthinker/statinfo/constant/GroupConst.java
+17
-0
MainActivity.java
...rc/main/java/com/srthinker/statinfo/uis/MainActivity.java
+35
-19
GroupedFragment.java
...rthinker/statinfo/uis/fragment/group/GroupedFragment.java
+7
-8
SelectDlgFragment.java
...hinker/statinfo/uis/fragment/group/SelectDlgFragment.java
+18
-9
Utils.java
...c/main/java/com/srthinker/statinfo/util/common/Utils.java
+1
-13
NewGroupView.java
...main/java/com/srthinker/statinfo/wedget/NewGroupView.java
+6
-6
activity_new_main.xml
app/src/main/res/layout/activity_new_main.xml
+7
-3
dialog_select.xml
app/src/main/res/layout/dialog_select.xml
+9
-2
fragment_group.xml
app/src/main/res/layout/fragment_group.xml
+1
-1
item_group_new.xml
app/src/main/res/layout/item_group_new.xml
+10
-3
dimens.xml
app/src/main/res/values/dimens.xml
+1
-1
styles.xml
app/src/main/res/values/styles.xml
+1
-1
themes.xml
app/src/main/res/values/themes.xml
+1
-1
No files found.
app/src/main/java/com/srthinker/statinfo/constant/GroupConst.java
View file @
ddc2d232
package
com
.
srthinker
.
statinfo
.
constant
;
package
com
.
srthinker
.
statinfo
.
constant
;
import
com.srthinker.statinfo.bean.Group2Bean
;
import
java.util.ArrayList
;
public
class
GroupConst
{
public
class
GroupConst
{
public
static
final
String
WATERPROOF
=
"waterproof"
;
public
static
final
String
WATERPROOF
=
"waterproof"
;
...
@@ -14,4 +18,17 @@ public class GroupConst {
...
@@ -14,4 +18,17 @@ public class GroupConst {
public
static
final
int
NO_GROUP
=
100
;
public
static
final
int
NO_GROUP
=
100
;
public
static
final
int
GROUPED
=
200
;
public
static
final
int
GROUPED
=
200
;
//钢筋班组,木工班组,泥工班组,水电班组,防水班组,外架班组,项目部,监理单位
public
static
ArrayList
<
Group2Bean
>
group2BeansConst
=
new
ArrayList
<>();
static
{
group2BeansConst
.
add
(
new
Group2Bean
(
5
,
"钢筋班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
6
,
"木工班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
7
,
"泥工班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
8
,
"水电班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
1
,
"防水班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
2
,
"外架班组"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
3
,
"项目部"
,
0
));
group2BeansConst
.
add
(
new
Group2Bean
(
4
,
"监理单位"
,
0
));
}
}
}
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
View file @
ddc2d232
...
@@ -2,14 +2,6 @@ package com.srthinker.statinfo.uis;
...
@@ -2,14 +2,6 @@ package com.srthinker.statinfo.uis;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_SN
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_SN
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
BUILD
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
BUILD_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
OUTRIGGER
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
OUTRIGGER_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
SUPERVISOR
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
SUPERVISOR_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
WATERPROOF
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
WATERPROOF_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
InOutType
.
ENTER_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
InOutType
.
ENTER_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
InOutType
.
LEAVE_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
InOutType
.
LEAVE_TYPE
;
import
static
com
.
srthinker
.
statinfo
.
download
.
upper
.
DownStatus
.
DOWN_ERROR
;
import
static
com
.
srthinker
.
statinfo
.
download
.
upper
.
DownStatus
.
DOWN_ERROR
;
...
@@ -25,7 +17,12 @@ import android.util.Log;
...
@@ -25,7 +17,12 @@ import android.util.Log;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.srthinker.statinfo.adapter.GroupShowAdapter
;
import
com.srthinker.statinfo.bean.Group2Bean
;
import
com.srthinker.statinfo.constant.GroupConst
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.helper.ConfigHelper
;
import
com.srthinker.statinfo.database.helper.ConfigHelper
;
...
@@ -77,6 +74,8 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -77,6 +74,8 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
public
static
boolean
NEED_NO_REPET
=
true
;
//是否需要去重,false:不需要,true:需要
public
static
boolean
NEED_NO_REPET
=
true
;
//是否需要去重,false:不需要,true:需要
private
int
group
;
private
GroupShowAdapter
showAdapter
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -107,19 +106,26 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -107,19 +106,26 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
});
});
}
}
private
void
initGroup
()
{
/*
private void initGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
/*mBinding.ngvBuild.initItem("工地班组",build,groupSize);
*/
/*mBinding.ngvBuild.initItem("工地班组",build,groupSize);
mBinding.ngvWaterproof.initItem("防水班组",waterproof,groupSize);
mBinding.ngvWaterproof.initItem("防水班组",waterproof,groupSize);
mBinding.ngvOutrigger.initItem("外架班组",outrigger,groupSize);
mBinding.ngvOutrigger.initItem("外架班组",outrigger,groupSize);
mBinding.ngvSupervisor.initItem("监理单位",supervisor,groupSize);*/
mBinding.ngvSupervisor.initItem("监理单位",supervisor,groupSize);*/
/*
mBinding.ngvBuild.initItem("工地班组",build);
mBinding.ngvBuild.initItem("工地班组",build);
mBinding.ngvWaterproof.initItem("防水班组",waterproof);
mBinding.ngvWaterproof.initItem("防水班组",waterproof);
mBinding.ngvOutrigger.initItem("外架班组",outrigger);
mBinding.ngvOutrigger.initItem("外架班组",outrigger);
mBinding.ngvSupervisor.initItem("监理单位",supervisor);
mBinding.ngvSupervisor.initItem("监理单位",supervisor);
}*/
private
void
initGroup
(){
GridLayoutManager
gLM
=
new
GridLayoutManager
(
this
,
4
,
RecyclerView
.
HORIZONTAL
,
false
);
mBinding
.
rvGroupTotal
.
setLayoutManager
(
gLM
);
showAdapter
=
new
GroupShowAdapter
(
this
,
GroupConst
.
group2BeansConst
);
mBinding
.
rvGroupTotal
.
setAdapter
(
showAdapter
);
}
}
private
void
checkAllPermission
()
{
private
void
checkAllPermission
()
{
...
@@ -133,7 +139,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -133,7 +139,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
}
}
}
}
private
void
updateGroup
()
{
/*
private void updateGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
...
@@ -143,7 +149,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -143,7 +149,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
mBinding.ngvOutrigger.setNumber(outrigger);
mBinding.ngvOutrigger.setNumber(outrigger);
mBinding.ngvSupervisor.setNumber(supervisor);
mBinding.ngvSupervisor.setNumber(supervisor);
}
}
*/
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
...
@@ -345,15 +351,25 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -345,15 +351,25 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
}
}
}
}
//如果只有一个人,从一个组换到另一个组,之前的数据没有清空,需要先进行清空,置空为0
//如果只有一个人,从一个组换到另一个组,之前的数据没有清空,需要先进行清空,置空为0
SharedUtil
.
getInstance
(
this
).
writeShared
(
WATERPROOF
,
0
);
/*
SharedUtil.getInstance(this).writeShared(WATERPROOF,0);
SharedUtil.getInstance(this).writeShared(OUTRIGGER,0);
SharedUtil.getInstance(this).writeShared(OUTRIGGER,0);
SharedUtil.getInstance(this).writeShared(BUILD,0);
SharedUtil.getInstance(this).writeShared(BUILD,0);
SharedUtil
.
getInstance
(
this
).
writeShared
(
SUPERVISOR
,
0
);
SharedUtil.getInstance(this).writeShared(SUPERVISOR,0);*/
//清空
for
(
Group2Bean
group2Bean
:
GroupConst
.
group2BeansConst
)
{
group2Bean
.
setNumber
(
0
);
}
for
(
Map
.
Entry
<
Integer
,
Integer
>
presentEntry
:
groupPresentHashMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
Integer
>
presentEntry
:
groupPresentHashMap
.
entrySet
())
{
int
group
=
presentEntry
.
getKey
();
int
group
=
presentEntry
.
getKey
();
int
presentSize
=
presentEntry
.
getValue
();
int
presentSize
=
presentEntry
.
getValue
();
Log
.
i
(
TAG
,
"updatePresentSize: group="
+
group
+
",presentSize="
+
presentSize
);
Log
.
i
(
TAG
,
"updatePresentSize: group="
+
group
+
",presentSize="
+
presentSize
);
switch
(
group
){
for
(
Group2Bean
group2Bean
:
GroupConst
.
group2BeansConst
)
{
if
(
group2Bean
.
getGroup_id
()==
group
){
group2Bean
.
setNumber
(
presentSize
);
break
;
}
}
/* switch (group){
case WATERPROOF_ID:
case WATERPROOF_ID:
SharedUtil.getInstance(this).writeShared(WATERPROOF,presentSize);
SharedUtil.getInstance(this).writeShared(WATERPROOF,presentSize);
break;
break;
...
@@ -366,11 +382,11 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -366,11 +382,11 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
case SUPERVISOR_ID:
case SUPERVISOR_ID:
SharedUtil.getInstance(this).writeShared(SUPERVISOR,presentSize);
SharedUtil.getInstance(this).writeShared(SUPERVISOR,presentSize);
break;
break;
}
}
*/
}
}
//要更新演示页面的分组请求
//要更新演示页面的分组请求
updateGroup
();
//
updateGroup();
showAdapter
.
setDataList
(
GroupConst
.
group2BeansConst
);
}
}
@Override
@Override
...
...
app/src/main/java/com/srthinker/statinfo/uis/fragment/group/GroupedFragment.java
View file @
ddc2d232
package
com
.
srthinker
.
statinfo
.
uis
.
fragment
.
group
;
package
com
.
srthinker
.
statinfo
.
uis
.
fragment
.
group
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
BUILD_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
OUTRIGGER_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
SUPERVISOR_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
WATERPROOF_ID
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -15,8 +10,9 @@ import android.view.ViewGroup;
...
@@ -15,8 +10,9 @@ import android.view.ViewGroup;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.srthinker.statinfo.R
;
import
com.srthinker.statinfo.adapter.GroupPagerAdapter
;
import
com.srthinker.statinfo.adapter.GroupPagerAdapter
;
import
com.srthinker.statinfo.bean.Group2Bean
;
import
com.srthinker.statinfo.constant.GroupConst
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.databinding.FragmentGroupedBinding
;
import
com.srthinker.statinfo.databinding.FragmentGroupedBinding
;
import
com.srthinker.statinfo.uis.fragment.BaseFragment
;
import
com.srthinker.statinfo.uis.fragment.BaseFragment
;
...
@@ -44,10 +40,13 @@ public class GroupedFragment extends BaseFragment {
...
@@ -44,10 +40,13 @@ public class GroupedFragment extends BaseFragment {
@Override
@Override
protected
void
initData
()
{
protected
void
initData
()
{
mGroupMap
=
new
LinkedHashMap
<>();
mGroupMap
=
new
LinkedHashMap
<>();
mGroupMap
.
put
(
getString
(
R
.
string
.
select_one
),
WATERPROOF_ID
);
for
(
Group2Bean
group2Bean
:
GroupConst
.
group2BeansConst
)
{
mGroupMap
.
put
(
group2Bean
.
getGroup_name
(),
group2Bean
.
getGroup_id
());
}
/*mGroupMap.put(getString(R.string.select_one), WATERPROOF_ID);
mGroupMap.put(getString(R.string.select_two), OUTRIGGER_ID);
mGroupMap.put(getString(R.string.select_two), OUTRIGGER_ID);
mGroupMap.put(getString(R.string.select_three),BUILD_ID);
mGroupMap.put(getString(R.string.select_three),BUILD_ID);
mGroupMap
.
put
(
getString
(
R
.
string
.
select_four
),
SUPERVISOR_ID
);
mGroupMap.put(getString(R.string.select_four),SUPERVISOR_ID);
*/
}
}
@Override
@Override
...
...
app/src/main/java/com/srthinker/statinfo/uis/fragment/group/SelectDlgFragment.java
View file @
ddc2d232
package
com
.
srthinker
.
statinfo
.
uis
.
fragment
.
group
;
package
com
.
srthinker
.
statinfo
.
uis
.
fragment
.
group
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
BUILD_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
OUTRIGGER_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
SUPERVISOR_ID
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
WATERPROOF_ID
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.ColorDrawable
;
...
@@ -18,18 +13,21 @@ import android.view.Window;
...
@@ -18,18 +13,21 @@ import android.view.Window;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
androidx.fragment.app.DialogFragment
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
com.srthinker.statinfo.R
;
import
com.srthinker.statinfo.adapter.GroupSelectAdapter
;
import
com.srthinker.statinfo.constant.GroupConst
;
import
com.srthinker.statinfo.databinding.DialogSelectBinding
;
import
com.srthinker.statinfo.databinding.DialogSelectBinding
;
import
com.srthinker.statinfo.util.common.Utils
;
import
com.srthinker.statinfo.util.common.Utils
;
public
class
SelectDlgFragment
extends
DialogFragment
{
public
class
SelectDlgFragment
extends
DialogFragment
implements
GroupSelectAdapter
.
OnItemClickListener
{
private
static
final
String
TAG
=
"SelectDlgFragment"
;
private
static
final
String
TAG
=
"SelectDlgFragment"
;
private
com
.
srthinker
.
statinfo
.
databinding
.
DialogSelectBinding
mBinding
;
private
com
.
srthinker
.
statinfo
.
databinding
.
DialogSelectBinding
mBinding
;
private
Context
context
;
private
Context
context
;
private
int
select
=
0
;
private
int
select
=
0
;
private
OnSelectOneListener
onSelectOneListener
;
private
OnSelectOneListener
onSelectOneListener
;
private
GroupSelectAdapter
gSelAda
;
public
static
SelectDlgFragment
getInstance
(){
public
static
SelectDlgFragment
getInstance
(){
SelectDlgFragment
selectDlgFragment
=
new
SelectDlgFragment
();
SelectDlgFragment
selectDlgFragment
=
new
SelectDlgFragment
();
...
@@ -52,6 +50,11 @@ public class SelectDlgFragment extends DialogFragment {
...
@@ -52,6 +50,11 @@ public class SelectDlgFragment extends DialogFragment {
}
}
private
void
initView
()
{
private
void
initView
()
{
GridLayoutManager
gLM
=
new
GridLayoutManager
(
context
,
4
);
mBinding
.
rvSelectGroup
.
setLayoutManager
(
gLM
);
gSelAda
=
new
GroupSelectAdapter
(
context
,
GroupConst
.
group2BeansConst
);
mBinding
.
rvSelectGroup
.
setAdapter
(
gSelAda
);
gSelAda
.
setOnItemClickListener
(
this
);
mBinding
.
ivClose
.
setOnClickListener
(
v
->{
mBinding
.
ivClose
.
setOnClickListener
(
v
->{
dismiss
();
dismiss
();
});
});
...
@@ -60,13 +63,14 @@ public class SelectDlgFragment extends DialogFragment {
...
@@ -60,13 +63,14 @@ public class SelectDlgFragment extends DialogFragment {
});
});
mBinding
.
btnConfirm
.
setOnClickListener
(
v
->{
mBinding
.
btnConfirm
.
setOnClickListener
(
v
->{
//Log.i(TAG, "initView: select="+select);
//Log.i(TAG, "initView: select="+select);
//Utils.showTips(context,"select="+select);
if
(
onSelectOneListener
!=
null
)
{
if
(
onSelectOneListener
!=
null
)
{
onSelectOneListener
.
onSelectOne
(
select
);
onSelectOneListener
.
onSelectOne
(
select
);
}
}
//Utils.showTips(context,"已更新列表");
//Utils.showTips(context,"已更新列表");
dismiss
();
dismiss
();
});
});
mBinding
.
rgSelect
.
setOnCheckedChangeListener
((
radioGroup
,
i
)
->
{
/*
mBinding.rgSelect.setOnCheckedChangeListener((radioGroup, i) -> {
switch (i){
switch (i){
case R.id.rb_select_one:
case R.id.rb_select_one:
select = WATERPROOF_ID;
select = WATERPROOF_ID;
...
@@ -81,7 +85,7 @@ public class SelectDlgFragment extends DialogFragment {
...
@@ -81,7 +85,7 @@ public class SelectDlgFragment extends DialogFragment {
select = SUPERVISOR_ID;
select = SUPERVISOR_ID;
break;
break;
}
}
});
});
*/
}
}
...
@@ -109,6 +113,11 @@ public class SelectDlgFragment extends DialogFragment {
...
@@ -109,6 +113,11 @@ public class SelectDlgFragment extends DialogFragment {
this
.
onSelectOneListener
=
onSelectOneListener
;
this
.
onSelectOneListener
=
onSelectOneListener
;
}
}
@Override
public
void
onItemClick
(
int
groupId
)
{
select
=
groupId
;
}
public
interface
OnSelectOneListener
{
public
interface
OnSelectOneListener
{
void
onSelectOne
(
int
select
);
void
onSelectOne
(
int
select
);
}
}
...
...
app/src/main/java/com/srthinker/statinfo/util/common/Utils.java
View file @
ddc2d232
...
@@ -12,7 +12,6 @@ import android.provider.Settings;
...
@@ -12,7 +12,6 @@ import android.provider.Settings;
import
android.text.InputType
;
import
android.text.InputType
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
import
android.util.TypedValue
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -92,18 +91,7 @@ public class Utils {
...
@@ -92,18 +91,7 @@ public class Utils {
return
dm
.
density
;
// 返回屏幕的像素密度数值
return
dm
.
density
;
// 返回屏幕的像素密度数值
}
}
//根据高度和行数设置字体大小
public
static
float
calculateTextSize
(
Context
ctx
,
int
line
){
int
screenHeight
=
getScreenHeight
(
ctx
);
if
(
line
>
0
)
{
int
lineHeight
=
screenHeight
/
line
;
TypedValue
typedValue
=
new
TypedValue
();
typedValue
.
density
=
(
int
)
ctx
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_PX
,
lineHeight
,
ctx
.
getResources
().
getDisplayMetrics
());
}
else
{
return
0
;
}
}
...
...
app/src/main/java/com/srthinker/statinfo/wedget/NewGroupView.java
View file @
ddc2d232
...
@@ -31,20 +31,20 @@ public class NewGroupView extends LinearLayout {
...
@@ -31,20 +31,20 @@ public class NewGroupView extends LinearLayout {
}
}
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
public
void
initItem
(
String
name
,
int
number
,
float
textSize
){
public
void
initItem
(
String
name
,
int
number
,
float
textSize
){
mBinding
.
tvGroupName
.
setText
(
name
+
":"
);
mBinding
.
tvGroupName
.
setText
(
name
+
":"
+
number
);
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
//
mBinding.tvGroupNumber.setText(number+"");
mBinding
.
tvGroupName
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
mBinding
.
tvGroupName
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
mBinding
.
tvGroupNumber
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
//
mBinding.tvGroupNumber.setTextSize(TypedValue.COMPLEX_UNIT_SP,textSize);
}
}
public
void
initItem
(
String
name
,
int
number
){
public
void
initItem
(
String
name
,
int
number
){
mBinding
.
tvGroupName
.
setText
(
name
+
":"
);
mBinding
.
tvGroupName
.
setText
(
name
+
":"
+
number
);
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
//
mBinding.tvGroupNumber.setText(number+"");
}
}
public
void
setNumber
(
int
number
){
public
void
setNumber
(
int
number
){
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
//
mBinding.tvGroupNumber.setText(number+"");
}
}
}
}
app/src/main/res/layout/activity_new_main.xml
View file @
ddc2d232
...
@@ -16,11 +16,10 @@
...
@@ -16,11 +16,10 @@
android:layout_alignParentRight=
"true"
/>
android:layout_alignParentRight=
"true"
/>
<LinearLayout
<LinearLayout
android:orientation=
"vertical"
android:orientation=
"vertical"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"20dp"
android:layout_centerVertical=
"true"
>
android:layout_centerVertical=
"true"
>
<com.srthinker.statinfo.wedget.NewGroupView
<!--
<com.srthinker.statinfo.wedget.NewGroupView
android:id="@+id/ngv_build"
android:id="@+id/ngv_build"
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"/>
...
@@ -35,6 +34,11 @@
...
@@ -35,6 +34,11 @@
<com.srthinker.statinfo.wedget.NewGroupView
<com.srthinker.statinfo.wedget.NewGroupView
android:id="@+id/ngv_supervisor"
android:id="@+id/ngv_supervisor"
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>-->
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_group_total"
android:layout_width=
"match_parent"
android:layout_gravity=
"center"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/dialog_select.xml
View file @
ddc2d232
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
android:padding=
"15dp"
android:padding=
"15dp"
android:layout_centerVertical=
"true"
/>
android:layout_centerVertical=
"true"
/>
</RelativeLayout>
</RelativeLayout>
<RadioGroup
<
!--<
RadioGroup
android:id="@+id/rg_select"
android:id="@+id/rg_select"
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
...
@@ -60,7 +60,14 @@
...
@@ -60,7 +60,14 @@
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
android:text="@string/select_four"/>
android:text="@string/select_four"/>
</RadioGroup>
</RadioGroup>-->
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_select_group"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
>
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/fragment_group.xml
View file @
ddc2d232
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
android:layout_toRightOf=
"@+id/iv_back"
android:layout_toRightOf=
"@+id/iv_back"
android:visibility=
"
visibl
e"
android:visibility=
"
gon
e"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"200dp"
>
android:layout_marginLeft=
"200dp"
>
<EditText
<EditText
...
...
app/src/main/res/layout/item_group_new.xml
View file @
ddc2d232
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/ll_item"
android:paddingLeft=
"5dp"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
android:id=
"@+id/tv_group_name"
android:id=
"@+id/tv_group_name"
...
@@ -11,8 +14,10 @@
...
@@ -11,8 +14,10 @@
android:text=
""
android:text=
""
android:textColor=
"@color/red"
android:textColor=
"@color/red"
android:gravity=
"center|left"
android:gravity=
"center|left"
android:textSize=
"@dimen/display_text"
/>
android:textSize=
"@dimen/display_text"
<TextView
android:maxLines=
"1"
/>
<!--<TextView
android:id="@+id/tv_group_number"
android:id="@+id/tv_group_number"
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
...
@@ -20,5 +25,7 @@
...
@@ -20,5 +25,7 @@
android:text=""
android:text=""
android:textColor="@color/red"
android:textColor="@color/red"
android:gravity="center|left"
android:gravity="center|left"
android:textSize=
"@dimen/display_text"
/>
android:textSize="@dimen/display_text"
/>-->
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
ddc2d232
...
@@ -11,5 +11,5 @@
...
@@ -11,5 +11,5 @@
<dimen
name=
"text_15"
>
15sp
</dimen>
<dimen
name=
"text_15"
>
15sp
</dimen>
<dimen
name=
"text_11"
>
11sp
</dimen>
<dimen
name=
"text_11"
>
11sp
</dimen>
<dimen
name=
"dlg_margin"
>
10dp
</dimen>
<dimen
name=
"dlg_margin"
>
10dp
</dimen>
<dimen
name=
"display_text"
>
95sp
</dimen>
<dimen
name=
"display_text"
>
73sp
</dimen>
//一列:95sp
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
ddc2d232
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<item
name=
"android:textColor"
>
@color/black
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
<item
name=
"android:background"
>
@null
</item>
<item
name=
"android:background"
>
@null
</item>
<item
name=
"android:button"
>
@null
</item>
<item
name=
"android:button"
>
@null
</item>
<item
name=
"android:drawableLeft"
>
@drawable/
check
_one
</item>
<item
name=
"android:drawableLeft"
>
@drawable/
select
_one
</item>
<item
name=
"android:drawablePadding"
>
5dp
</item>
<item
name=
"android:drawablePadding"
>
5dp
</item>
<item
name=
"android:layout_marginRight"
>
25dp
</item>
<item
name=
"android:layout_marginRight"
>
25dp
</item>
</style>
</style>
...
...
app/src/main/res/values/themes.xml
View file @
ddc2d232
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<!-- Base application theme. -->
<!-- Base application theme. -->
<style
name=
"Theme.StatInfo"
parent=
"Theme.
MaterialComponents.DayNight.NoActionBar.Bridge
"
>
<style
name=
"Theme.StatInfo"
parent=
"Theme.
AppCompat.Light.NoActionBar
"
>
<!-- Primary brand color. -->
<!-- Primary brand color. -->
<item
name=
"colorPrimary"
>
@color/white
</item>
<item
name=
"colorPrimary"
>
@color/white
</item>
<item
name=
"colorPrimaryVariant"
>
@color/transparent
</item>
<item
name=
"colorPrimaryVariant"
>
@color/transparent
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment