1
00:00:00,600 --> 00:00:01,270
Welcome back.

2
00:00:01,440 --> 00:00:06,960
And this video, we're going to start with the start screen or the main activity of our application

3
00:00:06,960 --> 00:00:07,770
of the quiz up.

4
00:00:07,980 --> 00:00:13,560
So let's get started with this empty activity when selecting a new template for the project.

5
00:00:13,570 --> 00:00:18,050
So I'm just going to press next year and I'm going to call this one quiz app.

6
00:00:19,560 --> 00:00:21,090
Everything else can stay the same.

7
00:00:21,130 --> 00:00:24,060
Maybe I should be 21 and then finish.

8
00:00:26,500 --> 00:00:29,260
So let's test this application on our device.

9
00:00:30,680 --> 00:00:36,080
Just to directly see what we already have, so this is the app that we have right now.

10
00:00:36,380 --> 00:00:38,030
And let me turn it around.

11
00:00:39,600 --> 00:00:44,950
As you can see, it's not turning that's great, because that's exactly what I wanted.

12
00:00:44,970 --> 00:00:45,990
I don't want it to turn.

13
00:00:46,200 --> 00:00:50,580
But if you really want to make sure that it's not going to turn, you can go to your Android manifest

14
00:00:50,880 --> 00:00:54,660
and then add a new setting here to your activity.

15
00:00:56,340 --> 00:00:59,820
And when it comes to the screen orientation, you have many different options here.

16
00:01:00,060 --> 00:01:02,460
You can read through them in the documentation.

17
00:01:02,670 --> 00:01:05,190
The one that I want to use is to portray one.

18
00:01:05,190 --> 00:01:10,410
So only the policy orientation will be accepted in my application.

19
00:01:12,020 --> 00:01:19,640
So here, I'll just add a screen orientation setting and I'm going to set out to portray portrait now,

20
00:01:19,640 --> 00:01:24,230
even though it's complaining, I'm still going to leave it as that because it's still going to work

21
00:01:24,230 --> 00:01:24,890
totally fine.

22
00:01:25,550 --> 00:01:28,580
Then I would like to assign a theme here.

23
00:01:28,910 --> 00:01:33,560
And the theme that I want to use is one that I will create myself.

24
00:01:34,540 --> 00:01:40,600
Because I want to have control over the style of this action there at the top.

25
00:01:42,150 --> 00:01:43,230
And how can I do that?

26
00:01:43,380 --> 00:01:50,880
Well, I can go to my values and then there is this style XML file in which I can create different styles.

27
00:01:51,100 --> 00:01:56,820
For example, you can see there is one style already with a dark action bar, and now we can create

28
00:01:56,820 --> 00:01:58,280
a light action bar as well.

29
00:01:58,560 --> 00:01:59,850
So I'm just going to do that.

30
00:02:00,150 --> 00:02:03,900
I'm just going to create a new style here, which I'm going to call.

31
00:02:05,230 --> 00:02:13,990
No action bar scene and its parent is going to be theme thought up compared to what a light.

32
00:02:15,100 --> 00:02:17,420
Thought no action bar.

33
00:02:19,030 --> 00:02:24,250
So this will be the parent theme, so we are going to pretty much use this theme here, but we're going

34
00:02:24,250 --> 00:02:25,540
to adjust it slightly.

35
00:02:26,000 --> 00:02:30,880
OK, so the things that I want to adjust here are the colors.

36
00:02:31,090 --> 00:02:35,230
So as you can see here, there are three colors which are set in there.

37
00:02:35,470 --> 00:02:37,990
And I want to do the same here.

38
00:02:40,320 --> 00:02:42,630
Now, you might wonder why would we even do that?

39
00:02:43,020 --> 00:02:48,240
Well, the thing is, I would like to have no action bar in my main activity.

40
00:02:48,600 --> 00:02:52,820
So here this main activity, our first screen should not have an action bar at the top.

41
00:02:53,160 --> 00:03:00,090
But still, if I use this theme as I define it here, so when I now go ahead and use my no action bar

42
00:03:00,090 --> 00:03:03,260
thing that I just created, which is in my style.

43
00:03:03,340 --> 00:03:11,230
This one here, when I use that, then it still needs the default colors and these are the default colors.

44
00:03:11,230 --> 00:03:16,650
So the color primer will be used from our colors, which in there is also called color primary.

45
00:03:16,920 --> 00:03:22,050
Our color primary dark, which we set for this theme, will be defined in this color color, primary

46
00:03:22,050 --> 00:03:22,410
dark.

47
00:03:22,680 --> 00:03:28,770
So even though the names are duplicative, it's still very important to distinguish.

48
00:03:28,950 --> 00:03:36,270
So in this style, we can define those three colors, but we could choose different colors here for

49
00:03:36,270 --> 00:03:37,980
this particular style.

50
00:03:38,580 --> 00:03:43,350
OK, but we're going to use still the same colors as we would use in a default.

51
00:03:44,570 --> 00:03:53,170
Theme that we have here, but we are going to use to parent, which is to no action bar style, again,

52
00:03:53,270 --> 00:04:01,280
if you still want to have an action bar, then we can go back to our default theme that had a dark action

53
00:04:01,280 --> 00:04:02,690
bar at the top.

54
00:04:03,680 --> 00:04:10,310
So coming back to our manifest, you can see it's complaining here because we need to add a style and

55
00:04:10,310 --> 00:04:14,930
then the no action bar theme, this one here.

56
00:04:16,060 --> 00:04:17,380
That we created ourselves.

57
00:04:19,180 --> 00:04:28,960
And then the next thing that I need to assign here is to add the Windows soft input mode and here I'm

58
00:04:28,960 --> 00:04:30,690
gonna use a just resource.

59
00:04:31,000 --> 00:04:38,500
So what that will do is it will resize our UI so that when the keyboard comes in, so the soft input,

60
00:04:38,500 --> 00:04:44,590
which means the keyboard of Android, when debt comes into play and is visible on the screen, that

61
00:04:44,590 --> 00:04:51,520
our UI will be resized, adjusted and resized so that it still fits on the screen and still looks good

62
00:04:51,520 --> 00:04:55,420
enough so that we can still see where we are actually entering a value.

63
00:04:57,130 --> 00:05:02,440
There are multiple options that you have here, you can see state visible adjust resources and so forth,

64
00:05:02,450 --> 00:05:08,740
so multiple different options and what they pretty much do, how the main window of the activity interacts

65
00:05:08,740 --> 00:05:12,040
with a window containing on screen soft keyboards.

66
00:05:13,220 --> 00:05:19,250
And the setting for does attribute effects to things to the state of the soft keyboard, whether it's

67
00:05:19,250 --> 00:05:24,950
hidden or visible, when the activity becomes the focus of user attention and then the adjustment made

68
00:05:24,950 --> 00:05:30,230
to the activities main window, whether it was resized smaller to make more room for the soft keyboard

69
00:05:30,230 --> 00:05:36,440
or whether its contents pan to make the current focus visible when part of the window is covered by

70
00:05:36,440 --> 00:05:37,300
the soft keyboard.

71
00:05:37,610 --> 00:05:44,870
OK, because sometimes when the part of our activity that is relevant for the user to enter data, for

72
00:05:44,870 --> 00:05:47,600
example, they textfield where he needs to enter something.

73
00:05:47,600 --> 00:05:53,270
So an added text and the soft keyboard is on top of it, then you cannot see what you're typing.

74
00:05:53,510 --> 00:05:55,580
And that's something that we want to avoid.

75
00:05:57,570 --> 00:06:03,180
All right, coming back to our project here, there's one more thing that I would like to set up for

76
00:06:03,180 --> 00:06:05,550
this video, and that's going to be our gradle.

77
00:06:05,580 --> 00:06:12,330
So in our great Allscripts here on the built gradle in the module lab, that's where I want to add another

78
00:06:12,330 --> 00:06:13,050
dependancy.

79
00:06:13,470 --> 00:06:19,070
So I want to use the dependency of Google, which is the material design.

80
00:06:19,410 --> 00:06:22,020
So here I'm going to add implementation

81
00:06:24,510 --> 00:06:34,020
apostrophe come dot, Google dot, Android dot material, Colen material.

82
00:06:35,430 --> 00:06:39,780
Kolon 1.0, dot zero.

83
00:06:41,720 --> 00:06:46,490
All right, so this is what we need in here, and once you enter and you dependancy, what you need

84
00:06:46,490 --> 00:06:48,310
to do is you need to think now.

85
00:06:48,620 --> 00:06:52,090
So this feature here with the dependencies is a pretty powerful tool.

86
00:06:52,100 --> 00:07:02,090
So we are adjusting our gradle and it will then download necessary dependencies and the necessary code,

87
00:07:02,090 --> 00:07:03,900
so to speak, that we can then reuse.

88
00:07:03,920 --> 00:07:07,030
So it's going to download libraries for us, which we then can use.

89
00:07:07,250 --> 00:07:12,020
And in this case, we're going to use the Android Material Design Library.

90
00:07:12,410 --> 00:07:12,890
All right.

91
00:07:13,250 --> 00:07:19,250
So that's just a preparation for the next video in which we are going to then set up the whole style

92
00:07:19,250 --> 00:07:25,000
of this activity, main XML file, because currently the only thing that we see in here is does have

93
00:07:25,040 --> 00:07:26,360
a world text view.

94
00:07:26,630 --> 00:07:30,920
And I would, of course, like to change that and create a beautiful screen in here.

95
00:07:31,430 --> 00:07:31,880
All right.

96
00:07:31,890 --> 00:07:33,230
So see you in the next video.

