Skip to content

Commit 49ef16f

Browse files
authored
Update README.md
1 parent 510f7ae commit 49ef16f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
What is ZOptimization
22
--------
33

4-
Android library for optimization your UI. You don't need to create dimens for ldpi/hdpi/xhdpi/xxhdpi and so on.
5-
All you have to do is create only one dimens.xml file and put values for a specific device.
4+
Android library that provides a means to optimize user interface without having configuration qualifiers for different pixel densities. The main idea is to make layout looks the same as on trusted device with correctly configured layout.
65

76
Example
87
--------
@@ -37,7 +36,7 @@ Usage
3736
</RelativeLayout>
3837
```
3938

40-
#### Activity
39+
#### Activity example
4140

4241
```java
4342
public class MainActivity extends Activity {
@@ -52,12 +51,12 @@ public class MainActivity extends Activity {
5251
super.onCreate(savedInstanceState);
5352
setContentView(getProperContentView());
5453

55-
//Data binding example
54+
// Data binding example (if needed)
5655
ViewGroup viewGroup = getProperContentView();
5756
setContentView(viewGroup);
5857
DataBindingUtil.bind<T>(viewGroup);
5958

60-
//How to get display metrics for tested device
59+
// How to get display metrics for the tested device
6160
DisplayMetrics metrics = getResources().getDisplayMetrics();
6261
float density = metrics.density; //TESTED_DEVICE_DENSITY
6362
float scaledDensity = metrics.scaledDensity; //TESTED_DEVICE_SCALED_DENSITY
@@ -69,10 +68,10 @@ public class MainActivity extends Activity {
6968
private ViewGroup getProperContentView() {
7069
return ZOptimization.with(this)
7170
.layout(R.layout.activity_main)
72-
.onlyFor(ZOptimization.Device.TABLET) //Optimized for tablets only.
73-
.exclude(ZOptimization.Type.ALL, R.id.login_button) //Disable optimization for specific ids.
74-
.exclude(ZOptimization.Type.TEXT, AppCompatButton.class) //Disable only text size optimization for specific classes.
75-
.enable(false, true, true, true) //Enable/disable optimization for a specific type
71+
.onlyFor(ZOptimization.Device.PHONE) // Optimized for phone only, also TABLET or BOTH can be used.
72+
.exclude(ZOptimization.Type.ALL, R.id.login_button) // Disable optimization for specific ids.
73+
.exclude(ZOptimization.Type.TEXT, AppCompatButton.class) // Disable text size optimization for specific classes.
74+
.enable(false, true, true, true) // Enable/disable optimization types
7675
.config(new DeviceBuilder()
7776
.applyDp(TESTED_DEVICE_DENSITY)
7877
.applySp(TESTED_DEVICE_SCALED_DENSITY)
@@ -82,7 +81,7 @@ public class MainActivity extends Activity {
8281
}
8382
```
8483

85-
#### Recycler view
84+
#### RecyclerView example
8685
```java
8786
@Override
8887
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@@ -110,7 +109,7 @@ Download
110109

111110
```groovy
112111
dependencies {
113-
compile 'com.github.z-four:zoptimization:1.0.4'
112+
compile 'com.github.z-four:zoptimization:1.0.5'
114113
}
115114
```
116115

@@ -133,10 +132,10 @@ Methods
133132
|layout(int)| Set layout id which need to optimize|
134133
|layout(ViewGroup)| Set ViewGroup which need to optimize|
135134
|onlyFor(enum)| Set device type (default: BOTH)|
136-
|testedScreen(int, int)| Set default display size (width, height)|
135+
|testedScreen(int, int)| Set tested display size (width, height)|
137136
|currentScreen(int, int)| Set current display size (width, height)|
138-
|exclude(enum, int[])| Setup optimization type (ZOptimization.Type) & specific ids for disable|
139-
|exclude(enum, class[])| Setup optimization type (ZOptimization.Type) & specific classes for disable|
137+
|exclude(enum, int[])| Setup optimization type & specific ids should be excluded|
138+
|exclude(enum, class[])| Setup optimization type & specific classes should be excluded|
140139
|applySp(float)| Setup tested device scaled density|
141140
|applyDp(float)| Setup tested device density|
142141
|enable(boolean, boolean, boolean, boolean)| Enable/disable optimization for all the types|

0 commit comments

Comments
 (0)