Commit 4781139d authored by Alan McNatty's avatar Alan McNatty
Browse files

Actual changes for previous post (issues 16, 17 and 18 + Japanese language...

Actual changes for previous post (issues 16, 17 and 18 + Japanese language support). User git issues again.
parent f13fec2e
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nz.net.catalyst.MaharaDroid"
android:versionCode="7"
android:versionName="1.7">
android:versionCode="8"
android:versionName="1.8">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="false" >
......
......@@ -2,14 +2,14 @@
<resources>
<string name="app_name">MaharaDroid</string>
<string name="artefacts_banner_text">Open source ePortfolios</string>
<string name="artefacts_banner_text">オープンソース eポートフォリオ</string>
<string name="artefacts_banner_text2">[mah-har-rah;verb]: to think, thinking, thought</string>
<string name="artefacts_no_saved_artefacts">保存されたアーティファクトはありません。</string>
<string name="options_menu_prefs">プリファレンス</string>
<string name="options_menu_deleteall">すべてを削除する</string>
<string name="options_menu_uploadall">すべてをアップロードする</string>
<string name="options_menu_viewsaved">アーティファクトを保存する</string>
<string name="options_menu_viewsaved">保存済みアーティファクト</string>
<string name="context_menu_upload">アップロード</string>
<string name="context_menu_view">表示</string>
......@@ -30,7 +30,7 @@
<string name="pref_upload_connection_key">upload.connection</string>
<string name="pref_upload_connection_title">接続タイプ</string>
<string name="pref_upload_connection_summary">アーティファクトのアップロードを以下の接続タイプに制限します (デフォルトはハンドセットの設定に依存します):</string>
<string name="pref_upload_connection_summary">アーティファクトのアップロードを選択した接続タイプに制限します (デフォルトはハンドセットの設定に依存します):</string>
<string-array name="pref_upload_connection_entry">
<item>デフォルト</item>
<item>WiFiのみ</item>
......@@ -46,7 +46,7 @@
<string name="pref_upload_folder_key">upload.folder</string>
<string name="pref_upload_folder_title">アップロードフォルダ</string>
<string name="pref_upload_folder_summary">あなたがアーティファクトをアップロードするベースフォルダを入力してください。</string>
<string name="pref_upload_folder_summary">あなたがアーティファクトをアップロードするベースフォルダを指定してください。</string>
<string name="pref_upload_folder_default">モバイルアップロード</string>
<string name="pref_upload_tags_key">upload.tags</string>
......
......@@ -31,12 +31,11 @@ Active text field border: #6398C1
<item name="android:paddingRight">5dp</item>
</style>
<style name="MaharaButton">
<item name="android:background">@drawable/button</item>
<item name="android:background">@drawable/button_state</item>
<item name="android:textColor">#fff</item>
<item name="android:padding">2dp</item>
<item name="android:layout_margin">2dp</item>
</style>
<style name="MaharaWindowTitleText" parent="android:TextAppearance.WindowTitle">
<item name="android:textSize">16dip</item>
<!--
......
......@@ -46,7 +46,7 @@ public class LogConfig {
* Rather than checking this directly, classes should use LogConfig.isDebug(TAG) to
* determine whether to log a DEBUG level.
*/
private static final boolean DEBUG = true;
private static final boolean DEBUG = false;
/**
* Whether the application should allow any tags to log at VERBOSE level.
......@@ -56,7 +56,7 @@ public class LogConfig {
* The Java compiler is unable to strip out calls to Log.isLoggable()
* (although, maybe the Dalvik compiler, or the JIT can ???)
*/
public static final boolean VERBOSE = true;
public static final boolean VERBOSE = false;
private static final int MAX_LOG_TAG_LENGTH = 23;
......
......@@ -59,17 +59,23 @@ public class Utils {
allowMobile = true;
ConnectivityManager cm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
int netType = info.getType();
if (netType == ConnectivityManager.TYPE_WIFI) {
if ( allowWiFi && info.isConnected() )
return true;
} else if (netType == ConnectivityManager.TYPE_MOBILE) {
if ( allowMobile && info.isConnected() )
return true;
if ( info != null ) {
int netType = info.getType();
if (netType == ConnectivityManager.TYPE_WIFI) {
if ( allowWiFi && info.isConnected() )
return true;
} else if (netType == ConnectivityManager.TYPE_MOBILE) {
if ( allowMobile && info.isConnected() )
return true;
}
} else {
// Assume we're a mobile (we're an Android after all)
return ( allowMobile );
}
return false;
}
public static String getFilePath(Context context, String u) {
......@@ -86,7 +92,12 @@ public class Utils {
if (cursor != null) {
if ( DEBUG ) Log.d(TAG, "cursor query succeeded");
cursor.moveToFirst();
file_path = cursor.getString(0);
try {
file_path = cursor.getString(0);
} catch ( android.database.CursorIndexOutOfBoundsException e ) {
if ( DEBUG ) Log.d(TAG, "couldn't get file_path from cursor");
return null;
}
cursor.close();
} else {
if ( DEBUG ) Log.d(TAG, "cursor query failed");
......
......@@ -107,6 +107,12 @@ public class ArtefactExpandableListAdapterActivity extends Activity implements O
artefactData.close();
super.onDestroy();
}
@Override
public void onPause() {
if ( artefactData != null )
artefactData.close();
super.onDestroy();
}
private Integer loadSavedArtefacts() {
Integer items = 0;
......@@ -120,7 +126,7 @@ public class ArtefactExpandableListAdapterActivity extends Activity implements O
Cursor cursor = db.query(ArtefactDataSQLHelper.TABLE, null, null, null, null,
null, null);
startManagingCursor(cursor);
//startManagingCursor(cursor);
while (cursor.moveToNext()) {
Long id = cursor.getLong(0);
......@@ -183,7 +189,7 @@ public class ArtefactExpandableListAdapterActivity extends Activity implements O
Cursor cursor = db.query(ArtefactDataSQLHelper.TABLE, null, null, null, null,
null, null);
startManagingCursor(cursor);
//startManagingCursor(cursor);
while (cursor.moveToNext()) {
Long id = cursor.getLong(0);
......
......@@ -99,6 +99,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
btnUpload = (Button)findViewById(R.id.btnUpload);
btnUpload.setOnClickListener(this);
btnSave = (Button)findViewById(R.id.btnSave);
btnSave.setOnClickListener(this);
......@@ -114,14 +115,14 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
checkAcceptanceOfConditions();
// Check data connection
if ( ! Utils.canUpload(this) ) {
btnUpload.setEnabled(false);
}
if ( ! Utils.canUpload(this) ) {
btnUpload.setEnabled(false);
}
logData = new ArtefactDataSQLHelper(this);
if ( m_extras.containsKey("artefact") ) {
if ( DEBUG ) Log.d(TAG, "Have a save artefact to upload");
if ( DEBUG ) Log.d(TAG, "Have a saved artefact to upload");
Artefact a = m_extras.getParcelable("artefact");
......@@ -176,7 +177,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
public void onResume(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkAcceptanceOfConditions();
checkAcceptanceOfConditions();
}
public void onClick(View v) {
......@@ -198,6 +199,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
}
private void InitiateUpload(boolean saveOnFail) {
if ( DEBUG ) Log.d(TAG, "initiate upload called.");
if ( ! checkAcceptanceOfConditions() ) {
return;
}
......@@ -210,6 +212,8 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
for ( int i = 0; i < uris.length; i++ ) {
String filename = Utils.getFilePath(this, uris[i]);
if ( DEBUG ) Log.d(TAG, "about to initiate upload of '" + filename + "'");
if (filename == null)
continue;
......@@ -276,7 +280,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
}
}
}
private void acceptConditions(Boolean accepted) {
btnUpload.setEnabled(accepted);
btnSave.setEnabled(accepted);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment