mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
More of Lachezars changes to integrate support-v4 support
git-svn-id: https://zxing.googlecode.com/svn/trunk@2122 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
d4cd1c4b58
commit
6780eee869
|
@ -22,25 +22,67 @@
|
|||
|
||||
<target name="init">
|
||||
<tstamp/>
|
||||
<mkdir dir="build"/>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="init">
|
||||
<mkdir dir="build"/>
|
||||
<target name="build" depends="init,build.legacy,build.honeycomb,build.supportv4">
|
||||
</target>
|
||||
|
||||
<target name="build.legacy" depends="init">
|
||||
<mkdir dir="build/legacy"/>
|
||||
<javac srcdir="src"
|
||||
destdir="build"
|
||||
destdir="build/legacy"
|
||||
source="6"
|
||||
target="6"
|
||||
optimize="true"
|
||||
debug="true"
|
||||
deprecation="true"
|
||||
excludes="**/IntentIntegratorV30.java,**/IntentIntegratorSupportV4.java"
|
||||
includeantruntime="false">
|
||||
<classpath>
|
||||
<pathelement location="${android-home}/platforms/android-15/android.jar"/>
|
||||
<pathelement location="${android-home}/platforms/android-10/android.jar"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
<jar jarfile="android-integration.jar" basedir="build"/>
|
||||
<jar jarfile="android-integration.jar" basedir="build/legacy"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build.honeycomb" depends="init">
|
||||
<mkdir dir="build/honeycomb"/>
|
||||
<javac srcdir="src"
|
||||
destdir="build/honeycomb"
|
||||
source="6"
|
||||
target="6"
|
||||
optimize="true"
|
||||
debug="true"
|
||||
deprecation="true"
|
||||
excludes="**/IntentIntegratorSupportV4.java"
|
||||
includeantruntime="false">
|
||||
<classpath>
|
||||
<pathelement location="${android-home}/platforms/android-13/android.jar"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
<jar jarfile="android-integration-honeycomb.jar" basedir="build/honeycomb"/>
|
||||
</target>
|
||||
|
||||
<target name="build.supportv4" depends="init">
|
||||
<mkdir dir="build/supportv4"/>
|
||||
<javac srcdir="src"
|
||||
destdir="build/supportv4"
|
||||
source="6"
|
||||
target="6"
|
||||
optimize="true"
|
||||
debug="true"
|
||||
deprecation="true"
|
||||
excludes="**/IntentIntegratorV30.java"
|
||||
includeantruntime="false">
|
||||
<classpath>
|
||||
<pathelement location="${android-home}/platforms/android-10/android.jar"/>
|
||||
<pathelement location="${android-home}/extras/android/compatibility/v4/android-support-v4.jar"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
<jar jarfile="android-integration-supportv4.jar" basedir="build/supportv4"/>
|
||||
</target>
|
||||
|
||||
<target name="export" depends="build">
|
||||
<copy file="android-integration.jar" todir="../androidtest/libs"/>
|
||||
</target>
|
||||
|
@ -48,6 +90,8 @@
|
|||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
<delete file="android-integration.jar"/>
|
||||
<delete file="android-integration-honeycomb.jar"/>
|
||||
<delete file="android-integration-supportv4.jar"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -54,13 +54,25 @@
|
|||
</developers>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- I wish the project properties plugin could be used here -->
|
||||
<android-home>FILL IN YOUR PATH HERE</android-home>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>4.0.1.2</version>
|
||||
<version>3.0</version>
|
||||
<type>jar</type>
|
||||
<scope>system</scope>
|
||||
<systemPath>/${android-home}/platforms/android-13/android.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>support</artifactId>
|
||||
<type>jar</type>
|
||||
<version>v4</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>/${android-home}/extras/android/compatibility/v4/android-support-v4.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
@ -102,6 +114,47 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- By default exclude the Honeycomb and Support classes. -->
|
||||
<excludes>
|
||||
<exclude>**/IntentIntegratorV30*</exclude>
|
||||
<exclude>**/IntentIntegratorSupportV4*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<!-- Build a Honeycomb classifier and exclude the Support classes. -->
|
||||
<execution>
|
||||
<id>honeycomb</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classifier>honeycomb</classifier>
|
||||
<excludes>
|
||||
<exclude>**/IntentIntegratorSupportV4*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- Build a SupportV4 classifier and exclude the Honeycomb classes. -->
|
||||
<execution>
|
||||
<id>supportv4</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classifier>supportv4</classifier>
|
||||
<excludes>
|
||||
<exclude>**/IntentIntegratorV30*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2012 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.zxing.integration.android;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
/**
|
||||
* IntentIntegrator for the V4 Android compatibility package.
|
||||
*
|
||||
* @author Lachezar Dobrev
|
||||
*/
|
||||
public final class IntentIntegratorSupportV4 extends IntentIntegrator {
|
||||
|
||||
private final Fragment fragment;
|
||||
|
||||
/**
|
||||
* @param fragment Fragment to handle activity response.
|
||||
*/
|
||||
public IntentIntegratorSupportV4(Fragment fragment) {
|
||||
super(fragment.getActivity());
|
||||
this.fragment = fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startActivityForResult(Intent intent, int code) {
|
||||
fragment.startActivityForResult(intent, code);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue