Skip to content

Commit 1bcc248

Browse files
committed
fix not auto focus
1 parent eadf355 commit 1bcc248

File tree

5 files changed

+49
-58
lines changed

5 files changed

+49
-58
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ android {
3434

3535
productFlavors {
3636
dev {
37-
minSdkVersion 19
37+
minSdkVersion 21
3838
}
3939
prod {
4040
minSdkVersion rootProject.ext.minSdkVersion as Integer

app/src/main/java/com/duy/ide/editor/code/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import android.widget.ProgressBar;
4646
import android.widget.Toast;
4747

48+
import com.duy.JavaApplication;
4849
import com.duy.compile.BuildApkTask;
4950
import com.duy.compile.BuildJarAchieveTask;
5051
import com.duy.compile.CompileJavaTask;
@@ -768,16 +769,21 @@ private void updateUiStartCompile() {
768769
if (mCompileProgress != null) mCompileProgress.setVisibility(View.VISIBLE);
769770
hideKeyboard();
770771
openDrawer(GravityCompat.START);
772+
773+
mMessagePresenter.resume((JavaApplication) getApplication());
771774
mMessagePresenter.clear();
772775
mMessagePresenter.append("Compiling...\n");
773776

774777
mContainerOutput.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
775778
mDiagnosticPresenter.clear();
776779

777780
mBottomPage.setCurrentItem(0);
781+
778782
}
779783

780784
private void updateUIFinish() {
785+
mMessagePresenter.pause((JavaApplication) getApplication());
786+
781787
if (mActionRun != null) mActionRun.setEnabled(true);
782788
if (mCompileProgress != null) {
783789
mHandler.postDelayed(new Runnable() {

app/src/main/java/com/duy/ide/editor/code/ProjectManagerActivity.java

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252
import com.commonsware.cwac.pager.PageDescriptor;
5353
import com.commonsware.cwac.pager.SimplePageDescriptor;
54-
import com.duy.JavaApplication;
5554
import com.duy.compile.diagnostic.DiagnosticFragment;
5655
import com.duy.compile.diagnostic.DiagnosticPresenter;
5756
import com.duy.compile.message.MessageFragment;
@@ -182,9 +181,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
182181
TabLayout bottomTab = findViewById(R.id.bottom_tab);
183182
bottomTab.setupWithViewPager(mBottomPage);
184183

185-
if (getIntent().getBooleanExtra("new_project", false)) {
186-
openDrawer(GravityCompat.START);
187-
}
188184
//create project if need
189185
createProjectIfNeed();
190186
}
@@ -284,35 +280,12 @@ protected void addNewPageEditor(@NonNull File file, boolean selectNewPage) {
284280
@Override
285281
protected void onPause() {
286282
super.onPause();
287-
mMessagePresenter.pause((JavaApplication) getApplication());
288283
mPagePresenter.pause();
289284
if (mProjectFile != null) {
290285
ProjectManager.saveProject(this, mProjectFile);
291286
}
292287
}
293288

294-
@Override
295-
protected void onResume() {
296-
super.onResume();
297-
mMessagePresenter.resume((JavaApplication) getApplication());
298-
}
299-
300-
301-
@Override
302-
protected void onNewIntent(Intent intent) {
303-
super.onNewIntent(intent);
304-
// if (intent.getStringExtra(CompileManager.FILE_PATH) != null) {
305-
// String filePath = intent.getStringExtra(CompileManager.FILE_PATH);
306-
// File file = new File(filePath);
307-
// if (!file.exists()) {
308-
// Toast.makeText(this, "File not found", Toast.LENGTH_SHORT).show();
309-
// return;
310-
// }
311-
// addNewPageEditor(file, SELECT);
312-
// //remove path
313-
// intent.removeExtra(CompileManager.FILE_PATH);
314-
// }
315-
}
316289

317290
protected abstract String getCode();
318291

@@ -465,23 +438,18 @@ public void onProjectCreated(@NonNull JavaProjectFolder projectFile) {
465438
}
466439

467440
//show file structure of project
468-
// mFilePresenter.show(projectFile, true);
469-
// mBottomPage.setCurrentItem(0);
470-
// mContainerOutput.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
471-
// mMessagePresenter.clear();
472-
// mDiagnosticPresenter.clear();
473-
// openDrawer(GravityCompat.START);
441+
mFilePresenter.show(projectFile, true);
442+
mBottomPage.setCurrentItem(0);
443+
mContainerOutput.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
444+
mMessagePresenter.clear();
445+
mDiagnosticPresenter.clear();
446+
openDrawer(GravityCompat.START);
474447

475448
ClassFile mainClass = projectFile.getMainClass();
476449
if (mainClass != null && mainClass.exist(projectFile)) {
477450
//add to database
478-
mFileManager.addNewPath(mainClass.getPath(projectFile));
479-
// addNewPageEditor(new File(mainClass.getPath(projectFile)), true);
451+
addNewPageEditor(new File(mainClass.getPath(projectFile)), true);
480452
}
481-
Intent intent = new Intent(this, MainActivity.class);
482-
intent.putExtra("new_project", true);
483-
this.finish();
484-
this.startActivity(intent);
485453
}
486454

487455
protected abstract void startAutoCompleteService();

app/src/main/res/layout/splash.xml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,41 @@
2121
android:gravity="center"
2222
android:orientation="vertical">
2323

24-
<ImageView
25-
android:id="@+id/imageView"
26-
android:layout_width="120dp"
27-
android:layout_height="120dp"
28-
android:layout_gravity="center"
29-
android:contentDescription="@string/logo"
30-
android:src="@mipmap/ic_launcher"/>
24+
<LinearLayout
25+
xmlns:android="http://schemas.android.com/apk/res/android"
26+
android:layout_width="match_parent"
27+
android:layout_height="0dp"
28+
android:layout_weight="1"
29+
android:gravity="center"
30+
android:orientation="vertical">
3131

32-
<TextView
33-
android:layout_width="wrap_content"
34-
android:layout_height="wrap_content"
35-
android:padding="8dp"
36-
android:text="@string/java_for_android"
37-
android:textAppearance="@style/TextAppearance.AppCompat.Large"
38-
android:textColor="?colorAccent"/>
32+
<ImageView
33+
android:id="@+id/imageView"
34+
android:layout_width="120dp"
35+
android:layout_height="120dp"
36+
android:layout_gravity="center"
37+
android:contentDescription="@string/logo"
38+
android:src="@mipmap/icon"/>
39+
40+
<TextView
41+
android:layout_width="wrap_content"
42+
android:layout_height="wrap_content"
43+
android:padding="8dp"
44+
android:text="@string/java_for_android"
45+
android:textAppearance="@style/TextAppearance.AppCompat.Large"
46+
android:textColor="?colorAccent"/>
3947

40-
<ProgressBar
41-
android:id="@+id/progressBar3"
42-
style="?android:attr/progressBarStyleSmall"
48+
<ProgressBar
49+
android:id="@+id/progressBar3"
50+
style="?android:attr/progressBarStyleSmall"
51+
android:layout_width="match_parent"
52+
android:layout_height="wrap_content"/>
53+
</LinearLayout>
54+
55+
<TextView
4356
android:layout_width="match_parent"
44-
android:layout_height="wrap_content"/>
57+
android:layout_height="wrap_content"
58+
android:gravity="center"
59+
android:text="@string/copy_right"/>
4560

4661
</LinearLayout>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@
396396
<string name="save_and_apply">Save and apply</string>
397397
<string name="create_new_theme">Create new theme</string>
398398
<string name="more_theme">Get premium version. Create your custom theme!</string>
399+
399400
<string name="java_for_android" translatable="false">Java for Android</string>
401+
400402
<string name="system_version" translatable="false">System version: </string>
401403
<string name="install" translatable="false">Install</string>
402404
<string name="class_" translatable="false">Class</string>

0 commit comments

Comments
 (0)