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
2ca8d50e
Commit
2ca8d50e
authored
Dec 25, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine layout for wide screens
parent
3a66bbba
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
142 additions
and
75 deletions
+142
-75
src/main/res/layout/layout_main.xml
src/main/res/layout/layout_main.xml
+5
-4
src/main/res/layout/layout_profiles.xml
src/main/res/layout/layout_profiles.xml
+1
-0
src/main/res/layout/layout_profiles_item.xml
src/main/res/layout/layout_profiles_item.xml
+75
-70
src/main/res/values/attrs.xml
src/main/res/values/attrs.xml
+4
-0
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
+1
-1
src/main/scala/com/github/shadowsocks/widget/BoundedCardView.scala
...scala/com/github/shadowsocks/widget/BoundedCardView.scala
+12
-0
src/main/scala/com/github/shadowsocks/widget/BoundedGridLayout.scala
...ala/com/github/shadowsocks/widget/BoundedGridLayout.scala
+12
-0
src/main/scala/com/github/shadowsocks/widget/BoundedView.scala
...ain/scala/com/github/shadowsocks/widget/BoundedView.scala
+32
-0
No files found.
src/main/res/layout/layout_main.xml
View file @
2ca8d50e
...
@@ -27,9 +27,10 @@
...
@@ -27,9 +27,10 @@
android:paddingEnd=
"72dip"
android:paddingEnd=
"72dip"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<android.support.v7.widget.GridLayout
android:layout_width=
"match_parent"
<com.github.shadowsocks.widget.BoundedGridLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:columnCount=
"4"
>
app:bounded_width=
"288dp"
app:columnCount=
"4"
>
<TextView
app:layout_column=
"0"
style=
"@style/TextAppearance.AppCompat.Body2"
<TextView
app:layout_column=
"0"
style=
"@style/TextAppearance.AppCompat.Body2"
android:ellipsize=
"marquee"
android:text=
"@string/sent"
android:ellipsize=
"marquee"
android:text=
"@string/sent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
@@ -63,7 +64,7 @@
...
@@ -63,7 +64,7 @@
android:textColor=
"?android:attr/textColorSecondary"
android:ellipsize=
"marquee"
android:textColor=
"?android:attr/textColorSecondary"
android:ellipsize=
"marquee"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
app:layout_columnWeight=
"1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
app:layout_columnWeight=
"1"
app:layout_gravity=
"fill_horizontal"
android:gravity=
"end"
/>
app:layout_gravity=
"fill_horizontal"
android:gravity=
"end"
/>
</
android.support.v7.widget.
GridLayout>
</
com.github.shadowsocks.widget.Bounded
GridLayout>
</LinearLayout>
</LinearLayout>
<com.github.jorgecastilloprz.FABProgressCircle
android:id=
"@+id/fabProgressCircle"
<com.github.jorgecastilloprz.FABProgressCircle
android:id=
"@+id/fabProgressCircle"
app:reusable=
"true"
app:reusable=
"true"
...
...
src/main/res/layout/layout_profiles.xml
View file @
2ca8d50e
...
@@ -10,5 +10,6 @@
...
@@ -10,5 +10,6 @@
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:paddingBottom=
"32dp"
android:paddingBottom=
"32dp"
android:clipChildren=
"false"
android:clipToPadding=
"false"
/>
android:clipToPadding=
"false"
/>
</LinearLayout>
</LinearLayout>
src/main/res/layout/layout_profiles_item.xml
View file @
2ca8d50e
<?xml version="1.0" encoding="utf-8"?>
<?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 -->
<!-- Based on: https://github.com/android/platform_frameworks_base/blob/505e3ab/core/res/res/layout/simple_list_item_2.xml -->
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:background=
"@drawable/background_selectable"
<com.github.shadowsocks.widget.BoundedCardView
android:layout_width=
"match_parent"
android:layout_marginTop=
"8dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:background=
"@drawable/background_selectable"
android:layout_marginEnd=
"8dp"
android:layout_marginTop=
"8dp"
android:id=
"@+id/indicator"
>
android:layout_marginStart=
"8dp"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_marginEnd=
"8dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:orientation=
"vertical"
app:bounded_width=
"480dp"
android:padding=
"8dp"
android:id=
"@+id/indicator"
>
android:focusable=
"true"
android:nextFocusRight=
"@+id/edit"
android:id=
"@+id/content"
android:background=
"?android:attr/selectableItemBackground"
>
<LinearLayout
android:layout_width=
"match_parent"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:orientation=
"vertical"
android:id=
"@+id/container"
>
android:padding=
"8dp"
<TextView
android:id=
"@+id/title"
android:focusable=
"true"
android:layout_width=
"0dp"
android:nextFocusRight=
"@+id/edit"
android:id=
"@+id/content"
android:background=
"?android:attr/selectableItemBackground"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:id=
"@+id/container"
>
android:textAppearance=
"?android:attr/textAppearanceLarge"
<TextView
android:id=
"@+id/title"
android:textColor=
"?android:attr/textColorPrimary"
android:layout_width=
"0dp"
android:gravity=
"center_vertical"
android:layout_height=
"wrap_content"
android:maxLines=
"2"
android:layout_gravity=
"center_vertical"
android:ellipsize=
"end"
/>
android:layout_weight=
"1"
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/share"
android:textAppearance=
"?android:attr/textAppearanceLarge"
android:layout_width=
"wrap_content"
android:textColor=
"?android:attr/textColorPrimary"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:padding=
"4dp"
android:maxLines=
"2"
android:layout_gravity=
"top"
android:ellipsize=
"end"
/>
app:srcCompat=
"@drawable/ic_social_share"
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/share"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:layout_width=
"wrap_content"
android:contentDescription=
"Share"
android:layout_height=
"wrap_content"
android:focusable=
"true"
android:padding=
"4dp"
android:nextFocusLeft=
"@+id/container"
/>
android:layout_gravity=
"top"
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/edit"
app:srcCompat=
"@drawable/ic_social_share"
android:layout_width=
"wrap_content"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:contentDescription=
"Share"
android:focusable=
"true"
android:nextFocusLeft=
"@+id/container"
/>
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/edit"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"4dp"
android:layout_gravity=
"top"
app:srcCompat=
"@drawable/ic_image_edit"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:contentDescription=
"Edit"
android:focusable=
"true"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"4dp"
android:layout_marginStart=
"8dp"
android:layout_gravity=
"top"
android:layout_marginTop=
"4dp"
app:srcCompat=
"@drawable/ic_image_edit"
android:id=
"@+id/details"
>
android:background=
"?attr/selectableItemBackgroundBorderless"
<TextView
android:id=
"@+id/address"
android:contentDescription=
"Edit"
android:layout_width=
"0dp"
android:focusable=
"true"
/>
android:layout_height=
"wrap_content"
android:gravity=
"top"
android:layout_weight=
"1"
android:maxLines=
"2"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
<TextView
android:id=
"@+id/traffic"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"top"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
</com.github.shadowsocks.widget.BoundedCardView>
android:layout_height=
"wrap_content"
</FrameLayout>
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"4dp"
android:id=
"@+id/details"
>
<TextView
android:id=
"@+id/address"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:gravity=
"top"
android:layout_weight=
"1"
android:maxLines=
"2"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
<TextView
android:id=
"@+id/traffic"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"top"
android:ellipsize=
"end"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"?android:attr/textColorSecondary"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
src/main/res/values/attrs.xml
View file @
2ca8d50e
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<declare-styleable
name=
"BoundedView"
>
<attr
name=
"bounded_width"
format=
"dimension"
/>
<attr
name=
"bounded_height"
format=
"dimension"
/>
</declare-styleable>
<declare-styleable
name=
"NumberPickerPreference"
>
<declare-styleable
name=
"NumberPickerPreference"
>
<attr
name=
"max"
format=
"integer"
/>
<attr
name=
"max"
format=
"integer"
/>
<attr
name=
"min"
format=
"integer"
/>
<attr
name=
"min"
format=
"integer"
/>
...
...
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
2ca8d50e
...
@@ -25,7 +25,7 @@ import java.util.GregorianCalendar
...
@@ -25,7 +25,7 @@ import java.util.GregorianCalendar
import
android.content._
import
android.content._
import
android.os.
{
Bundle
,
Handler
}
import
android.os.
{
Bundle
,
Handler
}
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v7.widget.
{
DefaultItemAnimator
,
LinearLayoutManager
,
RecyclerView
,
Toolbar
}
import
android.support.v7.widget.
_
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.helper.ItemTouchHelper
import
android.support.v7.widget.helper.ItemTouchHelper
import
android.support.v7.widget.helper.ItemTouchHelper.SimpleCallback
import
android.support.v7.widget.helper.ItemTouchHelper.SimpleCallback
...
...
src/main/scala/com/github/shadowsocks/widget/BoundedCardView.scala
0 → 100644
View file @
2ca8d50e
package
com.github.shadowsocks.widget
import
android.content.Context
import
android.support.v7.widget.CardView
import
android.util.AttributeSet
/**
* @author Mygod
*/
class
BoundedCardView
(
context
:
Context
,
attrs
:
AttributeSet
)
extends
CardView
(
context
,
attrs
)
with
BoundedView
{
initAttrs
(
context
,
attrs
)
}
src/main/scala/com/github/shadowsocks/widget/BoundedGridLayout.scala
0 → 100644
View file @
2ca8d50e
package
com.github.shadowsocks.widget
import
android.content.Context
import
android.support.v7.widget.GridLayout
import
android.util.AttributeSet
/**
* @author Mygod
*/
class
BoundedGridLayout
(
context
:
Context
,
attrs
:
AttributeSet
)
extends
GridLayout
(
context
,
attrs
)
with
BoundedView
{
initAttrs
(
context
,
attrs
)
}
src/main/scala/com/github/shadowsocks/widget/BoundedView.scala
0 → 100644
View file @
2ca8d50e
package
com.github.shadowsocks.widget
import
android.content.Context
import
android.util.AttributeSet
import
android.view.View
import
android.view.View.MeasureSpec
import
com.github.shadowsocks.R
/**
* Based on: http://stackoverflow.com/a/6212120/2245107
*
* @author Mygod
*/
trait
BoundedView
extends
View
{
private
var
boundedWidth
:
Int
=
_
private
var
boundedHeight
:
Int
=
_
protected
def
initAttrs
(
context
:
Context
,
attrs
:
AttributeSet
)
{
val
arr
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
BoundedView
)
boundedWidth
=
arr
.
getDimensionPixelSize
(
R
.
styleable
.
BoundedView_bounded_width
,
0
)
boundedHeight
=
arr
.
getDimensionPixelSize
(
R
.
styleable
.
BoundedView_bounded_height
,
0
)
arr
.
recycle
()
}
override
def
onMeasure
(
widthMeasureSpec
:
Int
,
heightMeasureSpec
:
Int
)
:
Unit
=
super
.
onMeasure
(
if
(
boundedWidth
>
0
&&
boundedWidth
<
MeasureSpec
.
getSize
(
widthMeasureSpec
))
MeasureSpec
.
makeMeasureSpec
(
boundedWidth
,
MeasureSpec
.
getMode
(
widthMeasureSpec
))
else
widthMeasureSpec
,
if
(
boundedHeight
>
0
&&
boundedHeight
<
MeasureSpec
.
getSize
(
heightMeasureSpec
))
MeasureSpec
.
makeMeasureSpec
(
boundedHeight
,
MeasureSpec
.
getMode
(
heightMeasureSpec
))
else
heightMeasureSpec
)
}
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