Skip to content

Commit

Permalink
sort by creators
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Jul 6, 2024
1 parent 4df92a5 commit 173ed8e
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 8 deletions.
44 changes: 44 additions & 0 deletions app/src/main/assets/creator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"rakarrack": [
5001, 5002,5003,5004,5005,5006,5007,
5008,5009,5010,5011,5012,5013,5014,5015,
5016,5017,5018,5019,5020,5021,5022,5023,
5024,5025,5026,5027,5028,5029,5030,5031,
5032,5033,5034,5035,5036,5037,5038,5039,
5040,5041,5042,5043,5044,5045
],
"MDA": [
6001,6002,6003,6004,6005,6006,6007,
6008,6009,6010,6011,6012,6013,6014,6015,6016,
6017,6018,6019,6020,6021,6022,6023,6024,6025,
6026,6027,6028,6029,6030,6031,6032,6033,6034,
6035,6036
],
"Guitarix": [
7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042,4062,4061,4063,4064,4068,4066,4067,
8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047,8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097
],
"Steve Harris": [
1407,1895,1896,1897,1181,1433,1431,1432,1430,1195,1898,1899,1900,1438,1403,1913,1191,1213,1196,1413,1220,1440,1409,1914,1436,1908,1421,1422,1420,1419,1605,1188,1408,1881,1203,1198,1414,1406,1212,1401,1214,1412,1915,1428,
1190,1889,1887,1888,1411,1909,1404,1207,1886,1202,1402,1185,1186,1907,1901,1192,1418,1410,1437,1424,1439,1885,1429,1201,1217,1218,1219,1423,1910,1417,1208,1189,1187,1210,1211,1206,1204,1209,1405,1337,1905
],
"Tom Szilagyi": [8102,2146,2159,2147,2156,2143,2151,2141,2145,2155,2150,2154,2142,2149,2157,2144,2158,2148],
"Tim Goetze": [
2592,2601,2606,1767,1772,2598,1773,2594,2608,2609,2602,2586,1765,1778,1779,1795,1771,2603,2607,2588,2589
],
"Infamous": [
8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016
],
"Invada": [3308,3309,3311,3312,3302,3303,3304,3305,3301,3306,3307],
"GNUitar": [
8098,8099,8105,8106
],
"Richard Taylor": [9010,9005,9011,9016,9007,9003,9015,9006,9002,9021,9020,9001],
"Shaji": [8100],
"Steven Atkinson": [8101],
"AidaDSP": [8104],
"x42": [8107],
"Alexey Baranov": [8108],
"Tom Baran": [4262],
"Radiocicletta": [1981,1982]
}
2 changes: 1 addition & 1 deletion app/src/main/assets/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Neural Amp Modelling": [
8101, 8104
],
"Impulse Response": [1885],
"Impulse Response": [1885, 8108],
"Cabinet": [
2592, 2601, 2606, 2589, 15012, 8095, 8018, 24700, 7037, 5006, 5004,
6004,5033,4065,2603,2607,7033,7035,8027,8060,8092,7038,8029
Expand Down
54 changes: 53 additions & 1 deletion app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public class MainActivity extends AppCompatActivity implements ActivityCompat.On

private static final String CHANNEL_ID = "default";
Surface surface_ = null;
Spinner pluginDialogSortBy ;
public static TextView sampleRateLabel ;
public static ImageView latencyWarnLogo ;
public static LinearLayout srLayout; ;
Expand Down Expand Up @@ -232,7 +233,7 @@ enum RequestCode {
boolean running = false ;
long bootFinish = 0 ;
static boolean showIntro = false ;
static public JSONObject pluginCategories;
static public JSONObject pluginCategories, pluginCreators;
public Spinner pluginDialogCategorySpinner;
AudioDeviceInfo[] audioDevicesInput, audioDevicesOutput;
int defaultInputDevice = 0;
Expand Down Expand Up @@ -459,6 +460,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

pluginCategories = MainActivity.loadJSONFromAsset("plugins.json");
pluginCreators = MainActivity.loadJSONFromAsset("creator.json");
availablePlugins = ConnectGuitar.loadJSONFromAssetFile(this, "all_plugins.json");
availablePluginsLV2 = ConnectGuitar.loadJSONFromAssetFile(this, "lv2_plugins.json");
ampModels = ConnectGuitar.loadJSONFromAssetFile(this, "amps.json");
Expand Down Expand Up @@ -1991,6 +1993,14 @@ public void afterTextChanged(Editable editable) {
}
});

Button clear = linearLayoutPluginDialog.findViewById(R.id.search_clear);
clear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.setText("");
}
});

ToggleButton toggleButton = (ToggleButton) linearLayoutPluginDialog.findViewById(R.id.pl_favs);
toggleButton.setButtonDrawable(R.drawable.ic_baseline_favorite_border_24);
toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
Expand All @@ -2015,8 +2025,50 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

ArrayAdapter<String> categoriesDataAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, categories);

List <String> creators = new ArrayList<>();
keys = pluginCreators.keys();

while (keys.hasNext()) {
String key = keys.next();
Log.d(TAG, "pluginCreator: key " + key);
creators.add(key);
}

ArrayAdapter<String> creatorDataAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, creators);

String [] sortBy = {
"Category",
"Creator"
} ;

ArrayAdapter<String> sortByAdaptor = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, sortBy);

pluginDialogSortBy = (Spinner) linearLayoutPluginDialog.findViewById(R.id.sort_by);
pluginDialogSortBy.setAdapter(sortByAdaptor);

pluginDialogSortBy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
pluginDialogCategorySpinner.setAdapter(categoriesDataAdapter);
break;
case 1:
pluginDialogCategorySpinner.setAdapter(creatorDataAdapter);
break ;
}

}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});
// Drop down layout style - list view with radio button
sortByAdaptor.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
categoriesDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
creatorDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
pluginDialogCategorySpinner = (Spinner) linearLayoutPluginDialog.findViewById(R.id.plugin_types);
// attaching data adapter to spinner
pluginDialogCategorySpinner.setAdapter(categoriesDataAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ void filterByCategory (String category) {

JSONArray IDs = null;
try {
IDs = (JSONArray) MainActivity.pluginCategories.get(category);
if (mainActivity.pluginDialogSortBy.getSelectedItemPosition() == 0)
IDs = (JSONArray) MainActivity.pluginCategories.get(category);
else
IDs = (JSONArray) MainActivity.pluginCreators.get(category);
} catch (JSONException e) {
e.printStackTrace();
return;
Expand Down
25 changes: 20 additions & 5 deletions app/src/main/res/layout/load_plugin_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
android:hint="Search"
android:layout_height="wrap_content"/>

<Button
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/baseline_close_24"
android:id="@+id/search_clear"/>

<ToggleButton
android:layout_width="40dp"
android:layout_height="wrap_content"
Expand All @@ -77,13 +83,22 @@
android:elevation="20dp"
android:layout_margin="10dp"
android:orientation="horizontal">
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Type:"
android:paddingRight="10dp"
android:textColor="@color/white"
android:fontFamily="@font/comfortaa"/>
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gruppo"
android:text="Sort by"
android:textSize="12dp"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sort_by"/>

</LinearLayout>
<Spinner
android:layout_width="wrap_content"
android:id="@+id/plugin_types"
Expand Down

0 comments on commit 173ed8e

Please sign in to comment.