Skip to content

Commit

Permalink
merge a-s-n
Browse files Browse the repository at this point in the history
  • Loading branch information
ninadthakare committed Nov 30, 2016
2 parents 7eaa231 + 6daa00b commit 67ba30e
Show file tree
Hide file tree
Showing 23 changed files with 1,459 additions and 6 deletions.
17 changes: 17 additions & 0 deletions README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# neostore

## Synopsis

This introductory course provides trainee with the opportunity to practice and expereince designing and publishing an android app.

## Design Reference

http://design.neosofttech.in/35/NeoSoft/NeoSTORE/Guideline_1.html

## API Reference

http://180.149.245.182:8844/trainingapp/webroot/apidoc/index.html#api-A_User

## License

A short snippet describing the license (MIT, Apache, etc.)
7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.12'

compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'com.google.code.gson:gson:2.8.0'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'me.relex:circleindicator:1.2.2@aar'

}
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.neosoft.neostore">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -22,5 +25,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.RegisterActivity"
android:label="RegisterActivity"
android:theme="@style/AppTheme" />
</application>
</manifest>
63 changes: 63 additions & 0 deletions app/src/main/java/com/neosoft/neostore/activity/LoginActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.neosoft.neostore.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.google.gson.Gson;
import com.neosoft.neostore.R;
import com.neosoft.neostore.serviceapi.GetServices;
import com.neosoft.neostore.serviceapi.Services;
import com.neosoft.neostore.validate.Validate;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener, Services.ApiResponse {

Button btnLogin, btnRegister;
EditText editEmail, editPass;
String email, pass;
Validate valid = new Validate();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

editEmail = (EditText) findViewById(R.id.edtEmail);
editPass = (EditText) findViewById(R.id.edtPass);
btnLogin = (Button) findViewById(R.id.btn_login);
btnRegister = (Button) findViewById(R.id.btn_login_signup);

btnLogin.setOnClickListener(this);
btnRegister.setOnClickListener(this);
}

@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_login:
if (valid.loginValidate(editEmail,editPass)) {
email = String.valueOf(editEmail.getText());
pass = String.valueOf(editPass.getText());

GetServices getServices = new GetServices();
getServices.login(email,pass);
}
break;

case R.id.btn_login_signup:
Intent intent = new Intent(getApplicationContext(), RegisterActivity.class);
startActivity(intent);
}
}

@Override
public void onSuccess(String response) {
Log.e(LoginActivity.class.getSimpleName(), "onSuccess response " + response);

new Gson().toJson(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.neosoft.neostore.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.neosoft.neostore.R;
import com.neosoft.neostore.serviceapi.GetServices;
import com.neosoft.neostore.serviceapi.Services;
import com.neosoft.neostore.validate.Validate;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener,Services.ApiResponse{

Button register;
Toolbar toolbar;
EditText editFname, editLname, editEmail, editPass, editConfirmPass, editPhone;
String fname, lname, email, pass, cpass, phone, gender;
RadioGroup rdGrpGender;
RadioButton rdbtnGender;
TextView txtGengerErr;
Validate valid = new Validate();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);

editFname = (EditText) findViewById(R.id.etFirstname);
editLname = (EditText) findViewById(R.id.etLastname);
editEmail = (EditText) findViewById(R.id.etEmail);
editPass = (EditText) findViewById(R.id.etPassword);
editConfirmPass = (EditText) findViewById(R.id.etConfirmPassword);
editPhone = (EditText) findViewById(R.id.etPhone);
register = (Button) findViewById(R.id.btnRegister);
toolbar = (Toolbar) findViewById(R.id.toolbar);
rdGrpGender = (RadioGroup) findViewById(R.id.radioGender);
txtGengerErr = (TextView) findViewById(R.id.txtGenderValidate);
txtGengerErr.setVisibility(View.VISIBLE);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
}
});
register.setOnClickListener(this);
}

@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnRegister :

if(valid.registerValidate(editFname,editLname,editEmail,editPass,editConfirmPass,rdGrpGender,txtGengerErr,editPhone)) {
int genderId = rdGrpGender.getCheckedRadioButtonId();
rdbtnGender = (RadioButton) findViewById(genderId);
fname = String.valueOf(editFname.getText());
lname = String.valueOf(editLname.getText());
email = String.valueOf(editEmail.getText());
pass = String.valueOf(editPass.getText());
cpass = String.valueOf(editConfirmPass.getText());
phone = String.valueOf(editPhone.getText());
if(rdbtnGender.getText().equals("Male"))
gender = "M";
else
gender = "F";

GetServices services = new GetServices();
services.register(fname,lname,email,pass,cpass,gender,phone);
}
break;
}
}

@Override
public void onSuccess(String response) {
Log.e(RegisterActivity.class.getSimpleName(),"onSuccess response "+response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.neosoft.neostore.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.neosoft.neostore.R;

public class HomepageFragment extends Fragment {
public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE";
private View v;
private boolean imageloaded;
public static final HomepageFragment newInstance(int message) {
HomepageFragment f = new HomepageFragment();
Bundle bdl = new Bundle();
bdl.putString(EXTRA_MESSAGE, String.valueOf(message));
f.setArguments(bdl);
return f;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
String message = getArguments().getString(EXTRA_MESSAGE);
if (!imageloaded) {
v = inflater.inflate(R.layout.homepage_layout, container, false);
ImageView imageView = (ImageView) v.findViewById(R.id.home_imageView);
imageView.setImageResource(Integer.parseInt(message));
imageloaded = true;
}
return v;
}
}
Loading

0 comments on commit 67ba30e

Please sign in to comment.