added exception for activity bundle

This commit is contained in:
NudeDude 2019-04-14 09:28:31 +02:00
parent 33962cea93
commit 8a9b503484
11 changed files with 34 additions and 8 deletions

View File

@ -150,6 +150,7 @@ public class ProfileEditor extends AsyncTask<Void, Void, Void> {
public void onClick(View v) {
Intent image = new Intent(ui.get(), ImageDetail.class);
image.putExtra("link", mediaLink);
image.putExtra("storable", false);
ui.get().startActivity(image);
}
});

View File

@ -299,6 +299,7 @@ public class ProfileLoader extends AsyncTask<Long, Void, Void> {
public void onClick(View v) {
Intent image = new Intent(ui.get(), ImageDetail.class);
image.putExtra("link", new String[]{user.getImageLink()});
image.putExtra("storable", true);
ui.get().startActivity(image);
}

View File

@ -253,7 +253,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Void> {
public void onClick(View v) {
Intent intent = new Intent(ui.get(), TweetDetail.class);
intent.putExtra("tweetID", tweet.getReplyId());
intent.putExtra("userID", tweet.getReplyUserId());
intent.putExtra("username", tweet.getReplyName());
ui.get().startActivity(intent);
}

View File

@ -11,6 +11,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.Display;
import android.widget.Toast;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.ImageAdapter;
import org.nuclearfog.twidda.adapter.ImageAdapter.OnImageClickListener;
@ -34,12 +35,13 @@ import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
*/
public class ImageDetail extends AppCompatActivity implements OnImageClickListener {
boolean storable = true;
boolean storable;
private ImageLoader imageAsync;
private ZoomView zoomImage;
private String link[];
private int width;
@Override
protected void onCreate(Bundle b) {
super.onCreate(b);
@ -47,9 +49,10 @@ public class ImageDetail extends AppCompatActivity implements OnImageClickListen
Bundle param = getIntent().getExtras();
if (param != null) {
if (BuildConfig.DEBUG && param.size() != 2)
throw new AssertionError();
link = param.getStringArray("link");
if (param.containsKey("storable"))
storable = param.getBoolean("storable");
storable = param.getBoolean("storable");
}
zoomImage = findViewById(R.id.image_full);

View File

@ -15,6 +15,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.MessageUpload;
import org.nuclearfog.twidda.database.GlobalSettings;
@ -40,8 +41,12 @@ public class MessagePopup extends AppCompatActivity implements View.OnClickListe
setContentView(R.layout.popup_dm);
String username = "";
Bundle param = getIntent().getExtras();
if (param != null && param.containsKey("username"))
username = param.getString("username");
if (param != null) {
if (BuildConfig.DEBUG && param.size() > 1)
throw new AssertionError();
if (param.containsKey("username"))
username = param.getString("username");
}
View root = findViewById(R.id.dm_popup);
View send = findViewById(R.id.dm_send);

View File

@ -37,6 +37,7 @@ public class ProfileEdit extends AppCompatActivity implements View.OnClickListen
private ProfileEditor editorAsync;
private TextView txtImg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -18,6 +18,7 @@ import android.view.animation.TranslateAnimation;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
import org.nuclearfog.twidda.adapter.TimelineAdapter;
@ -59,8 +60,11 @@ public class SearchPage extends AppCompatActivity implements OnRefreshListener,
getSupportActionBar().setDisplayShowTitleEnabled(false);
Bundle param = getIntent().getExtras();
if (param != null)
if (param != null) {
if (BuildConfig.DEBUG && param.size() != 1)
throw new AssertionError();
search = param.getString("search");
}
View root = findViewById(R.id.search_layout);
tweetSearch = findViewById(R.id.tweet_result);

View File

@ -24,6 +24,7 @@ import android.widget.TextView;
import android.widget.Toast;
import org.nuclearfog.tag.Tagger.OnTagClickListener;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.MainActivity;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
@ -76,6 +77,8 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
getTweet(link.getPath());
}
else if (param != null) {
if (BuildConfig.DEBUG && param.size() != 2)
throw new AssertionError();
tweetID = param.getLong("tweetID");
username = param.getString("username");
}
@ -264,7 +267,6 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
Tweet tweet = answerAdapter.getData(position);
Intent intent = new Intent(this, TweetDetail.class);
intent.putExtra("tweetID", tweet.getId());
intent.putExtra("userID", tweet.getUser().getId());
intent.putExtra("username", tweet.getUser().getScreenname());
startActivityForResult(intent, TWEET);
}
@ -281,6 +283,7 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
public void imageClick(String mediaLinks[]) {
Intent image = new Intent(this, ImageDetail.class);
image.putExtra("link", mediaLinks);
image.putExtra("storable", true);
startActivity(image);
}

View File

@ -15,6 +15,7 @@ import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.StatusUploader;
import org.nuclearfog.twidda.database.GlobalSettings;
@ -52,6 +53,8 @@ public class TweetPopup extends AppCompatActivity implements OnClickListener {
Bundle param = getIntent().getExtras();
if (param != null) {
if (BuildConfig.DEBUG && param.size() > 2)
throw new AssertionError();
if (param.containsKey("TweetID"))
inReplyId = param.getLong("TweetID");
if (param.containsKey("Addition"))

View File

@ -10,6 +10,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
import org.nuclearfog.twidda.adapter.UserAdapter;
@ -46,6 +47,8 @@ public class UserDetail extends AppCompatActivity implements OnItemClickListener
Bundle param = getIntent().getExtras();
if (param != null) {
if (BuildConfig.DEBUG && param.size() != 2)
throw new AssertionError();
mode = param.getInt("mode");
id = param.getLong("ID");
}

View File

@ -22,6 +22,7 @@ import android.widget.TabHost.OnTabChangeListener;
import android.widget.TextView;
import org.nuclearfog.tag.Tagger.OnTagClickListener;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
import org.nuclearfog.twidda.adapter.TimelineAdapter;
@ -71,6 +72,8 @@ public class UserProfile extends AppCompatActivity implements OnRefreshListener,
Bundle param = getIntent().getExtras();
if (param != null) {
if (BuildConfig.DEBUG && param.size() != 2)
throw new AssertionError();
userId = param.getLong("userID");
username = param.getString("username");
}