Skip to content

Commit

Permalink
Code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Swati4star committed Aug 10, 2018
1 parent 85a4bbe commit 4ce631b
Show file tree
Hide file tree
Showing 112 changed files with 6,806 additions and 7,914 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,6 +10,7 @@ app/build.gradle
.idea/ app/build.gradle
/app/src/main/AndroidManifest.xml
/app/src/main/java/functions/Constant.java
app/release/

.idea

Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -3,8 +3,8 @@ android:
components:
- platform-tools
- tools
- build-tools-23.0.1
- android-23
- build-tools-27.0.3
- android-27
# Support library
- extra-android-support
- extra-android-m2repository
Expand Down
46 changes: 29 additions & 17 deletions app/build.gradle
Expand Up @@ -3,9 +3,10 @@ apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.1.3'
}
}

Expand All @@ -14,14 +15,14 @@ repositories {
}

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "nsit.app.com.nsitapp"
minSdkVersion 14
targetSdkVersion 23
versionCode 26
versionName "2.5"
minSdkVersion 19
targetSdkVersion 27
versionCode 31
versionName "3.0.3"
}

buildTypes {
Expand All @@ -30,17 +31,28 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile group: 'org.jsoup', name: 'jsoup', version: '1.8.3'
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.nispok:snackbar:2.10.+'
compile files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'org.lucasr.twowayview:twowayview:0.1.4'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.squareup.okhttp3:okhttp:3.10.0'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

implementation 'com.squareup.picasso:picasso:2.5.2'

implementation group: 'org.jsoup', name: 'jsoup', version: '1.8.3'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation files('libs/YouTubeAndroidPlayerApi.jar')

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
37 changes: 12 additions & 25 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -32,28 +32,28 @@
android:name=".Description"
android:label="@string/title_activity_decsription" />
<activity
android:name=".Description_FullImage"
android:name=".DescriptionFullImage"
android:label="@string/title_activity_image" />
<activity
android:name=".Hangout_CollegeLocationMapView"
android:name=".Hangout.HangoutCollegeLocationMapView"
android:label="LocationMapView" />
<activity
android:name=".Hangout_collegeLocations"
android:name=".Hangout.HangoutCollegeLocations"
android:label="LocationMapView" />
<activity
android:name=".ChooseClass"
android:name=".Calendar.ChooseClass"
android:label="Select" />
<activity
android:name=".ChooseFeedItems"
android:label="@string/title_activity_choose_feed_items" />
<activity
android:name=".SubjectsShow"
android:name=".subjects.SubjectsShow"
android:label="@string/title_activity_subjects_show" />
<activity
android:name=".SubjectRemove"
android:name=".subjects.SubjectRemove"
android:label="@string/title_activity_subject_remove" />
<activity
android:name=".ProfList"
android:name=".professor.ProfessorsList"
android:label="@string/title_activity_subject_remove" />

<activity android:name=".NotificationSettings"
Expand Down Expand Up @@ -96,43 +96,30 @@
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>
<receiver
android:name=".PushNotification.MyAlarmReceiver"
android:process=":remote" >
<intent-filter>
<action android:name="nsit.app.com.nsitapp.PushNotification.MyAlarmReceiver" />
</intent-filter>
</receiver>

<service
android:name=".PushNotification.MyNotifiactionService"
android:exported="false" />


<activity
android:name=".view.ContestDetailActivity"
android:label="@string/title_activity_contest_detail"
android:parentActivityName=".view.CodeRadar_MainActivity"
android:parentActivityName=".view.CodeRadarActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme2">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".view.CodeRadar_MainActivity" />
android:value=".view.CodeRadarActivity" />
</activity>

<activity
android:name=".view.CodeRadar_MainActivity"
android:name=".view.CodeRadarActivity"
android:label="@string/title_activity_contest_reminder"
android:theme="@style/AppTheme2"/>
<activity
android:name=".PlaceMapActivity"
android:label="Place On Map"
android:theme="@style/AppTheme" />
<activity android:name=".HangoutsTypeDisplay" />
<activity android:name=".Hangout.HangoutsTypeDisplay" />


<activity
android:name=".Sub_load"
android:name=".subjects.SubjectLoad"
android:theme="@style/AppTheme" >
</activity>

Expand Down
@@ -1,12 +1,11 @@
package adapters;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
Expand All @@ -17,134 +16,131 @@
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import functions.ButtonAnimation;
import functions.ImageLoader;
import functions.Utils;
import nsit.app.com.nsitapp.Description;
import nsit.app.com.nsitapp.Description_FullImage;
import nsit.app.com.nsitapp.DescriptionFullImage;
import nsit.app.com.nsitapp.R;

import static functions.Constant.DES;
import static functions.Constant.IMAGE;
import static functions.Constant.LIKE;
import static functions.Constant.LINK;
import static functions.Constant.OBID;

public class CustomList extends ArrayAdapter<String> {
private final Activity context;
private final List<String> img, des, lik, link, obid, date;
private final ImageLoader imageLoader;

public CustomList(Activity context, List<String> image, List<String> desc, List<String> like, List<String> links,
List<String> oid, List<String> dates) {
public class FacebookPostAdapter extends ArrayAdapter<String> {
private final Activity context;
private final List<String> image, description, likes, link, objectId, date;

/**
* Initialize facebook post item
*
* @param context - context
* @param image - image of post
* @param desc - post description text
* @param like - likes count on post
* @param links - link of post
* @param oid - object id of post [internal use]
* @param dates - date of post
*/
public FacebookPostAdapter(Activity context, List<String> image, List<String> desc, List<String> like, List<String> links,
List<String> oid, List<String> dates) {
super(context, R.layout.message_layout, desc);
this.context = context;
img = image;
des = desc;
lik = like;
obid = oid;
this.image = image;
description = desc;
likes = like;
objectId = oid;
link = links;
date = dates;
imageLoader = new ImageLoader(context.getApplicationContext());
}

private class ViewHolder {

TextView Des, likes,dates,read;
TextView Des, likes, dates, read;
ImageView imageView;
FrameLayout frameLayout;
Button button;
}

@NonNull
@Override
public View getView(final int position, View view, ViewGroup parent) {
public View getView(final int position, View view, @NonNull ViewGroup parent) {
ViewHolder holder;
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (view == null) {
view = mInflater.inflate(R.layout.message_layout, parent,false);

view = mInflater.inflate(R.layout.message_layout, parent, false);
holder = new ViewHolder();
holder.Des = (TextView) view.findViewById(R.id.des);
holder.likes = (TextView) view.findViewById(R.id.likes);
holder.dates = (TextView) view.findViewById(R.id.date);
holder.read = (TextView) view.findViewById(R.id.read);
holder.imageView = (ImageView) view.findViewById(R.id.image);
holder.frameLayout = (FrameLayout) view.findViewById(R.id.frame);
holder.button = (Button) view.findViewById(R.id.show);
holder.Des = view.findViewById(R.id.des);
holder.likes = view.findViewById(R.id.likes);
holder.dates = view.findViewById(R.id.date);
holder.read = view.findViewById(R.id.read);
holder.imageView = view.findViewById(R.id.image);
holder.frameLayout = view.findViewById(R.id.frame);
holder.button = view.findViewById(R.id.show);
view.setTag(holder);
} else
holder = (ViewHolder) view.getTag();

ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar1);


if (des.get(position) == null)
if (description.get(position) == null)
holder.Des.setText(R.string.no_description);
else
holder.Des.setText(des.get(position));
holder.Des.setText(description.get(position));


if (lik.get(position) == null)
if (likes.get(position) == null)
holder.likes.setText("0");
else
holder.likes.setText(lik.get(position));

holder.likes.setText(likes.get(position));

holder.dates.setVisibility(View.VISIBLE);
if (date.get(position) != null) {
String x = Utils.GetLocalDateStringFromUTCString(date.get(position));
String formattedDate = x;
try {


DateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss+SSSS", Locale.ENGLISH);
DateFormat targetFormat = new SimpleDateFormat("dd MMMM , hh:mm a");
Date date2 = originalFormat.parse(x);
formattedDate = targetFormat.format(date2);
} catch (Exception e) {
Log.e("error", e.getMessage() + " ");
}

holder.dates.setText(formattedDate);
} else
holder.dates.setVisibility(View.INVISIBLE);

holder.read.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Context c = getContext();
Intent i = new Intent(getContext(), Description.class);
i.putExtra("dec", des.get(position));
i.putExtra("like", lik.get(position));
i.putExtra("img", img.get(position));
i.putExtra("link", link.get(position));
i.putExtra("oid", obid.get(position));
ButtonAnimation btnAnimation = new ButtonAnimation();
btnAnimation.animateButton(view, c);
c.startActivity(i);
}
holder.read.setOnClickListener(view1 -> {
Intent intent = new Intent(getContext(), Description.class);
intent.putExtra(DES, description.get(position));
intent.putExtra(LIKE, likes.get(position));
intent.putExtra(IMAGE, image.get(position));
intent.putExtra(LINK, link.get(position));
intent.putExtra(OBID, objectId.get(position));
ButtonAnimation btnAnimation = new ButtonAnimation();
btnAnimation.animateButton(view1, context);
context.startActivity(intent);
});

holder.frameLayout.setVisibility(View.VISIBLE);
if (img.get(position) != null) {

imageLoader.DisplayImage(img.get(position), holder.imageView, progressBar);
holder.button.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Context c = getContext();
Intent i = new Intent(getContext(), Description_FullImage.class);
i.putExtra("img", img.get(position));
i.putExtra("oid", obid.get(position));
ButtonAnimation btnAnimation = new ButtonAnimation();
btnAnimation.animateButton(v, c);
c.startActivity(i);
}
if (image.get(position) != null) {

Picasso.with(context).load(image.get(position)).into(holder.imageView);
holder.button.setOnClickListener(v -> {
Intent intent = new Intent(getContext(), DescriptionFullImage.class);
intent.putExtra(IMAGE, image.get(position));
intent.putExtra(OBID, objectId.get(position));
ButtonAnimation btnAnimation = new ButtonAnimation();
btnAnimation.animateButton(v, context);
context.startActivity(intent);
});

} else {
Expand All @@ -161,7 +157,7 @@ public void onClick(View v) {
set.addAnimation(slide);
set.addAnimation(fade);
view.startAnimation(set);

return view;
}

}

0 comments on commit 4ce631b

Please sign in to comment.