Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
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
sheteng
com.ccwangluo.accelerator
Commits
25b6a307
Commit
25b6a307
authored
Dec 24, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Layout bugfixes
parent
5217b1d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
25 deletions
+20
-25
src/main/res/layout/layout_profiles_item.xml
src/main/res/layout/layout_profiles_item.xml
+5
-9
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
+15
-16
No files found.
src/main/res/layout/layout_profiles_item.xml
View file @
25b6a307
...
@@ -48,22 +48,18 @@
...
@@ -48,22 +48,18 @@
android:layout_marginTop=
"4dp"
android:layout_marginTop=
"4dp"
android:id=
"@+id/details"
>
android:id=
"@+id/details"
>
<TextView
android:id=
"@+id/address"
<TextView
android:id=
"@+id/address"
android:layout_width=
"
match_parent
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:gravity=
"top"
android:gravity=
"center_vertical|start"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:maxLines=
"
1
"
android:maxLines=
"
2
"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
android:textColor=
"?android:attr/textColorSecondary"
/>
<TextView
android:id=
"@+id/traffic"
<TextView
android:id=
"@+id/traffic"
android:layout_width=
"
match_par
ent"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:gravity=
"top"
android:gravity=
"center_vertical|end"
android:layout_weight=
"1"
android:maxLines=
"1"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
android:textColor=
"?android:attr/textColorSecondary"
/>
...
...
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
25b6a307
...
@@ -20,8 +20,9 @@
...
@@ -20,8 +20,9 @@
package
com.github.shadowsocks
package
com.github.shadowsocks
import
java.util.GregorianCalendar
import
android.content._
import
android.content._
import
android.graphics.Typeface
import
android.os.
{
Build
,
Bundle
,
Handler
,
UserManager
}
import
android.os.
{
Build
,
Bundle
,
Handler
,
UserManager
}
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.RecyclerView.ViewHolder
...
@@ -31,17 +32,14 @@ import android.support.v7.widget.helper.ItemTouchHelper
...
@@ -31,17 +32,14 @@ import android.support.v7.widget.helper.ItemTouchHelper
import
android.support.v7.widget.helper.ItemTouchHelper.SimpleCallback
import
android.support.v7.widget.helper.ItemTouchHelper.SimpleCallback
import
android.view._
import
android.view._
import
android.widget.
{
TextView
,
Toast
}
import
android.widget.
{
TextView
,
Toast
}
import
com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.utils._
import
com.github.shadowsocks.utils._
import
com.github.shadowsocks.widget.UndoSnackbarManager
import
com.github.shadowsocks.widget.UndoSnackbarManager
import
com.google.android.gms.ads.
{
AdRequest
,
AdSize
,
NativeExpressAdView
}
import
com.google.android.gms.ads.
{
AdRequest
,
NativeExpressAdView
}
import
java.util.GregorianCalendar
import
scala.util.Random
import
scala.collection.mutable.ArrayBuffer
import
scala.collection.mutable.ArrayBuffer
import
scala.util.Random
final
class
ProfilesFragment
extends
ToolbarFragment
with
OnMenuItemClickListener
{
final
class
ProfilesFragment
extends
ToolbarFragment
with
OnMenuItemClickListener
{
private
final
class
ProfileViewHolder
(
val
view
:
View
)
extends
RecyclerView
.
ViewHolder
(
view
)
private
final
class
ProfileViewHolder
(
val
view
:
View
)
extends
RecyclerView
.
ViewHolder
(
view
)
...
@@ -49,9 +47,9 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
...
@@ -49,9 +47,9 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
var
item
:
Profile
=
_
var
item
:
Profile
=
_
private
val
t
ext1
=
itemView
.
findViewById
(
R
.
id
.
title
).
asInstanceOf
[
TextView
]
private
val
t
itle
=
itemView
.
findViewById
(
R
.
id
.
title
).
asInstanceOf
[
TextView
]
private
val
text2
=
itemView
.
findViewById
(
R
.
id
.
address
).
asInstanceOf
[
TextView
]
private
val
address
=
itemView
.
findViewById
(
R
.
id
.
address
).
asInstanceOf
[
TextView
]
private
val
t
ext3
=
itemView
.
findViewById
(
R
.
id
.
traffic
).
asInstanceOf
[
TextView
]
private
val
t
raffic
=
itemView
.
findViewById
(
R
.
id
.
traffic
).
asInstanceOf
[
TextView
]
private
val
indicator
=
itemView
.
findViewById
(
R
.
id
.
indicator
).
asInstanceOf
[
ViewGroup
]
private
val
indicator
=
itemView
.
findViewById
(
R
.
id
.
indicator
).
asInstanceOf
[
ViewGroup
]
itemView
.
setOnClickListener
(
this
)
itemView
.
setOnClickListener
(
this
)
...
@@ -73,15 +71,18 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
...
@@ -73,15 +71,18 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
val
tx
=
item
.
tx
+
txTotal
val
tx
=
item
.
tx
+
txTotal
val
rx
=
item
.
rx
+
rxTotal
val
rx
=
item
.
rx
+
rxTotal
var
title
=
if
(
isDemoMode
)
"Profile #"
+
item
.
id
else
item
.
name
var
title
=
if
(
isDemoMode
)
"Profile #"
+
item
.
id
else
item
.
name
val
address
=
(
if
(
item
.
host
.
contains
(
":"
))
"[%s]:%d"
else
"%s:%d"
).
format
(
item
.
host
,
item
.
remotePort
)
var
address
=
(
if
(
item
.
host
.
contains
(
":"
))
"[%s]:%d"
else
"%s:%d"
).
format
(
item
.
host
,
item
.
remotePort
)
if
(
title
==
null
||
title
.
isEmpty
)
title
=
address
if
((
title
==
null
||
title
.
isEmpty
)
&&
address
.
nonEmpty
)
{
title
=
address
address
=
""
}
val
traffic
=
getString
(
R
.
string
.
stat_profiles
,
val
traffic
=
getString
(
R
.
string
.
stat_profiles
,
TrafficMonitor
.
formatTraffic
(
tx
),
TrafficMonitor
.
formatTraffic
(
rx
))
TrafficMonitor
.
formatTraffic
(
tx
),
TrafficMonitor
.
formatTraffic
(
rx
))
handler
.
post
(()
=>
{
handler
.
post
(()
=>
{
t
ext1
.
setText
(
title
)
t
his
.
title
.
setText
(
title
)
t
ext2
.
setText
(
address
)
t
his
.
address
.
setText
(
address
)
t
ext3
.
setText
(
traffic
)
t
his
.
traffic
.
setText
(
traffic
)
})
})
}
}
...
@@ -90,11 +91,9 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
...
@@ -90,11 +91,9 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
updateText
()
updateText
()
if
(
item
.
id
==
app
.
profileId
)
{
if
(
item
.
id
==
app
.
profileId
)
{
// text1.setTypeface(null, Typeface.BOLD)
indicator
.
setBackgroundResource
(
R
.
drawable
.
background_selected
)
indicator
.
setBackgroundResource
(
R
.
drawable
.
background_selected
)
selectedItem
=
this
selectedItem
=
this
}
else
{
}
else
{
// text1.setTypeface(null, Typeface.NORMAL)
indicator
.
setBackgroundResource
(
R
.
drawable
.
background_selectable
)
indicator
.
setBackgroundResource
(
R
.
drawable
.
background_selectable
)
if
(
selectedItem
eq
this
)
selectedItem
=
null
if
(
selectedItem
eq
this
)
selectedItem
=
null
}
}
...
...
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