22
33import static de .kaiserdragon .iconrequest .BuildConfig .DEBUG ;
44import static de .kaiserdragon .iconrequest .helper .CommonHelper .makeToast ;
5+ import static de .kaiserdragon .iconrequest .helper .SettingsHelper .loadDataBool ;
56
67import android .content .ClipData ;
78import android .content .ClipboardManager ;
@@ -124,6 +125,8 @@ public static String[] actionSave(AppAdapter adapter, Boolean updateOnly, Contex
124125 ByteArrayOutputStream BaOs = new ByteArrayOutputStream ();
125126 ZipOutputStream zos = new ZipOutputStream (BaOs );
126127
128+ boolean excludeAppfilterLines = loadDataBool ("exclude_appfilter_line" ,context );
129+
127130 ArrayList <AppInfo > arrayList = adapter .getAllSelected ();
128131 if (arrayList .isEmpty ()) {
129132 // no apps are selected
@@ -135,14 +138,15 @@ public static String[] actionSave(AppAdapter adapter, Boolean updateOnly, Contex
135138 StringBuilder stringBuilderXML = new StringBuilder ();
136139 stringBuilderEmail .append (context .getString (R .string .request_email_text ));
137140 ArrayList <String > LabelList = new ArrayList <>();
138- stringBuilderXML .append ("<appfilter>\n \n " );
141+ if (! excludeAppfilterLines ) stringBuilderXML .append ("<appfilter>\n \n " );
139142 // process selected apps
140143 for (int i = 0 ; i < arrayList .size (); i ++) {
141144 //if (arrayList.get(i).selected) {
142145 String iconName = arrayList .get (i ).label .replaceAll ("[^a-zA-Z0-9 ]+" , "" ).replaceAll ("[ ]+" , "_" ).toLowerCase ();
143146 if (DEBUG ) Log .i (TAG , "iconName: " + iconName );
144147 if (!updateOnly ) {
145148 //if a name is a duplicate rename 1 so nothing gets replaced while saving
149+ //check if icon is in an arraylist if not add else rename and check again
146150 int n = 0 ;
147151 while (LabelList .contains (iconName )) {
148152 n ++;
@@ -165,12 +169,12 @@ public static String[] actionSave(AppAdapter adapter, Boolean updateOnly, Contex
165169
166170 }
167171 if (DEBUG ) Log .i (TAG , "iconName: " + iconName );
168- //check if icon is in an arraylist if not add else rename and check again
172+ if ( i != 0 ) stringBuilderXML . append ( " \n \n " );
169173 stringBuilderEmail .append (arrayList .get (i ).label ).append ("\n " );
170- stringBuilderXML . append ( " \t <!-- " ). append (arrayList .get ( i ). label ) .append (" --> \n \t <item component= \" ComponentInfo{" ).append (arrayList .get (i ).getCode ()) .append ("} \" drawable= \" " ). append ( iconName ). append ( " \" />" ). append ( " \n \n " );
171-
174+ if (! (arrayList .size ()<= 1 && excludeAppfilterLines )) stringBuilderXML .append ("\t <!-- " ).append (arrayList .get (i ).label ) .append (" --> \n \t " );
175+ stringBuilderXML . append ( "<item component= \" ComponentInfo{" ). append ( arrayList . get ( i ). getCode ()). append ( "} \" drawable= \" " ). append ( iconName ). append ( " \" />" );
172176 }
173- stringBuilderXML .append ("</appfilter>" );
177+ if (! excludeAppfilterLines ) stringBuilderXML .append ("\n \n </appfilter>" );
174178 // }
175179 SimpleDateFormat date = new SimpleDateFormat ("ddMMyyyy_HHmmss" , Locale .US );
176180 String zipName = date .format (new Date ());
0 commit comments