Wednesday, 7 September 2016

Android Easy ViewPager Library

Android View Pager Library

This Library can be used to create view pager in android very easily.
 View Pager is a Layout element that helps users to slide images one after the other.
In this Library only one function is used and can be customized to user needs.

The repository is uploaded on Bintray and has been compiled for Maven and JCentre.


Below you can see is a GIF of the output







 Download and use the library now:



Maven:

<dependency>
  <groupId>com.example.mypc.mylibrary</groupId>
  <artifactId>mylibrary</artifactId>
  <version>1.0</version>
  <type>pom</type>
</dependency>

Gradle:

compile 'com.example.mypc.mylibrary:mylibrary:1.0'


Tutorial :


1. Open your Android Studio and start with new Project.
2. Go to build.Gradle file and add the following dependency:
   compile 'com.example.mypc.mylibrary:mylibrary:1.0'
3. Sync the project with Gradle Files.
4. In your MainActivity.java File use the following code:



public class MainActivity extends Activity {
    int[] imageId = {
            R.drawable.b1,
            R.drawable.b2,
            R.drawable.b3,
            R.drawable.b2,
            R.drawable.b1,
            R.drawable.b3
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View v = new MyView(this);
        setContentView(v);
        MyView.addViewPager(5, MainActivity.this,imageId,100,3000);
       
        //Here first param is no of images
        // second is activtity
        // third is images array
        // fourth is speed of transition
        // fifth is duration for one image to stay.
       
    }



.
That's all Run your Project and BINGO it works!!!.



GITHUB CODE:

Visit:  https://github.com/subhamG98/view-pager-library


License:



Licensed 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.







Android Library- Parse JSON into Recycler View using just one line of code!


This repository will help Android developers to make connection with HTTP clients and put JSON data into Recycler View in just 1 simple function call. No need to establish any Async Task or set up any Adapters for Recycler View by yourself.
 All you need to give is the url of the JSON file and your xml layout about how to parameters should appear.
The repository is uploaded on Bintray and has been compiled for Maven and JCentre.


Click below link to see video tutorial




 Download and use the library now:

 Maven:
        <dependency>
        <groupId>com.dbconnection.subham.dblibrary</groupId>
        <artifactId>dblibrary</artifactId>
        <version>1.0</version>
        <type>pom</type>
        </dependency>


 Gradle:

compile 'com.dbconnection.subham.dblibrary:dblibrary:1.0'


Tutorial :

Consider we have a JSON available at any of our servers. We now want this data should be shown in our Recycler View in Android.
Lets look at sample JSON. This has been hosted at my servers. You can use yours. All you need is url of that JSON document.

{
 "result": [
  {
   "company": "Microsoft",
   "news": "Placement session for October 2015 is soon going to start. Please stay in touch. All the very best for your future endeavours.",
   "likes": "6",
   "url": "http://hello45.esy.es/PhotoUpload/uploads/32.png",
   "dp": "http://hello45.esy.es/DpUpload/uploads/2.png"
  },
  {
   "company": "Dhruv",
   "news": "Guys Ive been placed at AMAZON. Thanks to Placement Assured for their support and cooperation. Gonna miss you all. Bye!!!",
   "likes": "7",
   "url": "http://hello45.esy.es/PhotoUpload/uploads/34.png",
   "dp": "http://hello45.esy.es/DpUpload/uploads/dhruv.png"
  },
  {
   "company": "pa",
   "news": "final evaluation close Pull up your socks",
   "likes": "0",
   "url": "http://hello45.esy.es/PhotoUpload/uploads/31.png",
   "dp": "http://hello45.esy.es/DpUpload/uploads/01.png"
  },
  {
   "company": "Sgupta",
   "news": "check 123",
   "likes": "6",
   "url": "http://hello45.esy.es/PhotoUpload/uploads/31.png",
   "dp": "http://hello45.esy.es/DpUpload/uploads/subham.png"
  },
  {
   "company": "pa",
   "news": "Placement Assured wishes you All the best for your Placement Season",
   "likes": "98",
   "url": "http://hello45.esy.es/DpUpload/uploads/01.png",
   "dp": "http://hello45.esy.es/DpUpload/uploads/01.png"
  },
  
 ]
}


1. Open your Android Studio and start with new Project.
2. Go to build.Gradle file and add the following dependency:
   compile 'com.dbconnection.subham.dblibrary:dblibrary:1.0'
3. Sync the project with Gradle Files.
4. In your MainActivity.java File use the following code:


