How should i convert my AppTheme style to Material component - androidx

//This is my current AppTheme of my application. How should I migrate my AppTheme to Material Components?. I have Migrated my code to AndroidX.
<style name="AppBaseTheme" parent="#android:style/Theme.Light">
<item name="android:windowActionBar">true</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:actionBarSize">#dimen/actionbar_height</item>
<item name="actionBarSize">#dimen/actionbar_height</item>
</style>
<!-- Base application theme. -->
<style name="AppThemeMenu" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">true</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">

in order to use the material components, start by implementing the material library in your gradel files:
implementation 'com.google.android.material:material:1.1.0'
Then, got to the style.xml and change the parent to one of the following material parents:
Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
Theme.MaterialComponents.DayNight
Theme.MaterialComponents.DayNight.NoActionBar
Theme.MaterialComponents.DayNight.DarkActionBar
For more information you can check this page .
For example:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
Hope this helps! :)

Related

Premier Pro CEP panel not visible in extentions

I am trying to make a panel for Premier Pro. I have just started and tried to get my extension as an option in premier pro. But I am not able to see it in extensions. Here is my code
manifest.xml
<?xml version='1.0' encoding='UTF-8'?>
<!-- 1) -->
<ExtensionManifest ExtensionBundleId="com.my.test" ExtensionBundleVersion="1.0.0" Version="10.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ExtensionList>
<!-- 2) -->
<Extension Id="com.my.test.panel" Version="1.0.0" />
</ExtensionList>
<ExecutionEnvironment>
<HostList>
<!-- 3) -->
<Host Name="PPRO" Version="22.0" />
</HostList>
<LocaleList>
<Locale Code="All" />
</LocaleList>
<RequiredRuntimeList>
<RequiredRuntime Name="CSXS" Version="10.0" />
</RequiredRuntimeList>
</ExecutionEnvironment>
<DispatchInfoList>
<!-- 2) -->
<Extension Id="com.my.test.panel">
<DispatchInfo>
<Resources>
<!-- 4) -->
<MainPath>./client/index.html</MainPath>
<!-- 5) -->
<ScriptPath>./host/index.jsx</ScriptPath>
<CEFCommandLine />
</Resources>
<Lifecycle>
<AutoVisible>true</AutoVisible>
</Lifecycle>
<UI>
<Type>Panel</Type>
<!-- 6) -->
<Menu>My First Panel</Menu>
<Geometry>
<Size>
<!-- 7) -->
<Height>500</Height>
<Width>350</Width>
</Size>
</Geometry>
<Icons />
</UI>
</DispatchInfo>
</Extension>
</DispatchInfoList>
</ExtensionManifest>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Trigger</title>
</head>
<body style="background: white;">
Hello World
</body>
</html>
My project structure
I have save my project "myextension" in "~/Library/Application Support/Adobe/CEP/extensions/" location in my mac
I have also ran below command to set Adobe application into debug mode
defaults write com.adobe.CSXS.10.plist PlayerDebugMode 1 && killall -u `whoami` cfprefsd
But the "extensions" option in premier pro is greyed out.
How can I get myextension to show here and work?

Implement splash screen. how do I specify the image size?

I do splash screen, but the problem is that I do not know where to add
styles. how do I specify the image size ? How do I add text ?
[Activity(Label = "SplashActivity", Theme = "#style/Theme.Splash", MainLauncher = true)]
public class SplashScreen : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
StartActivity(typeof(MainActivity));
Finish();
OverridePendingTransition(0, 0);
}
}
`
In drawable folder splash_screen.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#color/splash_background"/>
</item>
<item>
<bitmap
android:src="#drawable/splash_logo"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
</layer-list>
Folder values, style.xml:
<style name="Theme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowActionBar">true</item>
</style>
I think you have two options.
1- create an image and visualize it (as in your sample)
2- create an activity layout, so you can add image, text... what you want
You can find some info in the official documentation: Xamarin.Forms SplashScreen
and here you can find the Android Sample: Xamarin.Android SplashScreen
In this sample, you have a style with a drawable:
<resources>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light">
</style>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowActionBar">true</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#color/splash_background"/>
</item>
<item>
<bitmap
android:src="#drawable/splash_logo"
android:tileMode="disabled"
android:gravity="center"/>
</item>
</layer-list>
but you can use a layout, in the same way it is used for MainActivity

How to change TimePicker Theme color?

I have this code to change the theme of the datepicker in my app in styles file in android project:
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#039BE5</item>
</style>
Is there a code same to this that can help me for the timepicker?
You can define style in style.xml
<style name="TimePickerTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#039BE5</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
And
TimePickerDialog timePicker = new TimePickerDialog(mContext, Resource.style.TimePickerTheme, fromListener, hour, min, false);

Xamarin forms splash screen visible navigate to another page

The splash screen is visible when navigating to a new page in xamarin.forms android. I want to remove or hide the image.
Here is my style.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="Theme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="Theme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1976D2</item>
<item name="colorAccent">#FF4081</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
</style>
<style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#drawable/Splash_</item>
</style>
</resources>
In you have activity for the splash, then add 'NoHistory=true' in the activity attribute. Sample below,
[Activity(Label = "XXXX", MainLauncher =true, Theme = "#style/Splash", NoHistory =true)]
public class SplashActivity : AppCompatActivity

Android custom button is smaller without reason

I have defined a custom button in Android.
This is my styles.xml:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:buttonStyle">#style/CustomButtonStyle</item>
</style>
<style name="CustomButtonStyle" parent="#android:style/Widget.Button">
<item name="android:background">#drawable/custom_button</item>
</style>
And this is my custom_button.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="#drawable/btn_custom_normal" />
<item android:state_window_focused="false" android:state_enabled="false" android:drawable="#drawable/btn_custom_disabled" />
<item android:state_pressed="true" android:drawable="#drawable/btn_custom_pressed" />
<item android:state_focused="true" android:state_enabled="true" android:drawable="#drawable/btn_custom_focused" />
<item android:state_enabled="true" android:drawable="#drawable/btn_custom_normal" />
<item android:state_focused="true" android:drawable="#drawable/btn_custom_disabled_focused" />
<item android:drawable="#drawable/btn_custom_disabled" />
</selector>
Applying the custom background works, but all buttons are now smaller, and the captions of the buttons are smaller, too. Why? How can I make them appear exactly like the default buttons, but only with another background?
I have found my mistake. I have to select a Holo button style as parent:
<style name="CustomButtonStyle" parent="#android:style/Widget.Holo.Button">
<item name="android:background">#drawable/custom_button</item>
</style>

Resources