split sgvs before broadcast
This commit is contained in:
parent
6124ef25a4
commit
1f3c54eb73
1 changed files with 18 additions and 12 deletions
|
@ -46,23 +46,29 @@ public class BroadcastSgvs {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleNewSgv(JSONArray sgvs, Context context, boolean isDelta) {
|
public static void handleNewSgv(JSONArray sgvs, Context context, boolean isDelta) {
|
||||||
|
|
||||||
|
List<JSONArray> splitted = BroadcastTreatment.splitArray(sgvs);
|
||||||
|
for (JSONArray part : splitted) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("sgvs", sgvs.toString());
|
bundle.putString("sgvs", part.toString());
|
||||||
bundle.putBoolean("delta", isDelta);
|
bundle.putBoolean("delta", isDelta);
|
||||||
Intent intent = new Intent(Intents.ACTION_NEW_SGV);
|
Intent intent = new Intent(Intents.ACTION_NEW_SGV);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||||
bundle = new Bundle();
|
for (JSONArray part : splitted) {
|
||||||
bundle.putString("sgvs", sgvs.toString());
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("sgvs", part.toString());
|
||||||
bundle.putBoolean("delta", isDelta);
|
bundle.putBoolean("delta", isDelta);
|
||||||
intent = new Intent(Intents.ACTION_NEW_SGV);
|
Intent intent = new Intent(Intents.ACTION_NEW_SGV);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue