mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-12 16:11:12 +02:00
Add header-title to Activity detail
This commit is contained in:
parent
01e99d2809
commit
fdea7ed24d
|
@ -154,6 +154,7 @@ public class ActivitySummariesChartFragment extends AbstractChartFragment {
|
|||
}
|
||||
|
||||
chart.getLegend().setCustom(legendEntries);
|
||||
chart.getLegend().setTextColor(LEGEND_TEXT_COLOR);
|
||||
chart.getLegend().setWordWrapEnabled(true);
|
||||
chart.getLegend().setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ActivityListingChartFragment extends AbstractChartFragment {
|
|||
if (item.getSessionType() != ActivitySession.SESSION_SUMMARY) {
|
||||
int tsFrom = (int) (item.getStartTime().getTime() / 1000);
|
||||
int tsTo = (int) (item.getEndTime().getTime() / 1000);
|
||||
showDetail(tsFrom, tsTo, getChartsHost().getDevice());
|
||||
showDetail(tsFrom, tsTo, item, getChartsHost().getDevice());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -206,9 +206,9 @@ public class ActivityListingChartFragment extends AbstractChartFragment {
|
|||
listingDashboardFragment.show(fm, "activity_list_total_dashboard");
|
||||
}
|
||||
|
||||
private void showDetail(int tsFrom, int tsTo, GBDevice device) {
|
||||
private void showDetail(int tsFrom, int tsTo, ActivitySession item, GBDevice device) {
|
||||
FragmentManager fm = getActivity().getSupportFragmentManager();
|
||||
ActivityListingDetail listingDetailFragment = ActivityListingDetail.newInstance(tsFrom, tsTo, device);
|
||||
ActivityListingDetail listingDetailFragment = ActivityListingDetail.newInstance(tsFrom, tsTo, item, device);
|
||||
listingDetailFragment.show(fm, "activity_list_detail");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge.activities.charts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
@ -14,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
|||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.ActivitySummariesChartFragment;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySession;
|
||||
|
||||
public class ActivityListingDetail extends DialogFragment {
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(ActivityListingDetail.class);
|
||||
|
@ -22,11 +29,12 @@ public class ActivityListingDetail extends DialogFragment {
|
|||
|
||||
}
|
||||
|
||||
public static ActivityListingDetail newInstance(int tsFrom, int tsTo, GBDevice device) {
|
||||
public static ActivityListingDetail newInstance(int tsFrom, int tsTo, ActivitySession item, GBDevice device) {
|
||||
ActivityListingDetail frag = new ActivityListingDetail();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("tsFrom", tsFrom);
|
||||
args.putInt("tsTo", tsTo);
|
||||
args.putSerializable("item", item);
|
||||
args.putParcelable(GBDevice.EXTRA_DEVICE, device);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
|
@ -45,6 +53,7 @@ public class ActivityListingDetail extends DialogFragment {
|
|||
|
||||
int tsFrom = getArguments().getInt("tsFrom");
|
||||
int tsTo = getArguments().getInt("tsTo");
|
||||
ActivitySession item = (ActivitySession) getArguments().getSerializable("item");
|
||||
GBDevice gbDevice;
|
||||
gbDevice = getArguments().getParcelable(GBDevice.EXTRA_DEVICE);
|
||||
if (gbDevice == null) {
|
||||
|
@ -57,5 +66,9 @@ public class ActivityListingDetail extends DialogFragment {
|
|||
.replace(R.id.chartsFragmentHolder, activitySummariesChartFragment)
|
||||
.commit();
|
||||
activitySummariesChartFragment.setDateAndGetData(gbDevice, tsFrom, tsTo);
|
||||
|
||||
ActivityListingAdapter stepListAdapter = new ActivityListingAdapter(getContext());
|
||||
View activityItem = view.findViewById(R.id.activityItemHolder);
|
||||
stepListAdapter.fill_item(item, 0, activityItem, null);
|
||||
}
|
||||
}
|
|
@ -77,21 +77,20 @@ public abstract class AbstractActivityListingAdapter<T> extends ArrayAdapter<T>
|
|||
if (isSummary(item, position)) {
|
||||
view = fill_dashboard(item, position, view, parent, context);
|
||||
} else if (isEmptySession(item, position)) {
|
||||
view = fill_empty(item, position, view, parent);
|
||||
view = fill_empty(parent);
|
||||
} else {
|
||||
view = fill_item(item, position, view, parent);
|
||||
}
|
||||
|
||||
return view;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private View fill_item(T item, int position, View view, ViewGroup parent) {
|
||||
view = null;
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.activity_list_item, parent, false);
|
||||
public View fill_item(T item, int position, View view, ViewGroup parent) {
|
||||
if (parent != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.activity_list_item, parent, false);
|
||||
}
|
||||
TextView timeFrom = view.findViewById(R.id.line_layout_time_from);
|
||||
TextView timeTo = view.findViewById(R.id.line_layout_time_to);
|
||||
TextView activityName = view.findViewById(R.id.line_layout_activity_name);
|
||||
|
@ -176,11 +175,10 @@ public abstract class AbstractActivityListingAdapter<T> extends ArrayAdapter<T>
|
|||
return view;
|
||||
}
|
||||
|
||||
private View fill_empty(T item, int position, View view, ViewGroup parent) {
|
||||
view = null;
|
||||
private View fill_empty(ViewGroup parent) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.activity_list_item, parent, false);
|
||||
View view = inflater.inflate(R.layout.activity_list_item, parent, false);
|
||||
view.setVisibility(View.GONE);
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
// ActivitySession holds activities detected by the steps/hr/intensity
|
||||
// and is used in the Activity List
|
||||
public class ActivitySession {
|
||||
public class ActivitySession implements Serializable {
|
||||
|
||||
public static int SESSION_NORMAL = 1;
|
||||
public static int SESSION_SUMMARY = 2;
|
||||
|
|
|
@ -10,9 +10,15 @@
|
|||
android:minWidth="1000dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/activity_list_item"
|
||||
android:id="@+id/activityItemHolder"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/chartsFragmentHolder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"></FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user