Skip to content

Commit

Permalink
focus when terminal open,reduce unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
PangBaiWork committed Mar 3, 2024
1 parent 9fee161 commit edfd8b2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug{
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

}

}

compileOptions {
Expand Down
18 changes: 9 additions & 9 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keepclassmembers class br.tiagohm.markdownview.MarkdownView {
public *;
}



-keepattributes *Annotation*
-keepattributes *JavascriptInterface*


# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn java.beans.BeanInfo
-dontwarn java.beans.FeatureDescriptor
-dontwarn java.beans.IntrospectionException
Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"versionCode": 2,
"versionName": "1.1",
"outputFile": "app-release.apk"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.pangbai.weblog.databinding.ActivityHomeBinding;
import com.pangbai.weblog.databinding.LayoutTerminalBinding;
import com.pangbai.weblog.execute.cmdExer;
import com.pangbai.weblog.preference.PrefManager;
import com.pangbai.weblog.project.Project;
import com.pangbai.weblog.tool.DialogUtils;
import com.pangbai.weblog.tool.Init;
Expand Down Expand Up @@ -154,6 +155,7 @@ void select(FileListSelect.FileChoose fileChoose) {


void openProject(Project project) {
PrefManager.putString(PrefManager.Keys.current_file,"");
ProjectManager.saveCurrentProject(project);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ protected void onCreate(Bundle savedInstanceState) {
String path = PrefManager.getString(PrefManager.Keys.current_file, "");
File file = new File(path);

if (file.exists()){
if (file.exists()) {
setCodeText(file);
currentFile=file;
currentFile = file;
filesListAdapter.setList(currentFile.getParentFile());

} else {
Expand Down Expand Up @@ -215,7 +215,8 @@ void setLayout() {
if (cmd) {
Snackbar.make(binding.getRoot(), "Success", Snackbar.LENGTH_SHORT).show();
} else {
DialogUtils.showConfirmationDialog(this, getString(R.string.scripts_execution_failed), cmdExer.result, null, null);
DialogUtils.showConfirmationDialog(this, getString(R.string.scripts_execution_failed), cmdExer.result, getString(android.R.string.copy), getString(R.string.cancle), () -> {
util.copyToClipboard(this, cmdExer.result);}, null);
}
});
});
Expand Down Expand Up @@ -322,7 +323,7 @@ public void onStateChanged(@NonNull View bottomSheet, int newState) {
}
// focus on cmdview;
if (newState == BottomSheetBehavior.STATE_EXPANDED) {
if (tabLayout.getSelectedTabPosition() == 1) {
if (tabLayout.getSelectedTabPosition() == 0) {
cmdBinding.terminal.requestFocus();
}
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/com/pangbai/weblog/tool/util.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
Expand Down Expand Up @@ -61,5 +63,11 @@ public static boolean isStringExist(String s,String[] ss){
return false;
}

public static void copyToClipboard(Context context, CharSequence text) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", text);
clipboard.setPrimaryClip(clip);
}


}
Binary file removed app/src/main/resources/lib/arm64-v8a/busybox
Binary file not shown.
2 changes: 1 addition & 1 deletion markdownView/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down

0 comments on commit edfd8b2

Please sign in to comment.