Skip to content

Commit 327940f

Browse files
committed
Merge branch 'develop' into release
2 parents 39dcaf3 + e2fd9a5 commit 327940f

File tree

75 files changed

+2920
-1242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2920
-1242
lines changed

.travis.yml

+36-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
language: android
22

3+
# Use the Travis Container-Based Infrastructure
4+
sudo: false
5+
6+
jdk:
7+
- oraclejdk8
8+
9+
env:
10+
global:
11+
- ANDROID_BUILD_TOOLS_VERSION=25.0.2
12+
- ADB_INSTALL_TIMEOUT=20 # install timeout in minutes (2 minutes by default)
13+
matrix:
14+
- ANDROID_TARGET=android-22 ANDROID_ABI=armeabi-v7a
15+
316
android:
417
components:
5-
# Update Android SDK Tools
6-
- tools
7-
8-
- build-tools-23.0.2
9-
- android-23
18+
- tools # to get the new `repository-11.xml`
19+
- tools # to install new Android SDK tools
20+
- platform-tools
21+
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
22+
- $ANDROID_TARGET
23+
- android-25
1024

1125
# Support library
1226
- extra-android-support
1327
- extra-android-m2repository
1428

29+
# System images
30+
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
31+
32+
before_script:
33+
- chmod +x ./gradlew
34+
# Emulator Management: Create, Start and Wait
35+
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
36+
- emulator -avd test -no-audio -no-window &
37+
- android-wait-for-emulator
38+
1539
script:
16-
- chmod +x ./gradlew
40+
- ./gradlew clean
41+
- ./gradlew check # Local unit tests
42+
- ./gradlew connectedCheck # Instrumented unit tests
43+
- ./gradlew jacocoTestReport
44+
45+
after_success:
46+
- bash <(curl -s https://codecov.io/bash)

README.md

+63-52
Original file line numberDiff line numberDiff line change
@@ -7,85 +7,96 @@ This is a fork of [dmytrodanylyk/realm-browser](https://github.com/dmytrodanylyk
77
<img src="screenshots/sc_1.png" width="256"> | <img src="screenshots/sc_2.png" width="256"> | <img src="screenshots/sc_3.png" width="256">
88
--- | --- | ---
99

10-
11-
### Integration [![](https://jitpack.io/v/jonasrottmann/realm-browser.svg)](https://jitpack.io/#jonasrottmann/realm-browser) [![Build Status](https://travis-ci.org/jonasrottmann/realm-browser.svg?branch=release)](https://travis-ci.org/jonasrottmann/realm-browser)
10+
### Integration [![](https://jitpack.io/v/jonasrottmann/realm-browser.svg)](https://jitpack.io/#jonasrottmann/realm-browser) [![codecov](https://codecov.io/gh/jonasrottmann/realm-browser/branch/develop/graph/badge.svg)](https://codecov.io/gh/jonasrottmann/realm-browser)
11+
Releases: [![Build Status](https://travis-ci.org/jonasrottmann/realm-browser.svg?branch=release)](https://travis-ci.org/jonasrottmann/realm-browser) - Develop branch (Snapshots): [![Build Status](https://travis-ci.org/jonasrottmann/realm-browser.svg?branch=develop)](https://travis-ci.org/jonasrottmann/realm-browser)
1212

1313
The project is available via [JitPack.io](https://jitpack.io/#jonasrottmann/realm-browser/).
1414

15-
Step 1. Add the JitPack repository to your build file
15+
1. **Add the JitPack repository to your build file**
16+
```
17+
allprojects {
18+
repositories {
19+
...
20+
maven { url "https://jitpack.io" }
21+
}
22+
}
23+
}
24+
```
25+
26+
2. **Add the dependency**
27+
```
28+
dependencies {
29+
debugCompile 'com.github.jonasrottmann.realm-browser:realm-browser:v0.0.9'
30+
testCompile 'com.github.jonasrottmann.realm-browser:realm-browser-no-op:v0.0.9'
31+
releaseCompile 'com.github.jonasrottmann.realm-browser:realm-browser-no-op:v0.0.9'
32+
}
33+
```
34+
The no-op version of Realm Browser has empty functions which do nothing. It is not necessary to include this, but you may if you do not want to access Realm Browser in release mode. If you want to use a build of the newest development use `compile "com.github.jonasrottmann.realm-browser:realm-browser:develop-SNAPSHOT"` instead.
35+
36+
3. Exclude support libraries (maybe optional): Realm Browser depends on Android support libraries, so you might want to exclude them from your project if they conflict with the ones you include:
37+
```
38+
depedencies {
39+
debugCompile ('com.github.jonasrottmann.realm-browser:realm-browser:v0.0.9') {
40+
exclude group: 'com.android.support';
41+
}
42+
}
43+
```
44+
45+
4. Add ProGuard rules (optional): Use these if you enable minification for debug builds or want to use Realm Browser in release builds.
46+
```
47+
# Realm Browser
48+
-keep class de.jonasrottmann.realmbrowser.* { *; }
49+
-keep class android.support.v7.widget.SearchView { *; }
50+
-keep class android.support.v7.view.** { *; }
51+
```
1652

17-
```
18-
allprojects {
19-
repositories {
20-
...
21-
maven { url "https://jitpack.io" }
22-
}
23-
}
24-
}
25-
```
53+
### Usage
2654

27-
Step 2. Add the dependency
55+
If you want to see all your database files:
2856

2957
```
30-
dependencies {
31-
debugCompile 'com.github.jonasrottmann.realm-browser:realm-browser:v0.0.8'
32-
testCompile 'com.github.jonasrottmann.realm-browser:realm-browser-no-op:v0.0.8'
33-
releaseCompile 'com.github.jonasrottmann.realm-browser:realm-browser-no-op:v0.0.8'
34-
}
58+
RealmBrowser.startRealmFilesActivity(context);
3559
```
3660

37-
The no-op version of Realm Browser has empty functions which do nothing. It is not necessary to include this,
38-
but you may if you do not want to access Realm Browser in release mode.
39-
40-
> ‼️ v0.0.8 is not working with the newest realm release. Use the develop snapshot version `compile "com.github.jonasrottmann.realm-browser:realm-browser:develop-SNAPSHOT"` meanwhile.
41-
42-
Realm Browser depends on Android support libraries, so you might want to exclude them from your project
43-
if they conflict with the ones you include:
61+
If you want to see all the tables in a database call:
4462

4563
```
46-
depedencies {
47-
debugCompile ('com.github.jonasrottmann.realm-browser:realm-browser:v0.0.8') {
48-
exclude group: 'com.android.support';
49-
}
50-
}
64+
RealmBrowser.startRealmModelsActivity(context, realmConfiguration);
5165
```
5266

53-
Step 3. Add ProGuard rules (optional)
54-
55-
Use these if you enable minification for debug builds or want to use Realm Browser in release builds.
67+
To display a notification from which the Realm Browser can be started:
5668

5769
```
58-
# Realm Browser
59-
-keep class de.jonasrottmann.realmbrowser.helper.* { *; }
60-
-keep class android.support.v7.widget.SearchView { *; }
61-
-keep class android.support.v7.view.** { *; }
70+
RealmBrowser.showRealmFilesNotification(context);
6271
```
63-
64-
### Usage
65-
66-
If you want to see all your databases call:
67-
6872
```
69-
RealmBrowser.startRealmFilesActivity(context);
73+
RealmBrowser.showRealmModelsNotification(context, realmConfiguration);
7074
```
7175

72-
If you want to see all the tables in a database call:
76+
There are also [App Shortcuts](https://developer.android.com/guide/topics/ui/shortcuts.html) available for devices running Android 7.1 or newer:
7377

7478
```
75-
RealmBrowser.startRealmModelsActivity(context, realmConfiguration);
79+
RealmBrowser.addFilesShortcut(context);
7680
```
77-
7881
```
79-
RealmBrowser.startRealmModelsActivity(context, "<name of the database file>");
82+
RealmBrowser.addModelsShortcut(context, realmConfiguration)
8083
```
8184

82-
To display a notification from which the Realm Browser can be started:
85+
For a full working example check out the [sample app](https://github.com/jonasrottmann/realm-browser/blob/release/app/src/main/java/de/jonasrottmann/realmsample/MainActivity.java).
8386

84-
```
85-
RealmBrowser.showRealmFilesNotification(context);
86-
```
87+
### TODO
88+
What's on the roadmap... 🚀
89+
- [ ] Tests
90+
- [ ] Be able to edit/create objects
91+
- [ ] Bidirectional scrolling in the browser window
92+
- [ ] Clean up
93+
- [ ] Nice architecture
94+
- [ ] Live reload the browser if updates happen in the background
95+
- [ ] Javadoc 📚
8796

88-
For a full working example check out the [sample app](https://github.com/jonasrottmann/realm-browser/blob/release/app/src/main/java/de/jonasrottmann/realmsample/MainActivity.java).
97+
### Other browsers
98+
99+
If you're looking for a Realm browser for your iOS Swift projects check out [bearjaw/RBSRealmBrowser](https://github.com/bearjaw/RBSRealmBrowser) 🎉
89100

90101
### License
91102

app/build.gradle

+29-7
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,53 @@ repositories {
66
}
77

88
android {
9-
compileSdkVersion 24
9+
compileSdkVersion project.compileSdkVersion
1010
buildToolsVersion project.buildToolsVersion
11+
1112
defaultConfig {
1213
applicationId "de.jonasrottmann.realmsample"
13-
minSdkVersion 15
14-
targetSdkVersion 24
14+
minSdkVersion project.minSdkVersion
15+
targetSdkVersion project.targetSdkVersion
1516
versionCode project.gitCommitCount
1617
versionName project.gitTag
18+
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
1719
}
20+
1821
buildTypes {
1922
release {
2023
minifyEnabled false
2124
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2225
}
2326
}
27+
28+
productFlavors {
29+
normal {
30+
applicationIdSuffix ".normal"
31+
}
32+
noop {
33+
applicationIdSuffix ".noop"
34+
}
35+
}
36+
37+
lintOptions {
38+
abortOnError false
39+
}
2440
}
2541

2642
dependencies {
2743
compile fileTree(include: ['*.jar'], dir: 'libs')
2844
compile "com.android.support:appcompat-v7:$project.supportLibVersion"
45+
compile "com.jakewharton.timber:timber:$project.timberVersion"
46+
47+
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
48+
exclude group: 'com.android.support', module: 'support-annotations'
49+
}
2950

30-
// Use local version of realm-browser
31-
debugCompile project(':realm-browser')
32-
releaseCompile project(':realm-browser-no-op')
51+
// test local version of realm-browser
52+
normalCompile project(':realm-browser')
53+
noopCompile project(':realm-browser-no-op')
3354

3455
// Use develop-snapshot version
35-
// compile "com.github.jonasrottmann.realm-browser:realm-browser:develop-SNAPSHOT"
56+
// normalCompile "com.github.jonasrottmann.realm-browser:realm-browser:develop-SNAPSHOT"
57+
// noopCompile "com.github.jonasrottmann.realm-browser:realm-browser:develop-SNAPSHOT"
3658
}

app/src/main/java/de/jonasrottmann/realmsample/Application.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.jonasrottmann.realmsample;
22

3+
import de.jonasrottmann.realmbrowser.RealmBrowser;
34
import io.realm.Realm;
45
import io.realm.RealmConfiguration;
56
import timber.log.Timber;
@@ -13,11 +14,18 @@ public void onCreate() {
1314
super.onCreate();
1415
Timber.plant(new Timber.DebugTree());
1516

16-
RealmConfiguration config = new RealmConfiguration.Builder(this)
17+
Realm.init(this);
18+
RealmConfiguration config = new RealmConfiguration.Builder()
1719
.name(REALM_FILE_NAME)
1820
.deleteRealmIfMigrationNeeded()
1921
.build();
2022

2123
Realm.setDefaultConfiguration(config);
24+
25+
RealmBrowser.showRealmModelsNotification(this, config);
26+
27+
RealmBrowser.addFilesShortcut(this);
28+
29+
RealmBrowser.addModelsShortcut(this, config);
2230
}
23-
}
31+
}

app/src/main/java/de/jonasrottmann/realmsample/MainActivity.java

+10-11
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@
44
import android.os.Bundle;
55
import android.view.View;
66
import android.widget.TextView;
7-
8-
import java.util.ArrayList;
9-
import java.util.Date;
10-
import java.util.List;
11-
import java.util.UUID;
12-
137
import de.jonasrottmann.realmbrowser.RealmBrowser;
148
import de.jonasrottmann.realmsample.data.Address;
159
import de.jonasrottmann.realmsample.data.Contact;
1610
import de.jonasrottmann.realmsample.data.RealmString;
1711
import de.jonasrottmann.realmsample.data.User;
1812
import io.realm.Realm;
13+
import io.realm.RealmConfiguration;
1914
import io.realm.RealmList;
15+
import java.util.ArrayList;
16+
import java.util.Date;
17+
import java.util.List;
18+
import java.util.UUID;
2019

2120
public class MainActivity extends Activity implements View.OnClickListener {
2221

2322
private TextView mTxtTitle;
2423

25-
2624
@Override
2725
protected void onCreate(Bundle savedInstanceState) {
2826
super.onCreate(savedInstanceState);
@@ -35,8 +33,6 @@ protected void onCreate(Bundle savedInstanceState) {
3533
findViewById(R.id.btnOpenModel).setOnClickListener(this);
3634

3735
updateTitle();
38-
39-
RealmBrowser.showRealmFilesNotification(this);
4036
}
4137

4238

@@ -98,7 +94,7 @@ private void insertUsers(int count) {
9894
user.setAge(i);
9995
user.setAddress(address);
10096
user.setUuid(UUID.randomUUID().toString());
101-
user.setByteArray(new byte[]{1, 2, 3});
97+
user.setByteArray(new byte[] { 1, 2, 3 });
10298
user.setCreationDate(new Date(System.currentTimeMillis()));
10399

104100
RealmList<RealmString> emailList = new RealmList<>();
@@ -136,6 +132,9 @@ private void startRealmFilesActivity() {
136132

137133

138134
private void startRealmModelsActivity() {
139-
RealmBrowser.startRealmModelsActivity(this, Realm.getDefaultInstance().getConfiguration());
135+
Realm realm = Realm.getDefaultInstance();
136+
RealmConfiguration configuration = realm.getConfiguration();
137+
realm.close();
138+
RealmBrowser.startRealmModelsActivity(this, configuration);
140139
}
141140
}

build.gradle

+24-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,35 @@ buildscript {
22
ext {
33
gitTag = 'git describe --tags'.execute([], project.rootDir).text.trim()
44
gitCommitCount = Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
5-
realmVersion = '1.1.0'
6-
supportLibVersion = '24.1.1'
7-
buildToolsVersion = '23.0.3'
5+
6+
buildToolsVersion = '25.0.2'
7+
8+
compileSdkVersion = 25
9+
targetSdkVersion = 25
10+
minSdkVersion = 15
11+
12+
// plugins
13+
androidGradlePluginVersion = '2.3.0'
14+
realmVersion = '3.0.0'
15+
dexcountVersion = '0.6.2'
16+
17+
// dependencies
18+
timberVersion = '4.3.0'
19+
supportLibVersion = '25.3.0'
20+
lombokVersion = '1.12.6'
821
}
22+
923
repositories {
1024
jcenter()
1125
}
26+
1227
dependencies {
13-
classpath 'com.android.tools.build:gradle:2.1.2'
14-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
28+
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
1529
classpath "io.realm:realm-gradle-plugin:$realmVersion"
30+
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcountVersion"
1631
}
32+
}
33+
34+
plugins {
35+
id "com.github.dcendents.android-maven" version "1.5" apply false
1736
}

0 commit comments

Comments
 (0)