Colors
This commit is contained in:
parent
2d33b8d246
commit
390847ab95
@ -16,7 +16,6 @@ import android.view.WindowInsets;
|
|||||||
import android.view.WindowInsetsController;
|
import android.view.WindowInsetsController;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import org.videolan.libvlc.interfaces.IVLCVout;
|
import org.videolan.libvlc.interfaces.IVLCVout;
|
||||||
@ -53,12 +52,14 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
|
|
||||||
private FragmentSurveillanceBinding binding;
|
private FragmentSurveillanceBinding binding;
|
||||||
private List<CameraView> cameraViews = new ArrayList<>();
|
private List<CameraView> cameraViews = new ArrayList<>();
|
||||||
|
int viewMargin;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
LayoutInflater inflater, ViewGroup container,
|
LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState
|
Bundle savedInstanceState
|
||||||
) {
|
) {
|
||||||
|
viewMargin = DpiUtils.DpToPixels(container.getContext(), 2);
|
||||||
|
|
||||||
binding = FragmentSurveillanceBinding.inflate(inflater, container, false);
|
binding = FragmentSurveillanceBinding.inflate(inflater, container, false);
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
@ -128,12 +129,13 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
} else {
|
} else {
|
||||||
// Cameras are less than the maximum number of cells in grid: fill remaining cells with empty views
|
// Cameras are less than the maximum number of cells in grid: fill remaining cells with empty views
|
||||||
View ev = new View(getContext());
|
View ev = new View(getContext());
|
||||||
ev.setBackgroundColor(getResources().getColor(R.color.purple_500));
|
ev.setBackgroundColor(getResources().getColor(R.color.purple_700));
|
||||||
LinearLayout.LayoutParams evParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams evParams = new LinearLayout.LayoutParams(
|
||||||
0,
|
0,
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
1.0f
|
1.0f
|
||||||
);
|
);
|
||||||
|
evParams.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
|
||||||
row.addView(ev, evParams);
|
row.addView(ev, evParams);
|
||||||
}
|
}
|
||||||
camIdx++;
|
camIdx++;
|
||||||
@ -151,6 +153,29 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
binding.gridRowContainer.removeAllViews();
|
binding.gridRowContainer.removeAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void hideAllCameraViewsButNot(View cameraView) {
|
||||||
|
for (int i = 0; i < binding.gridRowContainer.getChildCount(); i++) {
|
||||||
|
LinearLayout row = (LinearLayout) binding.gridRowContainer.getChildAt(i);
|
||||||
|
for (int j = 0; j < row.getChildCount(); j++) {
|
||||||
|
View cam = row.getChildAt(j);
|
||||||
|
if (cameraView.getId() == cam.getId())
|
||||||
|
cam.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
cam.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showAllCameras() {
|
||||||
|
for (int i = 0; i < binding.gridRowContainer.getChildCount(); i++) {
|
||||||
|
LinearLayout row = (LinearLayout) binding.gridRowContainer.getChildAt(i);
|
||||||
|
for (int j = 0; j < row.getChildCount(); j++) {
|
||||||
|
View cam = row.getChildAt(j);
|
||||||
|
cam.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private CameraView addCameraView(Camera camera, LinearLayout rowContainer) {
|
private CameraView addCameraView(Camera camera, LinearLayout rowContainer) {
|
||||||
CameraView cv = new CameraView(
|
CameraView cv = new CameraView(
|
||||||
getContext(),
|
getContext(),
|
||||||
@ -163,7 +188,6 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
1.0f
|
1.0f
|
||||||
);
|
);
|
||||||
int viewMargin = DpiUtils.DpToPixels(rowContainer.getContext(), 2);
|
|
||||||
params.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
|
params.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
|
||||||
rowContainer.addView(cv.surfaceView, params);
|
rowContainer.addView(cv.surfaceView, params);
|
||||||
|
|
||||||
@ -196,6 +220,12 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
this.libvlc = new LibVLC(context, new ArrayList<>(Arrays.asList(VLC_OPTIONS)));
|
this.libvlc = new LibVLC(context, new ArrayList<>(Arrays.asList(VLC_OPTIONS)));
|
||||||
|
|
||||||
surfaceView = new SurfaceView(context);
|
surfaceView = new SurfaceView(context);
|
||||||
|
surfaceView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SurveillanceFragment.this.hideAllCameraViewsButNot(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
SurfaceHolder holder = surfaceView.getHolder();
|
SurfaceHolder holder = surfaceView.getHolder();
|
||||||
|
|
||||||
holder.setKeepScreenOn(true);
|
holder.setKeepScreenOn(true);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
app:srcCompat="@drawable/ic_add_camera" />
|
app:srcCompat="@drawable/ic_add_camera"
|
||||||
|
app:tint="@color/purple_500"/>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,16 +1,15 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.Ojo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.Ojo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/purple_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
<item name="colorSecondaryVariant">@color/purple_200</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
@ -9,8 +9,8 @@
|
|||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/purple_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
<color name="purple_200">#FFBB86FC</color>
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
<color name="purple_500">#FF6200EE</color>
|
<color name="purple_500">#FF6200EE</color>
|
||||||
<color name="purple_700">#FF3700B3</color>
|
<color name="purple_700">#FF3700B3</color>
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
|
||||||
<color name="teal_700">#FF018786</color>
|
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
</resources>
|
</resources>
|
@ -9,12 +9,9 @@
|
|||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/purple_500</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/white</item>
|
||||||
<!-- Status bar color. -->
|
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user