Skip to content

Commit

Permalink
make grid show
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 20, 2015
1 parent 2f48f8f commit c7f6af1
Show file tree
Hide file tree
Showing 45 changed files with 540 additions and 58 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions JoinEvents/.idea/misc.xml → .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

This file was deleted.

11 changes: 0 additions & 11 deletions JoinEvents/app/src/main/res/layout/activity_home.xml

This file was deleted.

6 changes: 0 additions & 6 deletions JoinEvents/app/src/main/res/values/strings.xml

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions JoinEvents/app/app.iml → app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Home"
android:name=".SignIn"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Home" android:label="Home" />
<activity android:name=".SignUP" android:label="signUp" />
<activity android:name=".ThumbnailImage" android:label="ThumbnailImage"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package pmv02.ppr.yuichi10.github.com.joinevents;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;

import java.util.ArrayList;
import java.util.List;

/**
* Created by yuichi on 8/20/15.
*/
public class BitmapAdapter extends ArrayAdapter<Bitmap> {

private int resourceId;

public BitmapAdapter(Context context, int resource, int textViewResourceId, List<Bitmap> objects) {
super(context, resource, textViewResourceId, objects);
this.resourceId = resource;
}

public BitmapAdapter(Context context, int resource, List<Bitmap> objects) {
super(context, resource, objects);
resourceId = resource;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(resourceId, null);
}

ImageView view = (ImageView) convertView;
view.setImageBitmap(getItem(position));

return view;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package pmv02.ppr.yuichi10.github.com.joinevents;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

/**
* Created by yuichi on 8/20/15.
*/
public class Home extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
Log.d("Intent", "success");
Intent intent = getIntent();

TextView tv = (TextView)findViewById(R.id.homeText);
}
}
110 changes: 110 additions & 0 deletions app/src/main/java/pmv02/ppr/yuichi10/github/com/joinevents/SignIn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package pmv02.ppr.yuichi10.github.com.joinevents;

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

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SignIn extends ActionBarActivity implements View.OnClickListener{
EditText idSignIn;
EditText passwordSignIn;
static String packageName = "pmv02.ppr.yuichi10.github.com.joinevents";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
//get the edit text for sign in
idSignIn = (EditText)findViewById(R.id.idSignIn);
passwordSignIn = (EditText)findViewById(R.id.passwordSignIn);
//button for sign in
Button doSignIn = (Button)findViewById(R.id.doSignIn);
doSignIn.setOnClickListener(this);
//button for sign up
Button doSignUp = (Button)findViewById(R.id.doSignUp);
doSignUp.setOnClickListener(this);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_sign_in, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void onClick(View v) {

Intent intent = new Intent();
switch (v.getId()){
case R.id.doSignIn:
String strID = idSignIn.getText().toString();
String strPass = passwordSignIn.getText().toString();
strPass = encodePassdigiest(strPass);
Log.d("Intent","push button");
intent.setClassName(packageName, packageName + ".Home");
startActivity(intent);
break;
case R.id.doSignUp:
intent.setClassName(packageName, packageName + ".SignUP");
startActivity(intent);
break;
}
}



public String encodePassdigiest(String password){
byte[] enclyptedHash=null;
// MD5で暗号化したByte型配列を取得する
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
enclyptedHash = md5.digest();

// 暗号化されたByte型配列を、16進数表記文字列に変換する
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return bytesToHexString(enclyptedHash);
}

private String bytesToHexString(byte[] fromByte) {

StringBuilder hexStrBuilder = new StringBuilder();
for (int i = 0; i < fromByte.length; i++) {

// 16進数表記で1桁数値だった場合、2桁目を0で埋める
if ((fromByte[i] & 0xff) < 0x10) {
hexStrBuilder.append("0");
}
hexStrBuilder.append(Integer.toHexString(0xff & fromByte[i]));
}
return hexStrBuilder.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package pmv02.ppr.yuichi10.github.com.joinevents;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
* Created by yuichi on 8/20/15.
*/
public class SignUP extends Activity implements View.OnClickListener{
static int mRequestCode = 1001;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_up);
Log.d("Intent", "success");
Intent intent = getIntent();

Button thumbnail = (Button)findViewById(R.id.signUpGetImage);
thumbnail.setOnClickListener(this);
}

public void onActivityResult( int requestCode, int resultCode, Intent intent ){
if(requestCode == this.mRequestCode){
if(resultCode == Activity.RESULT_OK){
// 返却されてきたintentから値を取り出す
String str = intent.getStringExtra( "key" );
Log.d("aa",str);
}
}
}

@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.signUpGetImage:
Intent intent = new Intent();
intent.setClassName(SignIn.packageName, SignIn.packageName + ".ThumbnailImage");
startActivityForResult(intent,this.mRequestCode);
break;
}
}
}
Loading

0 comments on commit c7f6af1

Please sign in to comment.