2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 09:58:08 +00:00

Make DeviceFragments listview use full screen width so the over scroll indicator looks better

Summary:
Make DeviceFragments listview use full screen width so the over scroll indicator looks better

| {F6466146} | {F6466147} |
| before | after |

Test Plan: Apply patch and notice that the layout of the list elements has remained the same as before

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: nicolasfella, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17456
This commit is contained in:
Erik Duisters 2018-12-09 18:17:20 +01:00
parent 87ec4f2078
commit 15ff0fca2b
8 changed files with 81 additions and 62 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<inset
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="?attr/dividerHorizontal"
android:insetLeft="16dp"
android:insetRight="16dp"/>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<inset
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/divider_horizontal_holo_light"
android:insetLeft="16dp"
android:insetRight="16dp"/>

View File

@ -5,7 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_vertical_margin"
tools:context="org.kde.kdeconnect.UserInterface.DeviceFragment">
<LinearLayout
@ -13,8 +12,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
android:orientation="vertical">
android:orientation="vertical"
android:padding="@dimen/activity_vertical_margin"
android:visibility="gone">
<ProgressBar
android:id="@+id/pair_progress"
@ -73,8 +73,9 @@
android:id="@+id/error_message_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp"
android:visibility="gone">
<android.support.v7.widget.AppCompatImageView
@ -115,6 +116,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".DeviceActivity" />
android:divider="@drawable/list_divider"
tools:context=".DeviceActivity"
tools:listitem="@layout/list_item_with_icon_entry"/>
</LinearLayout>

View File

@ -1,29 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/abc_list_selector_holo_dark"
android:baselineAligned="false"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:paddingEnd="?android:attr/scrollbarSize"
android:paddingLeft="12dip"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip">
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/list_item_entry_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:contentDescription="@string/device_icon_description"
app:tint="?attr/colorControlNormal"
android:src="@drawable/ic_device_laptop" />
android:src="@drawable/ic_device_laptop"
app:tint="?attr/colorControlNormal"/>
<LinearLayout
android:layout_width="wrap_content"

View File

@ -42,6 +42,7 @@ import org.kde.kdeconnect.Helpers.NetworkHelper;
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.UserInterface.List.CustomItem;
import org.kde.kdeconnect.UserInterface.List.FailedPluginListItem;
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
import org.kde.kdeconnect.UserInterface.List.PluginItem;
import org.kde.kdeconnect.UserInterface.List.SmallEntryItem;
@ -378,9 +379,9 @@ public class DeviceFragment extends Fragment {
TextView header = new TextView(mActivity);
header.setPadding(
0,
((int) (16 * getResources().getDisplayMetrics().density)),
((int) (28 * getResources().getDisplayMetrics().density)),
0,
((int) (16 * getResources().getDisplayMetrics().density)),
((int) (8 * getResources().getDisplayMetrics().density))
);
header.setOnClickListener(null);

View File

@ -17,18 +17,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.kde.kdeconnect.UserInterface;
package org.kde.kdeconnect.UserInterface.List;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.UserInterface.List.SmallEntryItem;
class FailedPluginListItem extends SmallEntryItem {
public class FailedPluginListItem extends SmallEntryItem {
interface Action {
public interface Action {
void action(Plugin plugin);
}
FailedPluginListItem(Plugin plugin, Action action) {
public FailedPluginListItem(Plugin plugin, Action action) {
super(plugin.getDisplayName(), (view) -> action.action(plugin));
}
}

View File

@ -45,6 +45,12 @@ public class SmallEntryItem implements ListAdapter.Item {
@Override
public View inflateView(LayoutInflater layoutInflater) {
View v = layoutInflater.inflate(android.R.layout.simple_list_item_1, null);
v.setPadding(
((int) (28 * layoutInflater.getContext().getResources().getDisplayMetrics().density)),
0,
((int) (28 * layoutInflater.getContext().getResources().getDisplayMetrics().density)),
0
);
TextView titleView = v.findViewById(android.R.id.text1);
if (titleView != null) {