Skip to content

Commit

Permalink
removed Log.d that occurred frequently
Browse files Browse the repository at this point in the history
hoping nothing breaks 🤞
  • Loading branch information
Shaji Khan committed Feb 28, 2024
1 parent 057cf16 commit b366b92
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 30 deletions.
35 changes: 26 additions & 9 deletions app/src/main/java/com/shajikhan/ladspa/amprack/DataAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
boolean isSpinner = false ;
boolean isBypass = false ;
if (string != null) {
/*
Log.d(TAG, "onBindViewHolder: control name: " + string +
" -> " + string.equalsIgnoreCase("bypass"));
*/

isBypass = string.equalsIgnoreCase("bypass") || string.contains("oggle");
}

Expand All @@ -157,25 +161,26 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

}

Log.d(TAG, "onBindViewHolder: loading plugin -> " + pluginName );
// Log.d(TAG, "onBindViewHolder: loading plugin -> " + pluginName );
if (mainActivity.ampModels.has(pluginName)) {
Log.d(TAG, "onBindViewHolder: found amp model " + pluginName);
// Log.d(TAG, "onBindViewHolder: found amp model " + pluginName);
JSONObject control ;
ArrayList <String> models = new ArrayList<>();
try {
control = mainActivity.ampModels.getJSONObject(pluginName) ;
if (control.has(String.valueOf(i))) {
Log.d(TAG, "onBindViewHolder: found control " + i);
// Log.d(TAG, "onBindViewHolder: found control " + i);
isSpinner = true ;
JSONArray modelsData = control.getJSONArray(String.valueOf(i));
for (int x_ = 0 ; x_ < modelsData.length() ; x_++) {
Log.d(TAG, "onBindViewHolder: " + modelsData.getString(x_));
// Log.d(TAG, "onBindViewHolder: " + modelsData.getString(x_));
models.add(modelsData.getString(x_));
}

} else {
}/* else {
Log.d(TAG, "onBindViewHolder: no control for " + i);
}
}*/

} catch (JSONException e) {
Log.e(TAG, "onBindViewHolder: error parsing amp model " + pluginName, e);
}
Expand All @@ -196,7 +201,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

ToggleButton bypass = new ToggleButton(mainActivity);
if (isBypass) {
Log.d(TAG, "onBindViewHolder: turning on bypass switch");
// Log.d(TAG, "onBindViewHolder: turning on bypass switch");
bypass.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Expand Down Expand Up @@ -321,10 +326,13 @@ public void onNothingSelected(AdapterView<?> adapterView) {
spinner.setLayoutParams(spinnerLayoutParams);
spinner.setSelection((int) slider.getValue());

/*
Log.d(TAG, "onBindViewHolder: " +
String.format("[%s] %f",
string,
slider.getValue()));
*/
if (slider.getValue() == 1f) {
bypass.setChecked(true);
} else
Expand Down Expand Up @@ -390,7 +398,7 @@ public void onTextChanged(CharSequence charSequence, int __i, int i1, int i2) {
float value = Float.parseFloat (charSequence.toString()) ;
final int _position = holder.getAdapterPosition(); ;
final int _i = finalI;
Log.d(TAG, "Changing plugin control " + string + " [" + _position + " : " + _i + "] to " + value) ;
// Log.d(TAG, "Changing plugin control " + string + " [" + _position + " : " + _i + "] to " + value) ;
AudioEngine.setPluginControl(_position, _i, value);
mainActivity.saveActivePreset();
}
Expand All @@ -414,18 +422,24 @@ public void afterTextChanged(Editable editable) {
break ;
}

/*
Log.d(TAG, "onBindViewHolder: " + String.format (
"row %s: %s", key, arrayList.toString()
));
*/

if (knobPos >= arrayList.length()) {
row ++ ;
/*
Log.d(TAG, "onBindViewHolder: " + String.format(
"knobpos %d > row length %d = %d",
knobPos, arrayList.length(), knobPos - arrayList.length()
));
*/
knobPos = knobPos - arrayList.length() ;
Log.d(TAG, "onBindViewHolder: knobpos truncated to " + knobPos);
// Log.d(TAG, "onBindViewHolder: knobpos truncated to " + knobPos);
continue;
}

Expand Down Expand Up @@ -480,10 +494,13 @@ public void afterTextChanged(Editable editable) {

mainActivity.skinEngine.rotary(rotarySeekbar, knobType, slider.getValueFrom(), slider.getValueTo(), slider.getValue());
knobsLayout.addView(layoutRotary);
/*
Log.d(TAG, "onBindViewHolder: " + String.format(
"Setting size for knob type %d", knobType
));
*/

LinearLayout.LayoutParams layoutParams ;
int w = 0;
switch (knobType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void savePreset(String name, String desc, boolean shared, Map values, Ale
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d(TAG, "DocumentSnapshot written with ID: " + documentReference.getId());
// Log.d(TAG, "DocumentSnapshot written with ID: " + documentReference.getId());
dialog.dismiss();
Toast.makeText(context,
"Patch saved successfully",
Expand Down Expand Up @@ -220,10 +220,13 @@ public void onSuccess(Object o) {
Log.d(TAG, document.getId() + " => " + document.getData());
Map preset = (Map) document.getData();
// Log.d(TAG, "onComplete: " + String.format("%s | %s", uid, preset.get("uid")));
/*
Log.d(TAG, "onComplete: " + String.format(
"preset: %s",
preset.toString()
));
*/
if (preset.get("uid") .equals(uid) && shared == true)
continue;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/shajikhan/ladspa/amprack/Rack.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
// do something with jsonObject here
String name = object.getString("name");
String id = object.getString("id");
Log.d(TAG, "[LV2 plugin]: " + name + ": " + id);
// Log.d(TAG, "[LV2 plugin]: " + name + ": " + id);
mainActivity.pluginDialogAdapter.addItem(Integer.parseInt(key), name, Integer.parseInt(id));
}
} catch (JSONException e) {
Expand Down
43 changes: 28 additions & 15 deletions app/src/main/java/com/shajikhan/ladspa/amprack/SkinEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ void button (Button button, Resize resize, float factor) {

void view (View _view, String category, String name, Resize resize, float factor) {
String filename = config.get(category).get(name) ;
Log.d(TAG, "view: " + String.format("setting background to %s", filename));
// Log.d(TAG, "view: " + String.format("setting background to %s", filename));
/*
if (filename .startsWith("#")) {
_view.setBackground(null);
Expand Down Expand Up @@ -1670,8 +1670,12 @@ void cardText (TextView textView) {

void card (View layout) {
int w = layout.getWidth(), h = layout.getHeight() ;
// Log.d(TAG, "card() called with: layout = [" + layout + "]" +
// String.format("\n%d x %d", w, h));
/*
Log.d(TAG, "card() called with: layout = [" + layout + "]" +
String.format("\n%d x %d", w, h));
*/

Bitmap topLeft = skinner.getBitmapFromAssets(0, -1, themeDir + config.get("card").get("top-left"));
Bitmap topRight = skinner.getBitmapFromAssets(0, -1, themeDir + config.get("card").get("top-right"));
Bitmap bottomLeft = skinner.getBitmapFromAssets(0, -1, themeDir + config.get("card").get("bottom-left"));
Expand Down Expand Up @@ -1844,9 +1848,12 @@ void rotary (RotarySeekbar seekBar, int knobSize, float min, float max, float va
seekBar.setMinValue(min);
seekBar.setValue(value);
seekBar.setRotation((float) value/max);
// Log.d(TAG, "rotary: " + String.format(
// "[%f %f]: %f (%f)", min, max, value, seekBar.valueToRotation()
/*
Log.d(TAG, "rotary: " + String.format(
"[%f %f]: %f (%f)", min, max, value, seekBar.valueToRotation()
));
*/
}

void getUriFileList (Uri uri) {
Expand All @@ -1857,21 +1864,27 @@ void getUriFileList (Uri uri) {
root = DocumentFile.fromTreeUri(mainActivity, uri);
DocumentFile [] files = root.listFiles() ;
for (DocumentFile file: files) {
// Log.d(TAG, "getUriFileList: " + String.format(
// "\t%s:\t%s",
// file.getName(),
// file.getUri()
// ));
/*
Log.d(TAG, "getUriFileList: " + String.format(
"\t%s:\t%s",
file.getName(),
file.getUri()
));
*/
themeFiles.put(file.getName(), file.getUri());
bitmaps.put(file.getName(), skinner.getBitmap(file.getUri()));
if (file.isDirectory()) {
DocumentFile [] _files = file.listFiles() ;
for (DocumentFile _file: _files) {
// Log.d(TAG, "getUriFileList: " + String.format(
// "\t%s:\t%s",
// _file.getName(),
// _file.getUri()
// ));
/*
Log.d(TAG, "getUriFileList: " + String.format(
"\t%s:\t%s",
_file.getName(),
_file.getUri()
));
*/
themeFiles.put(file.getName() + "/" + _file.getName(), _file.getUri());
bitmaps.put(file.getName() + "/" + _file.getName(), skinner.getBitmap(_file.getUri()));

Expand Down
14 changes: 10 additions & 4 deletions app/src/main/java/com/shajikhan/ladspa/amprack/Skinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ public class Skinner {
void init () {
mainActivity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
density = displayMetrics.scaledDensity;
/*
Log.d(TAG, "Skinner: "+ String.format(
"density: %f upscale factor: %f",
density,
UPSCALE_FACTOR
));
*/

}

Skinner (MainActivity _mainActivity) {
Expand All @@ -44,9 +47,9 @@ public int convertDpToPixel(float dp){
}

public Bitmap getBitmap (float x, float y, float width, float height, int resource) {
Log.d(TAG, String.format("getBitmap: %f , %f => %f x %f", x,y,width,height) );
// Log.d(TAG, String.format("getBitmap: %f , %f => %f x %f", x,y,width,height) );
Bitmap mBitmap = BitmapFactory.decodeResource(mainActivity.getResources(), resource) ;
Log.d(TAG, String.format("getBitmap: image dimensions: %d x %d", mBitmap.getWidth(), mBitmap.getHeight()));
// Log.d(TAG, String.format("getBitmap: image dimensions: %d x %d", mBitmap.getWidth(), mBitmap.getHeight()));
if (x + width > mBitmap.getWidth())
x = mBitmap.getWidth() - width ;
try {
Expand Down Expand Up @@ -104,9 +107,12 @@ public Bitmap getBitmapFromAssets (int width, int height, String filename) {
}

if (width == 0 || height == 0) {
/*
Log.d(TAG, "getBitmapFromAssets: returning " +
String.format ("[%s: %dx%d]",
filename, mBitmap.getWidth(), mBitmap.getHeight()));
*/
try {
if (assetFilename != null)
assetFilename.close();
Expand Down Expand Up @@ -140,7 +146,7 @@ public Bitmap getBitmapFromAssets (int width, int height, String filename) {
}

public Bitmap getBitmapFromAssets1 (float x, float y, float width, float height, String filename) {
Log.d(TAG, String.format("getBitmap: %f , %f => %f x %f", x,y,width,height) );
// Log.d(TAG, String.format("getBitmap: %f , %f => %f x %f", x,y,width,height) );
InputStream assetFilename ;
Bitmap mBitmap ;

Expand All @@ -155,7 +161,7 @@ public Bitmap getBitmapFromAssets1 (float x, float y, float width, float height,
if (width == -1) width = height * (mBitmap.getWidth() / mBitmap.getHeight());
if (height == -1) height = width * (mBitmap.getHeight() / mBitmap.getWidth());

Log.d(TAG, String.format("getBitmap: image dimensions: %d x %d", mBitmap.getWidth(), mBitmap.getHeight()));
// Log.d(TAG, String.format("getBitmap: image dimensions: %d x %d", mBitmap.getWidth(), mBitmap.getHeight()));
if (x + width > mBitmap.getWidth())
x = mBitmap.getWidth() - width ;
try {
Expand Down

0 comments on commit b366b92

Please sign in to comment.