Permalink
Browse files

alignment

  • Loading branch information...
1 parent cb3b6c2 commit 2f7ef76384a37d100bbaf6b7e8cf8efe38dd1af3 @jyothsnayekkanti committed Mar 17, 2012
View
@@ -47,7 +47,7 @@
}
public static final class id {
public static final int aboutSearchType=0x7f080026;
- public static final int aboutSortType=0x7f080041;
+ public static final int aboutSortType=0x7f08003f;
public static final int animateButton=0x7f080000;
public static final int base10=0x7f080014;
public static final int base10explain=0x7f08001d;
@@ -70,52 +70,51 @@
public static final int base8help=0x7f08000f;
public static final int base8value=0x7f08001a;
public static final int body=0x7f080009;
- public static final int complexityLabel=0x7f080037;
- public static final int complexityLabelAverage=0x7f08003c;
- public static final int complexityLabelAverageValue=0x7f08003d;
- public static final int complexityLabelBest=0x7f080039;
- public static final int complexityLabelBestValue=0x7f08003a;
- public static final int complexityLabelWorst=0x7f08003f;
- public static final int complexityLabelWorstValue=0x7f080040;
+ public static final int complexityLabel=0x7f080035;
+ public static final int complexityLabelAverage=0x7f08003a;
+ public static final int complexityLabelAverageValue=0x7f08003b;
+ public static final int complexityLabelBest=0x7f080037;
+ public static final int complexityLabelBestValue=0x7f080038;
+ public static final int complexityLabelWorst=0x7f08003d;
+ public static final int complexityLabelWorstValue=0x7f08003e;
public static final int converter=0x7f080003;
public static final int converterInputValue=0x7f08000b;
public static final int explainButton=0x7f080027;
- public static final int gallery=0x7f080047;
+ public static final int gallery=0x7f080046;
public static final int gates=0x7f080006;
public static final int generateSearchButton=0x7f08002c;
- public static final int generateSortButton=0x7f080042;
+ public static final int generateSortButton=0x7f080040;
public static final int help=0x7f080008;
public static final int home=0x7f080002;
public static final int inputLabel=0x7f080029;
public static final int marquee_convert=0x7f080021;
public static final int marquee_gates=0x7f080024;
public static final int marquee_search=0x7f080023;
public static final int marquee_sort=0x7f080022;
- public static final int outputLabel=0x7f080031;
+ public static final int outputLabel=0x7f080042;
public static final int quit=0x7f080007;
public static final int searchButton=0x7f08002f;
public static final int searchInputElement=0x7f08002e;
public static final int searchInputValues=0x7f08002b;
- public static final int searchOutputValues=0x7f080032;
public static final int searcher=0x7f080005;
- public static final int sortButton=0x7f080044;
- public static final int sortInputValues=0x7f080043;
- public static final int sortOutputValues=0x7f080046;
+ public static final int sortButton=0x7f080043;
+ public static final int sortInputValues=0x7f080041;
+ public static final int sortOutputValues=0x7f080045;
public static final int sorter=0x7f080004;
public static final int spinner=0x7f08000a;
public static final int tableRow1=0x7f080025;
public static final int tableRow2=0x7f080028;
public static final int tableRow3=0x7f08002a;
public static final int tableRow3a=0x7f08002d;
public static final int tableRow4=0x7f080030;
- public static final int tableRow4a=0x7f080045;
- public static final int tableRow5=0x7f080033;
- public static final int tableRow6=0x7f080036;
- public static final int tableRow7=0x7f080038;
- public static final int tableRow8=0x7f08003b;
- public static final int tableRow9=0x7f08003e;
- public static final int timetaken=0x7f080035;
- public static final int timetakenLabel=0x7f080034;
+ public static final int tableRow4a=0x7f080044;
+ public static final int tableRow5=0x7f080031;
+ public static final int tableRow6=0x7f080034;
+ public static final int tableRow7=0x7f080036;
+ public static final int tableRow8=0x7f080039;
+ public static final int tableRow9=0x7f08003c;
+ public static final int timetaken=0x7f080033;
+ public static final int timetakenLabel=0x7f080032;
public static final int toolbar=0x7f080001;
public static final int webview=0x7f080020;
}
View
@@ -16,19 +16,30 @@
</LinearLayout>
<LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="10dp"
+ >
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView android:id="@+id/aboutSearchType" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" />
- <Button android:id="@+id/explainButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:text="@string/explain_label" />
+ <Button android:id="@+id/explainButton" android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:layout_marginTop="2dp"
+ android:background="@drawable/help" />
</TableRow>
-
+ </LinearLayout>
+<LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="10dp"
+ >
<TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView
android:id="@+id/inputLabel"
@@ -49,10 +60,10 @@
</TextView>
<Button
android:id="@+id/generateSearchButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginTop="2dp"
- android:text="@string/generate_label" />
+ android:background="@drawable/help"/>
</TableRow>
<TableRow android:id="@+id/tableRow3a" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<EditText
@@ -65,28 +76,19 @@
<Button
android:id="@+id/searchButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginTop="2dp"
- android:text="@string/search_label" />
+ android:background="@drawable/help" />
</TableRow>
<TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content" >
- <TextView
- android:id="@+id/outputLabel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+
+ <Button android:id="@+id/animateButton" android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginTop="2dp"
- android:text="@string/search_output_label" >
- </TextView>
- <TextView
- android:id="@+id/searchOutputValues"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp">
- </TextView>
- <Button android:id="@+id/animateButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:text="@string/animate_label" />
+ android:background="@drawable/help" />
</TableRow>
<TableRow android:id="@+id/tableRow5" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView
@@ -103,7 +105,14 @@
android:layout_marginTop="2dp" >
</TextView>
</TableRow>
-
+ </LinearLayout>
+<LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="10dp"
+ >
+
<TableRow android:id="@+id/tableRow6" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView android:id="@+id/complexityLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:text="@string/complexity_label"/>
</TableRow>
View
@@ -26,7 +26,7 @@
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView android:id="@+id/aboutSortType" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" />
- <Button android:id="@+id/explainButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:text="@string/explain_label" />
+ <Button android:id="@+id/explainButton" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginTop="2dp" android:background="@drawable/help"/>
</TableRow>
<TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content" >
@@ -35,31 +35,33 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sort_input_label" >
- </TextView>
+
+
+
+ </TextView>
+
+<Button
+ android:id="@+id/generateSortButton"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:layout_marginTop="2dp"
+ android:background="@drawable/help"
+ />
+
</TableRow>
<TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView
android:id="@+id/sortInputValues"
- android:layout_width="200dp"
+ android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
- android:inputType="number" >
+ >
</TextView>
- <Button
- android:id="@+id/generateSortButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"
- android:text="@string/generate_label" />
+
- <Button
- android:id="@+id/sortButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"
- android:text="@string/sort_label" />
+
</TableRow>
@@ -72,17 +74,24 @@
android:layout_marginTop="2dp"
android:text="@string/sort_output_label" >
</TextView>
-
+
+ <Button
+ android:id="@+id/sortButton"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:layout_marginTop="2dp"
+ android:background="@drawable/help" />
+
</TableRow>
<TableRow android:id="@+id/tableRow4a" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView
android:id="@+id/sortOutputValues"
- android:layout_width="wrap_content"
+ android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp">
</TextView>
- <Button android:id="@+id/animateButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:text="@string/animate_label" />
+ <Button android:id="@+id/animateButton" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginTop="2dp" android:background="@drawable/help" />
</TableRow>
<TableRow android:id="@+id/tableRow5" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView
View
@@ -20,14 +20,14 @@
<string name="explain_label">Explain</string>
<string name="animate_label">Animate</string>
<string name="converter_label">Converter</string>
- <string name="sort_input_label">Generate numbers to sort</string>
+ <string name="sort_input_label">Generate Numbers to Sort</string>
<string name="search_input_label">Enter number to search</string>
<string name="sort_label">Sort</string>
- <string name="sort_output_label">Sorted numbers</string>
+ <string name="sort_output_label">Sort numbers</string>
<string name="search_output_label">Contains</string>
<string name="timetaken_label">Time taken</string>
<string name="search_label">Search</string>
- <string name="generate_label">Generate</string>
+ <string name="generate_label">Regenerate</string>
<string name="gates_label">Logic Gates</string>
<string name="binary_label">Binary</string>
<string name="quaternary_label">Quaternary</string>
@@ -160,7 +160,7 @@ public void onItemClick(AdapterView<?> parent,
if(componentTypeSelected.equalsIgnoreCase("search")){
setSearchTypeSelected(searchText[pos].toString());
Intent intent = new Intent(context, SearchActivity.class);
- intent.putExtra("searchType", getSortTypeSelected());
+ intent.putExtra("searchType", getSearchTypeSelected());
context.startActivity(intent);
}
if(componentTypeSelected.equalsIgnoreCase("gates")){
@@ -11,14 +11,15 @@
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
+import android.widget.Toast;
import com.algorithms.AlgorithmHelper;
import com.algorithms.search.ISearcher;
import com.algorithms.search.SearchFactory;
public class SearchActivity extends Activity {
TextView input;
- TextView output;
+// TextView output;
EditText searchElement;
String searchType = null;
TextView aboutSearchType;
@@ -49,7 +50,7 @@ public void onCreate(Bundle savedInstanceState)
aboutSearchType = (TextView) findViewById(R.id.aboutSearchType);
input = (TextView) findViewById(R.id.searchInputValues);
- output = (TextView) findViewById(R.id.searchOutputValues);
+// output = (TextView) findViewById(R.id.searchOutputValues);
searchElement = (EditText) findViewById(R.id.searchInputElement);
aboutComplexityBest = (TextView) findViewById(R.id.complexityLabelBestValue);
aboutComplexityAvg = (TextView) findViewById(R.id.complexityLabelAverageValue);
@@ -80,9 +81,22 @@ public void onClick(View v) {
@Override
public void onClick(View v) {
int[] inputArray = getInputArray(input.getText().toString());
- int element = Integer.parseInt(searchElement.getText().toString());
- boolean isEementFound = searcher.contains(inputArray, element);
- output.setText(getResultText(isEementFound));
+ int element;
+ if(null != searchElement.getText() && !searchElement.getText().toString().equals("")){
+ element = Integer.parseInt(searchElement.getText().toString());
+ boolean isEementFound = false;
+ isEementFound = searcher.contains(inputArray, element);
+ getResultText(isEementFound);
+ //output.setText(getResultText(isEementFound));
+ }
+ else
+ {
+ // Create a piece of toast.
+ Toast pieceToast = Toast.makeText(getApplicationContext(), "Enter number to Search", Toast.LENGTH_SHORT);
+
+ // Show the toast.
+ pieceToast.show();
+ }
}
});
@@ -181,11 +195,21 @@ private String getResultText(boolean isEementFound){
if(!isEementFound)
{
- result = "Given number does not exist";
+// result = "Given number does not exist";
+ // Create a piece of toast.
+ Toast pieceToast = Toast.makeText(getApplicationContext(), "Given number does not exist", Toast.LENGTH_SHORT);
+
+ // Show the toast.
+ pieceToast.show();
}
else
{
- result = "Given number found";
+// result = "Given number found";
+ // Create a piece of toast.
+ Toast pieceToast = Toast.makeText(getApplicationContext(), "Given number found", Toast.LENGTH_SHORT);
+
+ // Show the toast.
+ pieceToast.show();
}
return result;
}
Oops, something went wrong.

0 comments on commit 2f7ef76

Please sign in to comment.