Skip to content

Commit ff98b04

Browse files
committed
Change database to JsonDatabase.java
1 parent 829ce6c commit ff98b04

File tree

17 files changed

+508
-103
lines changed

17 files changed

+508
-103
lines changed

.idea/assetWizardSettings.xml

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,27 +120,27 @@ dependencies {
120120
androidTestImplementation 'com.android.support.test:runner:1.0.1'
121121
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
122122

123-
implementation 'com.android.support:multidex:1.0.3'
123+
api 'com.android.support:multidex:1.0.3'
124124

125-
implementation fileTree(dir: 'libs', include: ['*.jar'])
125+
api fileTree(dir: 'libs', include: ['*.jar'])
126126

127-
implementation 'com.github.afollestad.material-dialogs:commons:0.8.5.8'
128-
implementation 'com.rengwuxian.materialedittext:library:2.0.3'
127+
api 'com.github.afollestad.material-dialogs:commons:0.8.5.8'
128+
api 'com.rengwuxian.materialedittext:library:2.0.3'
129129

130-
implementation 'org.apmem.tools:layouts:1.10@aar'
131-
implementation 'com.makeramen:roundedimageview:2.2.1'
132-
implementation 'com.yqritc:recyclerview-flexibledivider:1.2.9'
130+
api 'org.apmem.tools:layouts:1.10@aar'
131+
api 'com.makeramen:roundedimageview:2.2.1'
132+
api 'com.yqritc:recyclerview-flexibledivider:1.2.9'
133133

134134
api project(':lib-n-ide')
135135
api project(':emulatorview')
136136
api project(':libtermexec')
137137
api project(':style')
138138

139-
implementation 'com.google.firebase:firebase-core:15.0.2'
140-
implementation 'com.google.firebase:firebase-storage:15.0.2'
141-
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
139+
api 'com.google.firebase:firebase-core:15.0.2'
140+
api 'com.google.firebase:firebase-storage:15.0.2'
141+
api 'com.crashlytics.sdk.android:crashlytics:2.9.2'
142142

143-
implementation 'io.github.kobakei:ratethisapp:1.2.0'
143+
api 'io.github.kobakei:ratethisapp:1.2.0'
144144
}
145145

146146

app/src/main/ic_launcher-web.png

838 Bytes
Loading

lib-n-ide/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies {
4848
api 'com.simplecityapps:recyclerview-fastscroll:1.0.18'
4949
api 'org.apache.commons:commons-lang3:3.7'
5050
api 'com.google.guava:guava:25.1-android'
51+
api 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
5152

5253
api project(':style')
5354
api project(':libastyle')

lib-n-ide/src/main/java/com/duy/ide/core/IdeActivity.java

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
import android.support.v4.view.GravityCompat;
3939
import android.support.v4.view.ViewPager;
4040
import android.support.v4.widget.DrawerLayout;
41-
import android.support.v7.widget.LinearLayoutManager;
42-
import android.support.v7.widget.RecyclerView;
41+
import android.support.v7.app.ActionBarDrawerToggle;
4342
import android.support.v7.widget.Toolbar;
4443
import android.text.TextUtils;
4544
import android.view.Gravity;
@@ -76,7 +75,7 @@
7675
import com.jecelyin.editor.v2.manager.MenuManager;
7776
import com.jecelyin.editor.v2.manager.RecentFilesManager;
7877
import com.jecelyin.editor.v2.manager.TabManager;
79-
import com.jecelyin.editor.v2.utils.DBHelper;
78+
import com.duy.ide.database.SQLHelper;
8079
import com.jecelyin.editor.v2.widget.SymbolBarLayout;
8180
import com.jecelyin.editor.v2.widget.menu.MenuDef;
8281
import com.jecelyin.editor.v2.widget.menu.MenuFactory;
@@ -112,7 +111,6 @@ public abstract class IdeActivity extends ThemeSupportActivity implements MenuIt
112111
public DrawerLayout mDrawerLayout;
113112
protected TabManager mTabManager;
114113
protected DiagnosticPresenter mDiagnosticPresenter;
115-
private RecyclerView mTabRecyclerView;
116114
private SymbolBarLayout mSymbolBarLayout;
117115
private Preferences mPreferences;
118116
private MenuManager mMenuManager;
@@ -137,13 +135,16 @@ public void onDrawerOpened(View drawerView) {
137135
hideSoftInput();
138136
}
139137
});
138+
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(
139+
this, mDrawerLayout, mToolbar, R.string.open_drawer, R.string.close_drawer
140+
);
141+
mDrawerLayout.addDrawerListener(actionBarDrawerToggle);
142+
actionBarDrawerToggle.syncState();
140143

