Skip to content

Commit

Permalink
move to publish screen after photo added
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHorstmann committed Apr 27, 2014
1 parent 0718a5c commit 0f02340
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
8 changes: 1 addition & 7 deletions src/AndroidClient/res/layout/create_poll_1.xml
Expand Up @@ -34,13 +34,7 @@
android:id="@+id/buttonSkipPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Skip -->" />
android:text="No photo" />


<ImageView
android:id="@+id/imageView1"
android:layout_width="137dp"
android:layout_height="178dp"
android:src="@drawable/ic_launcher" />

</LinearLayout>
7 changes: 7 additions & 0 deletions src/AndroidClient/res/layout/create_poll_2.xml
Expand Up @@ -18,6 +18,13 @@
android:text="Ready to publish?"
android:textAppearance="?android:attr/textAppearanceMedium" />

<ImageView
android:id="@+id/imageViewThumbnail"
android:layout_width="163dp"
android:layout_height="0dp"
android:layout_weight="1.20"
android:src="@drawable/ic_launcher" />

<Button
android:id="@+id/buttonPublish"
android:layout_width="wrap_content"
Expand Down
Expand Up @@ -57,6 +57,7 @@ protected void onPostExecute(String result) {


Poll mPoll;
Uri mImageUri;
int screen = 0;

Button mButtonPublish;
Expand All @@ -83,16 +84,17 @@ protected void onCreate(Bundle savedInstanceState) {

if (savedInstanceState != null) {
newPhotoFileName = savedInstanceState.getString("newPhotoFileName");
screen = savedInstanceState.getInt("screen");
//mPoll = savedInstanceState.getString("mPoll); <-- TODO deserialize
}
else {
mPoll = new Poll();
screen = 0;
}


mLocalStorageService = new LocalStorageService(this);
mBackendService = new BackendService(mLocalStorageService);

mPoll = new Poll();


screen = 0;
draw();
}

Expand Down Expand Up @@ -143,8 +145,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
mEditTextQuestion.requestFocus();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditTextQuestion, 0); // hmmm doesn't work...


}


Expand Down Expand Up @@ -198,25 +198,27 @@ public void onClick(View v) {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
Uri uri = Uri.fromFile(new File(newPhotoFileName));
ImageView iv = (ImageView)findViewById(R.id.imageView1);
iv.setImageURI(uri);
mImageUri = Uri.fromFile(new File(newPhotoFileName));
}

if ((requestCode == PICK_IMAGE) && (resultCode == Activity.RESULT_OK) && (data != null)) {
Uri uri = data.getData();
ImageView iv = (ImageView)findViewById(R.id.imageView1);
iv.setImageURI(uri);
mImageUri = data.getData();
}

if (mImageUri != null) {
screen = 2;
draw();
}
}




private void drawPublishScreen() {

createAlertDialogs();

setContentView(R.layout.create_poll_2);

ImageView iv = (ImageView)findViewById(R.id.imageViewThumbnail);
iv.setImageURI(mImageUri);

mProgressBarPublish = (ProgressBar)findViewById(R.id.progressBarPublish);
mProgressBarPublish.setVisibility(View.INVISIBLE);
Expand Down

0 comments on commit 0f02340

Please sign in to comment.