 public class MainActivity extends Activity {  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     View v = new MyView(this);  
     setContentView(v);  
     String[] tagnames={"company","news","url"}; //These are the keys of the JSON ARRay  
     String[] tagtype={"text","text","image"}; //This is type of value, it can be text or image  
     String arrayname="result";// This is the name of array of JSON File  
      MyView.setinputdata("http://hello45.esy.es/PhotoUpload/getAllImages.php",arrayname,tagnames,tagtype,R.layout.list_card_view);  
 //As you see you need to pass only URL, Name of result array,names of key in JSON key value pairs,And a layout file to see the results.Make sure while making layout files you give id to each elements as p1,p2,p3..... as specifie in tagnames.  
   }  
 }  


As you can see in the above code, only 5 parameters need to be passed to the function. These are:

  • URL: Enter the url where JSON is being returned from.
  • tagnames: These show the keys in the key value pair of JSON. List here those keys that you wish to show in your Recycler View.
  • tagtypes: This is for Recycler view to understand whether it should display a TextView or an ImageView. Hence corresponding to the tagnames values enter the tagntypes. Only options possible are "text" or "image". Make sure there order is same i..e as shown in above code company corresponds to text,news to text and url to image.
  • arrayname: It is the name of the final array in JSON . For eg in JSON showed above it is "result". 
  • Layout File: Make an XML file for the layout of how you want to display items of recycler view. I have provided you with one sample file. All you need is to set TextViews and ImageViews corresponding to no of parameters in tagname array. While making the layout File keep in mind to name the elements ids as p1,p2,p3... etc only. For eg in XML File, TextView corresponding to company should have id as p1,TextView corresponding to news should have id as p2, and Imageview corresponding to url should have id p3.
5. Make sure to add Internet permissions in Android XML File.
6. That's all Run your Project and BINGO it works!!!.

You can find the reference to XML File here.


 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   android:orientation="vertical" android:layout_width="match_parent"  
   android:layout_height="wrap_content">  
   <android.support.v7.widget.CardView  
     android:layout_width="match_parent"  
     android:layout_height="wrap_content">  
     <LinearLayout  
       android:orientation="vertical"  
       android:layout_width="match_parent"  
       android:layout_height="wrap_content" >  
       <TextView  
         android:layout_width="fill_parent"  
         android:layout_height="wrap_content"  
         android:id="@+id/p1"  
         android:textColor="#ff342511"  
         android:textSize="20dp"  
         android:text="Paper name"  
         android:textStyle="bold" />  
       <TextView  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:textStyle="bold"  
         android:text="New Text"  
         android:id="@+id/p2"  
         android:textColor="#ffffb54b" />  
       <TextView  
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content"  
         android:textStyle="bold"  
         android:text="New Text"  
         android:id="@+id/p3"  
         android:textColor="#ff100920" />  
     </LinearLayout>  
   </android.support.v7.widget.CardView>  
 </LinearLayout>  



GITHUB CODE:

Visit:  https://github.com/subhamG98/Android-Parse-JSON-in-one-line-function


License:



Licensed 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.

Wednesday, 10 August 2016

Systems And Networks- Intrusion and Security

I’ve made an ANDROID APP using Android Studio 1.2.2 for client side and Python 2.7 for server side implementation along with Wamp’s Apache and database, and created apps for Cryptography and Steganography(Digital Signatures) including Image transfer through hotspot along with Controlling PC from android mobile and also take screenshots of PC secretly. Also I made an Android App that veils itself as a simple Calculator but can extract secretly all personal information from user’s device and display to another user in the same hotspot zone.


Tuesday, 9 August 2016

Android App- Placement Assured

Minor Project 1


This app provides necessary information to all students aspiring to seek placements. It has 3 major sections namely- New Feed, Shop Books, Practice Papers.In addition , Jobs are show according to Locations , Role or Company.Google Graph API has been used to show charts and compare companies.Practice Papers are of two types 1. Technical 2. Aptitude/Resoning based.Students can see questions and answers for the same.The questions have been scraped through know websites.

All data has been crawled from various website showing jobs such as naukri. com etc.
It has a chat feature to talk to seniors or friends. 
Twitter Fabric Framework has been used to show #placement tweets to users.
Facebook and Twitter login has also been done.

Playstore Link



Android App- HUNT SHUNT

SUMMER TRAINING PROJECT


Hunt Shunt App has been designed for providing chatting facilities to people within 5km of range.  If two users using this app comes within 5km range , then they can chat with each other. Once, the distance increases the chat is deleted forever. 

It also showcases nearby Restaurants, Hotels, Temples, Mosques, Banks , ATMs etc.The user can add new photos to his profile and has to swipe right to begin chatting. The user can also see his friends those of who are in his contact list and registered on the app.

The App uses Google Map API to show nearby places. It also has an amalgamation of Recycler View, Collapsing Layout , Card Views etc and uses Retrofit Networking to  extract data into JSON form. Twitter Digits Framework has been used to verify phone calls on start.