diff --git a/app/src/main/java/com/example/srinivasan/database2/Float.java b/app/src/main/java/com/example/srinivasan/database2/Float.java index 0ac48b67a690969d55c2e2b07a54c48bde07ef5d..91abf7ca2131c809c34352b0d8ba77feeff89295 100644 --- a/app/src/main/java/com/example/srinivasan/database2/Float.java +++ b/app/src/main/java/com/example/srinivasan/database2/Float.java @@ -51,7 +51,7 @@ public class Float extends AppCompatActivity { button=(Button)findViewById(R.id.button); databaseHelperTwo=new DatabaseHelperTwo(getApplicationContext()); - databaseHelperTwo.searchpass(); + //databaseHelperTwo.searchpass(); s=new Session(this); if (!s.loggedIn()){ diff --git a/app/src/main/java/com/example/srinivasan/database2/RecyclerAdapter.java b/app/src/main/java/com/example/srinivasan/database2/RecyclerAdapter.java index 771dab8b6d985c0446e03a3b40b4222ce851757a..d44e9ee68c12adf78c6ad6cb16fd9767dfae0bcd 100644 --- a/app/src/main/java/com/example/srinivasan/database2/RecyclerAdapter.java +++ b/app/src/main/java/com/example/srinivasan/database2/RecyclerAdapter.java @@ -104,7 +104,7 @@ String[] a,b,c; try { viewHolder.itemImage.setImageBitmap(bitmapArray.get(i)); }catch (IndexOutOfBoundsException e){ - + viewHolder.itemImage.setImageBitmap(null); } } diff --git a/app/src/main/java/com/example/srinivasan/database2/SingleView.java b/app/src/main/java/com/example/srinivasan/database2/SingleView.java index 77680508b9f0eaea46b51607e5f699cd2cdcaabe..0d7fa3059a1886848a992c781332a222c95bf3a0 100644 --- a/app/src/main/java/com/example/srinivasan/database2/SingleView.java +++ b/app/src/main/java/com/example/srinivasan/database2/SingleView.java @@ -1,7 +1,9 @@ package com.example.srinivasan.database2; import android.app.ProgressDialog; +import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; @@ -11,6 +13,7 @@ import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; +import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.PopupWindow; @@ -19,12 +22,13 @@ import android.widget.TextView; import java.util.ArrayList; +import static android.R.attr.editTextStyle; import static android.R.attr.handle; -public class SingleView extends AppCompatActivity { +public class SingleView extends AppCompatActivity implements View.OnClickListener{ DatabaseHelperTwo db2; String[] date, time, query , locat; - TextView date1, time1, com1 ,location ; + TextView date1, time1, com1 ,location ,comments,typecom,butcom; ProgressBar progressBar; FloatingActionButton fab; ProgressDialog progress; @@ -32,7 +36,10 @@ public class SingleView extends AppCompatActivity { private TextView textView; PopupWindow popupWindow; private Handler handler = new Handler(); - + SharedPreferences sharedpreferences; + public static final String MyPREFERENCES = "MyPrefs" ; + public static final String textsave = null; + int position; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -42,11 +49,15 @@ public class SingleView extends AppCompatActivity { time1 = (TextView) findViewById(R.id.texttime); com1 = (TextView) findViewById(R.id.comm); location = (TextView)findViewById(R.id.location); + comments = (TextView)findViewById(R.id.comments); + typecom = (EditText)findViewById(R.id.typecom); + butcom = (Button)findViewById(R.id.butcom); + butcom.setOnClickListener(this); // Get intent data popupWindow = new PopupWindow(this); Intent i = getIntent(); // Selected image id - int position = i.getExtras().getInt("i"); + position = i.getExtras().getInt("i"); //ImageAdapter imageAdapter = new ImageAdapter(this); ArrayList<Bitmap> bitmapArray = new ArrayList<Bitmap>(); bitmapArray = db2.searchpass(); @@ -62,6 +73,12 @@ public class SingleView extends AppCompatActivity { } }); */ + sharedpreferences = getSharedPreferences("text",0); + //SharedPreferences.Editor sedt = sharedpreferences.edit(); + String newtw = sharedpreferences.getString("text",""); + + comments.setText(newtw); + ImageView imageView = (ImageView) findViewById(R.id.SingleView); //imageView.setImageResource(imageAdapter.mThumbIds[position]); imageView.setImageBitmap(bitmapArray.get(position)); @@ -71,9 +88,17 @@ public class SingleView extends AppCompatActivity { location.setText(locat[position]); } + /*public void Comment(View v){ + String a; + a = typecom.getText().toString(); + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString(textsave, a); + editor.commit(); + comments.append(++i + " . "+ a + "\n\n"); + } public void pro(View v) { - /* + progress = new ProgressDialog(SingleView.this); progress.setMax(100); progress.setMessage("Work on Progress"); @@ -104,7 +129,17 @@ public class SingleView extends AppCompatActivity { public void handleMessage(Message msg) { super.handleMessage(msg); progress.incrementProgressBy(1); - }*/ + } + }*/ + + @Override + public void onClick(View v) { + String a; + a = typecom.getText().toString(); + comments.append("->"+ a + "\n\n"); + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString("text",comments.getText().toString()); + editor.commit(); } } diff --git a/app/src/main/res/layout/activity_float.xml b/app/src/main/res/layout/activity_float.xml index 35ff7bb5a92159aa6f793389eb44ee68231ec8b0..6ffeb0cf8e0ad557f2e26b772744f788d9acfeee 100644 --- a/app/src/main/res/layout/activity_float.xml +++ b/app/src/main/res/layout/activity_float.xml @@ -14,7 +14,7 @@ <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> diff --git a/app/src/main/res/layout/content_single_view.xml b/app/src/main/res/layout/content_single_view.xml index 47b2b48de9b2b809535e410bfb0a452d39a0ed71..4e3c9520a2f0ed0bf82845be0a324c27df64f95d 100644 --- a/app/src/main/res/layout/content_single_view.xml +++ b/app/src/main/res/layout/content_single_view.xml @@ -141,6 +141,43 @@ android:text="Loc" android:textColor="@android:color/holo_blue_bright" android:textSize="24sp" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/LinearLayout06" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@+id/LinearLayout05" + android:orientation="vertical" + android:paddingTop="30dp"> + + + <TextView + android:id="@+id/textView10" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Comments :" + android:textSize="30sp" /> + + <TextView + android:id="@+id/comments" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:textSize="30sp" /> + + <EditText + android:id="@+id/typecom" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPersonName" /> + + <Button + android:id="@+id/butcom" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Submit Comment" /> </LinearLayout> </RelativeLayout> </android.support.v4.widget.NestedScrollView>