Commit c58bb4bf authored by Thomas Krex's avatar Thomas Krex

replaced dialog for adding feeds by a activity with two fragments

parent 6fb3e53e
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.tum.in.tttclient"
android:versionCode="1"
android:versionName="1.0" >
package="de.tum.in.tttclient"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" >
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" >
</uses-permission>
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ttt24"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/Theme.Customactionbar" >
<activity
android:name="tttclient.activities.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application
android:allowBackup="true"
android:icon="@drawable/ttt24"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/Theme.Customactionbar" >
<activity
android:name="tttclient.activities.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="tttclient.activities.FeedActivity"
android:configChanges="orientation|screenSize"
android:label="Feeds"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="http" />
<data android:host="ttt.in.tum.de" />
<data android:pathPattern="\\/lectures\\/ttt-android.*"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="tttclient.activities.FeedDetailActivity"
android:configChanges="orientation|screenSize" >
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="landscape" >
</activity>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="tttclient.activities.FeedActivity"
android:configChanges="orientation|screenSize"
android:label="Feeds" >
</activity>
<activity
android:name="tttclient.activities.FeedWizardActivity"
android:label="Add new Feed"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="http" />
<data android:host="ttt.in.tum.de" />
<data android:pathPattern="\\/lectures\\/ttt-android.*" />
<service android:name="tttclient.services.DownloadService" >
</service>
<service android:name="tttclient.services.ParseService" >
</service>
</application>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
>
</activity>
<activity
android:name="tttclient.activities.FeedDetailActivity"
android:configChanges="orientation|screenSize" >
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="landscape" >
</activity>
<service android:name="tttclient.services.DownloadService" >
</service>
<service android:name="tttclient.services.ParseService" >
</service>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="2"
android:baselineAligned="false">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/tx_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:ems="10"
android:hint="Name"
android:singleLine="true" />
<EditText
android:id="@+id/tx_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:ems="10"
android:hint="Url"
android:singleLine="true" >
</EditText>
<Button
android:id="@+id/button_paste"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/paste_url" />
</LinearLayout>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:gravity="center_horizontal"
android:text="Suscribe to all Lectures since the following date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<DatePicker
android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false" />
<Button
android:id="@+id/button_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/save" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<fragment
android:id="@+id/feedFragment"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<fragment
android:id="@+id/itemFragment"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:layout_gravity="center_horizontal">
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/my_border"
android:fillViewport="false"
android:paddingLeft="5dip"
android:paddingRight="5dip" >
</ScrollView>
<LinearLayout
android:id="@+id/surfaceContainer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@android:color/black"
android:gravity="center" >
<SurfaceView
android:id="@+id/playerView_extended"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<SurfaceView
android:id="@+id/playerView_fullscreen"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:orientation="vertical" >
<ViewSwitcher
android:id="@+id/viewSwitcher"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center" >
<SurfaceView
android:id="@+id/playerView_fullscreen"
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="horizontal"
android:weightSum="3" >
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="false"
android:paddingLeft="5dip" >
</ScrollView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<SurfaceView
android:id="@+id/playerView_extended"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</ViewSwitcher>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<SurfaceView
android:id="@+id/playerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="240dp"
android:layout_height="match_parent"
android:visibility="gone"
android:background="@color/trans_black"
android:fillViewport="false"
/>
</RelativeLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:hapticFeedbackEnabled="true"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/headerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/listHeader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@android:color/darker_gray"
android:gravity="center"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5" >
<TextView
android:id="@+id/itemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="4"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/statusIcon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:src="@drawable/ic_action_download" >
</ImageView>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5" >
<ViewStub
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<EditText
android:id="@+id/tx_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Name"
android:singleLine="true" />
<ViewStub
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<EditText
android:id="@+id/tx_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Url"
android:inputType="textUri"
android:singleLine="true" >
</EditText>
<Button
android:id="@+id/button_paste"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/paste_url" />
<ViewStub
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:gravity="center_horizontal"
android:text="Suscribe to all Lectures since the following date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<DatePicker
android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:calendarViewShown="false" />
</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="60dp">
<LinearLayout
android:id="@+id/headerLayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
>
<TextView
android:id="@+id/listHeader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@android:color/darker_gray"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5" >
<TextView
android:id="@+id/itemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:layout_gravity="center"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/statusIcon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/ic_action_download" >
</ImageView>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/next"
android:showAsAction="always"
android:title="Next">
</item>
</menu>
\ No newline at end of file
package tttclient.activities;
import java.util.Calendar;
import tttclient.models.Feed;
import tttclient.models.FeedDbManager;
import tttclient.models.FeedItemDbManager;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ClipData;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.URLUtil;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
......@@ -55,23 +40,15 @@ public class FeedActivity extends SherlockActivity implements
private String feedUrl;
private String feedName;
private int feedId;
private Dialog addDialog;
private EditText urlTxt;
private EditText nameTxt;
private DatePicker datePicker;
private Button pasteButton;
private Button saveButton;
private Vibrator myVib;
private ListView feedLv;
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.feed_activity);
setContentView(R.layout.fragment_feeds);
myVib = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
feedLv = (ListView) findViewById(R.id.feed_list);
......@@ -90,152 +67,6 @@ public class FeedActivity extends SherlockActivity implements
feedLv.setOnItemClickListener(this);
feedLv.setOnItemLongClickListener(this);
// initializing Dialog for adding Feeds
addDialog = new Dialog(this);
addDialog.setContentView(R.layout.dialog_feeds);
urlTxt = (EditText) addDialog.findViewById(R.id.tx_url);
nameTxt = (EditText) addDialog.findViewById(R.id.tx_name);
addDialog.setTitle(R.string.add_feed);
addDialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
// emptying textfields after canceling dialog
urlTxt.setText("");
nameTxt.setText("");
}
});
datePicker= (DatePicker) addDialog.findViewById(R.id.datePicker);
//determine the current semester and set the spinner to its beginning
Calendar c = Calendar.getInstance();
int currMonth= c.get(Calendar.MONTH);
int year;
int month;
//winter semester
if(currMonth>=Calendar.OCTOBER || currMonth<Calendar.APRIL){
month =Calendar.OCTOBER;
if(currMonth>=Calendar.OCTOBER)
year=c.get(Calendar.YEAR);
else
year=c.get(Calendar.YEAR)-1;
}
//summer semester
else{
year=c.get(Calendar.YEAR);
month= Calendar.APRIL;
}
datePicker.init(year, month, 1, null);
// Button for pasting Url from the clipboard into the textfield
pasteButton = (Button) addDialog.findViewById(R.id.button_paste);
pasteButton.setOnClickListener(new OnClickListener() {
/**
* handles Click on "Paste URL" Button
*/
@SuppressLint("NewApi")
@Override
public void onClick(View v) {