confetti 0.9.18 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.9.17)
4
+ confetti (0.9.18)
5
5
  mustache (~> 0.11.2)
6
6
 
7
7
  GEM
@@ -2,7 +2,7 @@ module Confetti
2
2
  class Config
3
3
  class Image
4
4
  attr_accessor :src, :width, :height, :extras,
5
- :role, :platform, :main, :density, :state
5
+ :role, :platform, :main, :density, :state, :keep_original
6
6
 
7
7
  def initialize *args
8
8
  @src = args.shift
@@ -18,6 +18,7 @@ module Confetti
18
18
  @main = @extras['main']
19
19
  @density = @extras['density']
20
20
  @state = @extras['state']
21
+ @keep_original = @extras['keepOriginal']
21
22
  end
22
23
 
23
24
  def defined_attrs
@@ -29,7 +30,8 @@ module Confetti
29
30
  "gap:platform" => @platform,
30
31
  "gap:main" => @main,
31
32
  "gap:density" => @density,
32
- "gap:state" => @state
33
+ "gap:state" => @state,
34
+ "gap:keepOriginal" => @keep_original
33
35
  }
34
36
  end
35
37
  end
@@ -27,7 +27,8 @@
27
27
  android:debuggable="true" android:hardwareAccelerated="true">
28
28
  <activity android:name=".{{ class_name }}"
29
29
  android:screenOrientation="{{ app_orientation }}"
30
- android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
30
+ android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
31
+ android:windowSoftInputMode="{{ window_soft_input_mode }}">
31
32
  <intent-filter>
32
33
  <action android:name="android.intent.action.MAIN" />
33
34
  <category android:name="android.intent.category.LAUNCHER" />
@@ -38,6 +39,6 @@
38
39
  </intent-filter>
39
40
  </activity>
40
41
  </application>
41
- <uses-sdk android:minSdkVersion="{{ min_sdk_version }}" {{{ max_sdk_version_attribute }}}/>
42
+ <uses-sdk android:minSdkVersion="{{ min_sdk_version }}" {{{ max_sdk_version_attribute }}}{{{ target_sdk_version_attribute }}}/>
42
43
 
43
44
  </manifest>
@@ -103,10 +103,24 @@ module Confetti
103
103
  choice = @config.preference("android-maxSdkVersion")
104
104
 
105
105
  if int_value?(choice)
106
- "android:maxSdkVersion=\"#{ choice }\""
106
+ "android:maxSdkVersion=\"#{ choice }\" "
107
107
  end
108
108
  end
109
109
 
110
+ def target_sdk_version_attribute
111
+ choice = @config.preference("android-targetSdkVersion")
112
+
113
+ if int_value?(choice)
114
+ "android:targetSdkVersion=\"#{ choice }\" "
115
+ end
116
+ end
117
+
118
+ def window_soft_input_mode
119
+ choice = @config.preference("android-windowSoftInputMode").to_s
120
+
121
+ choice == "" ? "stateUnspecified|adjustUnspecified" : choice
122
+ end
123
+
110
124
  def int_value? val
111
125
  return if val.nil?
112
126
 
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.9.18"
2
+ VERSION = "0.9.19"
3
3
  end
@@ -20,7 +20,8 @@
20
20
  android:debuggable="true" android:hardwareAccelerated="true">
21
21
  <activity android:name=".ConfettiBareApp"
22
22
  android:screenOrientation="unspecified"
23
- android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
23
+ android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
24
+ android:windowSoftInputMode="stateUnspecified|adjustUnspecified">
24
25
  <intent-filter>
25
26
  <action android:name="android.intent.action.MAIN" />
26
27
  <category android:name="android.intent.category.LAUNCHER" />
@@ -26,7 +26,8 @@
26
26
  android:debuggable="true" android:hardwareAccelerated="true">
27
27
  <activity android:name=".ConfettiSampleApp"
28
28
  android:screenOrientation="unspecified"
29
- android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
29
+ android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
30
+ android:windowSoftInputMode="stateUnspecified|adjustUnspecified">
30
31
  <intent-filter>
