mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Merge branch 'master' into health-new-database
This commit is contained in:
commit
39961e8dc2
@ -64,11 +64,11 @@ dependencies {
|
||||
testCompile "org.robolectric:robolectric:3.2.2"
|
||||
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:25.2.0'
|
||||
compile 'com.android.support:cardview-v7:25.2.0'
|
||||
compile 'com.android.support:recyclerview-v7:25.2.0'
|
||||
compile 'com.android.support:support-v4:25.2.0'
|
||||
compile 'com.android.support:design:25.2.0'
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.android.support:cardview-v7:25.3.1'
|
||||
compile 'com.android.support:recyclerview-v7:25.3.1'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
compile 'com.android.support:design:25.3.1'
|
||||
compile 'com.github.tony19:logback-android-classic:1.1.1-4'
|
||||
compile 'org.slf4j:slf4j-api:1.7.7'
|
||||
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
|
||||
@ -76,7 +76,6 @@ dependencies {
|
||||
compile 'de.cketti.library.changelog:ckchangelog:1.2.2'
|
||||
compile 'net.e175.klaus:solarpositioning:0.0.9'
|
||||
compile 'com.github.freeyourgadget:greendao:1998d7cd2d21f662c6044f6ccf3b3a251bbad341'
|
||||
compile 'com.github.woxthebox:draglistview:1.2.9'
|
||||
compile 'org.apache.commons:commons-lang3:3.4'
|
||||
|
||||
// compile project(":DaoCore")
|
||||
|
@ -27,7 +27,8 @@ import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -35,8 +36,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import com.woxthebox.draglistview.DragListView;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -64,6 +63,8 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
= "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractAppManagerFragment.class);
|
||||
|
||||
private ItemTouchHelper appManagementTouchHelper;
|
||||
|
||||
protected abstract List<GBDeviceApp> getSystemAppsInCategory();
|
||||
|
||||
protected abstract String getSortFilename();
|
||||
@ -72,9 +73,13 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
|
||||
protected abstract boolean filterApp(GBDeviceApp gbDeviceApp);
|
||||
|
||||
public void startDragging(RecyclerView.ViewHolder viewHolder) {
|
||||
appManagementTouchHelper.startDrag(viewHolder);
|
||||
}
|
||||
|
||||
protected void onChangedAppOrder() {
|
||||
List<UUID> uuidList = new ArrayList<>();
|
||||
for (GBDeviceApp gbDeviceApp : mGBDeviceAppAdapter.getItemList()) {
|
||||
for (GBDeviceApp gbDeviceApp : mGBDeviceAppAdapter.getAppList()) {
|
||||
uuidList.add(gbDeviceApp.getUUID());
|
||||
}
|
||||
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuidList);
|
||||
@ -133,7 +138,6 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
}
|
||||
};
|
||||
|
||||
private DragListView appListView;
|
||||
protected final List<GBDeviceApp> appList = new ArrayList<>();
|
||||
private GBDeviceAppAdapter mGBDeviceAppAdapter;
|
||||
protected GBDevice mGBDevice = null;
|
||||
@ -237,10 +241,6 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mGBDevice = ((AppManagerActivity) getActivity()).getGBDevice();
|
||||
|
||||
if (PebbleUtils.getFwMajor(mGBDevice.getFirmwareVersion()) < 3 && !isCacheManager()) {
|
||||
appListView.setDragEnabled(false);
|
||||
}
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(ACTION_REFRESH_APPLIST);
|
||||
|
||||
@ -261,31 +261,21 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
|
||||
View rootView = inflater.inflate(R.layout.activity_appmanager, container, false);
|
||||
|
||||
appListView = (DragListView) (rootView.findViewById(R.id.appListView));
|
||||
RecyclerView appListView = (RecyclerView) (rootView.findViewById(R.id.appListView));
|
||||
appListView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(appList, R.layout.item_with_details, R.id.item_image, this.getContext(), this);
|
||||
appListView.setAdapter(mGBDeviceAppAdapter, false);
|
||||
appListView.setCanDragHorizontally(false);
|
||||
appListView.setDragListListener(new DragListView.DragListListener() {
|
||||
@Override
|
||||
public void onItemDragStarted(int position) {
|
||||
}
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(appList, R.layout.item_with_details_and_drag_handle, this);
|
||||
appListView.setAdapter(mGBDeviceAppAdapter);
|
||||
|
||||
@Override
|
||||
public void onItemDragging(int itemPosition, float x, float y) {
|
||||
}
|
||||
ItemTouchHelper.Callback appItemTouchHelperCallback = new AppItemTouchHelperCallback(mGBDeviceAppAdapter);
|
||||
appManagementTouchHelper = new ItemTouchHelper(appItemTouchHelperCallback);
|
||||
|
||||
@Override
|
||||
public void onItemDragEnded(int fromPosition, int toPosition) {
|
||||
onChangedAppOrder();
|
||||
}
|
||||
});
|
||||
appManagementTouchHelper.attachToRecyclerView(appListView);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
protected void sendOrderToDevice(String concatFilename) {
|
||||
ArrayList<UUID> uuids = new ArrayList<>();
|
||||
for (GBDeviceApp gbDeviceApp : mGBDeviceAppAdapter.getItemList()) {
|
||||
for (GBDeviceApp gbDeviceApp : mGBDeviceAppAdapter.getAppList()) {
|
||||
uuids.add(gbDeviceApp.getUUID());
|
||||
}
|
||||
if (concatFilename != null) {
|
||||
@ -295,11 +285,11 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
GBApplication.deviceService().onAppReorder(uuids.toArray(new UUID[uuids.size()]));
|
||||
}
|
||||
|
||||
public boolean openPopupMenu(View view, int position) {
|
||||
public boolean openPopupMenu(View view, GBDeviceApp deviceApp) {
|
||||
PopupMenu popupMenu = new PopupMenu(getContext(), view);
|
||||
popupMenu.getMenuInflater().inflate(R.menu.appmanager_context, popupMenu.getMenu());
|
||||
Menu menu = popupMenu.getMenu();
|
||||
final GBDeviceApp selectedApp = appList.get(position);
|
||||
final GBDeviceApp selectedApp = deviceApp;
|
||||
|
||||
if (!selectedApp.isInCache()) {
|
||||
menu.removeItem(R.id.appmanager_app_reinstall);
|
||||
@ -352,12 +342,11 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
}
|
||||
);
|
||||
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
popupMenu.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onContextItemSelected(MenuItem item, GBDeviceApp selectedApp) {
|
||||
private boolean onContextItemSelected(MenuItem item, GBDeviceApp selectedApp) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.appmanager_app_delete_cache:
|
||||
String baseName;
|
||||
@ -440,4 +429,46 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(mReceiver);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public class AppItemTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||
|
||||
private final GBDeviceAppAdapter gbDeviceAppAdapter;
|
||||
|
||||
public AppItemTouchHelperCallback(GBDeviceAppAdapter gbDeviceAppAdapter) {
|
||||
this.gbDeviceAppAdapter = gbDeviceAppAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
//app reordering is not possible on old firmwares
|
||||
if (PebbleUtils.getFwMajor(mGBDevice.getFirmwareVersion()) < 3 && !isCacheManager()) {
|
||||
return 0;
|
||||
}
|
||||
//we only support up and down movement and only for moving, not for swiping apps away
|
||||
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongPressDragEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
|
||||
gbDeviceAppAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
super.clearView(recyclerView, viewHolder);
|
||||
onChangedAppOrder();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,15 +16,15 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.woxthebox.draglistview.DragItemAdapter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -37,40 +37,41 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||
* Adapter for displaying GBDeviceApp instances.
|
||||
*/
|
||||
|
||||
public class GBDeviceAppAdapter extends DragItemAdapter<GBDeviceApp, GBDeviceAppAdapter.ViewHolder> {
|
||||
public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.AppViewHolder> {
|
||||
|
||||
private final int mLayoutId;
|
||||
private final int mGrabHandleId;
|
||||
private final Context mContext;
|
||||
private final List<GBDeviceApp> appList;
|
||||
private final AbstractAppManagerFragment mParentFragment;
|
||||
|
||||
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, int grabHandleId, Context context, AbstractAppManagerFragment parentFragment) {
|
||||
super(true); // longpress
|
||||
public List<GBDeviceApp> getAppList() {
|
||||
return appList;
|
||||
}
|
||||
|
||||
public GBDeviceAppAdapter(List<GBDeviceApp> list, int layoutId, AbstractAppManagerFragment parentFragment) {
|
||||
mLayoutId = layoutId;
|
||||
mGrabHandleId = grabHandleId;
|
||||
mContext = context;
|
||||
appList = list;
|
||||
mParentFragment = parentFragment;
|
||||
setHasStableIds(true);
|
||||
setItemList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return mItemList.get(position).getUUID().getLeastSignificantBits();
|
||||
return appList.get(position).getUUID().getLeastSignificantBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public int getItemCount() {
|
||||
return appList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GBDeviceAppAdapter.AppViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(mLayoutId, parent, false);
|
||||
return new ViewHolder(view);
|
||||
return new AppViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
super.onBindViewHolder(holder, position);
|
||||
GBDeviceApp deviceApp = mItemList.get(position);
|
||||
|
||||
public void onBindViewHolder(final AppViewHolder holder, int position) {
|
||||
final GBDeviceApp deviceApp = appList.get(position);
|
||||
|
||||
holder.mDeviceAppVersionAuthorLabel.setText(GBApplication.getContext().getString(R.string.appversion_by_creator, deviceApp.getVersion(), deviceApp.getCreator()));
|
||||
// FIXME: replace with small icons
|
||||
@ -93,29 +94,51 @@ public class GBDeviceAppAdapter extends DragItemAdapter<GBDeviceApp, GBDeviceApp
|
||||
default:
|
||||
holder.mDeviceImageView.setImageResource(R.drawable.ic_watchapp);
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
UUID uuid = deviceApp.getUUID();
|
||||
GBApplication.deviceService().onAppStart(uuid, true);
|
||||
}
|
||||
});
|
||||
|
||||
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
return mParentFragment.openPopupMenu(view, deviceApp);
|
||||
}
|
||||
});
|
||||
|
||||
holder.mDragHandle.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
mParentFragment.startDragging(holder);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public class ViewHolder extends DragItemAdapter<GBDeviceApp, GBDeviceAppAdapter.ViewHolder>.ViewHolder {
|
||||
TextView mDeviceAppVersionAuthorLabel;
|
||||
TextView mDeviceAppNameLabel;
|
||||
ImageView mDeviceImageView;
|
||||
public void onItemMove(int from, int to) {
|
||||
Collections.swap(appList, from, to);
|
||||
notifyItemMoved(from, to);
|
||||
}
|
||||
|
||||
public ViewHolder(final View itemView) {
|
||||
super(itemView, mGrabHandleId);
|
||||
public class AppViewHolder extends RecyclerView.ViewHolder {
|
||||
final TextView mDeviceAppVersionAuthorLabel;
|
||||
final TextView mDeviceAppNameLabel;
|
||||
final ImageView mDeviceImageView;
|
||||
final ImageView mDragHandle;
|
||||
|
||||
AppViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mDeviceAppVersionAuthorLabel = (TextView) itemView.findViewById(R.id.item_details);
|
||||
mDeviceAppNameLabel = (TextView) itemView.findViewById(R.id.item_name);
|
||||
mDeviceImageView = (ImageView) itemView.findViewById(R.id.item_image);
|
||||
mDragHandle = (ImageView) itemView.findViewById(R.id.drag_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClicked(View view) {
|
||||
UUID uuid = mItemList.get(getAdapterPosition()).getUUID();
|
||||
GBApplication.deviceService().onAppStart(uuid, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClicked(View view) {
|
||||
return mParentFragment.openPopupMenu(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
/* Copyright (C) 2016-2017 Daniele Gobbetti
|
||||
|
||||
This file is part of Gadgetbridge.
|
||||
|
||||
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Gadgetbridge is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.pebble;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
class DatalogSessionAnalytics extends DatalogSession {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatalogSessionAnalytics.class);
|
||||
private GBDeviceEventBatteryInfo mGBDeviceEventBatteryInfo = new GBDeviceEventBatteryInfo();
|
||||
private GBDevice mGBDevice;
|
||||
|
||||
DatalogSessionAnalytics(byte id, UUID uuid, int timestamp, int tag, byte itemType, short itemSize, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, itemType, itemSize);
|
||||
if (mGBDevice == null || !device.equals(mGBDevice)) { //prevent showing information of other pebble watches when switching devices
|
||||
mGBDevice = device;
|
||||
mGBDeviceEventBatteryInfo.state = BatteryState.UNKNOWN;
|
||||
}
|
||||
|
||||
// The default notification should not be too bad (one per hour) but we can override this if needed
|
||||
//mGBDevice.setBatteryThresholdPercent((short) 5);
|
||||
|
||||
taginfo = "(analytics - " + tag + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
GBDeviceEvent[] handleMessage(ByteBuffer datalogMessage, int length) {
|
||||
LOG.info("DATALOG " + taginfo + GB.hexdump(datalogMessage.array(), datalogMessage.position(), length));
|
||||
|
||||
datalogMessage.position(datalogMessage.position() + 3);
|
||||
int messageTS = datalogMessage.getInt();
|
||||
|
||||
datalogMessage.position(datalogMessage.position() + 12);
|
||||
short reportedMilliVolts = datalogMessage.getShort();
|
||||
|
||||
LOG.info("Battery reading for TS " + messageTS + " is: " + reportedMilliVolts + " milliVolts, mapped to percentage: " + milliVoltstoPercentage(reportedMilliVolts));
|
||||
|
||||
if (messageTS > 0 && reportedMilliVolts < 5000) { //some safety checks
|
||||
mGBDeviceEventBatteryInfo.state = BatteryState.BATTERY_NORMAL;
|
||||
mGBDeviceEventBatteryInfo.level = milliVoltstoPercentage(reportedMilliVolts);
|
||||
|
||||
return new GBDeviceEvent[]{mGBDeviceEventBatteryInfo, null};
|
||||
} else { //invalid data, but we ack nevertheless
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private short milliVoltstoPercentage(short batteryMilliVolts) {
|
||||
if (batteryMilliVolts > 4145) { //(4146 is still 100, next reported value is already 90)
|
||||
return 100;
|
||||
} else if (batteryMilliVolts > 4053) { //(4054 is still 90, next reported value is already 80)
|
||||
return 90;
|
||||
} else if (batteryMilliVolts > 4000) { //guessed
|
||||
return 80;
|
||||
} else if (batteryMilliVolts > 3880) { //confirmed
|
||||
return 70;
|
||||
} else if (batteryMilliVolts > 3855) { //probably
|
||||
return 60;
|
||||
} else if (batteryMilliVolts > 3780) { //3781 is still 50, next reading is 3776 but percentage on pebble unknown
|
||||
return 50;
|
||||
} else if (batteryMilliVolts >= 3750) { //3750 is still 40, next reported value is 3746 and already 30
|
||||
return 40;
|
||||
} else if (batteryMilliVolts > 3720) { //3723 is still 30, next reported value is 3719 and already 20
|
||||
return 30;
|
||||
} else if (batteryMilliVolts > 3680) { //3683 is still 20, next reported value is 3675 and already 10
|
||||
return 20;
|
||||
} else if (batteryMilliVolts > 3650) { //3657 is still 10
|
||||
return 10;
|
||||
} else {
|
||||
return 0; //or -1 for invalid?
|
||||
}
|
||||
}
|
||||
}
|
@ -2263,7 +2263,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
short item_size = buf.getShort();
|
||||
LOG.info("DATALOG OPENSESSION. id=" + (id & 0xff) + ", App UUID=" + uuid.toString() + ", log_tag=" + log_tag + ", item_type=" + item_type + ", itemSize=" + item_size);
|
||||
if (!mDatalogSessions.containsKey(id)) {
|
||||
if (uuid.equals(UUID_ZERO) && log_tag == 81) {
|
||||
if (uuid.equals(UUID_ZERO) && log_tag == 78) {
|
||||
mDatalogSessions.put(id, new DatalogSessionAnalytics(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else if (uuid.equals(UUID_ZERO) && log_tag == 81) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSteps(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else if (uuid.equals(UUID_ZERO) && log_tag == 83) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSleep(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
|
9
app/src/main/res/drawable/ic_drag_handle_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_drag_handle_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20,9H4v2h16V9zM4,15h16v-2H4v2z" />
|
||||
</vector>
|
@ -3,8 +3,9 @@
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AbstractAppManagerFragment">
|
||||
<com.woxthebox.draglistview.DragListView
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/appListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent" />
|
||||
android:layout_height="fill_parent" />
|
||||
</RelativeLayout>
|
||||
|
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:contentDescription="@string/candidate_item_device_image" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/item_image"
|
||||
android:layout_toStartOf="@+id/drag_handle"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollHorizontally="false"
|
||||
style="@style/Base.TextAppearance.AppCompat.SearchResult.Title"
|
||||
android:text="Item Name"
|
||||
android:maxLines="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_details"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Base.TextAppearance.AppCompat.SearchResult"
|
||||
android:text="Item Description" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/drag_handle"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:contentDescription="drag handle"
|
||||
app:srcCompat="@drawable/ic_drag_handle_black_24dp" />
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user