Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions .idea/markdown-navigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/markdown-navigator/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 17 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 'Google Inc.:Google APIs:21'
buildToolsVersion "22.0.1"
compileSdkVersion 21
buildToolsVersion '25.0.0'

defaultConfig {
applicationId "com.ap.collegespacev2"
Expand All @@ -21,8 +22,19 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.+'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
testCompile 'junit:junit:4.12'
}
repositories {
mavenCentral()
}
66 changes: 36 additions & 30 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ap.collegespacev2">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<permission android:name="com.ap.collegespacev2.C2D_MESSAGE" android:protectionLevel="signature" />
<permission
android:name="com.ap.collegespacev2.C2D_MESSAGE"
android:protectionLevel="signature" />

<uses-permission android:name="com.ap.collegespacev2.permission.C2D_MESSAGE" />

<application
Expand All @@ -18,54 +21,57 @@
android:supportsRtl="true"
android:theme="@style/BaseTheme">
<activity
android:name="com.ap.collegespacev2.Home"
android:label="@string/app_name">
</activity>
android:name=".Home"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.Settings"
android:label="@string/app_name">
</activity>
android:name=".Settings"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.NSITulator"
android:label="@string/app_name">
</activity>
android:name=".NSITulator"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.Bookmarks"
android:label="@string/app_name">
</activity>
android:name=".Bookmarks"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.Calculator"
android:label="@string/app_name">
</activity>
android:name=".Calculator"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.BaseActivity"
android:label="@string/app_name">
</activity>
android:name=".BaseActivity"
android:label="@string/app_name" />
<activity
android:name="com.ap.collegespacev2.Launcher"
android:name=".Launcher"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ap.collegespacev2.PostDetails"
android:theme="@style/ThemeFading"
android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
android:name=".PostDetails"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/ThemeFading" />

<receiver
android:name="com.ap.collegespacev2.Gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
android:name=".Gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />

<category android:name="com.ap.collegespacev2" />
</intent-filter>
</receiver>

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name="com.ap.collegespacev2.Gcm.GcmIntentService" />

<service android:name=".Gcm.GcmIntentService" />

<activity android:name=".NsitPediaActivity" />
<activity android:name=".NSITpediaPostDetails"
android:parentActivityName=".NsitPediaActivity"
android:theme="@style/ThemeFading"></activity>
</application>
</manifest>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package com.ap.collegespacev2.Adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.ap.collegespacev2.Models.NpediaPosts;
import com.ap.collegespacev2.R;
import com.bumptech.glide.Glide;


import java.util.ArrayList;

/**
* Created by anirudh on 26/07/17.
*/

public class NsitPediaAdapter extends RecyclerView.Adapter<NsitPediaAdapter.PostsViewHolder> {

ArrayList<NpediaPosts> arrayListPosts ;
Context mContext ;
OnItemCLickedListener onItemCLickedListener;

public NsitPediaAdapter(ArrayList<NpediaPosts> arrayListPosts, Context mContext , OnItemCLickedListener oicl) {
this.arrayListPosts = arrayListPosts;
this.mContext = mContext;
this.onItemCLickedListener = oicl ;

}
public void updatePosts(ArrayList<NpediaPosts> arrayListPosts){
this.arrayListPosts = arrayListPosts ;
notifyDataSetChanged();
}
public interface OnItemCLickedListener {
void onItemCLicked(View view , NpediaPosts thisPost);
}
@Override
public PostsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = li.inflate(R.layout.list_nsitpedia_posts , parent , false) ;
return new PostsViewHolder(itemView);
}

@Override
public void onBindViewHolder(PostsViewHolder holder, int position) {
final NpediaPosts thisPost = arrayListPosts.get(position) ;
holder.tvTitle.setText(thisPost.getTitle());
holder.tvDescription.setText(Html.fromHtml(thisPost.getExcerpt()));
holder.tvAuthor.setText(thisPost.getAuthor().getUsername());
if(thisPost.getAuthor().getAvatar().equals("avatar")) {
Glide.with(mContext)
.load(R.drawable.ic_person)
.into(holder.ivAvatar);
}else{
Glide.with(mContext)
.load(thisPost.getAuthor().getAvatar())
.into(holder.ivAvatar);
}

if(!thisPost.getFeatured_image().getGuid().equals("guid")){
Glide.with(mContext)
.load(thisPost.getFeatured_image().getGuid())
.into(holder.ivFeaturedImage) ;

}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemCLickedListener.onItemCLicked(v , thisPost);
}
});

}

@Override
public int getItemCount() {
return arrayListPosts.size();
}

class PostsViewHolder extends RecyclerView.ViewHolder{
TextView tvTitle , tvAuthor , tvDescription ;
ImageView ivAvatar , ivFeaturedImage;
View itemView ;
public PostsViewHolder(View itemView) {
super(itemView);
tvTitle = (TextView) itemView.findViewById(R.id.tvTitle) ;
tvAuthor = (TextView) itemView.findViewById(R.id.tvPostersName) ;
tvDescription = (TextView) itemView.findViewById(R.id.tvDescription) ;
ivAvatar = (ImageView)itemView.findViewById(R.id.ivProfilePic) ;
ivFeaturedImage = (ImageView)itemView.findViewById(R.id.ivFeaturedImage) ;
this.itemView = itemView ;
}
}
}
1 change: 1 addition & 0 deletions app/src/main/java/com/ap/collegespacev2/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
switch (position)
{
case 0: toStart = new Intent(BaseActivity.this, Home.class); break;
case 1 : toStart = new Intent(BaseActivity.this , NsitPediaActivity.class) ; break ;
case 2: toStart = new Intent(BaseActivity.this, Bookmarks.class); break;
case 4: toStart = new Intent(BaseActivity.this, NSITulator.class); break;
case 5: toStart = new Intent(BaseActivity.this, Settings.class); break;
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/ap/collegespacev2/Helper/DBHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public class DBHelper extends SQLiteOpenHelper
public static final String TABLE_UPDATES_DATE = "date";
public static final String TABLE_UPDATES_MODIFIED = "modified";


public DBHelper(Context context)
{
super(context, DATABASE_NAME, null, 1);
super(context, DATABASE_NAME, null, 2);
}

@Override
Expand All @@ -40,6 +41,7 @@ public void onCreate(SQLiteDatabase db)
TABLE_UPDATES_LINK + " TEXT, " +
TABLE_UPDATES_DATE + " TEXT, " +
TABLE_UPDATES_MODIFIED + " TEXT)");
db.execSQL(NSITpediaTable.CMD_CREATE_TABLE);
Log.i("DBHelper", "onCreate()");
}

Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/ap/collegespacev2/Helper/DBUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.ap.collegespacev2.Helper;

/**
* Created by anirudh on 29/07/17.
*/

public class DBUtils {
public static final String CREATE_TABLE = " CREATE TABLE " ;
public static final String LBR = " ( " ;
public static final String RBR = " ) " ;
public static final String COMMA = " , " ;
public static final String SEMI = " ; " ;

public static final String TYPE_INTEGER = " INTEGER " ;
public static final String TYPE_TEXT = " TEXT " ;
public static final String TYPE_INT_PK = " INTEGER PRIMARY KEY " ;
public static final String TYPE_BOOLEAN = " BOOLEAN " ;
}
Loading