31
32
  <action android:name="android.intent.action.MAIN" />
32
33
  <category android:name="android.intent.category.LAUNCHER" />
@@ -24,7 +24,8 @@
24
24
  android:debuggable="true" android:hardwareAccelerated="true">
25
25
  <activity android:name=".AwesomeApp"
26
26
  android:screenOrientation="unspecified"
27
- android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
27
+ android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
28
+ android:windowSoftInputMode="stateUnspecified|adjustUnspecified">
28
29
  <intent-filter>
29
30
  <action android:name="android.intent.action.MAIN" />
30
31
  <category android:name="android.intent.category.LAUNCHER" />
@@ -24,4 +24,5 @@
24
24
 
25
25
  <preference name="android-minSdkVersion" value="8" />
26
26
  <preference name="android-maxSdkVersion" value="10" />
27
+ <preference name="android-targetSdkVersion" value="9" />
27
28
  </widget>
@@ -227,7 +227,7 @@ describe Confetti::Template::AndroidManifest do
227
227
 
228
228
  it "should return that number" do
229
229
  @sdk_pref.value = "12"
230
- @template.max_sdk_version_attribute.should == 'android:maxSdkVersion="12"'
230
+ @template.max_sdk_version_attribute.should == 'android:maxSdkVersion="12" '
231
231
  end
232
232
 
233
233
  it "should be nil if not a number" do
@@ -251,6 +251,70 @@ describe Confetti::Template::AndroidManifest do
251
251
  end
252
252
  end
253
253
 
254
+ describe "#target_sdk_version_attribute" do
255
+ before do
256
+ @config = Confetti::Config.new
257
+ @template = @template_class.new(@config)
258
+ end
259
+
260
+ it "should default to nil" do
261
+ @template.target_sdk_version_attribute.should be_nil
262
+ end
263
+
264
+ describe "when set" do
265
+ before do
266
+ @sdk_pref = Confetti::Config::Preference.new "android-targetSdkVersion"
267
+ @config.preference_set << @sdk_pref
268
+ end
269
+
270
+ it "should return that number" do
271
+ @sdk_pref.value = "12"
272
+ @template.target_sdk_version_attribute.should == 'android:targetSdkVersion="12" '
273
+ end
274
+
275
+ it "should be nil if not a number" do
276
+ @sdk_pref.value = "twelve"
277
+ @template.target_sdk_version_attribute.should be_nil
278
+ end
279
+ end
280
+
281
+ describe "output" do
282
+ before do
283
+ path = "#{ fixture_dir }/config_with_android_versions.xml"
284
+ @config = Confetti::Config.new(path)
285
+ @template = @template_class.new(@config)
286
+ end
287
+
288
+ it "should write the attributes correctly" do
289
+ rendered = @template.render
290
+ rendered.should match 'android:targetSdkVersion="9"'
291
+ end
292
+ end
293
+ end
294
+
295
+ describe "#window_soft_input_mode" do
296
+ before do
297
+ @config = Confetti::Config.new
298
+ @template = @template_class.new(@config)
299
+ end
300
+
301
+ it "should default to 'internalOnly' do" do
302
+ @template.window_soft_input_mode.should == "stateUnspecified|adjustUnspecified"
303
+ end
304
+
305
+ describe "when set" do
306
+ before do
307
+ @install_pref = Confetti::Config::Preference.new "android-windowSoftInputMode"
308
+ @config.preference_set << @install_pref
309
+ end
310
+
311
+ it "should use 'auto' when set to 'auto'" do
312
+ @install_pref.value = "stateVisible|adjustResize"
313
+ @template.window_soft_input_mode.should == "stateVisible|adjustResize"
314
+ end
315
+ end
316
+ end
317
+
254
318
  describe "version_code" do
255
319
  before do
256
320
  @config = Confetti::Config.new
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confetti
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 18
10
- version: 0.9.18
9
+ - 19
10
+ version: 0.9.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Lunny
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2013-09-09 00:00:00 Z
20
+ date: 2013-09-24 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: mustache