Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 24, 2015
1 parent acd4d38 commit 7cb33f2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
convertView = inflater.inflate(resourceId, null);
}



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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;

/**
* Created by yuichi on 8/24/15.
Expand All @@ -27,24 +26,32 @@ public class Gps implements LocationListener {
//get the place or not
boolean isGetPlace = false;

//set interface for call back
public interface GetPlaceCallBack{
public void isGetPlaceCB(double lon, double lat);
}
private GetPlaceCallBack _mGetPlaceCallBack;

//set call backs
public void setCallbacks(GetPlaceCallBack getPlaceCallBack){
_mGetPlaceCallBack = getPlaceCallBack;
}

//Constructor
public Gps(Context context){
//set context
this.mContext = context;
//make criteria
mCriteria = new Criteria();
}

//setProvider
public void setProvider(){
//set how power they use
mCriteria.setPowerRequirement(Criteria.POWER_LOW);
//set how much accuracy
mCriteria.setAccuracy(Criteria.ACCURACY_COARSE);
//get provider name from conditions
mProvider = mLocationManager.getBestProvider(mCriteria, true);
}

Expand All @@ -57,27 +64,29 @@ public void startGps(){
mLocationManager = (LocationManager)mContext.getSystemService(Context.LOCATION_SERVICE);
setProvider();
mLocationManager.requestLocationUpdates(mProvider, 0, 0, this);
Log.d("aaa","start");
}

//stop to get place
public void stopGps(){
mLocationManager.removeUpdates(this);
}

//give the value of longitude
public double getLongitude(){
return mLongitude;
}

//give the value of latitude
public double getLatitude(){
return mLatitude;
}

@Override
public void onLocationChanged(Location location) {
//set coordinate
mLongitude = location.getLongitude();
mLatitude = location.getLatitude();
Log.d("aaa","changed");
//call callback function
_mGetPlaceCallBack.isGetPlaceCB(mLongitude, mLatitude);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ public void isGetPlaceCB(double lon, double lat){
mGps.stopGps();
this.mLongitude = lon;
this.mLatitude = lat;
Log.d("aaa", "success");
showList();
}

@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.homeMakeGrope:
Log.d("aa","aa");
String className = ".MakeGroup";
Intent intent = new Intent();
intent.setClassName(SignIn.packageName, SignIn.packageName + className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import java.security.NoSuchAlgorithmException;

public class SignIn extends ActionBarActivity implements View.OnClickListener{
//edit text for id and password
EditText idSignIn;
EditText passwordSignIn;
//the path of this application
static String packageName = "pmv02.ppr.yuichi10.github.com.joinevents";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@ public class SignUP extends Activity implements View.OnClickListener{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_up);
Log.d("Intent", "success");
Intent intent = getIntent();

//the button when user try to choose images
Button thumbnail = (Button)findViewById(R.id.signUpGetImage);
thumbnail.setOnClickListener(this);

//set email width. try not to change width
email = (EditText)findViewById(R.id.signUpEmail_e);
email.setWidth(email.getWidth());
//set password width. not to change width
password1 = (EditText)findViewById(R.id.signUpPassword_e);
password1.setWidth(password1.getWidth());
//set password width. not to change width
password2 = (EditText)findViewById(R.id.signUpPassword2_e);
password2.setWidth(password2.getWidth());
//set name width. not to change width
name = (EditText)findViewById(R.id.signUpName_e);
name.setWidth(name.getWidth());
}
Expand Down Expand Up @@ -79,7 +82,7 @@ public void onClick(View v) {
switch (v.getId()){
//when select image button was pushed
case R.id.signUpGetImage:
//go to ThumbnailImage activity
//go to ThumbnailImage activity. get answer when next activity is finished
Intent intent = new Intent();
intent.setClassName(SignIn.packageName, SignIn.packageName + ".ThumbnailImage");
startActivityForResult(intent, this.mRequestCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
* Created by yuichi on 8/20/15.
*/
public class ThumbnailImage extends Activity implements AdapterView.OnItemClickListener, AbsListView.OnScrollListener{
ArrayList<String>imageMap = new ArrayList<String>();
//set thumbnails path
ArrayList<String>imagePaths = new ArrayList<String>();
//set bitmap image of thumbnail
ArrayList<Bitmap>imageList = new ArrayList<Bitmap>();
//
Cursor cursor;
ContentResolver resolver;
BitmapAdapter adapter;
Expand Down Expand Up @@ -53,15 +56,22 @@ public void onCreate(Bundle savedInstanceState) {

private void getThumbnail(){
int i = 0;
//get current position
cursor.getPosition();
//move to first
if(cursor.moveToFirst()){
do{
//get id and path
long idImage = cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID));
String pathImage = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
imageMap.add(pathImage);
//add image path to imagePaths
imagePaths.add(pathImage);
Bitmap bmp = MediaStore.Images.Thumbnails.getThumbnail(resolver,idImage,MediaStore.Images.Thumbnails.MINI_KIND,null);
Log.v("aa",cursor.getPosition() + "");
//set thumbnail bitmap to imageList
imageList.add(bmp);
//now just show 40 picture
//coz if set everything the memory will break
i++;
if(i == 40){
break;
Expand All @@ -74,18 +84,18 @@ private void getThumbnail(){
gridView.setAdapter(adapter);
}

//when the thumbnail picture are selected
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
Log.d("aa", imageList.get(position)+"");
//I do not know but I can not set bmp image
//thus now I set images url
intent.putExtra("key", imageMap.get(position));
intent.putExtra("key", imagePaths.get(position));
setResult(Activity.RESULT_OK, intent);
finish();
}


@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {

Expand Down

0 comments on commit 7cb33f2

Please sign in to comment.