Skip to content

Add ParseListLoader #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
40 changes: 40 additions & 0 deletions ParseListLoaderExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.example.tuanchauict.parselistloaderexample"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="ParseListLoaderExample"
android:supportsRtl="true"
android:name=".ListLoaderApplication"
>
<activity
android:name=".MainActivity"
android:label="ParseListLoaderExample"

>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name=".listview.ListViewDemoActivity" android:label="List View"/>

<activity android:name=".viewpager.ViewPagerDemoActivity" android:label="View Pager"/>

<activity android:name=".recycler.RecyclerViewDemoActivity" android:label="Recycler View"/>

<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id"/>
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key"/>
</application>

</manifest>
28 changes: 28 additions & 0 deletions ParseListLoaderExample/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: 'com.android.application'

dependencies {
compile 'com.android.support:recyclerview-v7:21.+'
compile project(':ParseLoginUI')
compile rootProject.ext.androidSupport
compile files(rootProject.ext.parsePath)
}


android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions ParseListLoaderExample/res/layout/activity_list_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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="match_parent">
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
40 changes: 40 additions & 0 deletions ParseListLoaderExample/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.tuanchauict.parselistloaderexample.MainActivity"
android:orientation="vertical"
android:gravity="center"
>

<Button
android:id="@+id/create_1000_objects"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create 1000 objects"
/>

<Button
android:id="@+id/goto_list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="List View Demo"
/>
<Button
android:id="@+id/goto_viewpager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ViewPager Demo"
/>
<Button
android:id="@+id/goto_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recycler View Demo"
/>

</LinearLayout>
12 changes: 12 additions & 0 deletions ParseListLoaderExample/res/layout/activity_recycler_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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="match_parent">

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
11 changes: 11 additions & 0 deletions ParseListLoaderExample/res/layout/activity_view_pager.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
21 changes: 21 additions & 0 deletions ParseListLoaderExample/res/layout/item_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>

<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
/>

</LinearLayout>
19 changes: 19 additions & 0 deletions ParseListLoaderExample/res/layout/item_layout_2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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="match_parent"
android:gravity="center"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
/>
</LinearLayout>
15 changes: 15 additions & 0 deletions ParseListLoaderExample/res/layout/item_waiting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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="match_parent">


<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
5 changes: 5 additions & 0 deletions ParseListLoaderExample/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Please put your application's app ID and keys here -->
<string name="parse_app_id">YOUR_PARSE_APP_ID</string>
<string name="parse_client_key">YOUR_PARSE_CLIENT_KEY</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.tuanchauict.parselistloaderexample;

import android.app.Application;

import com.parse.Parse;
import com.parse.ParseObject;

/**
* Created by tuanchauict on 10/25/15.
*/
public class ListLoaderApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

// Required - Initialize the Parse SDK
Parse.initialize(this);
ParseObject.registerSubclass(ParseDemoObject.class);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.example.tuanchauict.parselistloaderexample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.example.tuanchauict.parselistloaderexample.listview.ListViewDemoActivity;
import com.example.tuanchauict.parselistloaderexample.recycler.RecyclerViewDemoActivity;
import com.example.tuanchauict.parselistloaderexample.viewpager.ViewPagerDemoActivity;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

findViewById(R.id.create_1000_objects).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
create1000Objects();
}
});


findViewById(R.id.goto_list_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ListViewDemoActivity.class);
startActivity(intent);
}
});

findViewById(R.id.goto_viewpager).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ViewPagerDemoActivity.class);
startActivity(intent);
}
});

findViewById(R.id.goto_recycler_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, RecyclerViewDemoActivity.class);
startActivity(intent);
}
});
}

public void create1000Objects() {

for (int i = 0; i < 1000; i++) {
ParseDemoObject object = ParseDemoObject.getObject(i);
object.saveEventually();
}
Toast.makeText(this, "Check on your app's data", Toast.LENGTH_LONG).show();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.tuanchauict.parselistloaderexample;

import com.parse.ParseClassName;
import com.parse.ParseObject;

/**
* Created by tuanchauict on 10/25/15.
*/
@ParseClassName("ListLoaderItem")
public class ParseDemoObject extends ParseObject {
public static final String ATTR_SSD = "ssd";
public static final String ATTR_FIRST_NAME = "firstName";
public static final String ATTR_LAST_NAME = "lastName";


public static ParseDemoObject getObject(int ssd){
ParseDemoObject object = new ParseDemoObject();
object.put(ATTR_SSD, ssd);
object.put(ATTR_FIRST_NAME, "FirstName " + ssd);
object.put(ATTR_LAST_NAME, "LastName " + ssd);
return object;
}


public int getSSD(){
return getInt(ATTR_SSD);
}

public String getFirstname(){
return getString(ATTR_FIRST_NAME);
}


public String getLastName(){
return getString(ATTR_LAST_NAME);
}


}
Loading