forked from upstream-mirrors/OpenTracks
Removed zoom controls for ChartFragment.
This commit is contained in:
@@ -22,7 +22,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.widget.ZoomControls;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -77,10 +76,9 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
private ChartView chartView;
|
private ChartView chartView;
|
||||||
private ZoomControls zoomControls;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A runnable that will enable/disable zoom controls and orange pointer as appropriate and redraw.
|
* A runnable that will set the orange pointer as appropriate and redraw.
|
||||||
*/
|
*/
|
||||||
private final Runnable updateChart = new Runnable() {
|
private final Runnable updateChart = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -89,8 +87,6 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomControls.setIsZoomInEnabled(chartView.canZoomIn());
|
|
||||||
zoomControls.setIsZoomOutEnabled(chartView.canZoomOut());
|
|
||||||
chartView.setShowPointer(isSelectedTrackRecording());
|
chartView.setShowPointer(isSelectedTrackRecording());
|
||||||
chartView.invalidate();
|
chartView.invalidate();
|
||||||
}
|
}
|
||||||
@@ -112,21 +108,7 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.chart, container, false);
|
return inflater.inflate(R.layout.chart, container, false);
|
||||||
zoomControls = view.findViewById(R.id.chart_zoom_controls);
|
|
||||||
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
zoomIn();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
zoomOut();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -401,18 +383,6 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomIn() {
|
|
||||||
chartView.zoomIn();
|
|
||||||
zoomControls.setIsZoomInEnabled(chartView.canZoomIn());
|
|
||||||
zoomControls.setIsZoomOutEnabled(chartView.canZoomOut());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void zoomOut() {
|
|
||||||
chartView.zoomOut();
|
|
||||||
zoomControls.setIsZoomInEnabled(chartView.canZoomIn());
|
|
||||||
zoomControls.setIsZoomOutEnabled(chartView.canZoomOut());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a runnable on the UI thread if possible.
|
* Runs a runnable on the UI thread if possible.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,22 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/chart_view_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical">
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical" />
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/chart_view_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical" />
|
|
||||||
|
|
||||||
<ZoomControls
|
|
||||||
android:id="@+id/chart_zoom_controls"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@android:color/white"
|
|
||||||
android:gravity="right"
|
|
||||||
android:paddingRight="8dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user