141144
//keyboard hide/show listener
142145
setRootLayout(mDrawerLayout);
143146
attachKeyboardListeners();
144147

145-
mTabRecyclerView = findViewById(R.id.tabRecyclerView);
146-
147148
mSymbolBarLayout = findViewById(R.id.symbolBarLayout);
148149
mSymbolBarLayout.setOnSymbolCharClickListener(new SymbolBarLayout.OnSymbolCharClickListener() {
149150
@Override
@@ -158,10 +159,6 @@ public void onClick(View v, String text) {
158159
TextView versionView = findViewById(R.id.versionTextView);
159160
versionView.setText(SysUtils.getVersionName(this));
160161
mEditorPager.setVisibility(View.VISIBLE);
161-
162-
initToolbar();
163-
164-
mTabRecyclerView.setLayoutManager(new LinearLayoutManager(this));
165162
mTabManager = new TabManager(this);
166163

167164
initMenuView();
@@ -247,11 +244,6 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
247244
}
248245

249246

250-
private void initToolbar() {
251-
mToolbar.setNavigationIcon(R.drawable.ic_drawer_raw);
252-
mToolbar.setNavigationContentDescription(R.string.tab);
253-
}
254-
255247
@Override
256248
protected void onNewIntent(Intent intent) {
257249
super.onNewIntent(intent);
@@ -621,8 +613,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
621613
EditorDelegate delegate = getCurrentEditorDelegate();
622614
if (delegate != null) {
623615
delegate.saveInBackground(new File(file), encoding);
624-
DBHelper.getInstance(this).addRecentFile(file, encoding);
625-
DBHelper.getInstance(this).updateRecentFile(file, false);
616+
SQLHelper.getInstance(this).addRecentFile(file, encoding);
617+
SQLHelper.getInstance(this).updateRecentFile(file, false);
626618
}
627619
break;
628620
case RC_SETTINGS:
@@ -684,7 +676,7 @@ private void createNewEditor(File file, int offset, String encoding) {
684676
if (!mTabManager.newTab(file, offset, encoding)) {
685677
return;
686678
}
687-
DBHelper.getInstance(IdeActivity.this).addRecentFile(file.getPath(), encoding);
679+
SQLHelper.getInstance(IdeActivity.this).addRecentFile(file.getPath(), encoding);
688680
}
689681

690682
public void insertText(CharSequence text) {
@@ -737,10 +729,6 @@ public String getCurrentLang() {
737729
return editorDelegate.getLang();
738730
}
739731

740-
public RecyclerView getTabRecyclerView() {
741-
return mTabRecyclerView;
742-
}
743-
744732
@Override
745733
public void onEditorViewCreated(IEditorDelegate editorDelegate) {
746734

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.duy.ide.database;
2+
3+
import java.util.ArrayList;
4+
5+
public interface ITabDatabase {
6+
void addRecentFile(String path, String encoding);
7+
8+
void updateRecentFile(String path, boolean lastOpen);
9+
10+
void updateRecentFile(String path, String encoding, int offset);
11+
12+
ArrayList<RecentFileItem> getRecentFiles();
13+
14+
ArrayList<RecentFileItem> getRecentFiles(boolean lastOpenFiles);
15+
16+
void clearRecentFiles();
17+
18+
void clearFindKeywords(boolean isReplace);
19+
20+
void addFindKeyword(String keyword, boolean isReplace);
21+
22+
ArrayList<String> getFindKeywords(boolean isReplace);
23+
}

0 commit comments

Comments
 (0)