Skip to content

Commit

Permalink
making UI more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Feb 28, 2024
1 parent a9a8f2c commit a53b803
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public class MainActivity extends AppCompatActivity implements ActivityCompat.On
public boolean headphoneWarning = true;
static Context context;
static MainActivity mainActivity;
ExtendedFloatingActionButton fab ;
Button hidePanel;
SwitchMaterial onOff = null ;
String exportFormat ;
TextView patchName, patchNo, patchDesc ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void onClick(View view) {
final int pluginID = plugins.get(holder.getAdapterPosition());
Log.d(TAG, "Adding plugin ID: " + pluginID) ;
mainActivity.addPluginToRack(pluginID);
mainActivity.hidePanel.performClick();
}
});

Expand Down
84 changes: 45 additions & 39 deletions app/src/main/java/com/shajikhan/ladspa/amprack/Rack.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.graphics.ColorFilter;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
Expand Down Expand Up @@ -236,41 +237,46 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
}

if (b) {
if (!mainActivity.isStoragePermissionGranted()) {
// requestReadStoragePermission();
mainActivity.requestWriteStoragePermission();

/*
if (!isStoragePermissionGranted()) {
Toast.makeText(getApplicationContext(),
"Permission denied. Recording features are disabled.",
Toast.LENGTH_LONG)
.show();
return ;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!mainActivity.isStoragePermissionGranted()) {
// requestReadStoragePermission();
mainActivity.requestWriteStoragePermission();

/*
if (!isStoragePermissionGranted()) {
Toast.makeText(getApplicationContext(),
"Permission denied. Recording features are disabled.",
Toast.LENGTH_LONG)
.show();
return ;
}
*/
} else {
// AudioEngine.setRecordingActive(b);
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy_HH.mm.ss");
Date date = new Date();
mainActivity.lastRecordedFileName = formatter.format(date);
mainActivity.lastRecordedFileName = mainActivity.dir.getAbsolutePath() + "/" + mainActivity.lastRecordedFileName ;
AudioEngine.setFileName(mainActivity.lastRecordedFileName);
switch (mainActivity.exportFormat) {
case "0":
default:
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".wav" ;
break ;
case "1":
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".ogg" ;
break ;
case "2":
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".mp3" ;
break ;
}

AudioEngine.toggleRecording(b);
mainActivity.recording = b ;
}
*/
} else {
// AudioEngine.setRecordingActive(b);
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy_HH.mm.ss");
Date date = new Date();
mainActivity.lastRecordedFileName = formatter.format(date);
mainActivity.lastRecordedFileName = mainActivity.dir.getAbsolutePath() + "/" + mainActivity.lastRecordedFileName ;
AudioEngine.setFileName(mainActivity.lastRecordedFileName);
switch (mainActivity.exportFormat) {
case "0":
default:
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".wav" ;
break ;
case "1":
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".ogg" ;
break ;
case "2":
mainActivity.lastRecordedFileName = mainActivity.lastRecordedFileName + ".mp3" ;
break ;
}

AudioEngine.toggleRecording(b);
mainActivity.recording = b ;
MainActivity.alert("Feature not supported", "Your device is too old to support this feature. Sorry.");
return ;
}
} else {
// mainActivity.lastRecordedFileName = AudioEngine.getRecordingFileName();
Expand All @@ -282,8 +288,8 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
}
});

ExtendedFloatingActionButton fab = view.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
mainActivity.fab = view.findViewById(R.id.fab);
mainActivity.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mainActivity.dataAdapter.plugins.size() > 1 && MainActivity.proVersion == false) {
Expand Down Expand Up @@ -640,8 +646,8 @@ public void onClick(View v) {

mainActivity. toggleMixer = mainActivity.findViewById(R.id.mixer_toggle);

Button hidePanel = mainActivity.findViewById(R.id.hide_panel);
hidePanel.setOnClickListener(new View.OnClickListener() {
mainActivity.hidePanel = mainActivity.findViewById(R.id.hide_panel);
mainActivity.hidePanel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mainActivity.toggleMixer.setChecked(!mainActivity.toggleMixer.isChecked());
Expand Down Expand Up @@ -788,7 +794,7 @@ public void onClick(View v) {

if (mainActivity.useTheme) {
mainActivity.skinEngine.cardText(mainActivity.patchDesc);
mainActivity.skinEngine.cardText(hidePanel);
mainActivity.skinEngine.cardText(mainActivity.hidePanel);
mainActivity.skinEngine.cardText(mainActivity.triggerRecordToggle);
mainActivity.toggleMixer.setCompoundDrawables(null,null,null,null);

Expand Down Expand Up @@ -841,7 +847,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
optionsBtn.setCompoundDrawables(null, null, null, null);
mainActivity.skinEngine.setLogo(mainActivity.findViewById(R.id.logo_img));

mainActivity.skinEngine.fab(fab, SkinEngine.Resize.Width, 1);
mainActivity.skinEngine.fab(mainActivity.fab, SkinEngine.Resize.Width, 1);

mainActivity.skinEngine.slider(mainActivity.inputVolume);
mainActivity.skinEngine.slider(mainActivity.outputVolume);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/rack.xml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
android:drawableLeft="@drawable/ic_baseline_keyboard_double_arrow_up_24"
android:layout_marginRight="10dp"
android:background="@color/fui_transparent"
android:text="Hide Panel"/>
android:text="Hide Mixer"/>
</LinearLayout>
</LinearLayout>

Expand Down

0 comments on commit a53b803

Please sign in to comment.