-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from CCExtractor/master
implemented sort by size, implemented sort by time_stamp_added
- Loading branch information
Showing
15 changed files
with
312 additions
and
42 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
sdk.dir=C:\\Users\\Arshad\\AppData\\Local\\Android\\sdk | ||
flutter.sdk=C:\\flutter | ||
flutter.buildMode=debug | ||
flutter.versionName=1.0.0 | ||
flutter.versionCode=1 | ||
flutter.versionName=0.1.0 | ||
flutter.versionCode=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,93 @@ | ||
import 'package:deluge_client/core/all_acc.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class sort_helper { | ||
static bool reverse_order = false; | ||
static bool non_reverse_order = true; | ||
static Map<String, dynamic> sort(Map<String, dynamic> map) { | ||
|
||
static bool by_size_order = false; | ||
static bool by_date_time = false; | ||
static Map<String, dynamic> sort(Map<String, dynamic> map) { | ||
return Map.fromEntries(map.entries.toList().reversed); | ||
} | ||
static Map<multtorrent, dynamic> sort_for_multi(Map<multtorrent, dynamic>map) { | ||
|
||
|
||
static Map<multtorrent, dynamic> sort_for_multi( | ||
Map<multtorrent, dynamic> map) { | ||
return Map.fromEntries(map.entries.toList().reversed); | ||
} | ||
|
||
|
||
static Map<String, dynamic> sort_by_size(Map<String, dynamic> map) { | ||
List<map_as_list_view> mid_list = new List<map_as_list_view>(); | ||
map.entries.forEach((e) => | ||
mid_list.add(map_as_list_view(hash: e.key, properties: e.value))); | ||
mid_list.sort((a, b) => (a.properties['total_size'] ~/ 1000000) | ||
.compareTo(b.properties['total_size'] ~/ 1000000)); | ||
Map<String, dynamic> output_map = new Map<String, dynamic>(); | ||
mid_list.forEach((val) => output_map[val.hash] = val.properties); | ||
|
||
return output_map; | ||
} | ||
|
||
static Map<multtorrent, dynamic> sort_by_size_for_multi( | ||
Map<multtorrent, dynamic> map) { | ||
List<map_as_list_view_for_multi> mid_list = | ||
new List<map_as_list_view_for_multi>(); | ||
map.entries.forEach((e) => mid_list | ||
.add(map_as_list_view_for_multi(identity: e.key, properties: e.value))); | ||
mid_list.sort((a, b) => (a.properties['total_size'] ~/ 1000000) | ||
.compareTo(b.properties['total_size'] ~/ 1000000)); | ||
Map<multtorrent, dynamic> output_map = new Map<multtorrent, dynamic>(); | ||
mid_list.forEach((val) => output_map[val.identity] = val.properties); | ||
|
||
return output_map; | ||
} | ||
|
||
//-----------date and time comparision | ||
static Map<String, dynamic> sort_by_date_time(Map<String, dynamic> map) { | ||
final format = new DateFormat('dd-MM-yyyy hh:mm a'); | ||
final eta = new DateFormat('hh:mm'); | ||
List<map_as_list_view> mid_list = new List<map_as_list_view>(); | ||
map.entries.forEach((e) => | ||
mid_list.add(map_as_list_view(hash: e.key, properties: e.value))); | ||
mid_list.sort((a, b) => (format.format(DateTime.fromMillisecondsSinceEpoch( | ||
a.properties['time_added'] * 1000))) | ||
.compareTo(format.format(DateTime.fromMillisecondsSinceEpoch( | ||
b.properties['time_added'] * 1000)))); | ||
Map<String, dynamic> output_map = new Map<String, dynamic>(); | ||
mid_list.forEach((val) => output_map[val.hash] = val.properties); | ||
|
||
return output_map; | ||
} | ||
//-for multi | ||
static Map<multtorrent, dynamic> sort_by_date_time_for_multi( | ||
Map<multtorrent, dynamic> map) { | ||
final format = new DateFormat('dd-MM-yyyy hh:mm a'); | ||
final eta = new DateFormat('hh:mm'); | ||
|
||
List<map_as_list_view_for_multi> mid_list = | ||
new List<map_as_list_view_for_multi>(); | ||
map.entries.forEach((e) => mid_list | ||
.add(map_as_list_view_for_multi(identity: e.key, properties: e.value))); | ||
mid_list.sort((a, b) => (format.format(DateTime.fromMillisecondsSinceEpoch( | ||
a.properties['time_added'] * 1000))) | ||
.compareTo(format.format(DateTime.fromMillisecondsSinceEpoch( | ||
b.properties['time_added'] * 1000)))); | ||
Map<multtorrent, dynamic> output_map = new Map<multtorrent, dynamic>(); | ||
mid_list.forEach((val) => output_map[val.identity] = val.properties); | ||
|
||
return output_map; | ||
} | ||
|
||
} | ||
|
||
class map_as_list_view { | ||
String hash; | ||
Map<String, dynamic> properties; | ||
map_as_list_view({this.hash, this.properties}); | ||
} | ||
|
||
class map_as_list_view_for_multi { | ||
multtorrent identity; | ||
Map<String, dynamic> properties; | ||
map_as_list_view_for_multi({this.identity, this.properties}); | ||
} |
Oops, something went wrong.