Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
wenyuanbo
tic
Commits
729224b1
Commit
729224b1
authored
Aug 21, 2018
by
eqy
Committed by
Tianqi Chen
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check in (#1629)
parent
16d3c1f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
33 deletions
+5
-33
apps/android_rpc/app/src/main/java/ml/dmlc/tvm/tvmrpc/MainActivity.java
+4
-20
apps/android_rpc/app/src/main/res/layout/content_main.xml
+0
-11
apps/android_rpc/app/src/main/res/values/strings.xml
+1
-2
No files found.
apps/android_rpc/app/src/main/java/ml/dmlc/tvm/tvmrpc/MainActivity.java
View file @
729224b1
...
@@ -39,11 +39,9 @@ import android.app.NotificationManager;
...
@@ -39,11 +39,9 @@ import android.app.NotificationManager;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
private
boolean
skipRelaunch
=
true
;
// wait time before automatic restart of RPC Activity
// wait time before automatic restart of RPC Activity
public
static
final
int
HANDLER_RESTART_DELAY
=
5000
;
public
static
final
int
HANDLER_RESTART_DELAY
=
5000
;
private
void
showDialog
(
String
title
,
String
msg
)
{
private
void
showDialog
(
String
title
,
String
msg
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
title
);
builder
.
setTitle
(
title
);
...
@@ -91,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -91,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
final
Runnable
rPCStarter
=
new
Runnable
()
{
final
Runnable
rPCStarter
=
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
if
(
switchPersistent
.
isChecked
())
{
if
(
switchPersistent
.
isChecked
())
{
System
.
err
.
println
(
"relaunching RPC activity
in 5s
..."
);
System
.
err
.
println
(
"relaunching RPC activity..."
);
Intent
intent
=
((
MainActivity
)
context
).
updateRPCPrefs
();
Intent
intent
=
((
MainActivity
)
context
).
updateRPCPrefs
();
startActivity
(
intent
);
startActivity
(
intent
);
}
}
...
@@ -116,6 +114,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -116,6 +114,7 @@ public class MainActivity extends AppCompatActivity {
if
(
isChecked
)
{
if
(
isChecked
)
{
System
.
err
.
println
(
"automatic RPC restart enabled..."
);
System
.
err
.
println
(
"automatic RPC restart enabled..."
);
updateRPCPrefs
();
updateRPCPrefs
();
setupRelaunch
();
}
else
{
}
else
{
System
.
err
.
println
(
"automatic RPC restart disabled..."
);
System
.
err
.
println
(
"automatic RPC restart disabled..."
);
updateRPCPrefs
();
updateRPCPrefs
();
...
@@ -123,29 +122,14 @@ public class MainActivity extends AppCompatActivity {
...
@@ -123,29 +122,14 @@ public class MainActivity extends AppCompatActivity {
}
}
});
});
Button
startRPC
=
findViewById
(
R
.
id
.
button_start_rpc
);
startRPC
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
Intent
intent
=
((
MainActivity
)
context
).
updateRPCPrefs
();
startActivity
(
intent
);
}
});
enableInputView
(
true
);
enableInputView
(
true
);
}
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
System
.
err
.
println
(
"MainActivity onResume..."
);
System
.
err
.
println
(
"MainActivity onResume..."
);
System
.
err
.
println
(
"skipRelaunch: "
+
skipRelaunch
);
enableInputView
(
true
);
// if this is the first time onResume is called, do nothing, otherwise we
setupRelaunch
();
// may double launch
if
(!
skipRelaunch
)
{
enableInputView
(
true
);
setupRelaunch
();
}
else
{
skipRelaunch
=
false
;
}
super
.
onResume
();
super
.
onResume
();
}
}
...
...
apps/android_rpc/app/src/main/res/layout/content_main.xml
View file @
729224b1
...
@@ -78,15 +78,4 @@
...
@@ -78,15 +78,4 @@
android:textOn=
"@string/switch_on"
/>
android:textOn=
"@string/switch_on"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation=
"horizontal"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
>
<Button
android:id=
"@+id/button_start_rpc"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"@string/start_rpc"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
apps/android_rpc/app/src/main/res/values/strings.xml
View file @
729224b1
...
@@ -9,11 +9,10 @@
...
@@ -9,11 +9,10 @@
<string
name=
"label_address"
>
Address
</string>
<string
name=
"label_address"
>
Address
</string>
<string
name=
"label_port"
>
Port
</string>
<string
name=
"label_port"
>
Port
</string>
<string
name=
"label_key"
>
Key
</string>
<string
name=
"label_key"
>
Key
</string>
<string
name=
"label_persistent"
>
Keep RPC Alive
</string>
<string
name=
"label_persistent"
>
Enable RPC
</string>
<string
name=
"switch_on"
>
Enabled
</string>
<string
name=
"switch_on"
>
Enabled
</string>
<string
name=
"switch_off"
>
Disabled
</string>
<string
name=
"switch_off"
>
Disabled
</string>
<string
name=
"start_rpc"
>
Start RPC
</string>
<string
name=
"stop_rpc"
>
Stop RPC
</string>
<string
name=
"stop_rpc"
>
Stop RPC
</string>
</resources>
</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