Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
echo-adr-Deprecated
Project
Project
Details
Activity
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
echo
echo-adr-Deprecated
Commits
8abf92b5
Commit
8abf92b5
authored
Jul 23, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
当前设备出口查询
parent
50ad9037
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
0 deletions
+147
-0
UserApi.java
app/src/main/java/com/virjar/echo/adr/repo/UserApi.java
+5
-0
LogFragment.java
app/src/main/java/com/virjar/echo/adr/ui/LogFragment.java
+59
-0
MineFragment.java
app/src/main/java/com/virjar/echo/adr/ui/MineFragment.java
+17
-0
fragment_mine.xml
app/src/main/res/layout/fragment_mine.xml
+62
-0
strings.xml
app/src/main/res/values/strings.xml
+4
-0
No files found.
app/src/main/java/com/virjar/echo/adr/repo/UserApi.java
View file @
8abf92b5
...
...
@@ -8,6 +8,7 @@ import retrofit2.http.Field;
import
retrofit2.http.FormUrlEncoded
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.Query
;
public
interface
UserApi
{
@GET
(
"api/user/userInfo"
)
...
...
@@ -18,4 +19,8 @@ public interface UserApi {
@POST
(
"api/user/login"
)
Call
<
Result
<
UserInfo
>>
loginWithUsername
(
@Field
(
"userName"
)
String
userName
,
@Field
(
"password"
)
String
password
);
@GET
(
"api/user/queryClientMapping"
)
Call
<
Result
<
Integer
>>
getClientMappingPort
(
@Query
(
"clientId"
)
String
clientId
);
}
app/src/main/java/com/virjar/echo/adr/ui/LogFragment.java
View file @
8abf92b5
...
...
@@ -13,12 +13,21 @@ import androidx.annotation.Nullable;
import
androidx.fragment.app.Fragment
;
import
com.virjar.echo.adr.R
;
import
com.virjar.echo.adr.bean.Result
;
import
com.virjar.echo.adr.component.LogServices
;
import
com.virjar.echo.adr.repo.APIServices
;
import
com.virjar.echo.adr.repo.EchoConfig
;
import
com.virjar.echo.nat.log.EchoLogger
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
public
class
LogFragment
extends
Fragment
{
private
TextView
logView
;
private
TextView
mappingView
;
private
boolean
running
=
false
;
@Nullable
...
...
@@ -28,9 +37,59 @@ public class LogFragment extends Fragment {
logView
=
view
.
findViewById
(
R
.
id
.
tv_log
);
logView
.
setText
(
LogServices
.
logSnapshot
());
mappingView
=
view
.
findViewById
(
R
.
id
.
tv_mapping_proxy
);
return
view
;
}
@Override
public
void
onResume
()
{
super
.
onResume
();
updateClientId
();
}
private
void
updateClientId
()
{
APIServices
.
userApi
.
getClientMappingPort
(
EchoConfig
.
getClientId
()
).
enqueue
(
new
Callback
<
Result
<
Integer
>>()
{
@Override
public
void
onResponse
(
Call
<
Result
<
Integer
>>
call
,
Response
<
Result
<
Integer
>>
response
)
{
final
Result
<
Integer
>
result
=
response
.
body
();
if
(!
result
.
isOk
())
{
new
Handler
(
Looper
.
getMainLooper
())
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
updateClientId
();
}
},
3000
);
return
;
}
new
Handler
(
Looper
.
getMainLooper
()).
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mappingView
.
setText
(
EchoConfig
.
getEchoServer
()
+
":"
+
result
.
getData
());
}
});
}
@Override
public
void
onFailure
(
Call
<
Result
<
Integer
>>
call
,
Throwable
t
)
{
EchoLogger
.
getLogger
().
error
(
"can not get mapping info"
,
t
);
new
Handler
(
Looper
.
getMainLooper
())
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
updateClientId
();
}
},
3000
);
}
});
}
public
void
start
()
{
if
(
running
)
{
return
;
...
...
app/src/main/java/com/virjar/echo/adr/ui/MineFragment.java
View file @
8abf92b5
package
com
.
virjar
.
echo
.
adr
.
ui
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.Fragment
;
import
com.virjar.echo.adr.R
;
public
class
MineFragment
extends
Fragment
{
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_mine
,
container
,
false
);
return
view
;
}
}
app/src/main/res/layout/fragment_mine.xml
0 → 100644
View file @
8abf92b5
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.LogFragment"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_login_account"
android:layout_weight=
"3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/btn_login_out"
android:text=
"@string/logout"
android:paddingLeft=
"10dp"
android:layout_weight=
"1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:text=
"@string/quota"
android:layout_weight=
"3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/tv_quota"
android:layout_weight=
"3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<TextView
android:text=
"我的在线设备"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
></TextView>
<ListView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
></ListView>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
8abf92b5
...
...
@@ -25,4 +25,8 @@
<string
name=
"attachment_summary_on"
>
Automatically download attachments for incoming emails
</string>
<string
name=
"attachment_summary_off"
>
Only download attachments when manually requested
</string>
<string
name=
"logout"
>
退出登录
</string>
<string
name=
"quota"
>
容量
</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