Skip to content
Snippets Groups Projects
Commit 7f186ab6 authored by Francesco's avatar Francesco
Browse files

bugfix/code cleanup

parent 0330711e
Branches
Tags
No related merge requests found
apply plugin: 'com.android.application'
apply plugin: 'versionPlugin'
android {
signingConfigs {
config {
}
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "ohi.andre.consolelauncher"
minSdkVersion 8
targetSdkVersion 23
versionCode 66
versionName "4.1"
versionCode 67
versionName "4.2"
}
buildTypes {
release {
minifyEnabled true
......@@ -21,6 +24,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
versionPlugin {
buildTypesMatcher = 'release'
supportBuildNumber = true
buildNumberPrefix = 'b'
fileNameFormat = 't-ui-vrs_$versionName-build_$versionCode'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
......@@ -28,7 +41,7 @@ android {
}
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile files('../libs/CompareString.jar')
compile files('../libs/commons-io-2.4.jar')
}
\ No newline at end of file
......@@ -39,9 +39,10 @@ public class LauncherActivity extends Activity implements Reloadable {
private MainManager main;
private boolean hideStatusBar;
private boolean openKeyboardOnStart;
private PreferencesManager preferencesManager;
// access Main.onCommand from UIManager
private CommandExecuter ex = new CommandExecuter() {
@Override
......@@ -54,7 +55,7 @@ public class LauncherActivity extends Activity implements Reloadable {
return null;
}
};
// access input from MainManager
private Inputable in = new Inputable() {
@Override
......@@ -66,7 +67,7 @@ public class LauncherActivity extends Activity implements Reloadable {
}
}
};
// access output from MainManager
private Outputable out = new Outputable() {
@Override
......@@ -124,14 +125,17 @@ public class LauncherActivity extends Activity implements Reloadable {
startService(service);
}
// use system wp
boolean useSystemWP = Boolean.parseBoolean(preferencesManager.getValue(PreferencesManager.USE_SYSTEMWP));
if (useSystemWP)
setTheme(R.style.SystemWallpaperStyle);
// hide status bar
hideStatusBar = Boolean.parseBoolean(preferencesManager.getValue(PreferencesManager.FULLSCREEN));
openKeyboardOnStart = Boolean.parseBoolean(preferencesManager.getValue(PreferencesManager.OPEN_KEYBOARD));
if (!openKeyboardOnStart) {
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
setContentView(R.layout.main_view);
ViewGroup mainView = (ViewGroup) findViewById(R.id.mainview);
......@@ -184,6 +188,7 @@ public class LauncherActivity extends Activity implements Reloadable {
protected void onStart() {
super.onStart();
if (openKeyboardOnStart)
ui.onStart();
}
......
......@@ -229,13 +229,31 @@ public class MainManager {
class TuiCommandTrigger implements CmdTrigger {
@Override
public boolean trigger(ExecInfo info, Outputable out, String input, int id) throws Exception {
public boolean trigger(final ExecInfo info, final Outputable out, final String input, final int id) throws Exception {
final boolean[] returnValue = new boolean[1];
Thread t = new Thread() {
@Override
public void run() {
super.run();
try {
Command command = CommandTuils.parse(input, info, false);
if (command != null) {
out.onOutput(command.exec(info), id);
return true;
returnValue[0] = true;
} else
return false;
returnValue[0] = false;
} catch (Exception e) {
out.onOutput(e.toString(), id);
}
}
};
t.run();
t.join();
return returnValue[0];
}
}
}
......@@ -43,25 +43,25 @@ public class UIManager implements OnTouchListener {
private final int RAM_DELAY = 3000;
public Handler handler;
// usable stuff
protected Context mContext;
protected LinearLayout suggestionsView;
// this is for double tap
private DevicePolicyManager policy;
private ComponentName component;
private GestureDetector det;
private ExecInfo info;
// reference for open/close kb
private InputMethodManager imm;
// reference to MainManager's onCommand
private CommandExecuter trigger;
// my terminal
private TerminalAdapter mTerminalAdapter;
// last measured root height
private int lastMeasuredHeight;
// reference to views
private TextView ram;
// this is for RAM view
private ActivityManager.MemoryInfo memory;
private ActivityManager activityManager;
private Runnable ramRunnable = new Runnable() {
......@@ -285,8 +285,6 @@ public class UIManager implements OnTouchListener {
// call this to trigger a suggestion change
private void requestSuggestion(final String before, final String lastWord) {
suggestionsView.removeAllViews();
if (suggestionViewParams == null) {
suggestionViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
suggestionViewParams.setMargins(SkinManager.SUGGESTION_MARGIN, 0, SkinManager.SUGGESTION_MARGIN, 0);
......
......@@ -25,10 +25,10 @@ public class aliasfile implements CommandAbstraction {
@Override
public String exec(final ExecInfo info) throws Exception {
File tuiFolder = Tuils.getTuiFolder();
final File aliasFile = new File(tuiFolder, PreferencesManager.ALIASES_FILENAME);
final File aliasFile = new File(tuiFolder, PreferencesManager.ALIAS_FILENAME);
FileManager.openFile(info.context, aliasFile);
return info.res.getString(R.string.output_opening) + " " + PreferencesManager.ALIASES_FILENAME;
return info.res.getString(R.string.output_opening) + " " + PreferencesManager.ALIAS_FILENAME;
}
@Override
......
......@@ -10,6 +10,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import ohi.andre.comparestring.Compare;
import ohi.andre.consolelauncher.tuils.Tuils;
......@@ -160,7 +161,7 @@ public class FileManager {
return 0;
}
public static ArrayList<File> lsFile(File f, boolean showHidden) {
public static List<File> lsFile(File f, boolean showHidden) {
File[] content = f.listFiles();
Arrays.sort(content, new Comparator<File>() {
......@@ -175,7 +176,7 @@ public class FileManager {
}
});
ArrayList<File> files = new ArrayList<>();
List<File> files = new ArrayList<>();
for (File u : content)
if (!u.isHidden() || showHidden)
files.add(u);
......
......@@ -46,8 +46,11 @@ public class PreferencesManager {
public static final String USE_SYSTEMWP = "useSystemWallpaper";
public static final String FULLSCREEN = "fullscreen";
public static final String NOTIFICATION = "keepAliveWithNotification";
public static final String ALIASES_FILENAME = "alias.txt";
public static final String OPEN_KEYBOARD = "openKeyboardOnStart";
public static final String ALIAS_FILENAME = "alias.txt";
public static final int ALIAS = 11;
// settings version
private static final String SETTINGS_VERSION = "settingsVersion";
private List<String> settings;
......@@ -101,7 +104,7 @@ public class PreferencesManager {
name = SETTINGS_FILENAME;
break;
case PreferencesManager.ALIAS:
name = ALIASES_FILENAME;
name = ALIAS_FILENAME;
break;
default:
return null;
......
......@@ -79,8 +79,7 @@ public class SuggestionsManager {
Command cmd = null;
try {
cmd = CommandTuils.parse(before, info, true);
} catch (Exception e) {
}
} catch (Exception e) {}
if (cmd != null) {
if (cmd.cmd.maxArgs() == 1 && before.contains(" ")) {
......
......@@ -3,9 +3,11 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.hamsterksu:android-appversion-gradle-plugin:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment