This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
24 additions
and
15 deletions.
There are no files selected for viewing
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,5 +1,8 @@ | ||
use android_properties::AndroidProperties; | ||
|
||
fn main() { | ||
for property in android_properties::prop_values() { | ||
println!("{}", property); | ||
let properties = AndroidProperties::new(); | ||
for property in properties.property_values() { | ||
println!("{:?}", properties.get(&property)); | ||
} | ||
} |
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,11 +1,14 @@ | ||
use android_properties::AndroidProperty; | ||
use android_properties::{AndroidProperties, AndroidProperty}; | ||
|
||
const HELLO_WORLD_PROPERTY: &str = "hello.world"; | ||
|
||
fn main() { | ||
let mut hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY); | ||
match hello_world.value() { | ||
Some(_value) => println!("{}", hello_world), | ||
let properties = AndroidProperties::new(); | ||
let hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY); | ||
properties.set(&hello_world, "bonjour").unwrap(); | ||
|
||
match properties.get(&hello_world) { | ||
Some(value) => println!("{:?}", value), | ||
None => println!("Property {} not found", hello_world.name()), | ||
}; | ||
} |
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,12 +1,15 @@ | ||
use android_properties::{setprop, AndroidProperty}; | ||
use android_properties::{AndroidProperties, AndroidProperty}; | ||
|
||
const HELLO_WORLD_PROPERTY: &str = "hello.world"; | ||
|
||
fn main() { | ||
setprop(HELLO_WORLD_PROPERTY, "initial value").expect("Cannot set android property"); | ||
let properties = AndroidProperties::new(); | ||
|
||
properties.set_property(HELLO_WORLD_PROPERTY, "initial value").expect("Cannot set android property"); | ||
|
||
let hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY); | ||
println!("Initial property: {}", hello_world); | ||
println!("Initial property: {:?}", properties.get(&hello_world)); | ||
|
||
setprop(HELLO_WORLD_PROPERTY, "refreshed value").expect("Cannot set android property"); | ||
println!("Refreshed property: {}", hello_world); | ||
properties.set_property(HELLO_WORLD_PROPERTY, "refreshed value").expect("Cannot set android property"); | ||
println!("Refreshed property: {:?}", properties.get(&hello_world)); | ||
} |
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,3 +1,6 @@ | ||
use android_properties::AndroidProperties; | ||
|
||
fn main() { | ||
android_properties::setprop("hello.world", "hello").expect("Cannot set android property"); | ||
let properties = AndroidProperties::new(); | ||
properties.set_property("hello.world", "hello").expect("Cannot set android property"); | ||
} |