Commit 606a8931 authored by 9731301's avatar 9731301

add colors for themes

parent 6abac0b9
......@@ -30,13 +30,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private DrawerLayout drawerLayout;
private ImageView theme;
private NavigationView navigationView;
private String themeState = "bright";
private String themeState = "colored";
@Override
protected void onCreate(Bundle savedInstanceState) {
//todo check prefreces and set primitive theme and it is enough to set sTheme
super.onCreate(savedInstanceState);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateThemeForMainActivity(this);
setContentView(R.layout.activity_main);
init();
......
......@@ -13,6 +13,6 @@ public class ArchivedNotesActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_achived_notes);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateSetTheme(this, getSupportActionBar());
}
}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.AllNotes;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ActionBar;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.widget.LinearLayout;
......@@ -15,9 +19,7 @@ public class AllNotesActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_notes);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateSetTheme(this , getSupportActionBar());
setTitle("all notes");
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ public class MyCalenderActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_calender);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateSetTheme(this, getSupportActionBar());
setTitle("calendar");
}
}
\ No newline at end of file
......@@ -8,8 +8,6 @@ import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
......@@ -44,7 +42,7 @@ public class CameraActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera_x);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateSetTheme(this, getSupportActionBar());
checkRuntimePermission();
init();
addListeners();
......
......@@ -7,6 +7,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import android.provider.MediaStore;
......@@ -19,6 +20,7 @@ import android.widget.LinearLayout;
import com.example.mynotepad.MenuFeatures.Pics.AddTextToPicDialog.AddTextToPicDialog;
import com.example.mynotepad.MenuFeatures.Pics.AddTextToPicDialog.OnSavePicListenerClick;
import com.example.mynotepad.MenuFeatures.Pics.Camera.CameraActivity;
import com.example.mynotepad.MenuFeatures.Utils;
import com.example.mynotepad.R;
import java.io.File;
......@@ -29,6 +31,7 @@ public class ChoosingPicsFragment extends Fragment {
private LinearLayout camera, gallery;
private String newFilePath;
private ConstraintLayout constraintLayout ;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
......@@ -42,12 +45,27 @@ public class ChoosingPicsFragment extends Fragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
init(view);
setBg(Utils.sTheme);
addListeners();
}
private void setBg(String sTheme) {
switch (sTheme) {
case "dark":
constraintLayout.setBackgroundResource(R.drawable.main_bg_dark);
break;
case "bright":
constraintLayout.setBackgroundResource(R.drawable.main_bg_bright);
break;
case "colored":
constraintLayout.setBackgroundResource(R.drawable.main_bg_colored);
break;
}
}
private void init(View view) {
camera = view.findViewById(R.id.cameraBtn);
gallery = view.findViewById(R.id.galleryBtn);
constraintLayout = view.findViewById(R.id.constrainLayout);
}
private void addListeners() {
......
......@@ -8,6 +8,7 @@ import androidx.navigation.ui.NavigationUI;
import android.os.Bundle;
import com.example.mynotepad.MenuFeatures.Utils;
import com.example.mynotepad.R;
import com.google.android.material.bottomnavigation.BottomNavigationView;
......@@ -17,6 +18,7 @@ public class PicsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pics);
Utils.onActivityCreateSetTheme(this, getSupportActionBar());
BottomNavigationView navView = findViewById(R.id.nav_view);//set bottom navigation view
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(R.id.navigation_picturedNoteList , R.id.navigation_choosePic).build();//set fragments
NavController navController = Navigation.findNavController(this , R.id.nav_pic_fragment_place);//set place of fragment
......
......@@ -2,13 +2,14 @@ package com.example.mynotepad.MenuFeatures;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBar;
import com.example.mynotepad.R;
public class Utils {
public static String sTheme ="dark";
public static String sTheme ="colored";
/**
* Set the theme of the Activity, and restart it by creating a new Activity of the same type.
......@@ -23,17 +24,40 @@ public class Utils {
/**
* Set the theme of the activity, according to the configuration.
*/
public static void onActivityCreateSetTheme(Activity activity) {
public static void onActivityCreateSetTheme(Activity activity, ActionBar supportActionBar) {
switch (sTheme) {
case "dark":
case "dark": {
activity.setTheme(R.style.AppThemeDark);
supportActionBar.setBackgroundDrawable(new ColorDrawable(activity.getResources().getColor(R.color.colorPrimary2)));
break;
case "bright":
}
case "bright": {
activity.setTheme(R.style.AppThemeNoActionBArBright);
supportActionBar.setBackgroundDrawable(new ColorDrawable(activity.getResources().getColor(R.color.colorPrimary)));
break;
}
case "colored": {
activity.setTheme(R.style.AppThemeColored);
supportActionBar.setBackgroundDrawable(new ColorDrawable(activity.getResources().getColor(R.color.colorPrimary3)));
break;
case "colored":
activity.setTheme(R.style.AppTheme);
}
}
}
public static void onActivityCreateThemeForMainActivity(Activity activity) {
switch (sTheme) {
case "dark": {
activity.setTheme(R.style.AppThemeDark);
break;
}
case "bright": {
activity.setTheme(R.style.AppThemeNoActionBArBright);
break;
}
case "colored": {
activity.setTheme(R.style.AppThemeColored);
break;
}
}
}
}
......@@ -13,7 +13,7 @@ public class VoiceMassagesActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voice_massages);
Utils.onActivityCreateSetTheme(this);
Utils.onActivityCreateSetTheme(this, getSupportActionBar());
setTitle("voice massages");
}
}
......
......@@ -3,8 +3,8 @@
android:shape="rectangle">
<gradient
android:startColor="?colorSecondaryVariant"
android:endColor="?colorSurface"
android:startColor="?colorSecondary"
android:endColor="?colorSecondary"
android:type="radial"
android:gradientRadius="500dp"/>
<stroke
......
......@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#DC35438C" />
<solid android:color="?colorPrimaryDark" />
<corners android:radius="0dp" />
</shape>
</item>
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:shape="oval">
<solid android:color="#74385E80"/>
<solid android:color="?colorSurface"/>
<stroke
android:width="10dp"
android:color="#F04F7EA8"/>
android:color="?android:textColorTertiary"
tools:targetApi="lollipop" />
<corners android:radius="0dp"/>
</shape>
\ No newline at end of file
......@@ -15,7 +15,7 @@
android:layout_marginTop="12dp"
android:text="title"
android:padding="5dp"
android:textColor="?android:textColorPrimary"
android:textColor="?android:textColor"
android:textSize="20dp" />
<TextView
......@@ -28,7 +28,7 @@
android:layout_marginRight="15dp"
android:lines="3"
android:padding="5dp"
android:textColor="?android:textColorPrimary"
android:textColor="?android:textColor"
android:text="body text"
android:textSize="12dp" />
......
......@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/colorPrimary"
android:background="?colorPrimary"
android:orientation="horizontal">
......
......@@ -55,7 +55,8 @@
android:clickable="true"
android:focusable="true"
android:src="@drawable/add"
app:backgroundTint="#EA2027"
android:tint="?android:textColor"
app:backgroundTint="?colorError"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
......@@ -8,31 +9,35 @@
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/index">
android:layout_height="0dp">
</FrameLayout>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id="@+id/customToolbarOption"
android:layout_width="match_parent"
android:layout_height="50dp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:background="?colorButtonNormal"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<include layout="@layout/player_sheet"/>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id="@+id/customToolbarOption"
android:layout_width="match_parent"
android:layout_height="50dp"
app:layout_anchor="@+id/frameLayout"
app:layout_anchorGravity="center" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
......@@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MenuFeatures.Pics.ChoosingPicsFragment"
android:background="@drawable/main_bg_bright">
android:background="@drawable/main_bg_bright"
android:id="@+id/constrainLayout">
<LinearLayout
android:layout_width="wrap_content"
......@@ -27,7 +28,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/camera"
android:textColor="@color/white"
android:background="@drawable/bg_button2"
android:gravity="center"
android:textSize="20dp"/>
......@@ -37,7 +37,8 @@
android:layout_height="wrap_content"
android:background="@drawable/bg_icon"
android:padding="10dp"
android:src="@drawable/ic_camera" />
android:src="@drawable/ic_camera"
app:tint="?android:textColor"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
......@@ -52,7 +53,6 @@
android:background="@drawable/bg_button2"
android:gravity="center"
android:text="@string/gallery"
android:textColor="@color/white"
android:textSize="20dp"/>
<ImageView
......@@ -61,6 +61,7 @@
android:src="@drawable/ic_gallery"
android:background="@drawable/bg_icon"
android:padding="10dp"
app:tint="?android:textColor"
/>
</LinearLayout>
......
......@@ -50,7 +50,7 @@
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint="#EA2027"
app:backgroundTint="?colorError"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".MenuFeatures.VoiceMassages.RecordFragment">
tools:context=".MenuFeatures.VoiceMassages.RecordFragment"
android:background="?colorButtonNormal">
<ImageView
android:id="@+id/imageView8"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="0dp"
android:scaleType="fitXY"
android:src="@drawable/index" />
<ImageView
android:id="@+id/img"
android:layout_below="@+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@drawable/pic_stones"/>
android:layout_marginTop="60dp"
android:src="@drawable/pic_stones" />
<LinearLayout
android:id="@+id/linearLayoutRecorder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/img"
android:layout_alignParentBottom="@id/imageView8"
android:orientation="vertical">
<ImageView
......@@ -42,7 +36,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:textColor="#016D91"
android:textColor="?android:textColorTertiary"
android:textSize="60sp" />
......@@ -56,7 +50,8 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:background="@drawable/start_stop_bg"
android:src="@drawable/mic" />
android:src="@drawable/ic_record"
app:tint="@color/black"/>
<ImageView
......
......@@ -5,13 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView6"
android:layout_width="356dp"
android:layout_height="356dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/index"
/>
<TextView
android:layout_width="wrap_content"
......
......@@ -7,23 +7,29 @@
<color name="colorBtn">#2980b9</color>
<color name="colorDrawer">#e3f2fb</color>
<color name="colorHeader">#F57AA0B5</color>
<color name="mediaHeader">#3A478C</color>
<color name="mediaHeader">#30336b</color>
<color name="floatingButton">#f5c7c5</color>
<color name="background">#607AA0B5</color>
<color name="colorPrimary2">#ffb142</color>
<color name="colorPrimaryDark2">#cc8e35</color>
<color name="colorPrimary2">#242424</color>
<color name="colorPrimaryDark2">#4A4A4A</color>
<color name="colorAccent2">#ffda79</color>
<color name="colorButtonTxt2">#FFFFFF</color>
<color name="colorBtn2">#f2dbb2</color>
<color name="colorDrawer2">#e9d9bf</color>
<color name="colorDrawer2">#1b1b1b</color>
<color name="colorHeader2">#ffda79</color>
<color name="mediaHeader2">#9E691D</color>
<color name="mediaHeader2">#f0932b</color>
<color name="floatingButton2">#efefef</color>
<color name="background2">#2f2f2f</color>
<color name="colorPrimary3">#2ed573</color>
<color name="colorPrimaryDark3">#cc8e35</color>
<color name="colorPrimary3">#ff9da2</color>
<color name="colorPrimaryDark3">#808e9b</color>
<color name="colorAccent3">#ffda79</color>
<color name="colorButtonTxt3">#ff6348</color>
<color name="colorBtn3">#f2dbb2</color>
<color name="colorDrawer3">#e9d9bf</color>
<color name="colorHeader3">#ffda79</color>
<color name="mediaHeader3">#9E691D</color>
<color name="colorBtn3">#808e9b</color>
<color name="colorDrawer3">#F6D2D0</color>
<color name="colorHeader3">#C39F9E</color>
<color name="mediaHeader3">#C39F9E</color>
<color name="floatingButton3">#ff9da2</color>
<color name="background3">#F3DEDE</color>
</resources>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark2</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorSecondary">@color/colorBtn</item>
<item name="android:textColor">@color/white</item>
......@@ -11,6 +11,7 @@
<item name="colorSecondaryVariant">@color/colorDrawer</item>
<item name="colorSurface">@color/colorHeader</item>
<item name="android:textColorTertiary">@color/mediaHeader</item>
</style>
<!-- bright application theme. -->
......@@ -27,6 +28,8 @@
<item name="colorSecondaryVariant">@color/colorDrawer</item>
<item name="colorSurface">@color/colorHeader</item>
<item name="android:textColorTertiary">@color/mediaHeader</item>
<item name="colorError">@color/floatingButton</item>
<item name="colorButtonNormal">@color/background</item>
</style>
<!-- dark application theme. -->
......@@ -41,6 +44,8 @@
<item name="colorSecondaryVariant">@color/colorDrawer2</item>
<item name="colorSurface">@color/colorHeader2</item>
<item name="android:textColorTertiary">@color/mediaHeader2</item>
<item name="colorError">@color/floatingButton2</item>
<item name="colorButtonNormal">@color/background2</item>
</style>
<style name="AppThemeColored">
......@@ -48,11 +53,13 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark3</item>
<item name="colorAccent">@color/colorAccent3</item>
<item name="colorSecondary">@color/colorBtn3</item>
<item name="android:textColor">@color/black</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColor">@color/white</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="colorSecondaryVariant">@color/colorDrawer3</item>
<item name="colorSurface">@color/colorHeader3</item>
<item name="android:textColorTertiary">@color/mediaHeader3</item>
<item name="colorError">@color/floatingButton3</item>
<item name="colorButtonNormal">@color/background3</item>
</style>
</resources>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment