Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@

<activity android:name="SingleChoiceListView"
android:label="Single-choice list" />
<activity android:name="MainSettingsActivity"></activity>
</application>
</manifest>
2 changes: 2 additions & 0 deletions demo/res/layout/list_item_click_remove.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:background="@drawable/drag"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_height"
android:contentDescription="@string/drag_item"
android:layout_weight="0" />
<TextView
android:id="@+id/text"
Expand All @@ -20,6 +21,7 @@
android:paddingLeft="8dp" />
<ImageView
android:id="@id/click_remove"
android:contentDescription="@string/remove_item"
android:background="@drawable/delete_x"
android:layout_width="@dimen/item_height"
android:layout_height="@dimen/item_height"
Expand Down
23 changes: 23 additions & 0 deletions demo/res/layout/list_item_simple_checkable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mobeta.android.demodslv.CheckableLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/item_height"
android:orientation="horizontal">
<ImageView
android:id="@id/drag_handle"
android:background="@drawable/drag"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_height"
android:contentDescription="@string/drag_item"
android:layout_weight="0" />
<CheckedTextView
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_height"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:paddingLeft="8dp" />
</com.mobeta.android.demodslv.CheckableLinearLayout>
18 changes: 18 additions & 0 deletions demo/res/layout/sort_list_array_dialog_preference.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mobeta.android.dslv.DragSortListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:id="@android:id/list"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:choiceMode="multipleChoice"
dslv:sort_enabled="true"
dslv:remove_enabled="false"
dslv:drag_handle_id="@id/drag_handle"
>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump this > to the end of the previous line.



</com.mobeta.android.dslv.DragSortListView>
6 changes: 6 additions & 0 deletions demo/res/menu/activity_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/menu_settings" android:title="@string/settings"></item>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<item android:id="@+id/menu_settings" android:title="@string/settings"/>

Also an extra newline under here.



</menu>
20 changes: 20 additions & 0 deletions demo/res/values/preferences_strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_name_values">
<item>Bob</item>
<item>Fred</item>
<item>George</item>
</string-array>
<string-array name="pref_name_titles">
<item>Bob Menwaldo</item>
<item>Fred Frankfurd</item>
<item>George Stephanopolis</item>
</string-array>
<string-array name="pref_name_defaults">
<item>George</item>
<item>Fred</item>
<item>Bob</item>
</string-array>
<string name="pref_name_selection">Name Order Preference</string>
<string name="pref_header_test">Test</string>
</resources>
3 changes: 3 additions & 0 deletions demo/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,7 @@
<item>Zambia</item>
<item>Zimbabwe</item>
</string-array>
<string name="settings">Settings</string>
<string name="drag_item">Drag Item</string>
<string name="remove_item">Remove Item</string>
</resources>
9 changes: 9 additions & 0 deletions demo/res/xml/pref_headers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<preference-headers
xmlns:android="http://schemas.android.com/apk/res/android">

<!-- These settings headers are only used on tablets. -->

<header
android:fragment="com.mobeta.android.demodslv.MainSettingsActivity$NameSelectionPreferenceFragment"
android:title="@string/pref_header_test"/>
</preference-headers>
9 changes: 9 additions & 0 deletions demo/res/xml/pref_name.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<com.mobeta.android.demodslv.SortableListPreference
android:defaultValue="@array/pref_name_defaults"
android:entries="@array/pref_name_titles"
android:entryValues="@array/pref_name_values"
android:key="name_order"
android:persistent="true"
android:title="@string/pref_name_selection" />
</PreferenceScreen>
39 changes: 33 additions & 6 deletions demo/src/com/mobeta/android/demodslv/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
Expand All @@ -15,7 +17,6 @@
import java.util.ArrayList;
import java.util.Arrays;


public class Launcher extends ListActivity {

private ArrayList<ActivityInfo> mActivities = null;
Expand All @@ -34,12 +35,16 @@ public void onCreate(Bundle savedInstanceState) {
"com.mobeta.android.demodslv", PackageManager.GET_ACTIVITIES);

mActivities = new ArrayList<ActivityInfo>(Arrays.asList(pi.activities));
String ourName = getClass().getName();
String[] excludeList = new String[]{getClass().getName(),
MainSettingsActivity.class.getName()};
for (int i = 0; i < mActivities.size(); ++i) {
if (ourName.equals(mActivities.get(i).name)) {
mActivities.remove(i);
break;
}
for (String name: excludeList)
{
if (name.equals(mActivities.get(i).name)) {
mActivities.remove(i);
break;
}
}
}
} catch (PackageManager.NameNotFoundException e) {
// Do nothing. Adapter will be empty.
Expand Down Expand Up @@ -76,5 +81,27 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_menu, menu);

return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
Intent intent;
switch (item.getItemId()) {
case R.id.menu_settings:
intent =new Intent(this,MainSettingsActivity.class);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}

}
Loading