Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
IOTClient
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lola
IOTClient
Commits
7194ec08
Commit
7194ec08
authored
May 14, 2019
by
DESKTOP-NFGF3PG\zxa01
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add no content UI
parent
2bf070bb
Pipeline
#40
canceled with stages
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
18 deletions
+42
-18
app/src/main/java/com/example/zxa01/iotclient/common/http/Api.java
...ain/java/com/example/zxa01/iotclient/common/http/Api.java
+10
-12
app/src/main/java/com/example/zxa01/iotclient/component/home/device/DeviceModel.java
...le/zxa01/iotclient/component/home/device/DeviceModel.java
+1
-0
app/src/main/java/com/example/zxa01/iotclient/component/home/device/DeviceViewModel.java
...xa01/iotclient/component/home/device/DeviceViewModel.java
+2
-0
app/src/main/java/com/example/zxa01/iotclient/component/home/record/RecordModel.java
...le/zxa01/iotclient/component/home/record/RecordModel.java
+1
-0
app/src/main/java/com/example/zxa01/iotclient/component/home/record/RecordViewModel.java
...xa01/iotclient/component/home/record/RecordViewModel.java
+2
-0
app/src/main/res/layout/fragment_device.xml
app/src/main/res/layout/fragment_device.xml
+10
-0
app/src/main/res/layout/fragment_record.xml
app/src/main/res/layout/fragment_record.xml
+10
-0
app/src/main/res/layout/recycler_view_record.xml
app/src/main/res/layout/recycler_view_record.xml
+2
-2
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+4
-4
No files found.
app/src/main/java/com/example/zxa01/iotclient/common/http/Api.java
View file @
7194ec08
...
...
@@ -23,18 +23,16 @@ public class Api {
private
static
ApiInterface
api
;
public
static
ApiInterface
getApi
()
{
if
(
api
==
null
)
{
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
.
baseUrl
(
"http://"
+
Config
.
getConfig
().
getGateway
())
.
client
(
new
OkHttpClient
.
Builder
()
.
build
())
.
addConverterFactory
(
GsonConverterFactory
.
create
(
new
GsonBuilder
()
.
create
()))
.
build
();
api
=
retrofit
.
create
(
ApiInterface
.
class
);
}
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
.
baseUrl
(
"http://"
+
Config
.
getConfig
().
getGateway
())
.
client
(
new
OkHttpClient
.
Builder
()
.
build
())
.
addConverterFactory
(
GsonConverterFactory
.
create
(
new
GsonBuilder
()
.
create
()))
.
build
();
api
=
retrofit
.
create
(
ApiInterface
.
class
);
return
api
;
}
...
...
app/src/main/java/com/example/zxa01/iotclient/component/home/device/DeviceModel.java
View file @
7194ec08
...
...
@@ -37,6 +37,7 @@ public class DeviceModel extends BaseObservable {
@Override
public
void
onFailure
(
Call
<
List
<
Device
>>
call
,
Throwable
t
)
{
devicesMLD
.
setValue
(
null
);
Log
.
e
(
"readDevices - onFailure()"
,
t
.
getMessage
(),
t
);
}
}
...
...
app/src/main/java/com/example/zxa01/iotclient/component/home/device/DeviceViewModel.java
View file @
7194ec08
...
...
@@ -16,6 +16,7 @@ import java.util.List;
public
class
DeviceViewModel
extends
ViewModel
{
public
ObservableBoolean
isLoading
=
new
ObservableBoolean
(
true
);
public
ObservableBoolean
isNoContent
=
new
ObservableBoolean
(
true
);
private
DeviceModel
deviceModel
=
new
DeviceModel
();
private
DeviceAdapter
adapter
=
new
DeviceAdapter
(
R
.
layout
.
recycler_view_device
,
this
);
private
Context
context
;
...
...
@@ -67,6 +68,7 @@ public class DeviceViewModel extends ViewModel {
public
void
setAdapter
(
List
<
Device
>
devices
)
{
isLoading
.
set
(
false
);
isNoContent
.
set
(
devices
==
null
);
adapter
.
setDevices
(
devices
);
}
...
...
app/src/main/java/com/example/zxa01/iotclient/component/home/record/RecordModel.java
View file @
7194ec08
...
...
@@ -35,6 +35,7 @@ public class RecordModel extends BaseObservable {
@Override
public
void
onFailure
(
Call
<
List
<
PrivacyChoiceResponse
>>
call
,
Throwable
t
)
{
privacyChoiceResponsesMLD
.
setValue
(
null
);
Log
.
e
(
"fetchRecord - onFailure()"
,
t
.
getMessage
(),
t
);
}
});
...
...
app/src/main/java/com/example/zxa01/iotclient/component/home/record/RecordViewModel.java
View file @
7194ec08
...
...
@@ -16,6 +16,7 @@ import java.util.List;
public
class
RecordViewModel
extends
ViewModel
{
public
ObservableBoolean
isLoading
=
new
ObservableBoolean
(
true
);
public
ObservableBoolean
isNoContent
=
new
ObservableBoolean
(
true
);
private
RecordModel
recordModel
=
new
RecordModel
();
private
RecordAdapter
adapter
=
new
RecordAdapter
(
R
.
layout
.
recycler_view_record
,
this
);
private
Context
context
;
...
...
@@ -69,6 +70,7 @@ public class RecordViewModel extends ViewModel {
public
void
setAdapter
(
List
<
PrivacyChoiceResponse
>
privacyChoiceResponses
)
{
isLoading
.
set
(
false
);
isNoContent
.
set
(
privacyChoiceResponses
==
null
);
adapter
.
setPrivacyChoiceResponses
(
privacyChoiceResponses
);
}
...
...
app/src/main/res/layout/fragment_device.xml
View file @
7194ec08
...
...
@@ -47,6 +47,16 @@
android:src=
"@drawable/ic_add_black_24dp"
app:backgroundTint=
"@color/colorPrimary"
/>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"@string/no_content"
android:textAlignment=
"center"
android:textSize=
"@dimen/font"
android:visibility=
"@{viewModel.isLoading && viewModel.isNoContent ? View.GONE : View.VISIBLE}"
/>
</FrameLayout>
</layout>
app/src/main/res/layout/fragment_record.xml
View file @
7194ec08
...
...
@@ -59,6 +59,16 @@
</LinearLayout>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:textAlignment=
"center"
android:textSize=
"@dimen/font"
android:text=
"@string/no_content"
android:visibility=
"@{viewModel.isLoading && viewModel.isNoContent ? View.GONE : View.VISIBLE}"
/>
</FrameLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/recycler_view_record.xml
View file @
7194ec08
...
...
@@ -66,12 +66,12 @@
android:layout_marginTop=
"@dimen/margin_sm"
android:layout_marginBottom=
"@dimen/margin_sm"
android:textColor=
"@color/colorWhite"
android:background=
"@
drawable/green_radius_background
"
android:background=
"@
{true ? @drawable/green_radius_background : @drawable/red_radius_background }
"
android:paddingLeft=
"@dimen/padding_sm"
android:paddingTop=
"@dimen/padding_xs"
android:paddingRight=
"@dimen/padding_sm"
android:paddingBottom=
"@dimen/padding_xs"
android:text=
"
同意
"
android:text=
"
@{true ? @string/record_accept : @string/record_reject }
"
android:textSize=
"@dimen/font_sm"
tools:text=
"同意"
/>
<TextView
...
...
app/src/main/res/values/strings.xml
View file @
7194ec08
...
...
@@ -19,7 +19,6 @@
<string
name=
"bind_button_cancel"
>
返回
</string>
<string
name=
"bind_qrcode_error"
>
格式錯誤
</string>
<!--Detail-->
<string
name=
"detail_preference_setting"
>
隱私選項設定
</string>
<string
name=
"detail_detect_report"
>
檢測報告下載
</string>
...
...
@@ -38,6 +37,9 @@
<!--Record-->
<string
name=
"record_title"
>
隱私選擇記錄
</string>
<string
name=
"record_view"
>
檢視
</string>
<string
name=
"record_accept"
>
同意
</string>
<string
name=
"record_reject"
>
拒絕
</string>
<!--Login-->
<string
name=
"action_sign_in"
>
登入
</string>
...
...
@@ -51,10 +53,8 @@
<string
name=
"error_incorrect_password"
>
This password is incorrect
</string>
<string
name=
"error_field_required"
>
This field is required
</string>
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<!--Common-->
<string
name=
"dialog"
>
dialog
</string>
<string
name=
"no_content"
>
查無資料
</string>
</resources>
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