-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
214 changed files
with
8,549 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
|
||
cmpe443 | ||
cmpe487/final-project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
26 changes: 26 additions & 0 deletions
26
...t/Auctioner/app/src/androidTest/java/com/enescakir/auctioner/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
cmpe436/final-project/Auctioner/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
79 changes: 79 additions & 0 deletions
79
...436/final-project/Auctioner/app/src/main/java/com/enescakir/auctioner/AuctionAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
cmpe436/final-project/Auctioner/app/src/main/java/com/enescakir/auctioner/BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
cmpe436/final-project/Auctioner/app/src/main/java/com/enescakir/auctioner/BidAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} |
Oops, something went wrong.