Skip to content

Commit

Permalink
Add CmpE436 and CmpE487 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
enescakir committed Dec 10, 2018
1 parent 8163e20 commit ee22071
Show file tree
Hide file tree
Showing 214 changed files with 8,549 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

cmpe443
cmpe487/final-project
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ Programming projects that I have written at university
- [Project 1](/cmpe321/project1) `Latex`
- [Project 2](/cmpe321/project2) `Java`
- [Project 3](/cmpe321/project3) `PHP`
-

### [CmpE322 - Operating Systems](/cmpe322)
- [Project 1](/cmpe322/project1) `C++`
- [Project 2](/cmpe322/project2) `C++`
- [Project 3](/cmpe322/project3) `C++`
-

### [CmpE362 - Intro to Signal Processing](/cmpe362)
- [Project 1](/cmpe362/project1) `Matlab`
- [Project 2](/cmpe362/project2) `Matlab`
- [Project 3](/cmpe362/project3) `Matlab`
-

### [CmpE493 - Introduction to Information Retrieval](/cmpe493)
- [Project 1](/cmpe493/project1) `Python`
- [Project 2](/cmpe493/project2) `Python`
Expand Down
Empty file added cmpe230/project1/test.stm
Empty file.
11 changes: 11 additions & 0 deletions cmpe436/final-project/Auctioner/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
4 changes: 4 additions & 0 deletions cmpe436/final-project/Auctioner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Real-time Auction Android App
It has 2 different activities.

`MainActivity` is using for auction listing and `DetailActivity` is using for auction bidding page.
1 change: 1 addition & 0 deletions cmpe436/final-project/Auctioner/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
32 changes: 32 additions & 0 deletions cmpe436/final-project/Auctioner/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.enescakir.auctioner"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support:design:28.0.0'
}
21 changes: 21 additions & 0 deletions cmpe436/final-project/Auctioner/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.enescakir.auctioner;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.enescakir.auctioner", appContext.getPackageName());
}
}
21 changes: 21 additions & 0 deletions cmpe436/final-project/Auctioner/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.enescakir.auctioner">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DetailActivity" />
</application>
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.enescakir.auctioner;

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

import com.enescakir.auctioner.Model.Auction;

import java.util.ArrayList;

public class AuctionAdapter extends RecyclerView.Adapter<AuctionAdapter.MyViewHolder> {

ArrayList<Auction> auctions;
LayoutInflater inflater;

public AuctionAdapter(Context context, ArrayList<Auction> auctions) {
inflater = LayoutInflater.from(context);
this.auctions = auctions;
}


@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.row_auction, parent, false);
return new MyViewHolder(view);
}

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.setData(auctions.get(position), position);
}

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


class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView nameView, dateView;
ImageView imageView;
Auction auction;
int position;

public MyViewHolder(View view) {
super(view);
nameView = (TextView) view.findViewById(R.id.nameView);
dateView = (TextView) view.findViewById(R.id.dateView);
imageView = (ImageView) view.findViewById(R.id.imageView);
view.setOnClickListener(this);
}

public void setData(Auction auction, int position) {
this.auction = auction;
this.position = position;
this.nameView.setText(auction.getName());
this.dateView.setText(String.format("Until: %s", auction.getHumanDate()));
Context context = imageView.getContext();
int image = context.getResources().getIdentifier(auction.getImageName(), "drawable", context.getPackageName());
this.imageView.setImageResource(image);
}

@Override
public void onClick(View view) {
Context context = view.getContext();
Intent intent = new Intent(view.getContext(), DetailActivity.class);
intent.putExtra("auctionId", auction.getId());
intent.putExtra("auctionName", auction.getName());
intent.putExtra("auctionDescription", auction.getDescription());
intent.putExtra("auctionDate", auction.getDate());
context.startActivity(intent);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.enescakir.auctioner;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.enescakir.auctioner.Model.User;

public class BaseActivity extends AppCompatActivity {
public static String username;
public static int points;
public SharedPreferences preferences;
ProgressDialog progressDialog;

public void showToast(Context context, String message) {
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}

public void showProgress(Context context) {
progressDialog = ProgressDialog.show(context, "", "Loading. Please wait...", true);
}

public void dismissProgress() {
if (progressDialog != null) {
progressDialog.dismiss();
}
}

public final void runOnThread(Thread action) {
action.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.enescakir.auctioner;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.enescakir.auctioner.Model.Bid;

import java.util.ArrayList;

public class BidAdapter extends RecyclerView.Adapter<BidAdapter.MyViewHolder> {

ArrayList<Bid> bids;
LayoutInflater inflater;

public BidAdapter(Context context, ArrayList<Bid> bids) {
inflater = LayoutInflater.from(context);
this.bids = bids;
}


@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.row_bid, parent, false);
return new MyViewHolder(view);
}

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.setData(bids.get(position), position);

}

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

public void addBid(Bid bid) {
bids.add(0, bid);
notifyItemInserted(0);
}

class MyViewHolder extends RecyclerView.ViewHolder {
TextView usernameView, pointView, dateView;
Bid bid;
int position;

public MyViewHolder(View view) {
super(view);
usernameView = (TextView) view.findViewById(R.id.usernameView);
pointView = (TextView) view.findViewById(R.id.pointView);
dateView = (TextView) view.findViewById(R.id.dateView);
}

public void setData(Bid bid, int position) {
this.bid = bid;
this.position = position;
this.usernameView.setText(bid.getUsername());
this.pointView.setText(String.format("%d points", bid.getPoint()));
this.dateView.setText(bid.getHumanDate());
}
}
}
Loading

0 comments on commit ee22071

Please sign in to comment.