Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
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
1
Merge Requests
1
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
杨秀秀
HBHAndroid
Commits
19391ce5
Commit
19391ce5
authored
Jul 20, 2023
by
杨秀秀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基础搭建
1:添加分页网络请求
parent
9a8e1663
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
689 additions
and
61 deletions
+689
-61
AndroidManifest.xml
hbhbcompany/src/main/AndroidManifest.xml
+6
-0
ApiService.kt
.../src/main/java/com/xx/hbhbcompany/data/http/ApiService.kt
+2
-1
HomeRequest.java
...java/com/xx/hbhbcompany/data/http/requst/HomeRequest.java
+2
-1
HomeViewModel.java
...c/main/java/com/xx/hbhbcompany/ui/home/HomeViewModel.java
+7
-1
MerchantAuditListActivity.kt
...hbhbcompany/ui/merchantaudit/MerchantAuditListActivity.kt
+21
-0
MerchantAuditListViewModel.java
...bcompany/ui/merchantaudit/MerchantAuditListViewModel.java
+19
-0
activity_audit_list.xml
hbhbcompany/src/main/res/layout/activity_audit_list.xml
+63
-0
item_merchant_audit.xml
hbhbcompany/src/main/res/layout/item_merchant_audit.xml
+46
-0
strings.xml
hbhbcompany/src/main/res/values/strings.xml
+3
-58
build.gradle
hbhusershop/build.gradle
+5
-0
AndroidManifest.xml
hbhusershop/src/main/AndroidManifest.xml
+5
-0
MainActivity2.kt
...sershop/src/main/java/com/xx/hbhusershop/MainActivity2.kt
+36
-0
PageViewModel.kt
...src/main/java/com/xx/hbhusershop/ui/main/PageViewModel.kt
+19
-0
PlaceholderFragment.kt
...in/java/com/xx/hbhusershop/ui/main/PlaceholderFragment.kt
+73
-0
SectionsPagerAdapter.kt
...n/java/com/xx/hbhusershop/ui/main/SectionsPagerAdapter.kt
+35
-0
activity_main2.xml
hbhusershop/src/main/res/layout/activity_main2.xml
+44
-0
fragment_main.xml
hbhusershop/src/main/res/layout/fragment_main.xml
+23
-0
dimens.xml
hbhusershop/src/main/res/values-land/dimens.xml
+3
-0
dimens.xml
hbhusershop/src/main/res/values-w1240dp/dimens.xml
+3
-0
dimens.xml
hbhusershop/src/main/res/values-w600dp/dimens.xml
+3
-0
dimens.xml
hbhusershop/src/main/res/values-w820dp/dimens.xml
+6
-0
dimens.xml
hbhusershop/src/main/res/values/dimens.xml
+8
-0
strings.xml
hbhusershop/src/main/res/values/strings.xml
+3
-0
themes.xml
hbhusershop/src/main/res/values/themes.xml
+9
-0
ApiDisposablePageObserver.java
...a/me/goldze/mvvmhabit/http/ApiDisposablePageObserver.java
+137
-0
BasePageResponse.java
.../main/java/me/goldze/mvvmhabit/http/BasePageResponse.java
+48
-0
bg_foregrount_radius_1.xml
...wlibrary/src/main/res/drawable/bg_foregrount_radius_1.xml
+13
-0
bg_white_radius_12.xml
xxviewlibrary/src/main/res/drawable/bg_white_radius_12.xml
+0
-0
styles.xml
xxviewlibrary/src/main/res/values-v21/styles.xml
+14
-0
styles.xml
xxviewlibrary/src/main/res/values-v31/styles.xml
+14
-0
styles.xml
xxviewlibrary/src/main/res/values/styles.xml
+19
-0
No files found.
hbhbcompany/src/main/AndroidManifest.xml
View file @
19391ce5
...
...
@@ -34,6 +34,12 @@
<activity
android:name=
".ui.home.HomeActivity"
android:exported=
"true"
/>
<activity
android:name=
".ui.merchantaudit.MerchantAuditListActivity"
android:exported=
"true"
>
</activity>
</application>
</manifest>
\ No newline at end of file
hbhbcompany/src/main/java/com/xx/hbhbcompany/data/http/ApiService.kt
View file @
19391ce5
...
...
@@ -6,6 +6,7 @@ import com.xx.hbhbcompany.data.http.respons.UserInfoBean
import
com.xx.hbhbcompany.data.http.respons.ActivityCenterBean
import
com.xx.hbhbcompany.data.http.respons.JobInformationBean
import
io.reactivex.rxjava3.core.Observable
import
me.goldze.mvvmhabit.http.BasePageResponse
import
me.goldze.mvvmhabit.http.BaseResponse
import
okhttp3.MultipartBody
import
okhttp3.RequestBody
...
...
@@ -83,6 +84,6 @@ interface ApiService {
*/
@Headers
(
"Content-type:application/json"
)
@POST
(
"app/recruitment/queryAppRecruitmentList"
)
fun
getJobInformationList
(
@Body
requestBody
:
RequestBody
):
Observable
<
Base
Response
<
List
<
JobInformationBean
>
>>
fun
getJobInformationList
(
@Body
requestBody
:
RequestBody
):
Observable
<
Base
PageResponse
<
JobInformationBean
>>
}
\ No newline at end of file
hbhbcompany/src/main/java/com/xx/hbhbcompany/data/http/requst/HomeRequest.java
View file @
19391ce5
...
...
@@ -10,6 +10,7 @@ import java.util.List;
import
io.reactivex.rxjava3.core.Observable
;
import
me.goldze.mvvmhabit.http.ApiParams
;
import
me.goldze.mvvmhabit.http.BasePageResponse
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
okhttp3.RequestBody
;
...
...
@@ -29,7 +30,7 @@ public class HomeRequest extends BaseRespons {
/**
* 招聘列表
*/
public
Observable
<
Base
Response
<
List
<
JobInformationBean
>
>>
getJobInformationList
()
public
Observable
<
Base
PageResponse
<
JobInformationBean
>>
getJobInformationList
()
{
ApiParams
<
JobRequestBody
>
apiParams
=
new
ApiParams
<
JobRequestBody
>();
JobRequestBody
requestBody
=
new
JobRequestBody
(
"1"
,
"10"
);
...
...
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/home/HomeViewModel.java
View file @
19391ce5
...
...
@@ -19,6 +19,7 @@ import io.reactivex.rxjava3.disposables.Disposable;
import
io.reactivex.rxjava3.functions.Consumer
;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
import
me.goldze.mvvmhabit.http.ApiDisposableObserver
;
import
me.goldze.mvvmhabit.http.ApiDisposablePageObserver
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
public
class
HomeViewModel
extends
BaseViewModel
<
HomeRequest
>
{
...
...
@@ -85,7 +86,7 @@ public class HomeViewModel extends BaseViewModel<HomeRequest> {
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposable
Observer
<
List
<
JobInformationBean
>
>()
{
}).
subscribe
(
new
ApiDisposable
PageObserver
<
JobInformationBean
>()
{
@Override
public
void
onSuccess
(
List
<
JobInformationBean
>
resultBean
)
{
JobInformationList
.
postValue
(
resultBean
);
...
...
@@ -96,6 +97,11 @@ public class HomeViewModel extends BaseViewModel<HomeRequest> {
dismissDialog
();
}
@Override
public
void
getTotal
(
int
total
)
{
}
});
}
...
...
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/merchantaudit/MerchantAuditListActivity.kt
0 → 100644
View file @
19391ce5
package
com.xx.hbhbcompany.ui.merchantaudit
import
android.os.Bundle
import
com.xx.hbhbcompany.BR
import
com.xx.hbhbcompany.R
import
com.xx.hbhbcompany.databinding.ActivityAuditListBinding
import
com.xx.hbhbcompany.databinding.ActivityAuditListBindingImpl
import
me.goldze.mvvmhabit.base.BaseActivity
class
MerchantAuditListActivity
:
BaseActivity
<
ActivityAuditListBinding
,
MerchantAuditListViewModel
>()
{
override
fun
initContentView
(
savedInstanceState
:
Bundle
?):
Int
{
return
R
.
layout
.
activity_audit_list
}
override
fun
initVariableId
():
Int
{
return
BR
.
viewModel
}
}
\ No newline at end of file
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/merchantaudit/MerchantAuditListViewModel.java
0 → 100644
View file @
19391ce5
package
com
.
xx
.
hbhbcompany
.
ui
.
merchantaudit
;
import
android.app.Application
;
import
androidx.annotation.NonNull
;
import
com.xx.hbhbcompany.data.http.BaseRespons
;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
public
class
MerchantAuditListViewModel
extends
BaseViewModel
<
BaseRespons
>
{
public
MerchantAuditListViewModel
(
@NonNull
Application
application
)
{
super
(
application
);
}
public
MerchantAuditListViewModel
(
@NonNull
Application
application
,
BaseRespons
model
)
{
super
(
application
,
model
);
}
}
hbhbcompany/src/main/res/layout/activity_audit_list.xml
0 → 100644
View file @
19391ce5
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"viewModel"
type=
"com.xx.hbhbcompany.ui.merchantaudit.MerchantAuditListViewModel"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/bg_grey"
android:orientation=
"vertical"
>
<com.xx.xxviewlibrary.witget.XxBar
android:layout_width=
"match_parent"
android:layout_height=
"55dp"
app:bar_title=
'@{@string/merchant_audit}'
/>
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/tabs"
app:tabTextAppearance=
"@style/tablayout_comm_style"
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:paddingBottom=
"19dp"
android:paddingTop=
"19dp"
app:tabIndicator=
"@drawable/bg_foregrount_radius_1"
app:tabIndicatorColor=
"@color/foreground"
app:tabSelectedTextColor=
"@color/foreground"
android:layout_height=
"72dp"
>
<com.google.android.material.tabs.TabItem
android:layout_width=
"wrap_content"
android:layout_height=
"26dp"
android:text=
"待审核"
android:id=
"@+id/tab_aal_tobe_reciewed"
/>
<com.google.android.material.tabs.TabItem
android:layout_width=
"wrap_content"
android:layout_height=
"26dp"
android:text=
"待提交"
android:id=
"@+id/tab_aal_tobe_submit"
/>
<com.google.android.material.tabs.TabItem
android:layout_width=
"wrap_content"
android:layout_height=
"26dp"
android:text=
"待审批"
android:id=
"@+id/tab_aal_tobe_approve"
/>
<com.google.android.material.tabs.TabItem
android:layout_width=
"wrap_content"
android:layout_height=
"26dp"
android:text=
"店总驳回"
android:id=
"@+id/tab_aal_reject"
/>
</com.google.android.material.tabs.TabLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"17dp"
/>
</LinearLayout>
</layout>
\ No newline at end of file
hbhbcompany/src/main/res/layout/item_merchant_audit.xml
0 → 100644
View file @
19391ce5
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:background=
"@drawable/bg_white_radius_12"
android:padding=
"13dp"
android:layout_height=
"wrap_content"
>
<TextView
style=
"@style/xxTextContent"
android:id=
"@+id/tv_ima_time"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:layout_marginTop=
"4dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:id=
"@+id/v_ima_line1"
android:background=
"@color/line_grey"
app:layout_constraintTop_toBottomOf=
"@+id/tv_ima_time"
android:layout_marginTop=
"12dp"
/>
<ImageView
android:layout_width=
"88dp"
android:layout_height=
"88dp"
app:layout_constraintTop_toBottomOf=
"@+id/v_ima_line1"
app:layout_constraintLeft_toLeftOf=
"parent"
android:layout_marginTop=
"13dp"
android:id=
"@+id/iv_ima_img"
/>
<!-- <TextView
style="@style/xxTextTitle"
android:textStyle="bold"
android:id="@+id/tv_ima_title"
app:layout_constraintTop_toTopOf="@+id/iv_ima_img"
-->
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
hbhbcompany/src/main/res/values/strings.xml
View file @
19391ce5
...
...
@@ -55,62 +55,7 @@
<string
name=
"order_management"
>
订单管理
</string>
<!--我的-->
<string
name=
"navigation_mine"
>
我的
</string>
<!--我的模块 王小丫-->
<string
name=
"my_name"
>
王小丫
</string>
<!--我的模块 督导-->
<string
name=
"supervision"
>
督导
</string>
<!--我的模块 运营部-->
<string
name=
"operation"
>
运营部
</string>
<!--我的模块 我的评论-->
<string
name=
"my_comments"
>
我的评论
</string>
<!--我的模块 我的点赞-->
<string
name=
"my_like"
>
我的点赞
</string>
<!--我的模块 修改密码-->
<string
name=
"change_password"
>
修改密码
</string>
<!--我的模块 隐私协议-->
<string
name=
"privacy_agreement"
>
隐私协议
</string>
<!--我的模块 清除缓存-->
<string
name=
"clear_cache"
>
清除缓存
</string>
<!--我的模块 检查更新-->
<string
name=
"check_for_updates"
>
检查更新
</string>
<!--我的模块 当前版本V1.0.0-->
<string
name=
"current_version"
>
当前版本V1.0.0
</string>
<!--我的模块 退出登录-->
<string
name=
"log_out"
>
退出登录
</string>
<string
name=
"lorem_ipsum"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris
volutpat, dolor id interdum ullamcorper, risus dolor egestas lectus, sit amet mattis purus
dui nec risus. Maecenas non sodales nisi, vel dictum dolor. Class aptent taciti sociosqu ad
litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse blandit eleifend
diam, vel rutrum tellus vulputate quis. Aliquam eget libero aliquet, imperdiet nisl a,
ornare ex. Sed rhoncus est ut libero porta lobortis. Fusce in dictum tellus.\n\n
Suspendisse interdum ornare ante. Aliquam nec cursus lorem. Morbi id magna felis. Vivamus
egestas, est a condimentum egestas, turpis nisl iaculis ipsum, in dictum tellus dolor sed
neque. Morbi tellus erat, dapibus ut sem a, iaculis tincidunt dui. Interdum et malesuada
fames ac ante ipsum primis in faucibus. Curabitur et eros porttitor, ultricies urna vitae,
molestie nibh. Phasellus at commodo eros, non aliquet metus. Sed maximus nisl nec dolor
bibendum, vel congue leo egestas.\n\n
Sed interdum tortor nibh, in sagittis risus mollis quis. Curabitur mi odio, condimentum sit
amet auctor at, mollis non turpis. Nullam pretium libero vestibulum, finibus orci vel,
molestie quam. Fusce blandit tincidunt nulla, quis sollicitudin libero facilisis et. Integer
interdum nunc ligula, et fermentum metus hendrerit id. Vestibulum lectus felis, dictum at
lacinia sit amet, tristique id quam. Cras eu consequat dui. Suspendisse sodales nunc ligula,
in lobortis sem porta sed. Integer id ultrices magna, in luctus elit. Sed a pellentesque
est.\n\n
Aenean nunc velit, lacinia sed dolor sed, ultrices viverra nulla. Etiam a venenatis nibh.
Morbi laoreet, tortor sed facilisis varius, nibh orci rhoncus nulla, id elementum leo dui
non lorem. Nam mollis ipsum quis auctor varius. Quisque elementum eu libero sed commodo. In
eros nisl, imperdiet vel imperdiet et, scelerisque a mauris. Pellentesque varius ex nunc,
quis imperdiet eros placerat ac. Duis finibus orci et est auctor tincidunt. Sed non viverra
ipsum. Nunc quis augue egestas, cursus lorem at, molestie sem. Morbi a consectetur ipsum, a
placerat diam. Etiam vulputate dignissim convallis. Integer faucibus mauris sit amet finibus
convallis.\n\n
Phasellus in aliquet mi. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. In volutpat arcu ut felis sagittis, in finibus massa
gravida. Pellentesque id tellus orci. Integer dictum, lorem sed efficitur ullamcorper,
libero justo consectetur ipsum, in mollis nisl ex sed nisl. Donec maximus ullamcorper
sodales. Praesent bibendum rhoncus tellus nec feugiat. In a ornare nulla. Donec rhoncus
libero vel nunc consequat, quis tincidunt nisl eleifend. Cras bibendum enim a justo luctus
vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim.
</string>
<string
name=
"merchant_audit"
>
店户审核
</string>
</resources>
\ No newline at end of file
hbhusershop/build.gradle
View file @
19391ce5
...
...
@@ -30,6 +30,9 @@ android {
kotlinOptions
{
jvmTarget
=
'1.8'
}
buildFeatures
{
viewBinding
true
}
}
dependencies
{
...
...
@@ -38,6 +41,8 @@ dependencies {
implementation
'androidx.appcompat:appcompat:1.4.1'
implementation
'com.google.android.material:material:1.2.1'
implementation
'androidx.constraintlayout:constraintlayout:2.1.3'
implementation
'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation
'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
hbhusershop/src/main/AndroidManifest.xml
View file @
19391ce5
...
...
@@ -8,6 +8,11 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.HBHFurniture"
>
<activity
android:name=
".MainActivity2"
android:exported=
"false"
android:label=
"@string/title_activity_main2"
android:theme=
"@style/Theme.HBHFurniture.NoActionBar"
/>
<activity
android:name=
".MainActivity"
android:exported=
"true"
>
...
...
hbhusershop/src/main/java/com/xx/hbhusershop/MainActivity2.kt
0 → 100644
View file @
19391ce5
package
com.xx.hbhusershop
import
android.os.Bundle
import
com.google.android.material.floatingactionbutton.FloatingActionButton
import
com.google.android.material.snackbar.Snackbar
import
com.google.android.material.tabs.TabLayout
import
androidx.viewpager.widget.ViewPager
import
androidx.appcompat.app.AppCompatActivity
import
android.view.Menu
import
android.view.MenuItem
import
com.xx.hbhusershop.ui.main.SectionsPagerAdapter
import
com.xx.hbhusershop.databinding.ActivityMain2Binding
class
MainActivity2
:
AppCompatActivity
()
{
private
lateinit
var
binding
:
ActivityMain2Binding
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
binding
=
ActivityMain2Binding
.
inflate
(
layoutInflater
)
setContentView
(
binding
.
root
)
val
sectionsPagerAdapter
=
SectionsPagerAdapter
(
this
,
supportFragmentManager
)
val
viewPager
:
ViewPager
=
binding
.
viewPager
viewPager
.
adapter
=
sectionsPagerAdapter
val
tabs
:
TabLayout
=
binding
.
tabs
tabs
.
setupWithViewPager
(
viewPager
)
val
fab
:
FloatingActionButton
=
binding
.
fab
fab
.
setOnClickListener
{
view
->
Snackbar
.
make
(
view
,
"Replace with your own action"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
()
}
}
}
\ No newline at end of file
hbhusershop/src/main/java/com/xx/hbhusershop/ui/main/PageViewModel.kt
0 → 100644
View file @
19391ce5
package
com.xx.hbhusershop.ui.main
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.Transformations
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.ViewModelProvider
class
PageViewModel
:
ViewModel
()
{
private
val
_index
=
MutableLiveData
<
Int
>()
val
text
:
LiveData
<
String
>
=
Transformations
.
map
(
_index
)
{
"Hello world from section: $it"
}
fun
setIndex
(
index
:
Int
)
{
_index
.
value
=
index
}
}
\ No newline at end of file
hbhusershop/src/main/java/com/xx/hbhusershop/ui/main/PlaceholderFragment.kt
0 → 100644
View file @
19391ce5
package
com.xx.hbhusershop.ui.main
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
androidx.fragment.app.Fragment
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
com.xx.hbhusershop.R
import
com.xx.hbhusershop.databinding.FragmentMainBinding
/**
* A placeholder fragment containing a simple view.
*/
class
PlaceholderFragment
:
Fragment
()
{
private
lateinit
var
pageViewModel
:
PageViewModel
private
var
_binding
:
FragmentMainBinding
?
=
null
// This property is only valid between onCreateView and
// onDestroyView.
private
val
binding
get
()
=
_binding
!!
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
pageViewModel
=
ViewModelProvider
(
this
).
get
(
PageViewModel
::
class
.
java
).
apply
{
setIndex
(
arguments
?.
getInt
(
ARG_SECTION_NUMBER
)
?:
1
)
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
_binding
=
FragmentMainBinding
.
inflate
(
inflater
,
container
,
false
)
val
root
=
binding
.
root
val
textView
:
TextView
=
binding
.
sectionLabel
pageViewModel
.
text
.
observe
(
viewLifecycleOwner
,
Observer
{
textView
.
text
=
it
})
return
root
}
companion
object
{
/**
* The fragment argument representing the section number for this
* fragment.
*/
private
const
val
ARG_SECTION_NUMBER
=
"section_number"
/**
* Returns a new instance of this fragment for the given section
* number.
*/
@JvmStatic
fun
newInstance
(
sectionNumber
:
Int
):
PlaceholderFragment
{
return
PlaceholderFragment
().
apply
{
arguments
=
Bundle
().
apply
{
putInt
(
ARG_SECTION_NUMBER
,
sectionNumber
)
}
}
}
}
override
fun
onDestroyView
()
{
super
.
onDestroyView
()
_binding
=
null
}
}
\ No newline at end of file
hbhusershop/src/main/java/com/xx/hbhusershop/ui/main/SectionsPagerAdapter.kt
0 → 100644
View file @
19391ce5
package
com.xx.hbhusershop.ui.main
import
android.content.Context
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
androidx.fragment.app.FragmentPagerAdapter
import
com.xx.hbhusershop.R
private
val
TAB_TITLES
=
arrayOf
(
R
.
string
.
tab_text_1
,
R
.
string
.
tab_text_2
)
/**
* A [FragmentPagerAdapter] that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
class
SectionsPagerAdapter
(
private
val
context
:
Context
,
fm
:
FragmentManager
)
:
FragmentPagerAdapter
(
fm
)
{
override
fun
getItem
(
position
:
Int
):
Fragment
{
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment.
return
PlaceholderFragment
.
newInstance
(
position
+
1
)
}
override
fun
getPageTitle
(
position
:
Int
):
CharSequence
?
{
return
context
.
resources
.
getString
(
TAB_TITLES
[
position
])
}
override
fun
getCount
():
Int
{
// Show 2 total pages.
return
2
}
}
\ No newline at end of file
hbhusershop/src/main/res/layout/activity_main2.xml
0 → 100644
View file @
19391ce5
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MainActivity2"
>
<com.google.android.material.appbar.AppBarLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:theme=
"@style/Theme.HBHFurniture.AppBarOverlay"
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:minHeight=
"?actionBarSize"
android:padding=
"@dimen/appbar_padding"
android:text=
"@string/app_name"
android:textAppearance=
"@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
/>
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/tabs"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id=
"@+id/view_pager"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|end"
android:layout_marginEnd=
"@dimen/fab_margin"
android:layout_marginBottom=
"16dp"
app:srcCompat=
"@android:drawable/ic_dialog_email"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
hbhusershop/src/main/res/layout/fragment_main.xml
0 → 100644
View file @
19391ce5
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/constraintLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.main.PlaceholderFragment"
>
<TextView
android:id=
"@+id/section_label"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/activity_horizontal_margin"
android:layout_marginTop=
"@dimen/activity_vertical_margin"
android:layout_marginEnd=
"@dimen/activity_horizontal_margin"
android:layout_marginBottom=
"@dimen/activity_vertical_margin"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/constraintLayout"
tools:layout_constraintLeft_creator=
"1"
tools:layout_constraintTop_creator=
"1"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
hbhusershop/src/main/res/values-land/dimens.xml
0 → 100644
View file @
19391ce5
<resources>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values-w1240dp/dimens.xml
0 → 100644
View file @
19391ce5
<resources>
<dimen
name=
"fab_margin"
>
200dp
</dimen>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values-w600dp/dimens.xml
0 → 100644
View file @
19391ce5
<resources>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values-w820dp/dimens.xml
0 → 100644
View file @
19391ce5
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen
name=
"activity_horizontal_margin"
>
64dp
</dimen>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values/dimens.xml
0 → 100644
View file @
19391ce5
<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=
"appbar_padding"
>
16dp
</dimen>
<dimen
name=
"fab_margin"
>
16dp
</dimen>
<dimen
name=
"appbar_padding_top"
>
8dp
</dimen>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values/strings.xml
View file @
19391ce5
<resources>
<string
name=
"app_name"
>
HbhUserShop
</string>
<string
name=
"title_activity_main2"
>
MainActivity2
</string>
<string
name=
"tab_text_1"
>
Tab 1
</string>
<string
name=
"tab_text_2"
>
Tab 2
</string>
</resources>
\ No newline at end of file
hbhusershop/src/main/res/values/themes.xml
View file @
19391ce5
...
...
@@ -6,4 +6,13 @@
</style>
<style
name=
"Theme.HBHFurniture"
parent=
"Base.Theme.HBHFurniture"
/>
<style
name=
"Theme.HBHFurniture.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
</style>
<style
name=
"Theme.HBHFurniture.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<style
name=
"Theme.HBHFurniture.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
</resources>
\ No newline at end of file
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposablePageObserver.java
0 → 100644
View file @
19391ce5
package
me
.
goldze
.
mvvmhabit
.
http
;
import
java.util.List
;
import
io.reactivex.rxjava3.observers.DisposableObserver
;
import
me.goldze.mvvmhabit.base.AppManager
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
me.goldze.mvvmhabit.utils.Utils
;
/**
* Created by goldze on 2017/5/10.
* 统一的Code封装处理。该类仅供参考,实际业务逻辑, 根据需求来定义,
*/
public
abstract
class
ApiDisposablePageObserver
<
T
>
extends
DisposableObserver
<
BasePageResponse
<
T
>>
{
@Override
public
void
onComplete
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
e
.
printStackTrace
();
if
(
e
instanceof
ResponseThrowable
)
{
ResponseThrowable
rError
=
(
ResponseThrowable
)
e
;
ToastUtils
.
showShort
(
rError
.
message
);
return
;
}
//其他全部甩锅网络异常
ToastUtils
.
showShort
(
"网络异常"
);
}
@Override
public
void
onStart
()
{
super
.
onStart
();
// ToastUtils.showShort("http is start");
// if NetworkAvailable no ! must to call onCompleted
if
(!
NetworkUtil
.
isNetworkAvailable
(
Utils
.
getContext
()))
{
KLog
.
d
(
"无网络,读取缓存数据"
);
onComplete
();
}
}
@Override
public
void
onNext
(
BasePageResponse
<
T
>
baseResponse
)
{
switch
(
baseResponse
.
getCode
())
{
case
CodeRule
.
CODE_200
:
//请求成功, 正确的操作方式
onSuccess
(
baseResponse
.
getRows
());
getMsg
(
baseResponse
.
getMsg
());
getTotal
(
baseResponse
.
getTotal
());
break
;
case
CodeRule
.
CODE_220
:
// 请求成功, 正确的操作方式, 并消息提示
onSuccess
(
baseResponse
.
getRows
());
getTotal
(
baseResponse
.
getTotal
());
break
;
case
CodeRule
.
CODE_300
:
//请求失败,不打印Message
KLog
.
e
(
"请求失败"
);
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getCode
());
break
;
case
CodeRule
.
CODE_330
:
//请求失败,打印Message
ToastUtils
.
showShort
(
baseResponse
.
getMsg
());
break
;
case
CodeRule
.
CODE_500
:
//服务器内部异常
ToastUtils
.
showShort
(
baseResponse
.
getMsg
());
onError
(
baseResponse
.
getMsg
());
break
;
case
CodeRule
.
CODE_503
:
//参数为空
KLog
.
e
(
"参数为空"
);
break
;
case
CodeRule
.
CODE_502
:
//没有数据
KLog
.
e
(
"没有数据"
);
break
;
case
CodeRule
.
CODE_510
:
//无效的Token,提示跳入登录页
ToastUtils
.
showShort
(
"token已过期,请重新登录"
);
//关闭所有页面
AppManager
.
getAppManager
().
finishAllActivity
();
//跳入登录界面
//*****该类仅供参考,实际业务Code, 根据需求来定义,******//
break
;
case
CodeRule
.
CODE_530
:
ToastUtils
.
showShort
(
"请先登录"
);
break
;
case
CodeRule
.
CODE_551
:
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getCode
());
break
;
default
:
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getCode
());
break
;
}
}
public
static
final
class
CodeRule
{
//请求成功, 正确的操作方式
static
final
int
CODE_200
=
200
;
//请求成功, 消息提示
static
final
int
CODE_220
=
220
;
//请求失败,不打印Message
static
final
int
CODE_300
=
300
;
//请求失败,打印Message
static
final
int
CODE_330
=
330
;
//服务器内部异常
static
final
int
CODE_500
=
500
;
//参数为空
static
final
int
CODE_503
=
503
;
//没有数据
static
final
int
CODE_502
=
502
;
//无效的Token
static
final
int
CODE_510
=
510
;
//未登录
static
final
int
CODE_530
=
530
;
//请求的操作异常终止:未知的页面类型
static
final
int
CODE_551
=
551
;
}
//请求成功且返回码为200的回调方法,这里抽象方法申明
public
abstract
void
onSuccess
(
List
<
T
>
resultBean
);
//请求成功但返回的code码不是200的回调方法,这里抽象方法申明
public
abstract
void
onError
(
String
Error
);
public
void
getMsg
(
String
msg
)
{
}
public
abstract
void
getTotal
(
int
total
)
;
}
\ No newline at end of file
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/BasePageResponse.java
0 → 100644
View file @
19391ce5
package
me
.
goldze
.
mvvmhabit
.
http
;
import
java.util.List
;
/**
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public
class
BasePageResponse
<
T
>
{
private
int
code
;
private
String
msg
;
//实际数据
private
List
<
T
>
rows
;
//总数
private
int
total
;
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
List
<
T
>
getRows
()
{
return
rows
;
}
public
void
setRows
(
List
<
T
>
rows
)
{
this
.
rows
=
rows
;
}
public
int
getTotal
()
{
return
total
;
}
public
void
setTotal
(
int
total
)
{
this
.
total
=
total
;
}
}
xxviewlibrary/src/main/res/drawable/bg_foregrount_radius_1.xml
0 → 100644
View file @
19391ce5
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:width=
"20dp"
android:height=
"2dp"
android:gravity=
"center"
>
<shape>
<corners
android:radius=
"1dp"
/>
<!--color无效,源码用tabIndicatorColor-->
<solid
android:color=
"@color/foreground"
/>
</shape>
</item>
</layer-list>
\ No newline at end of file
app
/src/main/res/drawable/bg_white_radius_12.xml
→
xxviewlibrary
/src/main/res/drawable/bg_white_radius_12.xml
View file @
19391ce5
File moved
xxviewlibrary/src/main/res/values-v21/styles.xml
View file @
19391ce5
...
...
@@ -40,4 +40,18 @@
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"xxTextTitle"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"xxTextContent"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
</resources>
\ No newline at end of file
xxviewlibrary/src/main/res/values-v31/styles.xml
View file @
19391ce5
...
...
@@ -42,4 +42,18 @@
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"xxTextTitle"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"xxTextContent"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
</resources>
\ No newline at end of file
xxviewlibrary/src/main/res/values/styles.xml
View file @
19391ce5
...
...
@@ -38,4 +38,23 @@
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"tablayout_comm_style"
parent=
"Widget.MaterialComponents.TabLayout"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
<item
name=
"android:textStyle"
>
bold
</item>
</style>
<style
name=
"xxTextTitle"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
<style
name=
"xxTextContent"
parent=
"Widget.AppCompat.TextView"
>
<item
name=
"android:textSize"
>
16sp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
</style>
</resources>
\ No newline at end of file
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