« first day (281 days earlier)      last day (30 days later) » 

7:25 AM
gist: 1fd67d80a17305757b80792f89db7113, 2017-01-25 07:24:52Z
public class HoppyCastPostingActivity extends BaseClass
{
	  ArrayList<CategoryModel> categoryArrayList;
    ArrayList<CastBoxBlock> blockList;
    CastDataPostAdapter blockAdapter;

    public ItemTouchHelper mItemTouchHelper;
	
	 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hoppy_cast_posting);

		//other code
			
		setupRecyclerView();
	}
  
	private void setupRecyclerView()
    {
        try
        {
            blockList = new ArrayList<CastBoxBlock>();
            blockList.add(new CastBoxBlock("0"));

            blockAdapter = new CastDataPostAdapter(activity, blockList, blockItemInterface);
            if (blockAdapter != null)
            {
                Log.e(TAG, "RecyclerView is ready. Set :)....");
				
                RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(activity);
                recyclerViewPostCastData.setLayoutManager(mLayoutManager);
                recyclerViewPostCastData.setItemAnimator(new DefaultItemAnimator());
                recyclerViewPostCastData.setAdapter(blockAdapter);
                blockAdapter.notifyDataSetChanged();
				
            }

        }catch (Exception e){
            constant.printError(TAG, "setupRecyclerView()");
            e.printStackTrace();
        }
    }
	
	CastBoxBlockItemInterface blockItemInterface = new CastBoxBlockItemInterface() {
		@Override
        public void blockMoveToUp(ArrayList<CastBoxBlock> blockList, int position, String index) {
            Log.e(TAG, "blockMoveToUp() method is called.....");
			
            ItemTouchHelper itemTouchHelper = new ItemTouchHelper(_ithCallback);
            itemTouchHelper.attachToRecyclerView(recyclerViewPostCastData);
        }

        @Override
        public void blockMoveToDown(ArrayList<CastBoxBlock> blockList, int position, String index) {
            Log.e(TAG, "blockMoveToDown() method is called.....");
			
			      ItemTouchHelper itemTouchHelper = new ItemTouchHelper(_ithCallback);
            itemTouchHelper.attachToRecyclerView(recyclerViewPostCastData);
        }
    };
	
	ItemTouchHelper.Callback _ithCallback = new ItemTouchHelper.Callback() {
		//and in your imlpementaion of

      public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
       // get the viewHolder's and target's positions in your adapter data, swap them
      final int fromPosition = viewHolder.getAdapterPosition();
			final int toPosition = target.getAdapterPosition();

			if (fromPosition < toPosition)
			{
				for (int i = fromPosition; i < toPosition; i++) {
					Collections.swap(blockList, i, i+1);
				}
			}
			else
			{
				for (int i = fromPosition; i> toPosition; i--) {
					Collections.swap(blockList, i, i-1);
				}
			}
			blockAdapter.notifyItemChanged(fromPosition, toPosition);
      return true;
      }

      @Override
      public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
                //TODO
      }

      //defines the enabled move directions in each state (idle, swiping, dragging).
      @Override
      public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
                return makeFlag(ItemTouchHelper.ACTION_STATE_DRAG,
                        ItemTouchHelper.DOWN | ItemTouchHelper.UP | ItemTouchHelper.START | ItemTouchHelper.END);
      }
      
    };
}
 
1 message moved from [[iOS][Android][ChaosOverFlow]](chat.stackoverflow.com/rooms/26424/iosandroidchaosoverflow)
 
hello
 
 
2 hours later…
9:42 AM
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
 
1 message moved from [[iOS][Android][ChaosOverFlow]](chat.stackoverflow.com/rooms/26424/iosandroidchaosoverflow)
 
 
8 hours later…
5:53 PM
String Query Benchmark, MATLAB (R2016b)
Cell Array Size: 60 x 60
==================================
Loop, contains:   0.00844 seconds
Loop, regexp:     0.00998 seconds
Loop, strfind:    0.00269 seconds
cellfun, logical: 0.02488 seconds
cellfun, isempty: 0.01507 seconds
1 message moved from CHATLAB and Talktave
 

« first day (281 days earlier)      last day (30 days later) »