Showing posts with label android tutorial. Show all posts
Showing posts with label android tutorial. Show all posts

Thursday, October 13, 2016

Migrating to Swift 2.3 or Swift 3 from Swift 2.2


Xcode 8 has feature to Migrator from 2.2, 2.3 ----> 3.0

Take care of these steps before migrate

1. All Build and test case should be pass on Xcode7.3
2. Project should be have version control otherwise you are able to see the changes after the migration.
3. If your project contains multiple scheme than better to go for two different projects.

Swift 3.0 Migration

When you the xcode 8.0, it will prompted the alert for migration from Swift 2.2 or 2.3 to Swift 3.
Same thing you can do manually also from  edit --> convert ---> To convert swift syntax

Somebody has issue like me,  We wanted to stay 2.3 for time been and release the build from Xcode 8.

Solution is very easy just you have to set "Use legacy Swift build setting" ---> YES 

you'll able to build the project and run into iOS10 devices.


Swift 3.0 Migration Issues

There are many issues come across to you.. like compiler crash or syntax error.. If you don't want to this kind issue than follow above steps

Well there are known issues in Swift 3.0 migration 

1. Swift Standard library
   Migrator failed due to using of indexing methods on SetIndex and DictionaryIndex 


Learn Swift 3.0 in 5 hours





Sunday, February 14, 2016

svn tagging in Xcode using iSVN


Download iSVN from  http://www.einhugur.com/iSvn/



Add root directory of xcode project.



Open Browse Repository 



* Select the trunk folder of project in the repository and copy the trunk file paste into tag folder with tag name.




Thanks,




Wednesday, December 4, 2013

Calendar - Multi-dates selection

Calendar library for iOS platform.

I have seen many library from https://www.cocoacontrols.com/platforms/ios/controls but haven't got any solution which i really want than i have downloaded one of the library than customize the calendar library. Now user can select multiple dates or single date from this library and it will return NSMutable Array of selected dates.






This way we can select multiple dates from calendar view. by pressing back button it will return all selected dates in Array.

for download this library follow this link:-
https://github.com/IndraPatel123/CalendarLibrary

Friday, October 18, 2013

Horizontal ListView in Android

First create main_layout like this way

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    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=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <com.example.horizontallistview.TwoWayView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="89dp" >
    </com.example.horizontallistview.TwoWayView>

</RelativeLayout> 


2. In Main activity class

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;

public class MainActivity extends Activity {
    private static final String LOGTAG = "TwoWayViewSample";

    private TwoWayView mListView;

    private Toast mToast;
    private String mClickMessage;
    private String mScrollMessage;
    private String mStateMessage;

    @SuppressLint("ShowToast")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        mClickMessage = "";
        mScrollMessage = "";
        mStateMessage = "";

        mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
        mToast.setGravity(Gravity.CENTER, 0, 0);

        mListView = (TwoWayView) findViewById(R.id.listView1);
        mListView.setItemMargin(10);
        mListView.setLongClickable(true);
        mListView.setOrientation(Orientation.HORIZONTAL);
       
        mListView.setHorizontalScrollBarEnabled(true);
        mListView.setVerticalScrollBarEnabled(false);
       

        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View child, int position,
                    long id) {
                mClickMessage = "Item clicked: " + position;
                refreshToast();
            }
        });

        mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View child,
                    int position, long id) {
                mClickMessage = "Item long pressed: " + position;
                refreshToast();
                return true;
            }
        });

        mListView.setOnScrollListener(new TwoWayView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(TwoWayView view, int scrollState) {
                String stateName = "Undefined";
                switch(scrollState) {
                case SCROLL_STATE_IDLE:
                    stateName = "Idle";
                    break;

                case SCROLL_STATE_TOUCH_SCROLL:
                    stateName = "Dragging";
                    break;

                case SCROLL_STATE_FLING:
                    stateName = "Flinging";
                    break;
                }

                mStateMessage = "Scroll state changed: " + stateName;
                refreshToast();
            }

            @Override
            public void onScroll(TwoWayView view, int firstVisibleItem,
                    int visibleItemCount, int totalItemCount) {
                mScrollMessage = "Scroll (first: " + firstVisibleItem + ", count = " + visibleItemCount + ")";
                refreshToast();
            }
        });

        mListView.setRecyclerListener(new TwoWayView.RecyclerListener() {
            @Override
            public void onMovedToScrapHeap(View view) {
                Log.d(LOGTAG, "View moved to scrap heap");
            }
        });

        mListView.setAdapter(new SimpleListAdapter(MainActivity.this));
    }

    private void refreshToast() {
        StringBuffer buffer = new StringBuffer();

        if (!TextUtils.isEmpty(mClickMessage)) {
            buffer.append(mClickMessage);
        }

        if (!TextUtils.isEmpty(mScrollMessage)) {
            if (buffer.length() != 0) {
                buffer.append("\n");
            }

            buffer.append(mScrollMessage);
        }

        if (!TextUtils.isEmpty(mStateMessage)) {
            if (buffer.length() != 0) {
                buffer.append("\n");
            }

            buffer.append(mStateMessage);
        }

        mToast.setText(buffer.toString());
        mToast.show();
    }
}


Please find working code from Github
https://github.com/IndraPatel123/HorizontalListView