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
f59f7137
Commit
f59f7137
authored
Nov 18, 2017
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace CardView with normal list view
parent
f4eeab05
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
23 deletions
+26
-23
mobile/src/main/res/drawable/background_profile.xml
mobile/src/main/res/drawable/background_profile.xml
+0
-3
mobile/src/main/res/layout/layout_profile.xml
mobile/src/main/res/layout/layout_profile.xml
+19
-17
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
.../main/scala/com/github/shadowsocks/ProfilesFragment.scala
+7
-3
No files found.
mobile/src/main/res/drawable/background_profile.xml
View file @
f59f7137
...
...
@@ -3,7 +3,6 @@
<item>
<shape
android:shape=
"rectangle"
>
<solid
android:color=
"@color/material_primary_300"
/>
<corners
android:radius=
"4dp"
/>
</shape>
</item>
<item>
...
...
@@ -12,7 +11,6 @@
<item
android:state_selected=
"true"
>
<shape
android:shape=
"rectangle"
>
<solid
android:color=
"@color/material_green_700"
/>
<corners
android:radius=
"4dp"
/>
</shape>
</item>
</selector>
...
...
@@ -20,7 +18,6 @@
<item
android:left=
"8dp"
>
<shape
android:shape=
"rectangle"
>
<solid
android:color=
"@android:color/white"
/>
<corners
android:bottomRightRadius=
"4dp"
android:topRightRadius=
"4dp"
/>
</shape>
</item>
</layer-list>
mobile/src/main/res/layout/layout_profile.xml
View file @
f59f7137
<?xml version="1.0" encoding="utf-8"?>
<!-- Based on: https://github.com/android/platform_frameworks_base/blob/505e3ab/core/res/res/layout/simple_list_item_2.xml -->
<
Frame
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/ads"
android:orientation=
"vertical"
android:focusable=
"false"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<
com.github.shadowsocks.widget.BoundedCardView
android:layout_width=
"match_parent"
<
FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:layout_gravity=
"center_horizontal"
app:bounded_width=
"@dimen/profile_item_max_width"
android:id=
"@+id/indicator"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:padding=
"8dp"
android:paddingLeft=
"16dp"
android:paddingRight=
"4dp"
android:paddingTop=
"8dp"
android:paddingBottom=
"8dp"
android:focusable=
"true"
android:nextFocusRight=
"@+id/edit"
android:id=
"@+id/content"
...
...
@@ -31,6 +33,7 @@
android:layout_weight=
"1"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"?android:attr/textColorPrimary"
android:textStyle=
"bold"
android:gravity=
"center_vertical"
android:maxLines=
"2"
android:ellipsize=
"end"
/>
...
...
@@ -56,8 +59,7 @@
</LinearLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"4dp"
>
android:layout_marginStart=
"8dp"
>
<TextView
android:id=
"@android:id/text2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -78,5 +80,5 @@
android:textColor=
"?android:attr/textColorSecondary"
/>
</RelativeLayout>
</LinearLayout>
</
com.github.shadowsocks.widget.BoundedCardView
>
</
Frame
Layout>
</
FrameLayout
>
</
Linear
Layout>
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
f59f7137
...
...
@@ -135,15 +135,16 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
val
params
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
params
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
params
.
setMargins
(
0
,
getResources
.
getDimensionPixelOffset
(
R
.
dimen
.
margin_small
)
,
0
,
0
)
params
.
setMargins
(
0
,
0
,
0
,
0
)
adView
=
new
AdView
(
getActivity
)
adView
.
setLayoutParams
(
params
)
adView
.
setAdUnitId
(
"ca-app-pub-9097031975646651/7760346322"
)
adView
.
setAdSize
(
AdSize
.
LARGE
_BANNER
)
itemView
.
findViewById
[
LinearLayout
](
R
.
id
.
content
).
addView
(
adView
)
adView
.
setAdSize
(
AdSize
.
SMART
_BANNER
)
itemView
.
findViewById
[
LinearLayout
](
R
.
id
.
ads
).
addView
(
adView
)
// Load Ad
val
adBuilder
=
new
AdRequest
.
Builder
()
adBuilder
.
addTestDevice
(
"B08FC1764A7B250E91EA9D0D5EBEB208"
)
adView
.
loadAd
(
adBuilder
.
build
())
}
else
adView
.
setVisibility
(
View
.
VISIBLE
)
}
else
if
(
adView
!=
null
)
adView
.
setVisibility
(
View
.
GONE
)
...
...
@@ -266,7 +267,10 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
if
(
app
.
profileManager
.
getFirstProfile
.
isEmpty
)
app
.
dataStore
.
profileId
=
app
.
profileManager
.
createProfile
().
id
val
profilesList
=
view
.
findViewById
[
RecyclerView
](
R
.
id
.
list
)
val
layoutManager
=
new
LinearLayoutManager
(
getActivity
,
LinearLayoutManager
.
VERTICAL
,
false
)
val
dividerItemDecoration
=
new
DividerItemDecoration
(
profilesList
.
getContext
(),
layoutManager
.
getOrientation
())
profilesList
.
setLayoutManager
(
layoutManager
)
profilesList
.
addItemDecoration
(
dividerItemDecoration
)
layoutManager
.
scrollToPosition
(
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
case
(
profile
,
i
)
if
profile
.
id
==
app
.
dataStore
.
profileId
=>
i
}.
getOrElse
(-
1
))
...
...
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