Skip to content

Commit c4f6879

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 5104bb3 + 2e99cb9 commit c4f6879

27 files changed

Lines changed: 1346 additions & 115 deletions

README.md

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
DialogAlchemy
22
========
33

4+
[![Release](https://jitpack.io/v/NeoLSN/DialogAlchemy.svg?style=flat)](https://jitpack.io/#NeoLSN/DialogAlchemy)
5+
6+
<img src="https://github.com/NeoLSN/DialogAlchemy/raw/master/arts/device_portrait.png" height="300" alt="Portrait image" />
7+
<img src="https://github.com/NeoLSN/DialogAlchemy/raw/master/arts/device_landscape.png" width="300" alt="Landscape image" />
8+
49
This is a dialog utility library. It provides a easy way to let developers deal with screen rotation issue.
510

611
Installation
@@ -12,28 +17,34 @@ repositories {
1217
}
1318
dependencies {
1419
...
15-
compile 'com.github.NeoLSN:DialogAlchemy:1.0.0'
20+
compile 'com.github.NeoLSN:DialogAlchemy:1.1.0'
1621
}
1722
```
1823
API
1924
--------
2025
- Alchemist - Dialog fragment
21-
- Material - Basic dialog model
22-
- PhilosopherStone - A interface for custom view
26+
- Material - Basic dialog model for most of Android Dialog library
27+
- PhilosopherStone - There are two purpose for Philosopher Stone
28+
1. A interface for custom view (main purpose)
29+
2. Expand the Dialog library ability
30+
- Be a model, not be a controller
2331
- TransmutationCircle - A interface for dialog creation factory
32+
1. Should satisfy Material model requirement
33+
2. At least process PhilosopherStone as a custom view
34+
3. Increase
2435
- DialogAlchemy - A utility class to show a dialog
2536

2637
Usage
2738
--------
28-
##### Basic Usage
39+
#### Basic Usage
2940
```Java
3041
Material material = new Material.Builder(getActivity())
3142
.setTitle("Dialog Title")
3243
.setMessage("Dialog message")
3344
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
3445
@Override
3546
public void onClick(DialogInterface dialog, int which) {
36-
... do something ...
47+
... Do something ...
3748
}
3849
})
3950
.setNegativeButton(android.R.string.cancel, null)
@@ -42,7 +53,7 @@ Usage
4253
Alchemist alchemist = DialogAlchemy.show(getFragmentManager(), material);
4354
```
4455

45-
##### Advanced Usage
56+
#### Advanced Usage
4657
```Java
4758
//Create a custom view
4859
PhilosopherStone stone = new EditTextStone.Builder()
@@ -56,7 +67,7 @@ Usage
5667
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
5768
@Override
5869
public void onClick(DialogInterface dialog, int which) {
59-
... do something ...
70+
... Do something ...
6071
}
6172
})
6273
.setNegativeButton(android.R.string.cancel, null)
@@ -83,7 +94,7 @@ When ```DialogAlchemy.show()``` called, it will set a tag to ```Alchemist``` aut
8394
Material material = alchemist.getMaterial();
8495
Material.Builder builder = material.rebuild(this);
8596

86-
// reset listner or callback in here
97+
// reset listener or callback in here
8798

8899
Material newMaterial = builder.build();
89100
alchemist.setMaterial(newMaterial);
@@ -109,7 +120,7 @@ When ```DialogAlchemy.show()``` called, it will set a tag to ```Alchemist``` aut
109120
Material material = alchemist.getMaterial();
110121
Material.Builder builder = material.rebuild(this);
111122

112-
// reset listner or callback in here
123+
// reset listener or callback in here
113124

114125
Material newMaterial = builder.build();
115126
alchemist.setMaterial(newMaterial);
@@ -122,4 +133,34 @@ When ```DialogAlchemy.show()``` called, it will set a tag to ```Alchemist``` aut
122133

123134
super.onSaveInstanceState(outState);
124135
}
125-
```
136+
```
137+
#### Set default TransmutationCircle
138+
```Java
139+
public class DemoApplication extends Application {
140+
141+
@Override
142+
public void onCreate() {
143+
super.onCreate();
144+
...
145+
DialogAlchemy.setDefaultCircle(new MetalTransmutationCircle());
146+
}
147+
}
148+
```
149+
150+
License
151+
--------
152+
153+
Copyright (C) 2016 Jason Yang
154+
Copyright (C) 2007 The Android Open Source Project
155+
156+
Licensed under the Apache License, Version 2.0 (the "License");
157+
you may not use this file except in compliance with the License.
158+
You may obtain a copy of the License at
159+
160+
http://www.apache.org/licenses/LICENSE-2.0
161+
162+
Unless required by applicable law or agreed to in writing, software
163+
distributed under the License is distributed on an "AS IS" BASIS,
164+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165+
See the License for the specific language governing permissions and
166+
limitations under the License.

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ dependencies {
2323
compile project(path: ':library')
2424
compile fileTree(dir: 'libs', include: ['*.jar'])
2525
compile 'com.android.support:appcompat-v7:23.4.0'
26+
compile 'com.github.fengdai:alertdialogpro-theme-holo:0.2.6'
27+
compile 'com.afollestad.material-dialogs:core:0.8.5.9'
28+
2629
testCompile 'junit:junit:4.12'
2730
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
2831
androidTestCompile 'com.android.support.test:runner:0.5'

app/src/androidTest/java/ui/android/dialogalchemy/ExampleInstrumentationTest.java renamed to app/src/androidTest/java/ui/android/dialogalchemy/example/ExampleInstrumentationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ui.android.dialogalchemy;
1+
package ui.android.dialogalchemy.example;
22

33
import android.content.Context;
44
import android.support.test.InstrumentationRegistry;
@@ -23,6 +23,6 @@ public void useAppContext() throws Exception {
2323
// Context of the app under test.
2424
Context appContext = InstrumentationRegistry.getTargetContext();
2525

26-
assertEquals("ui.android.dialogalchemy", appContext.getPackageName());
26+
assertEquals("ui.android.dialogalchemy.example", appContext.getPackageName());
2727
}
2828
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package="ui.android.dialogalchemy.example">
44

55
<application
6+
android:name=".DemoApplication"
67
android:allowBackup="true"
78
android:icon="@mipmap/ic_launcher"
89
android:label="@string/app_name"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ui.android.dialogalchemy.example;
2+
3+
import android.app.Application;
4+
5+
import ui.android.dialogalchemy.DialogAlchemy;
6+
import ui.android.dialogalchemy.circle.MetalTransmutationCircle;
7+
8+
/**
9+
* Created by JasonYang on 2016/6/14.
10+
*/
11+
public class DemoApplication extends Application {
12+
13+
@Override
14+
public void onCreate() {
15+
super.onCreate();
16+
17+
DialogAlchemy.setDefaultCircle(new MetalTransmutationCircle());
18+
}
19+
}

0 commit comments

Comments
 (0)