index, String s)
return sb.toString();
}
+
+ @Override
+ public void finish()
+ {
+ dbHelper.close();
+ super.finish();
+ }
public static String postFormDataToUrl(String url, String data) throws Exception
{
InputStream is = null;
@@ -1155,7 +1155,6 @@ public void onInitializationFailure(Provider arg0,
YouTubeInitializationResult arg1) {
// TODO Auto-generated method stub
Toast.makeText(this, arg1.toString(), Toast.LENGTH_LONG).show();
-
}
@Override
diff --git a/src/usbong/android/questionloader/ParseToUnicode.java b/src/usbong/android/questionloader/ParseToUnicode.java
new file mode 100644
index 0000000..acbe3cf
--- /dev/null
+++ b/src/usbong/android/questionloader/ParseToUnicode.java
@@ -0,0 +1,84 @@
+package usbong.android.questionloader;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+
+/**
+ * Operations on char primitives and Character objects.
+ *
+ * This class tries to handle null input gracefully.
+ * An exception will not be thrown for a null input.
+ * Each method documents its behaviour in more detail.
+ *
+ * @author Stephen Colebourne
+ * @since 2.1
+ * @version $Id: CharUtils.java 437554 2006-08-28 06:21:41Z bayard $
+ */
+public class ParseToUnicode {
+
+ //--------------------------------------------------------------------------
+ /**
+ * Converts the string to the unicode format '\u0020'.
+ *
+ * This format is the Java source code format.
+ *
+ *
+ * CharUtils.unicodeEscaped(' ') = "\u0020"
+ * CharUtils.unicodeEscaped('A') = "\u0041"
+ *
+ *
+ * @param ch the character to convert
+ * @return the escaped unicode string
+ */
+ public static String unicodeEscaped(char ch) {
+ if (ch < 0x10) {
+ return "\\u000" + Integer.toHexString(ch);
+ } else if (ch < 0x100) {
+ return "\\u00" + Integer.toHexString(ch);
+ } else if (ch < 0x1000) {
+ return "\\u0" + Integer.toHexString(ch);
+ }
+ return "\\u" + Integer.toHexString(ch);
+ }
+
+ /**
+ * Converts the string to the unicode format '\u0020'.
+ *
+ * This format is the Java source code format.
+ *
+ * If null is passed in, null will be returned.
+ *
+ *
+ * CharUtils.unicodeEscaped(null) = null
+ * CharUtils.unicodeEscaped(' ') = "\u0020"
+ * CharUtils.unicodeEscaped('A') = "\u0041"
+ *
+ *
+ * @param ch the character to convert, may be null
+ * @return the escaped unicode string, null if null input
+ */
+ public static String unicodeEscaped(Character ch) {
+ if (ch == null) {
+ return null;
+ }
+ return unicodeEscaped(ch.charValue());
+ }
+
+
+
+}
diff --git a/src/usbong/android/questionloader/ResultPage.java b/src/usbong/android/questionloader/ResultPage.java
index 861c251..4951db7 100644
--- a/src/usbong/android/questionloader/ResultPage.java
+++ b/src/usbong/android/questionloader/ResultPage.java
@@ -139,9 +139,9 @@ public void onClick(DialogInterface dialog, int id) {
public void back(View view)
{
- Intent intent = new Intent(ResultPage.this, SongSelection.class);
- intent.putExtra("language", language);
- startActivity(intent);
+ //Intent intent = new Intent(ResultPage.this, SongSelection.class);
+ //intent.putExtra("language", language);
+ //startActivity(intent);
ResultPage.this.finish();
}
diff --git a/src/usbong/android/questionloader/ReviewPage.java b/src/usbong/android/questionloader/ReviewPage.java
index d5215cd..cbbe69c 100644
--- a/src/usbong/android/questionloader/ReviewPage.java
+++ b/src/usbong/android/questionloader/ReviewPage.java
@@ -125,8 +125,8 @@ public void exitReviewPage(View view)
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
- Intent intent = new Intent(ReviewPage.this, MainMenuActivity.class);
- startActivity(intent);
+ //Intent intent = new Intent(ReviewPage.this, MainMenuActivity.class);
+ //startActivity(intent);
ReviewPage.this.finish();
}
})
diff --git a/src/usbong/android/questionloader/SettingSelection.java b/src/usbong/android/questionloader/SettingSelection.java
index ddc60c2..3a24102 100644
--- a/src/usbong/android/questionloader/SettingSelection.java
+++ b/src/usbong/android/questionloader/SettingSelection.java
@@ -115,7 +115,7 @@ public void exitSettingSelection(View view)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Exiting...");
- builder.setMessage("Are you sure you want to return to Main Menu?")
+ builder.setMessage("Are you sure you want to return to Song Selection?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
diff --git a/src/usbong/android/questionloader/SongSelection.java b/src/usbong/android/questionloader/SongSelection.java
index a9e0822..3db26c9 100644
--- a/src/usbong/android/questionloader/SongSelection.java
+++ b/src/usbong/android/questionloader/SongSelection.java
@@ -16,6 +16,7 @@
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.Display;
@@ -40,7 +41,7 @@ public class SongSelection extends ListActivity {
Button review;
Resources myRes;
Drawable myDrawableImage;
-
+ View selected = null;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -68,6 +69,8 @@ protected void onCreate(Bundle savedInstanceState) {
//System.out.println(Arrays.toString(fileList));
ListView list = getListView();
+ list.setDividerHeight(0);
+ //list.setDivider(new ColorDrawable(0xFF613318));
//added by Mike, 12 June 2015
list.setCacheColorHint(0);
// list.setBackgroundResource(R.drawable.japanbanner);
@@ -91,8 +94,6 @@ else if (language.equalsIgnoreCase("Korean"))
list.addHeaderView(v);
list.setBackgroundColor(Color.parseColor("#FFFFFF")); //6f5c44 36342a
- list.setDividerHeight(10);
- list.setDivider(new ColorDrawable(0x00613318));
list.setOnItemClickListener(new OnItemClickListener() {
@Override
@@ -100,7 +101,8 @@ public void onItemClick(AdapterView> arg0, View arg1,
int position, long id) {
if(position!=0)
{
- //arg1.setBackgroundColor(Color.parseColor("#4e4b3c"));
+ arg1.setBackgroundColor(Color.parseColor("#BDD09F"));
+ selected = arg1;
// TODO Auto-generated method stub
TextView textPlaceHolder = (TextView) arg1.findViewById(R.id.textViewPlaceHolder);
//System.out.println(text.getText());
@@ -236,8 +238,9 @@ public View getView(int position, View convertView, ViewGroup arg2) {
*//*
ImageView banner_image = (ImageView) view.findViewById(R.id.banner_imageView);
*/
-
- TextView text = (TextView) view.findViewById(R.id.textView1);
+
+ TextView text = (TextView) view.findViewById(R.id.textView1);
+ TextView artist = (TextView) view.findViewById(R.id.textView2);
TextView textPlaceHolder = (TextView) view.findViewById(R.id.textViewPlaceHolder);
@@ -252,7 +255,8 @@ public View getView(int position, View convertView, ViewGroup arg2) {
InputStream is = getResources().getAssets().open(language+"/" + fileList[position]);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String currentLine=br.readLine();
- text.setText(currentLine+"\n"+br.readLine());
+ text.setText(currentLine);
+ artist.setText(br.readLine());
/*
String currentLine;
while((currentLine=br.readLine())!=null){
@@ -263,9 +267,14 @@ public View getView(int position, View convertView, ViewGroup arg2) {
catch(Exception e) {
e.printStackTrace();
}
-
return view;
}
-
}
+ @Override
+ protected void onStart()
+ {
+ super.onStart();
+ if (selected!=null)
+ selected.setBackgroundColor(Color.parseColor("#ffffff"));
+ }
}