diff --git a/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java b/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java
index 8057343..9e8138d 100644
--- a/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java
+++ b/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java
@@ -175,7 +175,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.O
int id = item.getItemId();
Fragment frag = null;
final FragmentManager manager = getSupportFragmentManager();
- final FragmentTransaction transaction = manager.beginTransaction();
+ FragmentTransaction transaction = manager.beginTransaction();
final Fragment old = manager.findFragmentById(R.id.fragment_container);
if(id == R.id.nav_devices) {
if(!(old instanceof USBListFragment)) {
@@ -200,6 +200,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.O
@Override
public void onEditPress(Long part_id) {
Fragment fragment = AddPartFragment.newInstance(part_id);
+ FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.fragment_container, fragment);
transaction.addToBackStack(null);
transaction.commit();
diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java
index 261ef57..8eb012b 100644
--- a/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java
+++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java
@@ -77,45 +77,45 @@ public class AddPartFragment extends Fragment {
final View v = inflater.inflate(R.layout.add_part, container, false);
EditText t = (EditText) v.findViewById(R.id.edit_part_id);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%08x",part.part_id).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%08x",part.part_id).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_flash_base_addr);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%08x",part.flash_base_addr).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%08x",part.flash_base_addr).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_flash_size);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%04x",part.flash_size).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%04x",part.flash_size).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_reset_vector_offset);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%02x",part.reset_vector_offset).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%02x",part.reset_vector_offset).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_ram_base_addr);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%08x",part.ram_base_addr).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%08x",part.ram_base_addr).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_ram_size);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%04x",part.ram_size).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%04x",part.ram_size).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_ram_buf_offset);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%03x",part.ram_buffer_offset).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%03x",part.ram_buffer_offset).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_ram_buf_size);
watchers.add(new HexaWatcher(t,this));
- t.setText(part != null ? "0x"+String.format("%03x",part.ram_buffer_size).toUpperCase() : "0x");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? "0x"+String.format("%03x",part.ram_buffer_size).toUpperCase() : "0x");
t = (EditText) v.findViewById(R.id.edit_part_name);
watchers.add(new EmptyWatcher(t,this));
- t.setText(part != null ? part.part_name : "");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? part.part_name : "");
t = (EditText) v.findViewById(R.id.edit_flash_nb_sector);
watchers.add(new EmptyWatcher(t,this));
- t.setText(part != null ? String.valueOf(part.flash_nb_sectors) : "");
t.addTextChangedListener(watchers.get(watchers.size()-1));
+ t.setText(part != null ? String.valueOf(part.flash_nb_sectors) : "");
Spinner s = (Spinner) v.findViewById(R.id.spinner_uuencode);
if(part != null)
@@ -195,7 +195,8 @@ public class AddPartFragment extends Fragment {
if (v == null)
v = getView();
boolean isValid = true;
- assert v != null;
+ if(v == null)
+ return;
EditText t = (EditText) v.findViewById(R.id.edit_part_id);
String hexa = t.getText().toString();
if(!hexa.matches("0x[0-9A-F]*"))
diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/Watcher.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/Watcher.java
index 15dbb4d..6d63889 100644
--- a/app/src/main/java/fr/mobdev/lpcprog/fragment/Watcher.java
+++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/Watcher.java
@@ -18,18 +18,22 @@
package fr.mobdev.lpcprog.fragment;
-import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
+import fr.mobdev.lpcprog.R;
+
class HexaWatcher implements TextWatcher {
private EditText v;
+ private Drawable orig;
private AddPartFragment fragment;
HexaWatcher(EditText view,AddPartFragment fragment) {
v = view;
this.fragment = fragment;
+ orig = v.getBackground();
}
@Override
@@ -46,9 +50,9 @@ class HexaWatcher implements TextWatcher {
public void afterTextChanged(Editable editable) {
String hexa = editable.toString();
if(!hexa.matches("0x[0-9A-F]+"))
- v.getBackground().setColorFilter(0xFFFF0000, PorterDuff.Mode.SRC);
+ v.setBackgroundResource(R.drawable.apptheme_edit_text_holo_light);
else
- v.getBackground().clearColorFilter();
+ v.setBackgroundDrawable(orig);
fragment.modifyBt(null);
}
}
@@ -57,9 +61,11 @@ class EmptyWatcher implements TextWatcher {
private EditText v;
private AddPartFragment fragment;
+ private Drawable orig;
EmptyWatcher(EditText view,AddPartFragment fragment) {
v = view;
this.fragment = fragment;
+ orig = v.getBackground();
}
@Override
@@ -75,6 +81,10 @@ class EmptyWatcher implements TextWatcher {
@Override
public void afterTextChanged(Editable editable) {
String data = editable.toString();
+ if(data.isEmpty())
+ v.setBackgroundResource(R.drawable.apptheme_edit_text_holo_light);
+ else
+ v.setBackgroundDrawable(orig);
fragment.modifyBt(null);
}
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/apptheme_textfield_activated_holo_light.9.png b/app/src/main/res/drawable-hdpi/apptheme_textfield_activated_holo_light.9.png
new file mode 100644
index 0000000..7a3c105
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/apptheme_textfield_activated_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-hdpi/apptheme_textfield_default_holo_light.9.png b/app/src/main/res/drawable-hdpi/apptheme_textfield_default_holo_light.9.png
new file mode 100644
index 0000000..dfe6381
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/apptheme_textfield_default_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_focused_holo_light.9.png b/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_focused_holo_light.9.png
new file mode 100644
index 0000000..a617c6d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_holo_light.9.png b/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_holo_light.9.png
new file mode 100644
index 0000000..c07e454
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/apptheme_textfield_disabled_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-hdpi/apptheme_textfield_focused_holo_light.9.png b/app/src/main/res/drawable-hdpi/apptheme_textfield_focused_holo_light.9.png
new file mode 100644
index 0000000..2fc9d7e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/apptheme_textfield_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-mdpi/apptheme_textfield_activated_holo_light.9.png b/app/src/main/res/drawable-mdpi/apptheme_textfield_activated_holo_light.9.png
new file mode 100644
index 0000000..2270255
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/apptheme_textfield_activated_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-mdpi/apptheme_textfield_default_holo_light.9.png b/app/src/main/res/drawable-mdpi/apptheme_textfield_default_holo_light.9.png
new file mode 100644
index 0000000..d71532b
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/apptheme_textfield_default_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_focused_holo_light.9.png b/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_focused_holo_light.9.png
new file mode 100644
index 0000000..81bf4a7
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_holo_light.9.png b/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_holo_light.9.png
new file mode 100644
index 0000000..0f6ecf3
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/apptheme_textfield_disabled_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-mdpi/apptheme_textfield_focused_holo_light.9.png b/app/src/main/res/drawable-mdpi/apptheme_textfield_focused_holo_light.9.png
new file mode 100644
index 0000000..45470af
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/apptheme_textfield_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/apptheme_textfield_activated_holo_light.9.png b/app/src/main/res/drawable-xhdpi/apptheme_textfield_activated_holo_light.9.png
new file mode 100644
index 0000000..91af119
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/apptheme_textfield_activated_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/apptheme_textfield_default_holo_light.9.png b/app/src/main/res/drawable-xhdpi/apptheme_textfield_default_holo_light.9.png
new file mode 100644
index 0000000..8d3f1e8
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/apptheme_textfield_default_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_focused_holo_light.9.png b/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_focused_holo_light.9.png
new file mode 100644
index 0000000..f4c5f39
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_holo_light.9.png b/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_holo_light.9.png
new file mode 100644
index 0000000..d49644b
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/apptheme_textfield_disabled_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/apptheme_textfield_focused_holo_light.9.png b/app/src/main/res/drawable-xhdpi/apptheme_textfield_focused_holo_light.9.png
new file mode 100644
index 0000000..f9ff9ad
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/apptheme_textfield_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/apptheme_textfield_activated_holo_light.9.png b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_activated_holo_light.9.png
new file mode 100644
index 0000000..27df819
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_activated_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/apptheme_textfield_default_holo_light.9.png b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_default_holo_light.9.png
new file mode 100644
index 0000000..93ce898
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_default_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_focused_holo_light.9.png b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_focused_holo_light.9.png
new file mode 100644
index 0000000..c5f0f2d
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_holo_light.9.png b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_holo_light.9.png
new file mode 100644
index 0000000..5d886a2
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_disabled_holo_light.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/apptheme_textfield_focused_holo_light.9.png b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_focused_holo_light.9.png
new file mode 100644
index 0000000..efeb1ce
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/apptheme_textfield_focused_holo_light.9.png differ
diff --git a/app/src/main/res/drawable/apptheme_edit_text_holo_light.xml b/app/src/main/res/drawable/apptheme_edit_text_holo_light.xml
new file mode 100644
index 0000000..26e8fbe
--- /dev/null
+++ b/app/src/main/res/drawable/apptheme_edit_text_holo_light.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/color.xml b/app/src/main/res/values/color.xml
index ba55cb6..6d56a1b 100644
--- a/app/src/main/res/values/color.xml
+++ b/app/src/main/res/values/color.xml
@@ -2,5 +2,5 @@
#000000
#000000
- #FFFFFF
+ #000000
\ No newline at end of file
diff --git a/app/src/main/res/values/colors_apptheme.xml b/app/src/main/res/values/colors_apptheme.xml
new file mode 100644
index 0000000..31e082d
--- /dev/null
+++ b/app/src/main/res/values/colors_apptheme.xml
@@ -0,0 +1,4 @@
+
+
+ #cc0000
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3ef9f16..c34a8e2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -36,15 +36,10 @@
- http://
- https://
- MainActivity
Open navigation drawer
Close navigation drawer
- Settings
-
-
- Hello blank fragment
Devices List
µC Definitions
µC Name
@@ -75,7 +70,7 @@
Copy file into Memory
Verify Checksum
Flash Binary
- Flash Suceed
+ Flash Succeed
Step
- Yes
diff --git a/build.gradle b/build.gradle
index 573f4fd..ef7ae5a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.1'
+ classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files