Translate

Friday, 13 May 2016

dimens.xml

<resources>

    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>

</resources>

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="hello">Hello World, Sudoku!</string>
    <string name="app_name">Sudoku</string>
    <string name="main_title">Android Sudoku</string>
    <string name="continue_label">Continue</string>
    <string name="new_game_label">New Game</string>
    <string name="about_label">About</string>
    <string name="exit_label">Exit</string>
    <string name="about_title">About Android Sudoku</string>
    <string name="about_text">\
Sudoku is a logic-based number placement puzzle.
Starting with a partially completed 9x9 grid, the
objective is to fill the grid so that each
row, each column, and each of the 3x3 boxes
(also called <i>blocks</i>) contains the digits
1 to 9 exactly once.</string>
    <string name="settings_label">Settings…</string>
    <string name="settings_title">Sudoku settings</string>
    <string name="settings_shortcut">s</string>
    <string name="music_title">Music</string>
    <string name="music_summary">Play background music</string>
    <string name="hints_title">Hints</string>
    <string name="hints_summary">Show hints during play</string>
    <string name="new_game_title">Difficulty</string>
    <string name="easy_label">Easy</string>
    <string name="medium_label">Medium</string>
    <string name="hard_label">Hard</string>
    <string name="extreme_label">Extreme</string>
    <string name="game_title">Game</string>
    <string name="high_score_label">High Score</string>
    <string name="no_moves_label">No moves</string>
    <string name="keypad_title">Keypad</string>
    <string name="num_0">0</string>
    <string name="num_1">1</string>
    <string name="num_2">2</string>
    <string name="num_3">3</string>
    <string name="num_4">4</string>
    <string name="num_5">5</string>
    <string name="num_6">6</string>
    <string name="num_7">7</string>
    <string name="num_8">8</string>
    <string name="num_9">9</string>

</resources>


Thursday, 12 May 2016

Values Folder in Sudoku Game

arrays.xml
colors.xml
dimens.xml
strings.xml
styles.xml


arrays.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string-array name="difficulty">
        <item>@string/easy_label</item>
        <item>@string/medium_label</item>
        <item>@string/hard_label</item>
        <item>@string/extreme_label</item>
    </string-array>

</resources>

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
 ! Excerpted from "Hello, Android!",
 ! published by The Pragmatic Bookshelf.
 ! Copyrights apply to this code. It may not be used to create training material, 
 ! courses, books, articles, and the like. Contact us if you are in doubt.
 ! We make no guarantees that this code is fit for any purpose. 
 ! Visit http://www.pragmaticprogrammer.com/titles/eband for more book information.
-->
<resources>
   <color name="background">#3500ffff</color>
   
   <color name="puzzle_background">#ffe6f0ff</color>
   <color name="puzzle_hilite">#ffffffff</color>
   <color name="puzzle_light">#64c6d4ef</color>
   <color name="puzzle_dark">#6456648f</color>
   <color name="puzzle_foreground">#ff000000</color>
   <color name="puzzle_hint_0">#64ff0000</color>
   <color name="puzzle_hint_1">#6400ff80</color>
   <color name="puzzle_hint_2">#2000ff80</color>
   <color name="puzzle_selected">#64ff8000</color>
   
</resources>

Wednesday, 11 May 2016

Main.xml


<?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:background="@color/background"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="30dip" >





    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="25dip"
        android:text="@string/main_title"
        android:textSize="24.5sp" />




    <Button
        android:id="@+id/continue_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/continue_label" />



    <Button
        android:id="@+id/new_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/new_game_label" />


<Button
        android:id="@+id/high_score"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/high_score_label" />


    <Button
        android:id="@+id/about_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/about_label" />



    <Button
        android:id="@+id/exit_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/exit_label" />

</LinearLayout>

Tuesday, 10 May 2016

High Score Panel in Sudoku Game

high_score_panel.xml

<?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:background="@color/background"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="30dip" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="25dip"
        android:text="High Score Panel"
        android:textSize="24.5sp" />
   
    <EditText
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="Name"
        android:inputType="text"
        android:text="" />

    <TextView
        android:id="@+id/difficulty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:textSize="20sp"
        android:text="" />

    <TextView
        android:id="@+id/timeElapsed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:textSize="20sp"
        android:text="" />

    <Button
        android:id="@+id/scoreSave"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Save"
        android:onClick="onClickSave"
        android:layout_marginTop="20dp" />

</LinearLayout>

Monday, 9 May 2016

