Added button to access the Miro Guide from the AddFeedActivity

This commit is contained in:
daniel oeh 2012-08-02 12:31:33 +02:00
parent c69dfff36c
commit 8960d85452
6 changed files with 58 additions and 6 deletions

View File

@ -175,6 +175,7 @@
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".activity.SearchActivity" /> android:value=".activity.SearchActivity" />
</activity> </activity>
<activity android:name=".activity.MiroGuideMainActivity" android:label="@string/miro_guide_label"></activity>
</application> </application>
</manifest> </manifest>

View File

@ -21,6 +21,22 @@
android:hint="@string/feedurl_label" android:hint="@string/feedurl_label"
android:inputType="textUri" /> android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<RelativeLayout <RelativeLayout
android:id="@+id/footer" android:id="@+id/footer"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View File

@ -21,6 +21,22 @@
android:hint="@string/feedurl_label" android:hint="@string/feedurl_label"
android:inputType="textUri" /> android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<LinearLayout <LinearLayout
android:id="@+id/footer" android:id="@+id/footer"
style="@android:style/ButtonBar" style="@android:style/ButtonBar"

View File

@ -159,6 +159,9 @@
<string name="sleep_timer_label">Sleep timer</string> <string name="sleep_timer_label">Sleep timer</string>
<string name="time_left_label">Time left:\u0020</string> <string name="time_left_label">Time left:\u0020</string>
<string name="loading_categories_label">Loading categories...</string> <string name="loading_categories_label">Loading categories...</string>
<string name="browse_miroguide_label">Browse Miro Guide</string>
<string name="txtv_browse_miroguide_label">Or browse the Miro Guide:</string>
<string name="miro_guide_label">Miro Guide</string>
</resources> </resources>

View File

@ -12,6 +12,7 @@ import android.content.IntentFilter;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
@ -37,6 +38,7 @@ public class AddFeedActivity extends SherlockActivity {
private FeedManager manager; private FeedManager manager;
private EditText etxtFeedurl; private EditText etxtFeedurl;
private Button butBrowseMiroGuide;
private Button butConfirm; private Button butConfirm;
private Button butCancel; private Button butCancel;
private long downloadId; private long downloadId;
@ -76,9 +78,19 @@ public class AddFeedActivity extends SherlockActivity {
}; };
etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl); etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl);
butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
butConfirm = (Button) findViewById(R.id.butConfirm); butConfirm = (Button) findViewById(R.id.butConfirm);
butCancel = (Button) findViewById(R.id.butCancel); butCancel = (Button) findViewById(R.id.butCancel);
butBrowseMiroGuide.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AddFeedActivity.this,
MiroGuideMainActivity.class));
}
});
butConfirm.setOnClickListener(new View.OnClickListener() { butConfirm.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -100,13 +112,16 @@ public class AddFeedActivity extends SherlockActivity {
super.onResume(); super.onResume();
StorageUtils.checkStorageAvailability(this); StorageUtils.checkStorageAvailability(this);
Intent intent = getIntent(); Intent intent = getIntent();
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) { if (intent.getAction() != null
if (AppConfig.DEBUG) Log.d(TAG, "Was started with ACTION_SEND intent"); && intent.getAction().equals(Intent.ACTION_SEND)) {
if (AppConfig.DEBUG)
Log.d(TAG, "Was started with ACTION_SEND intent");
String text = intent.getStringExtra(Intent.EXTRA_TEXT); String text = intent.getStringExtra(Intent.EXTRA_TEXT);
if (text != null) { if (text != null) {
etxtFeedurl.setText(text); etxtFeedurl.setText(text);
} else { } else {
if (AppConfig.DEBUG) Log.d(TAG, "No text was sent"); if (AppConfig.DEBUG)
Log.d(TAG, "No text was sent");
} }
} }
@ -115,7 +130,8 @@ public class AddFeedActivity extends SherlockActivity {
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
if (AppConfig.DEBUG) Log.d(TAG, "Stopping Activity"); if (AppConfig.DEBUG)
Log.d(TAG, "Stopping Activity");
} }
@Override @Override

View File

@ -56,6 +56,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
} }
} }
@SuppressLint("NewApi")
private void loadCategories() { private void loadCategories() {
AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() { AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() {
@ -64,7 +65,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
if (exception != null) { if (exception == null) {
if (AppConfig.DEBUG) Log.d(TAG, "Successfully loaded categories"); if (AppConfig.DEBUG) Log.d(TAG, "Successfully loaded categories");
categories = c; categories = c;
createAdapter(); createAdapter();
@ -79,7 +80,6 @@ public class MiroGuideMainActivity extends SherlockListActivity {
txtvStatus.setText(R.string.loading_categories_label); txtvStatus.setText(R.string.loading_categories_label);
} }
@SuppressLint({ "NewApi", "NewApi" })
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
MiroService service = new MiroService(); MiroService service = new MiroService();