forked from mirego/csgames17-competition
-
Notifications
You must be signed in to change notification settings - Fork 0
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
12 changed files
with
301 additions
and
9 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
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
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
85 changes: 85 additions & 0 deletions
85
android/app/src/main/java/com/mirego/cschat/activities/RegisterActivity.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,85 @@ | ||
package com.mirego.cschat.activities; | ||
|
||
import android.app.ProgressDialog; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.view.ViewGroup; | ||
import android.widget.EditText; | ||
|
||
import com.mirego.cschat.R; | ||
import com.mirego.cschat.controller.RegisterController; | ||
|
||
import javax.inject.Inject; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* Created by mahad on 25/03/17. | ||
*/ | ||
|
||
public class RegisterActivity extends BaseActivity{ | ||
|
||
public static int PHOTO_SELECTED = 1; | ||
|
||
@BindView(R.id.register_root) | ||
ViewGroup root; | ||
|
||
@BindView(R.id.ret_username) | ||
EditText retUsername; | ||
|
||
@BindView(R.id.ret_password) | ||
EditText retPassword; | ||
|
||
@Inject | ||
RegisterController registerController; | ||
|
||
ProgressDialog progressDialog; | ||
String photoURL; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.activity_register); | ||
ButterKnife.bind(this); | ||
|
||
//((CSChatApplication) getApplication()).component().inject(this); | ||
progressDialog = new ProgressDialog(this); | ||
progressDialog.setMessage(getString(R.string.register_loading)); | ||
} | ||
|
||
@OnClick(R.id.btn_register_submit) | ||
void onRegisterClicked(){ | ||
if (progressDialog.isShowing()) { | ||
progressDialog.dismiss(); | ||
} | ||
progressDialog.show(); | ||
if(photoURL != null){ | ||
|
||
} | ||
} | ||
|
||
@OnClick(R.id.btn_photo) | ||
void onPhotoClicked(){ | ||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); | ||
intent.setType("image/*"); | ||
startActivityForResult(intent, PHOTO_SELECTED); | ||
} | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
if(requestCode == PHOTO_SELECTED){ | ||
if(resultCode == RESULT_OK){ | ||
Uri photoURI = data.getData(); | ||
photoURL = photoURI.getPath(); | ||
|
||
AmazonS3Client s3Client = new AmazonS3Client( new BasicAWSCredentials( MY_ACCESS_KEY_ID, MY_SECRET_KEY ) ); | ||
|
||
} | ||
} | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
android/app/src/main/java/com/mirego/cschat/controller/RegisterController.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.mirego.cschat.controller; | ||
|
||
import com.mirego.cschat.models.User; | ||
import com.mirego.cschat.models.request.RegisterRequest; | ||
import com.mirego.cschat.services.CSChatService; | ||
import com.mirego.cschat.services.StorageService; | ||
|
||
import io.reactivex.Flowable; | ||
|
||
/** | ||
* Created by mahad on 25/03/17. | ||
*/ | ||
|
||
public class RegisterController { | ||
private final CSChatService chatService; | ||
private final StorageService storageService; | ||
|
||
public RegisterController(CSChatService chatService, StorageService storageService) { | ||
this.chatService = chatService; | ||
this.storageService = storageService; | ||
} | ||
|
||
public Flowable<User> registerPhoto(String username, String password, String photoURL) { | ||
return chatService.registerPhoto(new RegisterRequest(username, password, photoURL)); | ||
} | ||
|
||
public Flowable<User> registerNoPhoto(String username, String password) { | ||
return chatService.registerNoPhoto(new RegisterRequest(username, password)); | ||
} | ||
|
||
public void saveUserId(String userId) { | ||
storageService.storeUserId(userId); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
android/app/src/main/java/com/mirego/cschat/models/request/RegisterRequest.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,47 @@ | ||
package com.mirego.cschat.models.request; | ||
|
||
/** | ||
* Created by mahad on 25/03/17. | ||
*/ | ||
|
||
public class RegisterRequest { | ||
private String username; | ||
private String password; | ||
private String photoURL; | ||
|
||
|
||
public RegisterRequest(String username, String password, String photoURL) { | ||
this.username = username; | ||
this.password = password; | ||
this.photoURL = photoURL; | ||
} | ||
|
||
public RegisterRequest(String username, String password) { | ||
this.username = username; | ||
this.password = password; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getPhotoURL() { | ||
return photoURL; | ||
} | ||
|
||
public void setPhotoURL(String photoURL) { | ||
this.photoURL = photoURL; | ||
} | ||
} |
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
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,84 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.percent.PercentRelativeLayout 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:id="@+id/register_root" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@android:color/white" | ||
android:orientation="vertical" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
tools:context=".activities.RegisterActivity"> | ||
|
||
<TextView | ||
android:id="@+id/tv_register" | ||
fontPath="@string/font_lato_medium" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:text="@string/register_title" | ||
android:textColor="@color/black" | ||
android:textSize="30dp" | ||
app:layout_marginTopPercent="9%" /> | ||
|
||
<android.support.design.widget.TextInputLayout | ||
android:id="@+id/rtil_username" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/tv_register" | ||
android:hint="@string/login_username" | ||
android:textColorHint="@color/purpleyGrey" | ||
app:layout_marginTopPercent="10%"> | ||
|
||
<android.support.design.widget.TextInputEditText | ||
android:id="@+id/ret_username" | ||
style="@style/LoginField" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="@color/dustyOrange" | ||
android:inputType="textNoSuggestions" /> | ||
|
||
</android.support.design.widget.TextInputLayout> | ||
|
||
<android.support.design.widget.TextInputLayout | ||
android:id="@+id/rtil_password" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/rtil_username" | ||
android:hint="@string/login_password" | ||
android:textColorHint="@color/purpleyGrey" | ||
app:layout_marginTopPercent="4%"> | ||
|
||
<android.support.design.widget.TextInputEditText | ||
android:id="@+id/ret_password" | ||
style="@style/LoginField" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="@color/dustyOrange" | ||
android:inputType="textPassword" /> | ||
|
||
</android.support.design.widget.TextInputLayout> | ||
|
||
<Button | ||
android:id="@+id/btn_photo" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/rtil_password" | ||
android:text="@string/photo_upload" | ||
android:theme="@style/PinkishGreyButton" | ||
app:layout_marginTopPercent="6%"/> | ||
|
||
<Button | ||
android:id="@+id/btn_register_submit" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/btn_photo" | ||
android:text="@string/register_submit" | ||
android:theme="@style/OrangeButton" | ||
app:layout_marginTopPercent="6%" /> | ||
|
||
|
||
</android.support.percent.PercentRelativeLayout> |
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
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,22 @@ | ||
0 info it worked if it ends with ok | ||
1 verbose cli [ '/home/mahad/.nvm/versions/node/v6.9.4/bin/node', | ||
1 verbose cli '/home/mahad/.nvm/versions/node/v6.9.4/bin/npm', | ||
1 verbose cli 'start' ] | ||
2 info using [email protected] | ||
3 info using [email protected] | ||
4 verbose stack Error: ENOENT: no such file or directory, open '/home/mahad/Projects/package.json' | ||
4 verbose stack at Error (native) | ||
5 verbose cwd /home/mahad/Projects/csgames17-competition | ||
6 error Linux 4.4.9-040409-generic | ||
7 error argv "/home/mahad/.nvm/versions/node/v6.9.4/bin/node" "/home/mahad/.nvm/versions/node/v6.9.4/bin/npm" "start" | ||
8 error node v6.9.4 | ||
9 error npm v3.10.10 | ||
10 error path /home/mahad/Projects/package.json | ||
11 error code ENOENT | ||
12 error errno -2 | ||
13 error syscall open | ||
14 error enoent ENOENT: no such file or directory, open '/home/mahad/Projects/package.json' | ||
15 error enoent ENOENT: no such file or directory, open '/home/mahad/Projects/package.json' | ||
15 error enoent This is most likely not a problem with npm itself | ||
15 error enoent and is related to npm not being able to find a file. | ||
16 verbose exit [ -2, true ] |
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