Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Logcat
- 08-27 15:57:10.434: E/ActivityManager(80): ANR in com.example.positivityapp (com.example.positivityapp/.CreateSlideActivity)
- 08-27 15:57:10.434: E/ActivityManager(80): Reason: keyDispatchingTimedOut
- package com.example.positivityapp;
- import android.app.Activity;
- import android.content.Intent;
- import android.net.Uri;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.View;
- import android.widget.AdapterView;
- import android.widget.Button;
- import android.widget.ImageView;
- import android.widget.TextView;
- import android.widget.Toast;
- import java.util.ArrayList;
- import com.example.positivityapp.db.DBAdapter;
- import com.example.positivityapp.views.DraggableGridView;
- public class CreateSlideActivity extends Activity {
- private ArrayList<String> arl;
- Boolean arrsize;
- DraggableGridView dgv;
- ArrayList localArrayList;
- DBAdapter localDBAdapter;
- private FullImageLoader mLoder;
- private Uri musicUrl;
- private TextView textViewMessagetitle;
- boolean url = true;
- private void SaveVideo()
- {
- if (this.musicUrl != null)
- {
- String str = this.musicUrl.toString();
- this.localDBAdapter.addSlideShow(str, this.arl);
- Toast.makeText(getBaseContext(), "Saved!", 0).show();
- this.url = false;
- finish();
- return;
- }
- if (this.url) {}
- this.localDBAdapter.addSlideShow(null, this.arl);
- Toast.makeText(getBaseContext(), "Saved!", 0).show();
- this.url = true;
- finish();
- }
- private void setListeners()
- {
- this.dgv.setOnRearrangeListener(new com.animoto.android.views.OnRearrangeListener()
- {
- public void onRearrange(int paramAnonymousInt1, int paramAnonymousInt2)
- {
- String str = (String)CreateSlideActivity.this.arl.remove(paramAnonymousInt1);
- if (paramAnonymousInt1 < paramAnonymousInt2)
- {
- CreateSlideActivity.this.arl.add(paramAnonymousInt2, str);
- return;
- }
- CreateSlideActivity.this.arl.add(paramAnonymousInt2, str);
- }
- });
- this.dgv.setOnItemClickListener(new AdapterView.OnItemClickListener()
- {
- public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
- {
- CreateSlideActivity.this.dgv.removeViewAt(paramAnonymousInt);
- CreateSlideActivity.this.arl.remove(paramAnonymousInt);
- }
- });
- }
- protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
- {
- super.onActivityResult(paramInt1, paramInt2, paramIntent);
- if ((paramInt2 == -1) && (paramIntent != null))
- {
- if (paramInt1 != 1) {
- for (;;)
- {
- if (paramInt1 == 0)
- {
- this.localArrayList = ((ArrayList)paramIntent.getSerializableExtra("list"));
- if (this.arl == null)
- {
- this.arl = this.localArrayList;
- this.arrsize = Boolean.valueOf(true);
- }
- if (this.arrsize.booleanValue())
- {
- int k = 0;
- if (this.localArrayList != null)
- {
- this.textViewMessagetitle.setVisibility(0);
- this.dgv.setVisibility(0);
- this.arl.addAll(this.localArrayList);
- k = this.localArrayList.size();
- }
- for (int m = 0;; m++)
- {
- if (m >= k / 2)
- {
- this.arrsize = Boolean.valueOf(false);
- return;
- }
- this.localArrayList.remove(m);
- ImageView localImageView2 = new ImageView(this);
- localImageView2.setScaleType(ImageView.ScaleType.CENTER_CROP);
- localImageView2.setImageBitmap(this.mLoder.getBitmap((String)this.localArrayList.get(m), 300, 300));
- this.dgv.addView(localImageView2);
- }
- }
- if (this.localArrayList == null) {
- break;
- }
- this.textViewMessagetitle.setVisibility(0);
- this.dgv.setVisibility(0);
- this.arl.addAll(this.localArrayList);
- int i = this.localArrayList.size();
- for (int j = 0; j < i; j++)
- {
- ImageView localImageView1 = new ImageView(this);
- localImageView1.setScaleType(ImageView.ScaleType.CENTER_CROP);
- localImageView1.setImageBitmap(this.mLoder.getBitmap((String)this.localArrayList.get(j), 300, 300));
- this.dgv.addView(localImageView1);
- }
- }
- }
- }
- this.musicUrl = paramIntent.getData();
- }
- }
- public void onBackPressed()
- {
- super.onBackPressed();
- }
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_create_slide);
- Button button1 = (Button)findViewById(R.id.buttonChoosePictures);
- Button button2 = (Button)findViewById(R.id.buttonMusic);
- Button button3 = (Button)findViewById(R.id.buttonPreview);
- Button button4 = (Button)findViewById(R.id.buttonSave);
- button1.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(View view)
- {
- startActivityForResult(new Intent().setClass(CreateSlideActivity.this, MultiPhotoSelectActivity.class), 0);
- }
- });
- button2.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(View view)
- {
- Intent localIntent = new Intent();
- localIntent.setType("audio/*");
- localIntent.setAction("android.intent.action.GET_CONTENT");
- CreateSlideActivity.this.startActivityForResult(Intent.createChooser(localIntent, "Complete action using"), 1);
- }
- });
- button3.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(View view)
- {
- if (CreateSlideActivity.this.arl == null)
- {
- Toast.makeText(CreateSlideActivity.this.getBaseContext(), "Choose photos from gallery!", 0).show();
- return;
- }
- Intent localIntent = new Intent();
- localIntent.putExtra("list", CreateSlideActivity.this.arl);
- localIntent.setData(CreateSlideActivity.this.musicUrl);
- localIntent.putExtra("preview", true);
- localIntent.putExtra("oldslide", false);
- localIntent.setClass(CreateSlideActivity.this, SlideShow.class);
- CreateSlideActivity.this.startActivity(localIntent);
- }
- });
- button4.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(View paramAnonymousView)
- {
- if (CreateSlideActivity.this.arl == null)
- {
- Toast.makeText(CreateSlideActivity.this.getBaseContext(), "Choose photos from gallery!", 0).show();
- return;
- }
- CreateSlideActivity.this.localDBAdapter = new DBAdapter(CreateSlideActivity.this);
- CreateSlideActivity.this.SaveVideo();
- }
- });
- this.dgv = ((DraggableGridView)findViewById(R.id.vgv));
- this.textViewMessagetitle = ((TextView)findViewById(R.id.textViewMessagetitle));
- this.mLoder = new FullImageLoader(getBaseContext(), (short)200);
- setListeners();
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.create_slide, menu);
- return true;
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout
- android:padding="2.0dip"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:keepScreenOn="true"
- xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <LinearLayout
- android:gravity="center"
- android:orientation="vertical"
- android:id="@+id/layout_button"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_above="@+id/ad1">
- <LinearLayout
- android:gravity="center"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10.0dip">
- <Button
- android:id="@+id/buttonChoosePictures"
- android:background="@drawable/ingallery"
- android:layout_width="100.0dip"
- android:layout_height="100.0dip" />
- <Button
- android:id="@+id/buttonMusic"
- android:background="@drawable/inmusic"
- android:layout_width="100.0dip"
- android:layout_height="100.0dip" />
- </LinearLayout>
- <LinearLayout android:gravity="center"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10.0dip">
- <Button
- android:id="@+id/buttonPreview"
- android:background="@drawable/inpreview"
- android:layout_width="100.0dip"
- android:layout_height="100.0dip" />
- <Button
- android:id="@+id/buttonSave"
- android:background="@drawable/insave"
- android:layout_width="100.0dip"
- android:layout_height="100.0dip" />
- </LinearLayout>
- <LinearLayout
- android:gravity="center"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView
- android:textAppearance="?android:textAppearanceMedium"
- android:textColor="@android:color/white"
- android:id="@+id/textViewMessagetitle"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="3.0dip"
- android:layout_marginBottom="2.0dip"
- android:text="Drag slide to arrange slide" />
- <com.example.positivityapp.views.DraggableGridView
- android:scrollbarStyle="insideOverlay"
- android:id="@+id/vgv"
- android:background="@drawable/bg_grid"
- android:visibility="gone"
- android:scrollbars="vertical"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5.0dip" />
- </LinearLayout>
- </LinearLayout>
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement