Skip to content

Commit

Permalink
fix(theme & UI): fix theme colors and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxGalaxy committed Feb 11, 2024
1 parent 6935f81 commit 42ab06b
Show file tree
Hide file tree
Showing 29 changed files with 683 additions and 268 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.block.web.builder.ui.activities;

import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

public class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle arg0) {
EdgeToEdge.enable(this);
super.onCreate(arg0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.os.Environment;
import android.provider.Settings;
import android.view.View;
import androidx.activity.EdgeToEdge;
import androidx.annotation.CallSuper;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.core.app.ActivityCompat;
Expand Down Expand Up @@ -53,8 +52,6 @@ public class MainActivity extends BaseActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
EdgeToEdge.enable(this);

super.onCreate(savedInstanceState);

// Inflate and get instance of binding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.block.web.builder.listeners.ProjectCreationListener;
import com.block.web.builder.objects.Project;
import com.block.web.builder.ui.activities.MainActivity;
import com.block.web.builder.utils.ColorUtils;
import com.block.web.builder.utils.ProjectNameValidator;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
Expand All @@ -40,10 +39,7 @@ public CreateProjectDialog(
this.activity = activity;

MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(activity);
dialog
.getBackground()
.setTint(
ColorUtils.getColor(activity, com.google.android.material.R.attr.colorSurfaceVariant));

dialog.setTitle(activity.getString(R.string.create_new_project));

LayoutCreateProjectBinding binding =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.block.web.builder.R;
import com.block.web.builder.databinding.LayoutAddTextInBlockBinding;
import com.block.web.builder.listeners.ValueListener;
import com.block.web.builder.utils.ColorUtils;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;

public class AddTextInBlockDialog extends MaterialAlertDialogBuilder {
Expand All @@ -18,9 +17,6 @@ public class AddTextInBlockDialog extends MaterialAlertDialogBuilder {
public AddTextInBlockDialog(Activity activity, ValueListener listener) {
super(activity);
this.activity = activity;
getBackground()
.setTint(
ColorUtils.getColor(activity, com.google.android.material.R.attr.colorSurfaceVariant));
binding = LayoutAddTextInBlockBinding.inflate(activity.getLayoutInflater());
setTitle(R.string.enter_value);
setView(binding.getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.block.web.builder.databinding.LayoutNewBlocksHolderDialogBinding;
import com.block.web.builder.listeners.BlocksHolderListener;
import com.block.web.builder.core.BlocksHolder;
import com.block.web.builder.utils.ColorUtils;
import com.block.web.builder.utils.HexColorValidator;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
Expand All @@ -20,9 +19,6 @@ public class CreateBlocksHolderDialog extends MaterialAlertDialogBuilder {
public CreateBlocksHolderDialog(
Activity activity, ArrayList<BlocksHolder> blocksHolderList, BlocksHolderListener listener) {
super(activity);
getBackground()
.setTint(
ColorUtils.getColor(activity, com.google.android.material.R.attr.colorSurfaceVariant));
setTitle(getContext().getString(R.string.create_new_blocks_holder));
LayoutNewBlocksHolderDialogBinding binding =
LayoutNewBlocksHolderDialogBinding.inflate(activity.getLayoutInflater());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.block.web.builder.core.WebFile;
import com.block.web.builder.ui.activities.EventListActivity;
import com.block.web.builder.ui.adapters.EventAdapter;
import com.block.web.builder.utils.ColorUtils;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;

Expand All @@ -29,9 +28,6 @@ public AddEventDialog(

LayoutAddEventDialogBinding binding =
LayoutAddEventDialogBinding.inflate(mEventListActivity.getLayoutInflater());
getBackground()
.setTint(
ColorUtils.getColor(mEventListActivity, com.google.android.material.R.attr.colorSurfaceVariant));
setTitle(R.string.add_events);
setCancelable(false);
setView(binding.getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public ShowSourceCodeDialog(
super(activity);
LayoutSouceCodeDialogBinding binding =
LayoutSouceCodeDialogBinding.inflate(activity.getLayoutInflater());
getBackground()
.setTint(
ColorUtils.getColor(activity, com.google.android.material.R.attr.colorSurfaceVariant));
setTitle(R.string.source_code);

if (useSoraEditor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.block.web.builder.core.WebFile;
import com.block.web.builder.ui.activities.FileManagerActivity;
import com.block.web.builder.ui.adapters.FileListAdapterItem;
import com.block.web.builder.utils.ColorUtils;
import com.block.web.builder.utils.FileNameValidator;
import com.block.web.builder.utils.ProjectFileUtils;
import com.google.android.material.button.MaterialButtonToggleGroup;
Expand Down Expand Up @@ -65,9 +64,6 @@ public void onFileCreationFailed(String error) {
Toast.makeText(activity, error, Toast.LENGTH_SHORT).show();
}
};
getBackground()
.setTint(
ColorUtils.getColor(activity, com.google.android.material.R.attr.colorSurfaceVariant));
setTitle(activity.getString(R.string.create_new_file));
binding = LayoutNewFileDialogBinding.inflate(activity.getLayoutInflater());
setView(binding.getRoot());
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/color/navigation_item_background_color.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:alpha="@dimen/material_emphasis_disabled"
android:color="?attr/colorTertiaryContainer"
android:state_activated="true" />
<item
android:alpha="@dimen/material_emphasis_disabled"
android:color="?attr/colorTertiaryContainer"
android:state_checked="true" />
<item android:color="@android:color/transparent" />
</selector>
10 changes: 10 additions & 0 deletions app/src/main/res/color/navigation_item_color.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="?attr/colorOnTertiaryContainer"
android:state_checked="true" />
<item
android:alpha="@dimen/material_emphasis_disabled"
android:color="?attr/colorOnSurface"
android:state_enabled="false" />
<item android:color="?attr/colorOnSurfaceVariant" />
</selector>
7 changes: 4 additions & 3 deletions app/src/main/res/layout-land/activity_event_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
android:layout_width="match_parent"
android:fitsSystemWindows="true">

<LinearLayout
android:layout_height="match_parent"
Expand Down Expand Up @@ -169,6 +170,6 @@

</LinearLayout>

</LinearLayout>
</LinearLayout>

</FrameLayout>
</FrameLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_block_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/activity_block_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand All @@ -16,6 +17,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:id="@+id/toolbar" />

</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
Expand All @@ -37,6 +39,7 @@
android:layout_width="wrap_content"
android:indeterminate="true"
android:id="@+id/progressbar" />

</LinearLayout>

<LinearLayout
Expand All @@ -51,6 +54,7 @@
android:layout_width="wrap_content"
android:textColor="?attr/colorOnSurface"
android:id="@+id/tv_info" />

</LinearLayout>

<LinearLayout
Expand All @@ -63,6 +67,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/list" />

</LinearLayout>

</LinearLayout>
Expand All @@ -75,4 +80,5 @@
android:text="@string/new_block"
android:id="@+id/fab"
android:layout_gravity="end|bottom" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
10 changes: 8 additions & 2 deletions app/src/main/res/layout/activity_blocks_holder_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand All @@ -16,6 +17,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:id="@+id/toolbar" />

</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
Expand All @@ -37,6 +39,7 @@
android:layout_width="wrap_content"
android:indeterminate="true"
android:id="@+id/progressbar" />

</LinearLayout>

<LinearLayout
Expand All @@ -51,6 +54,7 @@
android:layout_width="wrap_content"
android:textColor="?attr/colorOnSurface"
android:id="@+id/tv_info" />

</LinearLayout>

<LinearLayout
Expand All @@ -63,6 +67,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/list" />

</LinearLayout>

</LinearLayout>
Expand All @@ -75,4 +80,5 @@
android:text="@string/new_blocks_holder"
android:id="@+id/fab"
android:layout_gravity="end|bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="?attr/colorSurface"
android:fitsSystemWindows="true"
android:id="@+id/coordinator">

<ScrollView
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_event_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
android:layout_width="match_parent"
android:fitsSystemWindows="true">

<LinearLayout
android:layout_height="match_parent"
Expand Down Expand Up @@ -171,4 +172,4 @@

</LinearLayout>

</FrameLayout>
</FrameLayout>
10 changes: 8 additions & 2 deletions app/src/main/res/layout/activity_event_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand All @@ -16,6 +17,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:id="@+id/toolbar" />

</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
Expand All @@ -37,6 +39,7 @@
android:layout_width="wrap_content"
android:indeterminate="true"
android:id="@+id/progressbar" />

</LinearLayout>

<LinearLayout
Expand All @@ -51,6 +54,7 @@
android:layout_width="wrap_content"
android:textColor="?attr/colorOnSurface"
android:id="@+id/tv_info" />

</LinearLayout>

<LinearLayout
Expand All @@ -63,6 +67,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/list" />

</LinearLayout>

</LinearLayout>
Expand All @@ -75,4 +80,5 @@
android:text="New Event"
android:id="@+id/fab"
android:layout_gravity="end|bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_file_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_image_cropper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand Down Expand Up @@ -52,4 +53,4 @@

</LinearLayout>

</LinearLayout>
</LinearLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_license.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
Expand Down
Loading

0 comments on commit 42ab06b

Please sign in to comment.