Button.xml

<?xml version="1.0" encoding="utf-8"?>
<com.vikesh.gamesudoku.view.buttonsgrid.NumberButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />


cell.xml

<?xml version="1.0" encoding="utf-8"?>
<com.vikesh.gamesudoku.view.sudokugrid.SudokuCell
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background ="@drawable/cell_shape" />

high_score.xml

<TableLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:shrinkColumns="*"  android:stretchColumns="*" android:background="#ffffff">


                        <!-- Row 1 with single column -->
                        <TableRow
                            android:id="@+id/tableRow1"
                            android:layout_height="wrap_content"
                            android:layout_width="fill_parent"
                            android:gravity="center_horizontal">


                            <TextView
                                android:layout_width="match_parent" android:layout_height="wrap_content"
                                android:textSize="18dp" android:text="---------High Score-------"  android:layout_span="3"
                                android:padding="18dip" android:background="#b0b0b0"
                                android:textColor="#000"/>


                       </TableRow>
         
                        <!-- Row 2 with 3 columns -->


                        <TableRow
                            android:id="@+id/tableRow2"
                            android:layout_height="wrap_content"
                            android:layout_width="match_parent">

                            <TextView
                                android:id="@+id/TextView04" android:text=""
                                android:layout_weight="1" android:background="#dcdcdc"
                                android:textColor="#000000"
                                android:padding="20dip" android:gravity="center"/>

                            <TextView
                                android:id="@+id/TextView041" android:text="Row 2 column 2"
                                android:layout_weight="1" android:background="#d3d3d3"
                                android:textColor="#000000"
                                android:padding="20dip" android:gravity="center"/>

                            <TextView
                                android:id="@+id/TextView042" android:text="Row 2 column 3"
                                android:layout_weight="1" android:background="#cac9c9"
                                android:textColor="#000000"
                                android:padding="20dip" android:gravity="center"/>

                        </TableRow>
                         
                        <!-- Row 3 with 3 columns -->
                        <TableRow
                            android:id="@+id/tableRow3"
                            android:layout_height="wrap_content"
                            android:layout_width="fill_parent"
                            android:gravity="center_horizontal">

                            <TextView
                                android:id="@+id/TextView043" android:text="Row 3 column 1"
                                android:layout_weight="1"  android:background="#b0b0b0"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                     
                            <TextView
                                android:id="@+id/TextView044" android:text="Row 3 column 2"
                                android:layout_weight="1" android:background="#a09f9f"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                            <TextView
                                android:id="@+id/TextView045" android:text="Row 3 column 2"
                                android:layout_weight="1" android:background="#a09f9f"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                        </TableRow>
                        
                        <TableRow
                            android:id="@+id/tableRow4"
                            android:layout_height="wrap_content"
                            android:layout_width="fill_parent"
                            android:gravity="center_horizontal">

                            <TextView
                                android:id="@+id/TextView046" android:text="Row 3 column 1"
                                android:layout_weight="1"  android:background="#b0b0b0"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                     
                            <TextView
                                android:id="@+id/TextView047" android:text="Row 3 column 2"
                                android:layout_weight="1" android:background="#a09f9f"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                            <TextView
                                android:id="@+id/TextView048" android:text="Row 3 column 2"
                                android:layout_weight="1" android:background="#a09f9f"
                                android:textColor="#000000"
                                android:padding="18dip" android:gravity="center"/>
                        </TableRow>
                         
      </TableLayout>


Saturday, 7 May 2016

Layout File in Sudoku

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.vikesh.gamesudoku.MainActivity">

     <Chronometer
        android:id="@+id/chronometer1"
        android:textColor="#4169E1"
        android:textSize="20dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:text="Chronometer" />
   
    <com.vikesh.gamesudoku.view.sudokugrid.SudokuGridView
        android:id="@+id/sudokuGridView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/chronometer1"
        android:numColumns="9"
        android:horizontalSpacing="0dp"
        android:verticalSpacing="0dp" />
    <com.vikesh.gamesudoku.view.buttonsgrid.ButtonsGridView
        android:id="@+id/buttonsGridView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/sudokuGridView"
        android:numColumns="6" />
       
</RelativeLayout>

Friday, 6 May 2016

Layout File in Sudoku Project

Layout File

about.xml
activity_main.xml
button.xml
cell.xml
high_score.xml
high_score_panel.xml
main.xml

About.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:padding="10dip">
    <TextView
        android:id="@+id/about_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/about_text" />
</ScrollView>