Commit e6a67a68 authored by Alan McNatty's avatar Alan McNatty
Browse files

Started working on 1.8 beta .. offline capability and some code rearranging

parent b802ed46
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nz.net.catalyst.MaharaDroid"
android:versionCode="6"
android:versionName="1.7">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
android:versionCode="7"
android:versionName="1.8">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true" >
<activity android:name=".MaharaDroid"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog">
<activity android:name=".ui.MaharaDroid"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......@@ -27,26 +27,27 @@
</intent-filter>
</activity>
<activity android:name=".ArtifactSettings" android:label="@string/artifactsettings">
<activity android:name=".ui.ArtifactSettingsActivity" android:label="@string/artifactsettings">
<intent-filter>
<action android:name="nz.net.catalyst.MaharaDroid.ArtifactSettings" />
<action android:name="nz.net.catalyst.MaharaDroid.ARTEFACTSETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".TransferProgress" android:label="@string/transferprogress">
<activity android:name=".ui.TransferProgress" android:label="@string/transferprogress">
<intent-filter>
<action android:name="nz.net.catalyst.MaharaDroid.TRANSFERPROGRESS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".ArtifactSendReceiver" android:icon="@drawable/icon" android:label="@string/app_name"
<activity android:name=".upload.ArtifactSenderActivity" android:icon="@drawable/icon" android:label="@string/app_name"
android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="application/*" />
......@@ -56,10 +57,12 @@
<data android:mimeType="text/xml" />
</intent-filter>
</activity>
<activity android:name=".EditPreferences"
android:label="@string/prefs_app_name" />
<activity android:name=".ui.EditPreferences"
android:label="@string/options_menu_prefs" />
<activity android:name=".ui.ArtefactExpandableListAdapterActivity"
android:label="@string/options_menu_viewsaved" />
<service android:name=".TransferService" android:label="@string/filetransfers"/>
<service android:name=".upload.TransferService" android:label="@string/filetransfers"/>
</application>
<!-- API Level 4 aka 1.6 required for multi-send support -->
<uses-sdk android:minSdkVersion="4" />
......
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/title"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="40dp"
android:singleLine="true"
android:gravity="left"
/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ArtifactTitleLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView android:text="@string/upload_title_label"
android:layout_width="50dip"
android:singleLine="false"
android:layout_height="wrap_content"
android:textStyle="bold"
style="@android:style/TextAppearance.Small">
</TextView>
<TextView
android:id="@+id/txtArtifactTitle"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Small">
</TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ArtifactDescriptionLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView android:text="@string/upload_description_label"
android:layout_width="50dip"
android:singleLine="false"
android:layout_height="wrap_content"
android:textStyle="bold"
style="@android:style/TextAppearance.Small">
</TextView>
<TextView android:id="@+id/txtArtifactDescription"
android:singleLine="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Small">
</TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView android:text="@string/upload_tags_label"
android:layout_width="50dip"
android:singleLine="false"
android:layout_height="wrap_content"
android:textStyle="bold"
style="@android:style/TextAppearance.Small">
</TextView>
<TextView android:id="@+id/txtArtifactTags"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Small">
</TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView android:text="@string/upload_time_label"
android:layout_width="50dip"
android:singleLine="false"
android:layout_height="wrap_content"
android:textStyle="bold"
style="@android:style/TextAppearance.Small">
</TextView>
<TextView android:id="@+id/txtArtifactTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Small">
</TextView>
</LinearLayout>
<TextView android:id="@+id/txtArtifactFilename"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
</TextView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<ExpandableListView android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:choiceMode="multipleChoice"
android:fastScrollEnabled="true"
/>
</LinearLayout>
\ No newline at end of file
......@@ -25,8 +25,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
>
</CheckBox>
/>
<TextView android:text="@string/upload_confirm_text"
android:id="@+id/txtArtifactConfirm"
......@@ -116,7 +115,6 @@
android:layout_height="wrap_content">
</EditText>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ArtifactSettingsButtonLayout"
......@@ -134,7 +132,14 @@
android:enabled="false"
>
</Button>
<Button android:text="@string/btnsave"
android:id="@+id/btnSave"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
>
</Button>
<Button android:text="@string/btncancellabel"
android:id="@+id/btnCancel"
android:layout_weight="1"
......@@ -143,6 +148,12 @@
</Button>
</LinearLayout>
<EditText android:text=""
android:id="@+id/txtArtifactId"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
</EditText>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dip"
>
<ImageView
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:src="@drawable/banner"
/>
<TextView android:text="Open source eportfolios"
android:layout_width="wrap_content"
android:singleLine="false"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_margin="5dp"
style="@android:style/TextAppearance.Large"
/>
<TextView android:text="[mah-har-rah;verb]: to think, thinking, thought"
android:layout_margin="5dp"
android:layout_width="fill_parent"
android:singleLine="false"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Small"
/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
......@@ -27,12 +27,14 @@
android:layout_toRightOf="@id/imgIcon"
android:gravity="center_horizontal"
android:id="@+id/prgNotification"
android:indeterminate="false"
android:progress="0"
android:max="100"
android:indeterminate="true"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:minHeight="20dip"
android:maxHeight="20dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal">
>
</ProgressBar>
</RelativeLayout>
......@@ -20,40 +20,22 @@
android:layout_height="fill_parent">
<TextView android:id="@+id/TransferPictureName"
android:text="Artefact"
android:text=""
android:gravity="bottom"
android:textSize="8pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<TextView android:id="@+id/TransferType"
android:text="Upload"
android:gravity="center_vertical"
android:padding="2dp"
android:textSize="6pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<TextView android:id="@+id/TransferPictureStatus"
android:text="Pending"
android:gravity="center_vertical"
android:padding="2dp"
android:textSize="6pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<ProgressBar android:id="@+id/TransferProgressBar"
android:indeterminate="false"
android:progress="0"
android:max="100"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="?android:attr/progressBarStyleHorizontal">
</ProgressBar>
android:indeterminateOnly="true"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:minHeight="20dip"
android:maxHeight="20dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/option_upload"
android:icon="@android:drawable/ic_menu_upload"
android:title="@string/options_menu_uploadall" />
<item android:id="@+id/option_delete"
android:icon="@android:drawable/ic_delete"
android:title="@string/options_menu_deleteall" />
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/context_upload"
android:icon="@android:drawable/ic_menu_upload"
android:title="@string/context_menu_upload" />
<item android:id="@+id/context_delete"
android:icon="@android:drawable/ic_delete"
android:title="@string/context_menu_delete" />
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/about"
android:icon="@android:drawable/ic_menu_info_details"
android:title="@string/pref_menu_about" />
<item android:id="@+id/option_pref"
android:icon= "@android:drawable/ic_menu_preferences"
android:title="@string/options_menu_prefs" />
<item android:id="@+id/view_saved_artefacts"
android:icon="@android:drawable/ic_menu_save"
android:title="@string/options_menu_viewsaved" />
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/about"
android:icon="@drawable/menu_info"
android:title="@string/pref_menu_about" />
<item android:id="@+id/reset"
android:icon="@drawable/menu_revert"
android:icon="@android:drawable/ic_menu_revert"
android:title="@string/pref_menu_reset" />
<item android:id="@+id/scan"
android:icon="@drawable/menu_scan"
android:icon="@android:drawable/ic_search_category_default"
android:title="@string/pref_menu_scan" />
</menu>
......@@ -2,7 +2,14 @@
<resources>
<string name="app_name">MaharaDroid</string>
<string name="startup_text">Welcome to MaharaDroid</string>
<string name="prefs_app_name">MaharaDroid Preferences</string>
<string name="options_menu_prefs">Preferences</string>
<string name="options_menu_deleteall">Delete All</string>
<string name="options_menu_uploadall">Upload All</string>
<string name="options_menu_viewsaved">Saved Artefacts</string>
<string name="context_menu_delete">Delete</string>
<string name="context_menu_upload">Upload</string>
<string name="pref_upload_url_key">upload.uri</string>
<string name="pref_upload_url_title">Upload URI</string>
......@@ -39,6 +46,7 @@
<string name="btnok">OK</string>
<string name="btnupload">Upload</string>
<string name="btnsave">Save</string>
<string name="btnsendlabel">Send</string>
<string name="btncancellabel">Cancel</string>
......@@ -50,6 +58,8 @@
<string name="uploadstarting">Your Upload is Starting</string>
<string name="uploadfinished">Your Upload is Finished</string>
<string name="uploadfailed">Upload failed</string>
<string name="savefailed">Save failed</string>
<string name="uploadsaved">Upload saved</string>
<string name="uploadnotavailable">Sorry you can only uploaded files as artefacts.</string>
<string name="uploadingartifact">Uploading Artefact</string>
<string name="uploading">Uploading</string>
......@@ -63,6 +73,7 @@
<string name="upload_title_label">Title:</string>
<string name="upload_description_label">Desc:</string>
<string name="upload_tags_label">Tag(s):</string>
<string name="upload_time_label">Saved:</string>
<string name="load_config_download_error">Sorry there was an error downloading the configuration file.</string>
<string name="load_config_error">Sorry there was an error parsing the configuration file.</string>
......
/*
* Copyright 2009 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.app.AlertDialog;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
/**
* <p>A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
* project's source code.</p>
*
* <h2>Initiating a barcode scan</h2>
*
* <p>Integration is essentially as easy as calling {@link #initiateScan(Activity)} and waiting
* for the result in your app.</p>
*
* <p>It does require that the Barcode Scanner application is installed. The
* {@link #initiateScan(Activity)} method will prompt the user to download the application, if needed.</p>
*
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
*
* <p>{@code
* public void onActivityResult(int requestCode, int resultCode, Intent intent) {
* IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
* if (scanResult != null) {
* // handle scan result
* }
* // else continue with any other code you need in the method
* ...
* }
* }</p>
*
* <p>This is where you will handle a scan result.
* Second, just call this in response to a user action somewhere to begin the scan process:</p>
*
* <p>{@code IntentIntegrator.initiateScan(yourActivity);}</p>
*
* <p>You can use {@link #initiateScan(Activity, CharSequence, CharSequence, CharSequence, CharSequence)} or
* {@link #initiateScan(Activity, int, int, int, int)} to customize the download prompt with
* different text labels.</p>
*
* <p>Note that {@link #initiateScan(Activity)} returns an {@link AlertDialog} which is non-null if the
* user was prompted to download the application. This lets the calling app potentially manage the dialog.
* In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()}
* method.</p>
*
* <h2>Sharing text via barcode</h2>
*
* <p>To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(Activity, CharSequence)}.</p>
*
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
*
* @author Sean Owen
* @author Fred Lin
* @author Isaac Potoczny-Jones
* @author Brad Drehmer
*/
public final class IntentIntegrator {
public static final int REQUEST_CODE = 0x0ba7c0de; // get it?
public static final String DEFAULT_TITLE = "Install Barcode Scanner?";
public static final String DEFAULT_MESSAGE =
"This application requires Barcode Scanner. Would you like to install it?";
public static final String DEFAULT_YES = "Yes";
public static final String DEFAULT_NO = "No";
// supported barcode formats
public static final String PRODUCT_CODE_TYPES = "UPC_A,UPC_E,EAN_8,EAN_13";
public static final String ONE_D_CODE_TYPES = PRODUCT_CODE_TYPES + ",CODE_39,CODE_93,CODE_128";
public static final String QR_CODE_TYPES = "QR_CODE";
public static final String ALL_CODE_TYPES = null;
private IntentIntegrator() {
}
/**
* See {@link #initiateScan(Activity, CharSequence, CharSequence, CharSequence, CharSequence)} --
* same, but uses default English labels.
*/
public static AlertDialog initiateScan(Activity activity) {
return initiateScan(activity, DEFAULT_TITLE, DEFAULT_MESSAGE, DEFAULT_YES, DEFAULT_NO);
}
/**
* See {@link #initiateScan(Activity, CharSequence, CharSequence, CharSequence, CharSequence)} --
* same, but takes string IDs which refer
* to the {@link Activity}'s resource bundle entries.
*/
public static AlertDialog initiateScan(Activity activity,
int stringTitle,
int stringMessage,
int stringButtonYes,
int stringButtonNo) {
return initiateScan(activity,
activity.getString(stringTitle),
activity.getString(stringMessage),
activity.getString(stringButtonYes),
activity.getString(stringButtonNo));
}
/**
* See {@link #initiateScan(Activity, CharSequence, CharSequence, CharSequence, CharSequence, CharSequence)} --
* same, but scans for all supported barcode types.
* @param stringTitle title of dialog prompting user to download Barcode Scanner
* @param stringMessage text of dialog prompting user to download Barcode Scanner
* @param stringButtonYes text of button user clicks when agreeing to download
* Barcode Scanner (e.g. "Yes")
* @param stringButtonNo text of button user clicks when declining to download
* Barcode Scanner (e.g. "No")
* @return an {@link AlertDialog} if the user was prompted to download the app,
* null otherwise
*/
public static AlertDialog initiateScan(Activity activity,
CharSequence stringTitle,
CharSequence stringMessage,
CharSequence stringButtonYes,
CharSequence stringButtonNo) {
return initiateScan(activity,
stringTitle,
stringMessage,
stringButtonYes,
stringButtonNo,
ALL_CODE_TYPES);
}
/**
* Invokes scanning.
*
* @param stringTitle title of dialog prompting user to download Barcode Scanner
* @param stringMessage text of dialog prompting user to download Barcode Scanner
* @param stringButtonYes text of button user clicks when agreeing to download
* Barcode Scanner (e.g. "Yes")
* @param stringButtonNo text of button user clicks when declining to download
* Barcode Scanner (e.g. "No")
* @param stringDesiredBarcodeFormats a comma separated list of codes you would
* like to scan for.
* @return an {@link AlertDialog} if the user was prompted to download the app,