Skip to content

Commit

Permalink
Osvežitev MainActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
LogAnd1 committed Jan 9, 2018
1 parent 9d331b2 commit c0310bb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.pp.podcastplayer;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
Expand Down Expand Up @@ -255,10 +256,16 @@ public void onClick(DialogInterface dialog, int whichButton) {
writer.close();
outputStream.close();

// Usprešno pisanje
// Uspešno pisanje
Toast.makeText(AddActivity.this,
"Podcast successfully added!",
Toast.LENGTH_LONG).show();
Intent returnIntent = new Intent();
returnIntent.putExtra("result",0);
setResult(MainActivity.RESULT_OK,returnIntent);
finish();



} catch (IOException e) {
Log.d("IO Error", "Pisanje neuspešno!");
Expand Down
21 changes: 20 additions & 1 deletion app/src/main/java/com/example/pp/podcastplayer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,28 @@ public boolean onOptionsItemSelected(MenuItem item) {
// Odpiranje download zaslona iz menu-ja
else if (id == R.id.action_add) {
Intent intent = new Intent(this, AddActivity.class);
startActivity(intent);
startActivityForResult(intent, 0);
return true;
}

return super.onOptionsItemSelected(item);
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Check which request we're responding to
if (requestCode == 0) {
// Make sure the request was successful
if (resultCode == RESULT_OK) {
finish();
startActivity(getIntent());
}
}
}



@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
Expand Down Expand Up @@ -218,6 +233,10 @@ public void tryAgain(View view) {
}
}





ArrayList results = new ArrayList<DataObject>();

private ArrayList<DataObject> getDataSet() {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/content_add.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

<Button
android:id="@+id/button_rss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="220dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="107dp"
android:layout_marginTop="30dp"
android:text="Dodaj RSS" />
</RelativeLayout>

0 comments on commit c0310bb

Please sign in to comment.