Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 691eb70

Browse files
committed
Implemented low-hanging #writeToParcel() methods.
1 parent 24567a7 commit 691eb70

File tree

13 files changed

+43
-12
lines changed

13 files changed

+43
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Added
1717

18+
- `android_content.ComponentName#writeToParcel()` method
19+
- `android_content.ContentValues#writeToParcel()` method
20+
- `android_graphics.Point#writeToParcel()` method
21+
- `android_graphics.PointF#writeToParcel()` method
22+
- `android_os.Parcel#writeArrayMap()` method
1823
- `android_os.Parcelable` mixin
1924

2025
## [0.7.0] - 2020-08-19

lib/src/app/exceptions.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import '../os/parcelable.dart' show Parcelable;
1313
/// entering authentication credentials, or granting access via other means.
1414
///
1515
/// See: https://developer.android.com/reference/android/app/AuthenticationRequiredException
16+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/AuthenticationRequiredException.java
1617
class AuthenticationRequiredException extends PlatformException
1718
with Parcelable {
1819

@@ -21,6 +22,6 @@ class AuthenticationRequiredException extends PlatformException
2122

2223
@override
2324
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
24-
throw UnimplementedError(); // TODO
25+
throw UnimplementedError(); // TODO: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/AuthenticationRequiredException.java#L79
2526
}
2627
}

lib/src/app/notification.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import 'notification_action.dart' show NotificationAction;
1616
/// notifications.
1717
///
1818
/// See: https://developer.android.com/reference/android/app/Notification
19+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/Notification.java
1920
class Notification with Parcelable {
2021
/// See: https://developer.android.com/reference/android/app/Notification#BADGE_ICON_LARGE
2122
static const int BADGE_ICON_LARGE = 2;
@@ -162,6 +163,6 @@ class Notification with Parcelable {
162163

163164
@override
164165
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
165-
throw UnimplementedError(); // TODO
166+
throw UnimplementedError(); // TODO: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/Notification.java#L1818
166167
}
167168
}

lib/src/app/wallpaper_colors.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import '../os/parcelable.dart' show Parcelable;
1010
/// Exposes the 3 most visually representative colors of a wallpaper.
1111
///
1212
/// See: https://developer.android.com/reference/android/app/WallpaperColors
13+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/WallpaperColors.java
1314
class WallpaperColors with Parcelable {
1415
/// The most visually representative color of the wallpaper.
1516
///
@@ -36,6 +37,6 @@ class WallpaperColors with Parcelable {
3637

3738
@override
3839
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
39-
throw UnimplementedError(); // TODO
40+
throw UnimplementedError(); // TODO: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/WallpaperColors.java#L281
4041
}
4142
}

lib/src/content/component_name.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '../os/parcelable.dart' show Parcelable;
66
/// Identifier for a specific application component that is available.
77
///
88
/// See: https://developer.android.com/reference/android/content/ComponentName
9+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/content/ComponentName.java
910
class ComponentName with Parcelable {
1011
/// The package name of this component.
1112
///
@@ -37,6 +38,7 @@ class ComponentName with Parcelable {
3738

3839
@override
3940
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
40-
throw UnimplementedError(); // TODO
41+
parcel.writeString(packageName);
42+
parcel.writeString(className);
4143
}
4244
}

lib/src/content/content_values.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ import '../os/parcelable.dart' show Parcelable;
77
/// process.
88
///
99
/// See: https://developer.android.com/reference/android/content/ContentValues
10+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/content/ContentValues.java
1011
class ContentValues with Parcelable {
1112
final Map<String, dynamic> map = const <String, dynamic>{};
1213

1314
/// Creates an empty set of values using the default initial size.
1415
///
1516
/// See: https://developer.android.com/reference/android/content/ContentValues#ContentValues()
16-
const ContentValues();
17+
ContentValues(); // FIXME: https://github.com/dart-lang/sdk/issues/40982
1718

1819
@override
1920
String get parcelableCreator => "android.content.ContentValues";
2021

2122
@override
2223
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
23-
throw UnimplementedError(); // TODO
24+
parcel.writeInt(map.length);
25+
parcel.writeArrayMap(map);
2426
}
2527
}

lib/src/content/intent.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import 'component_name.dart';
1818
/// description of an action to be performed.
1919
///
2020
/// See: https://developer.android.com/reference/android/content/Intent
21+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/content/Intent.java
2122
class Intent with Parcelable {
2223
static const MethodChannel _channel = MethodChannel('flutter_android/Intent');
2324

@@ -85,6 +86,6 @@ class Intent with Parcelable {
8586

8687
@override
8788
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
88-
throw UnimplementedError(); // TODO
89+
throw UnimplementedError(); // TODO: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/content/Intent.java#L10650
8990
}
9091
}

lib/src/graphics/bitmap.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import '../os/parcelable.dart' show Parcelable;
1010
/// Bitmap image.
1111
///
1212
/// See: https://developer.android.com/reference/android/graphics/Bitmap
13+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/graphics/java/android/graphics/Bitmap.java
1314
abstract class Bitmap with Parcelable {
1415
static Bitmap fromImage(final Image image) {
1516
return _ImageBitmap(image);

lib/src/graphics/point.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import '../os/parcelable.dart' show Parcelable;
88
/// [Point] holds two integer coordinates.
99
///
1010
/// See: https://developer.android.com/reference/android/graphics/Point
11+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/graphics/java/android/graphics/Point.java
1112
class Point extends math.Point<int> with Parcelable {
1213
Point([final int x = 0, final int y = 0]) : super(x, y);
1314

@@ -16,6 +17,7 @@ class Point extends math.Point<int> with Parcelable {
1617

1718
@override
1819
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
19-
throw UnimplementedError(); // TODO
20+
parcel.writeInt(x);
21+
parcel.writeInt(y);
2022
}
2123
}

lib/src/graphics/pointf.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import '../os/parcelable.dart' show Parcelable;
88
/// [PointF] holds two float coordinates.
99
///
1010
/// See: https://developer.android.com/reference/android/graphics/PointF
11+
/// See: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/graphics/java/android/graphics/PointF.java
1112
class PointF extends math.Point<double> with Parcelable {
1213
PointF([final double x = 0, final double y = 0]) : super(x, y);
1314

@@ -16,6 +17,7 @@ class PointF extends math.Point<double> with Parcelable {
1617

1718
@override
1819
void writeToParcel(final Parcel parcel, [final int flags = 0]) {
19-
throw UnimplementedError(); // TODO
20+
parcel.writeFloat(x);
21+
parcel.writeFloat(y);
2022
}
2123
}

0 commit comments

Comments
 (0)