-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project Structure and Basics of User Interface in an Android studio
- Loading branch information
1 parent
64b1066
commit ce1140b
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Android_Development_With_Java/1 Introduction/profile application performace.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
|
||
### **Profile Application Performance** | ||
|
||
An app is considered to have poor performance if it responds slowly, shows choppy animations, freezes, or consumes too much power. Fixing performance problems involves identifying areas in which your app makes inefficient use of resources such as the CPU, memory, graphics, network, and the device battery. To find and fix these problems, use the profiling and benchmarking tools and techniques described in this topic. | ||
|
||
Android Studio offers several profiling tools to help find and visualize potential problems: | ||
|
||
|
||
|
||
* **CPU profiler**: This tool helps track down runtime performance issues. | ||
* **Memory profiler**: This tool helps track memory allocations. | ||
* **Network profiler**: This tool monitors network traffic usage. | ||
* **Energy profiler**: This tool tracks energy usage, which can contribute to battery drain. | ||
|
||
See the Android Studio Profilers page for information about using those tools. | ||
|
||
The Jetpack Benchmark libraries allow your application to measure various important operations: | ||
|
||
|
||
|
||
* **Microbenchmark**: Measure important performance use cases, including application startup and redrawing that is triggered by actions such as UI animations or scrolling. | ||
* **Benchmark**: Measure CPU cost of specific functions. | ||
|
||
See the Benchmark your app page to learn more about these libraries. | ||
|
||
There are many potential causes of performance problems, so it can be difficult to know where to start if you are new to performance analysis. See Measuring performance to learn techniques for measuring performance, along with examples of how to use these techniques to resolve specific problems. |
46 changes: 46 additions & 0 deletions
46
Android_Development_With_Java/1 Introduction/project structure and basix UI.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
|
||
## **Project structure** | ||
|
||
Each project in Android Studio contains one or more modules with source code files and resource files. Types of modules include: | ||
|
||
|
||
|
||
* Android app modules | ||
* Library modules | ||
* Google App Engine modules | ||
|
||
![image](https://user-images.githubusercontent.com/66783850/143766317-ca52c4e9-9341-42f5-a148-2b0aa67e099d.png) | ||
|
||
|
||
By default, Android Studio displays your project files in the Android project view, as shown in figure 1. This view is organized by modules to provide quick access to your project's key source files. | ||
|
||
All the build files are visible at the top level under **Gradle Scripts** and each app module contains the following folders: | ||
|
||
|
||
|
||
* **manifests**: Contains the AndroidManifest.xml file. | ||
* **java**: Contains the Java source code files, including JUnit test code. | ||
* **res**: Contains all non-code resources, such as XML layouts, UI strings, and bitmap images. | ||
|
||
The Android project structure on disk differs from this flattened representation. To see the actual file structure of the project, select **Project** from the **Project** dropdown. | ||
![image](https://user-images.githubusercontent.com/66783850/143766331-42f9d10a-c269-4c34-96f2-5d943610d9d6.png) | ||
|
||
|
||
You can also customize the view of the project files to focus on specific aspects of your app development. For example, selecting the **Problems** view of your project displays links to the source files containing any recognized coding and syntax errors, such as a missing XML element closing tag in a layout file. | ||
|
||
|
||
## **The Basics of user interface** | ||
|
||
|
||
|
||
1. The **toolbar** lets you carry out a wide range of actions, including running your app and launching Android tools. | ||
2. The **navigation bar** helps you navigate through your project and open files for editing. It provides a more compact view of the structure visible in the **Project** window. | ||
3. The **editor window** is where you create and modify code. Depending on the current file type, the editor can change. For example, when viewing a layout file, the editor displays the Layout Editor. | ||
4. The **tool window bar** runs around the outside of the IDE window and contains the buttons that allow you to expand or collapse individual tool windows. | ||
5. The **tool windows** give you access to specific tasks like project management, search, version control, and more. You can expand them and collapse them. | ||
6. The **status bar** displays the status of your project and the IDE itself, as well as any warnings or messages. | ||
|
||
You can organize the main window to give yourself more screen space by hiding or moving toolbars and tool windows. You can also use keyboard shortcuts to access most IDE features. | ||
|
||
At any time, you can search across your source code, databases, actions, elements of the user interface, and so on, by double-pressing the Shift key, or clicking the magnifying glass in the upper right-hand corner of the Android Studio window. This can be very useful if, for example, you are trying to locate a particular IDE action that you have forgotten how to trigger. |
57 changes: 57 additions & 0 deletions
57
...pment_With_Java/13 Android Animation Tutorial/Types of animations in Android.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
|
||
Animations can add visual cues that notify users about what's going on in your app. They are especially useful when the UI changes state, such as when new content loads or new actions become available. Animations also add a polished look to your app, which gives it a higher quality look and feel. | ||
|
||
Android includes different animation APIs depending on what type of animation you want, so this page provides an overview of the different ways you can add motion to your UI. | ||
|
||
To better understand when you should use animations, also see the material design guide to motion. | ||
|
||
|
||
### **Types of animation in Android Studio** | ||
|
||
## **Animate bitmaps** | ||
|
||
When you want to animate a bitmap graphic such as an icon or illustration, you should use the drawable animation APIs. Usually, these animations are defined statically with a drawable resource, but you can also define the animation behavior at runtime. | ||
![image](https://developer.android.com/training/animation/videos/drawable-animation.gif) | ||
|
||
|
||
For example, animating a play button transforming into a pause button when tapped is a nice way to communicate to the user that the two actions are related, and that pressing one makes the other visible. | ||
|
||
|
||
## **Animate UI visibility and motion** | ||
|
||
When you need to change the visibility or position of views in your layout, you should include subtle animations to help the user understand how the UI is changing. | ||
|
||
|
||
To move, reveal, or hide views within the current layout, you can use the property animation system provided by the android.animation package, available in Android 3.0 (API level 11) and higher. These APIs update the properties of your View objects over a period of time, continuously redrawing the view as the properties change. For example, when you change the position properties, the view moves across the screen, or when you change the alpha property, the view fades in or out. | ||
|
||
To create these animations with the least amount of effort, you can enable animations on your layout so that when you simply change the visibility of a view, an animation applies automatically. For more information, see Auto Animate Layout Updates. | ||
|
||
To learn how to build animations with the property animation system, read the Property Animation Overview. Or see the following pages to create common animations: | ||
|
||
|
||
|
||
* Change a view visibility with a crossfade | ||
* Change a view visibility with a circular reveal | ||
* Swap views with a card flip | ||
* Change the view size with a zoom animation | ||
|
||
|
||
### **Physics-based motion** | ||
|
||
Whenever possible, your animations should apply real-world physics so they are natural-looking. For example, they should maintain momentum when their target changes, and make smooth transitions during any changes. | ||
|
||
To provide these behaviors, the Android Support library includes physics-based animation APIs that rely on the laws of physics to control how your animations occur. | ||
![image](https://developer.android.com/images/guide/topics/graphics/targetchange_pba.gif) | ||
|
||
|
||
Two common physics-based animations are the following: | ||
|
||
|
||
|
||
* Spring Animation | ||
* Fling Animation | ||
|
||
Animations not based on physics—such as those built with ObjectAnimator APIs—are fairly static and have a fixed duration. If the target value changes, you need to cancel the animation at the time of target value change, re-configure the animation with a new value as the new start value, and add the new target value. Visually, this process creates an abrupt stop in the animation, and a disjointed movement afterwards, as shown in figure 3. | ||
|
||
Whereas, animations built with physics-based animation APIs such as DynamicAnimation are driven by force. The change in the target value results in a change in force. The new force applies on the existing velocity, which makes a continuous transition to the new target. This process results in a more natural-looking animation, as shown in figure 4 |