mirror of
https://github.com/sismics/docs.git
synced 2024-12-26 05:03:48 +01:00
Android: advanced search UI
This commit is contained in:
parent
f1eb3795d9
commit
f7f5f93a9e
@ -9,19 +9,20 @@ import android.provider.SearchRecentSuggestions;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.androidquery.util.AQUtility;
|
||||
import com.sismics.docs.R;
|
||||
import com.sismics.docs.adapter.TagListAdapter;
|
||||
import com.sismics.docs.event.SearchEvent;
|
||||
import com.sismics.docs.fragment.SearchFragment;
|
||||
import com.sismics.docs.listener.JsonHttpResponseHandler;
|
||||
import com.sismics.docs.model.application.ApplicationContext;
|
||||
import com.sismics.docs.provider.RecentSuggestionsProvider;
|
||||
@ -154,6 +155,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
return true;
|
||||
|
||||
case R.id.advanced_search:
|
||||
SearchFragment dialog = SearchFragment.newInstance();
|
||||
dialog.show(getSupportFragmentManager(), "SearchFragment");
|
||||
return true;
|
||||
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(MainActivity.this, SettingsActivity.class));
|
||||
return true;
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.sismics.docs.fragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import com.sismics.docs.R;
|
||||
import com.sismics.docs.event.SearchEvent;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* Advanced search fragment.
|
||||
*
|
||||
* @author bgamard.
|
||||
*/
|
||||
public class SearchFragment extends DialogFragment {
|
||||
/**
|
||||
* Document sharing dialog fragment
|
||||
*/
|
||||
public static SearchFragment newInstance() {
|
||||
SearchFragment fragment = new SearchFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
// Setup the view
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.search_dialog, null);
|
||||
|
||||
// Build the dialog
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.search, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
EventBus.getDefault().post(new SearchEvent(null));
|
||||
getDialog().cancel();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
getDialog().cancel();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:padding="16dp"
|
||||
android:textSize="24dp"
|
||||
android:hint="Title"/>
|
||||
android:textSize="24sp"
|
||||
android:hint="@string/title"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/descriptionEditText"
|
||||
@ -20,7 +20,7 @@
|
||||
android:inputType="textMultiLine"
|
||||
android:layout_margin="8dp"
|
||||
android:padding="16dp"
|
||||
android:hint="Description"
|
||||
android:hint="@string/description"
|
||||
android:textSize="18sp"
|
||||
android:lines="2"/>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:text="Creation date"
|
||||
android:text="@string/creation_date"
|
||||
android:textColor="#9f9f9f"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_width="wrap_content"
|
||||
@ -46,7 +46,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:text="15/11/2014"
|
||||
android:padding="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -63,6 +62,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:hint="Add tags"
|
||||
android:hint="@string/add_tags"
|
||||
android:layout_margin="8dp"/>
|
||||
</LinearLayout>
|
123
docs-android/app/src/main/res/layout/search_dialog.xml
Normal file
123
docs-android/app/src/main/res/layout/search_dialog.xml
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- Simple search -->
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:hint="Simple search"/>
|
||||
|
||||
<!-- Fulltext search -->
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:hint="Fulltext search"/>
|
||||
|
||||
<!-- Language -->
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:padding="16dp"/>
|
||||
|
||||
<!-- Shared -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:text="Shared documents"
|
||||
android:textColor="#9f9f9f"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:padding="16dp"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Before date -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_weight="0.5"
|
||||
android:text="After date"
|
||||
android:textColor="#9f9f9f"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:padding="16dp"/>
|
||||
|
||||
<com.sismics.docs.ui.view.DatePickerView
|
||||
style="@android:style/Widget.DeviceDefault.Light.Spinner"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:padding="16dp"
|
||||
android:text="15/05/2014"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- After date -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_weight="0.5"
|
||||
android:text="Before date"
|
||||
android:textColor="#9f9f9f"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:padding="16dp"/>
|
||||
|
||||
<com.sismics.docs.ui.view.DatePickerView
|
||||
style="@android:style/Widget.DeviceDefault.Light.Spinner"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18sp"
|
||||
android:padding="16dp"
|
||||
android:text="15/05/2014"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Tags -->
|
||||
<com.sismics.docs.ui.view.TagsCompleteTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:layout_margin="8dp"
|
||||
android:hint="Search tags"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
@ -5,7 +5,13 @@
|
||||
<item android:id="@+id/action_search"
|
||||
android:title="@string/action_search"
|
||||
app:showAsAction="ifRoom"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView" />
|
||||
app:actionViewClass="android.widget.SearchView" />
|
||||
|
||||
<item
|
||||
android:id="@+id/advanced_search"
|
||||
app:showAsAction="collapseActionView"
|
||||
android:title="@string/advanced_search">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
|
@ -93,6 +93,12 @@
|
||||
<string name="upload_notification_message">Uploading the new file to the document</string>
|
||||
<string name="upload_notification_error">Error uploading the new file</string>
|
||||
<string name="delete_file">Delete current file</string>
|
||||
<string name="advanced_search">Advanced Search</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="add_tags">Add tags</string>
|
||||
<string name="creation_date">Creation date</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="title">Title</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user