-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
302364b
commit 7f49857
Showing
4 changed files
with
241 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
...de/dennisguse/opentracks/ui/aggregatedStatistics/daySpecificStats/DaySpecificAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package de.dennisguse.opentracks.ui.aggregatedStatistics.daySpecificStats; | ||
|
||
import android.database.Cursor; | ||
import android.util.SparseBooleanArray; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.appcompat.view.ActionMode; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import de.dennisguse.opentracks.R; | ||
import de.dennisguse.opentracks.data.models.Track; | ||
import de.dennisguse.opentracks.databinding.DaySpecificActivityItemBinding; | ||
import de.dennisguse.opentracks.ui.TrackListAdapter; | ||
import de.dennisguse.opentracks.ui.util.ActivityUtils; | ||
|
||
public class DaySpecificAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ActionMode.Callback { | ||
|
||
private final AppCompatActivity context; | ||
private final RecyclerView recyclerView; | ||
|
||
private final SparseBooleanArray selection = new SparseBooleanArray(); | ||
|
||
private Cursor cursor; | ||
|
||
private boolean selectionMode = false; | ||
private ActivityUtils.ContextualActionModeCallback actionModeCallback; | ||
|
||
public DaySpecificAdapter(AppCompatActivity context, RecyclerView recyclerView) { | ||
this.context = context; | ||
this.recyclerView = recyclerView; | ||
} | ||
|
||
@Override | ||
public boolean onCreateActionMode(ActionMode mode, Menu menu) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void onDestroyActionMode(ActionMode mode) { | ||
|
||
} | ||
|
||
@NonNull | ||
@Override | ||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.day_specific_activity_item, parent, false); | ||
return new ViewHolder(view); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | ||
TrackListAdapter.ViewHolder viewHolder = (TrackListAdapter.ViewHolder) holder; | ||
|
||
cursor.moveToPosition(position); | ||
viewHolder.bind(cursor); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return 0; | ||
} | ||
|
||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { | ||
|
||
private final DaySpecificActivityItemBinding viewBinding; | ||
private final View view; | ||
|
||
private Track.Id trackId; | ||
|
||
public ViewHolder(@NonNull View itemView) { | ||
super(itemView); | ||
|
||
viewBinding = DaySpecificActivityItemBinding.bind(itemView); | ||
view = itemView; | ||
|
||
view.setOnClickListener(this); | ||
view.setOnLongClickListener(this); | ||
} | ||
|
||
public void bind(Cursor cursor){ | ||
viewBinding.daySpecificActivity.setText("Run"); | ||
viewBinding.daySpecificActivityDisplacement.setText("0 m"); | ||
viewBinding.daySpecificActivityDistance.setText("0.14 km"); | ||
viewBinding.daySpecificActivitySpeed.setText("36.3 km/h"); | ||
viewBinding.daySpecificActivityTime.setText("0.50"); | ||
} | ||
|
||
public void setSelected(boolean isSelected) { | ||
selection.put((int) getId(), isSelected); | ||
view.setActivated(isSelected); | ||
} | ||
|
||
public long getId() { | ||
return trackId.id(); | ||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean onLongClick(View view) { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ui.aggregatedStatistics.daySpecificStats.DaySpecificActivity"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:clipToPadding="false" | ||
android:orientation="vertical" | ||
android:paddingBottom="?attr/actionBarSize" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/track_list" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="0.8" /> | ||
</LinearLayout> | ||
|
||
|
||
<include | ||
android:id="@+id/bottom_app_bar_layout" | ||
layout="@layout/bottomappbar" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:padding="8dp"> | ||
|
||
<TextView | ||
android:id="@+id/day_specific_activity" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:text="Run" | ||
android:textSize="15dp" | ||
android:textStyle="bold" /> | ||
|
||
<!-- Row for Run --> | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="8dp" | ||
android:padding="4dp" | ||
android:weightSum="4" | ||
android:textSize="10dp" | ||
android:visibility="visible"> | ||
|
||
<TextView | ||
android:id="@+id/day_specific_activity_displacement" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:layout_weight="1" | ||
android:textSize="13dp" | ||
android:text="0 m" /> | ||
|
||
<TextView | ||
android:id="@+id/day_specific_activity_distance" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:layout_weight="1" | ||
android:textSize="13dp" | ||
android:text="0.14 km" /> | ||
|
||
<TextView | ||
android:id="@+id/day_specific_activity_time" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:layout_weight="1" | ||
android:textSize="13dp" | ||
android:text="0.50" /> | ||
|
||
<TextView | ||
android:id="@+id/day_specific_activity_speed" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:textSize="13dp" | ||
android:layout_weight="1" | ||
android:text="36.3 km/h" /> | ||
</LinearLayout> | ||
|
||
<!-- Bottom Line --> | ||
<View | ||
android:id="@+id/marker_list_item_bottom_line" | ||
style="@style/HorizontalLine" | ||
android:layout_marginBottom="0dp"/> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |