mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 22:07:56 +01:00
Android: share editing
This commit is contained in:
parent
3330acfc75
commit
e17abfe411
@ -20,10 +20,8 @@ public class MainApplication extends Application {
|
|||||||
JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON);
|
JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON);
|
||||||
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
|
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
|
||||||
|
|
||||||
// TODO Tags caching
|
|
||||||
// TODO Fullscreen preview
|
// TODO Fullscreen preview
|
||||||
// TODO Caching preferences
|
// TODO Caching preferences
|
||||||
// TODO Edit sharing
|
|
||||||
// TODO Documents adding/editing
|
// TODO Documents adding/editing
|
||||||
// TODO Files adding/deleting
|
// TODO Files adding/deleting
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
@ -19,6 +20,7 @@ import android.widget.TextView;
|
|||||||
import com.sismics.docs.R;
|
import com.sismics.docs.R;
|
||||||
import com.sismics.docs.adapter.FilePagerAdapter;
|
import com.sismics.docs.adapter.FilePagerAdapter;
|
||||||
import com.sismics.docs.event.DocumentFullscreenEvent;
|
import com.sismics.docs.event.DocumentFullscreenEvent;
|
||||||
|
import com.sismics.docs.fragment.DocShareFragment;
|
||||||
import com.sismics.docs.listener.JsonHttpResponseHandler;
|
import com.sismics.docs.listener.JsonHttpResponseHandler;
|
||||||
import com.sismics.docs.model.application.ApplicationContext;
|
import com.sismics.docs.model.application.ApplicationContext;
|
||||||
import com.sismics.docs.resource.FileResource;
|
import com.sismics.docs.resource.FileResource;
|
||||||
@ -182,6 +184,11 @@ public class DocumentActivity extends ActionBarActivity {
|
|||||||
downloadZip();
|
downloadZip();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.share:
|
||||||
|
DialogFragment dialog = DocShareFragment.newInstance(document.optString("id"));
|
||||||
|
dialog.show(getSupportFragmentManager(), "DocShareFragment");
|
||||||
|
return true;
|
||||||
|
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.sismics.docs.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.sismics.docs.R;
|
||||||
|
import com.sismics.docs.event.ShareDeleteEvent;
|
||||||
|
import com.sismics.docs.event.ShareSendEvent;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import de.greenrobot.event.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share list adapter.
|
||||||
|
*
|
||||||
|
* @author bgamard.
|
||||||
|
*/
|
||||||
|
public class ShareListAdapter extends BaseAdapter {
|
||||||
|
/**
|
||||||
|
* Shares.
|
||||||
|
*/
|
||||||
|
private JSONArray shares;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share list adapter.
|
||||||
|
*
|
||||||
|
* @param shares Shares
|
||||||
|
*/
|
||||||
|
public ShareListAdapter(JSONArray shares) {
|
||||||
|
this.shares = shares;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return shares.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getItem(int position) {
|
||||||
|
return shares.optJSONObject(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return getItem(position).optString("id").hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View view, final ViewGroup parent) {
|
||||||
|
if (view == null) {
|
||||||
|
LayoutInflater vi = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = vi.inflate(R.layout.share_list_item, parent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill the view
|
||||||
|
final JSONObject share = getItem(position);
|
||||||
|
String name = share.optString("name");
|
||||||
|
TextView shareTextView = (TextView) view.findViewById(R.id.shareTextView);
|
||||||
|
shareTextView.setText(name.isEmpty() ? parent.getContext().getString(R.string.share_default_name) : name);
|
||||||
|
|
||||||
|
// Delete a share
|
||||||
|
ImageButton shareDeleteButton = (ImageButton) view.findViewById(R.id.shareDeleteButton);
|
||||||
|
shareDeleteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
EventBus.getDefault().post(new ShareDeleteEvent(share.optString("id")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Send the link
|
||||||
|
ImageButton shareSendButton = (ImageButton) view.findViewById(R.id.shareSendButton);
|
||||||
|
shareSendButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
EventBus.getDefault().post(new ShareSendEvent(share));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.sismics.docs.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share delete event.
|
||||||
|
*
|
||||||
|
* @author bgamard.
|
||||||
|
*/
|
||||||
|
public class ShareDeleteEvent {
|
||||||
|
/**
|
||||||
|
* Share ID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a share delete event.
|
||||||
|
*
|
||||||
|
* @param id Share ID
|
||||||
|
*/
|
||||||
|
public ShareDeleteEvent(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.sismics.docs.event;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share send event.
|
||||||
|
*
|
||||||
|
* @author bgamard.
|
||||||
|
*/
|
||||||
|
public class ShareSendEvent {
|
||||||
|
/**
|
||||||
|
* Share data.
|
||||||
|
*/
|
||||||
|
private JSONObject share;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a share send event.
|
||||||
|
*
|
||||||
|
* @param share Share data
|
||||||
|
*/
|
||||||
|
public ShareSendEvent(JSONObject share) {
|
||||||
|
this.share = share;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getShare() {
|
||||||
|
return share;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,186 @@
|
|||||||
|
package com.sismics.docs.fragment;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.sismics.docs.R;
|
||||||
|
import com.sismics.docs.adapter.ShareListAdapter;
|
||||||
|
import com.sismics.docs.event.ShareDeleteEvent;
|
||||||
|
import com.sismics.docs.event.ShareSendEvent;
|
||||||
|
import com.sismics.docs.listener.JsonHttpResponseHandler;
|
||||||
|
import com.sismics.docs.resource.DocumentResource;
|
||||||
|
import com.sismics.docs.resource.ShareResource;
|
||||||
|
import com.sismics.docs.util.PreferenceUtil;
|
||||||
|
|
||||||
|
import org.apache.http.Header;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import de.greenrobot.event.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document sharing dialog fragment.
|
||||||
|
*
|
||||||
|
* @author bgamard.
|
||||||
|
*/
|
||||||
|
public class DocShareFragment extends DialogFragment {
|
||||||
|
/**
|
||||||
|
* Document data.
|
||||||
|
*/
|
||||||
|
private JSONObject document;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document sharing dialog fragment
|
||||||
|
* @param id Document ID
|
||||||
|
*/
|
||||||
|
public static DocShareFragment newInstance(String id) {
|
||||||
|
DocShareFragment fragment = new DocShareFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("id", id);
|
||||||
|
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.document_share_dialog, null);
|
||||||
|
final Button shareAddButton = (Button) view.findViewById(R.id.shareAddButton);
|
||||||
|
final EditText shareNameEditText = (EditText) view.findViewById(R.id.shareNameEditText);
|
||||||
|
|
||||||
|
// Add a share
|
||||||
|
shareAddButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
shareNameEditText.setEnabled(false);
|
||||||
|
shareAddButton.setEnabled(false);
|
||||||
|
|
||||||
|
ShareResource.add(getActivity(), getArguments().getString("id"), shareNameEditText.getText().toString(),
|
||||||
|
new JsonHttpResponseHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||||
|
shareNameEditText.setText("");
|
||||||
|
loadShares(getDialog().getWindow().getDecorView());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllFailure(int statusCode, Header[] headers, byte[] responseBytes, Throwable throwable) {
|
||||||
|
Toast.makeText(getActivity(), R.string.error_adding_share, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
shareNameEditText.setEnabled(true);
|
||||||
|
shareAddButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get the shares
|
||||||
|
loadShares(view);
|
||||||
|
|
||||||
|
// Build the dialog
|
||||||
|
builder.setView(view)
|
||||||
|
.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
getDialog().cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the shares.
|
||||||
|
*
|
||||||
|
* @param view View
|
||||||
|
*/
|
||||||
|
private void loadShares(View view) {
|
||||||
|
if (isDetached()) return;
|
||||||
|
|
||||||
|
final ListView shareListView = (ListView) view.findViewById(R.id.shareListView);
|
||||||
|
final TextView shareEmptyView = (TextView) view.findViewById(R.id.shareEmptyView);
|
||||||
|
final ProgressBar shareProgressBar = (ProgressBar) view.findViewById(R.id.shareProgressBar);
|
||||||
|
|
||||||
|
shareListView.setEmptyView(shareProgressBar);
|
||||||
|
DocumentResource.get(getActivity(), getArguments().getString("id"), new JsonHttpResponseHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||||
|
document = response;
|
||||||
|
JSONArray shares = response.optJSONArray("shares");
|
||||||
|
shareProgressBar.setVisibility(View.GONE);
|
||||||
|
shareListView.setEmptyView(shareEmptyView);
|
||||||
|
shareListView.setAdapter(new ShareListAdapter(shares));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllFailure(int statusCode, Header[] headers, byte[] responseBytes, Throwable throwable) {
|
||||||
|
getDialog().cancel();
|
||||||
|
Toast.makeText(getActivity(), R.string.error_loading_shares, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onEvent(ShareDeleteEvent event) {
|
||||||
|
ShareResource.delete(getActivity(), event.getId(), new JsonHttpResponseHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||||
|
loadShares(getDialog().getWindow().getDecorView());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAllFailure(int statusCode, Header[] headers, byte[] responseBytes, Throwable throwable) {
|
||||||
|
Toast.makeText(getActivity(), R.string.error_deleting_share, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onEvent(ShareSendEvent event) {
|
||||||
|
if (document == null) return;
|
||||||
|
|
||||||
|
// Build the share link
|
||||||
|
String serverUrl = PreferenceUtil.getServerUrl(getActivity());
|
||||||
|
String link = serverUrl + "/share.html#/share/" + document.optString("id") + "/" + event.getShare().optString("id");
|
||||||
|
|
||||||
|
// Build the intent
|
||||||
|
Context context = getActivity();
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction(Intent.ACTION_SEND);
|
||||||
|
intent.putExtra(Intent.EXTRA_SUBJECT, document.optString("title"));
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, link);
|
||||||
|
intent.setType("text/plain");
|
||||||
|
|
||||||
|
// Open the target chooser
|
||||||
|
context.startActivity(Intent.createChooser(intent, context.getText(R.string.send_share_to)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
@ -30,4 +30,17 @@ public class DocumentResource extends BaseResource {
|
|||||||
params.put("search", query);
|
params.put("search", query);
|
||||||
client.get(getApiUrl(context) + "/document/list", params, responseHandler);
|
client.get(getApiUrl(context) + "/document/list", params, responseHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /document/id.
|
||||||
|
*
|
||||||
|
* @param context Context
|
||||||
|
* @param id ID
|
||||||
|
* @param responseHandler Callback
|
||||||
|
*/
|
||||||
|
public static void get(Context context, String id, JsonHttpResponseHandler responseHandler) {
|
||||||
|
init(context);
|
||||||
|
|
||||||
|
client.get(getApiUrl(context) + "/document/" + id, responseHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.sismics.docs.resource;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.loopj.android.http.RequestParams;
|
||||||
|
import com.sismics.docs.listener.JsonHttpResponseHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to /tag API.
|
||||||
|
*
|
||||||
|
* @author bgamard
|
||||||
|
*/
|
||||||
|
public class ShareResource extends BaseResource {
|
||||||
|
/**
|
||||||
|
* PUT /share.
|
||||||
|
*
|
||||||
|
* @param context Context
|
||||||
|
* @param documentId Document ID
|
||||||
|
* @param name Name
|
||||||
|
* @param responseHandler Callback
|
||||||
|
*/
|
||||||
|
public static void add(Context context, String documentId, String name, JsonHttpResponseHandler responseHandler) {
|
||||||
|
init(context);
|
||||||
|
|
||||||
|
RequestParams params = new RequestParams();
|
||||||
|
params.put("id", documentId);
|
||||||
|
params.put("name", name);
|
||||||
|
client.put(getApiUrl(context) + "/share", params, responseHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE /share.
|
||||||
|
*
|
||||||
|
* @param context Context
|
||||||
|
* @param id ID
|
||||||
|
* @param responseHandler Callback
|
||||||
|
*/
|
||||||
|
public static void delete(Context context, String id, JsonHttpResponseHandler responseHandler) {
|
||||||
|
init(context);
|
||||||
|
|
||||||
|
client.delete(getApiUrl(context) + "/share/" + id, responseHandler);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 271 B |
Binary file not shown.
After Width: | Height: | Size: 503 B |
Binary file not shown.
After Width: | Height: | Size: 629 B |
Binary file not shown.
After Width: | Height: | Size: 341 B |
Binary file not shown.
After Width: | Height: | Size: 681 B |
Binary file not shown.
After Width: | Height: | Size: 866 B |
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="12dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/shareListView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:choiceMode="singleChoice"
|
||||||
|
android:divider="@android:color/transparent"
|
||||||
|
android:dividerHeight="0dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shareEmptyView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:text="@string/document_not_shared"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/shareProgressBar"
|
||||||
|
style="?android:progressBarStyle"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:indeterminate="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#e5e5e5"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/shareNameEditText"
|
||||||
|
android:hint="@string/add_share_hint"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight=".8"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/shareAddButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight=".2"
|
||||||
|
android:text="@string/add"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
52
docs-android/app/src/main/res/layout/share_list_item.xml
Normal file
52
docs-android/app/src/main/res/layout/share_list_item.xml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="0dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iconShareImageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_link_grey600_24dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginEnd="8dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shareTextView"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toRightOf="@id/iconShareImageView"
|
||||||
|
android:layout_toEndOf="@id/iconShareImageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:textColor="#212121"
|
||||||
|
android:text="Shared with Bob"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shareDeleteButton"
|
||||||
|
android:layout_toLeftOf="@+id/shareSendButton"
|
||||||
|
android:layout_toStartOf="@+id/shareSendButton"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_delete_grey600_24dp"
|
||||||
|
android:contentDescription="@string/delete_share"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shareSendButton"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:src="@drawable/ic_share_grey600_24dp"
|
||||||
|
android:contentDescription="@string/send_share"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -2,6 +2,12 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/share"
|
||||||
|
app:showAsAction="collapseActionView"
|
||||||
|
android:title="@string/share">
|
||||||
|
</item>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/download_file"
|
android:id="@+id/download_file"
|
||||||
app:showAsAction="collapseActionView"
|
app:showAsAction="collapseActionView"
|
||||||
|
@ -42,5 +42,17 @@
|
|||||||
<string name="no_files">No files</string>
|
<string name="no_files">No files</string>
|
||||||
<string name="error_loading_files">Error loading files</string>
|
<string name="error_loading_files">Error loading files</string>
|
||||||
<string name="new_document">New document</string>
|
<string name="new_document">New document</string>
|
||||||
|
<string name="share">Sharing</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
|
<string name="add">Add</string>
|
||||||
|
<string name="add_share_hint">Name the share (optional)</string>
|
||||||
|
<string name="document_not_shared">This document is not currently shared</string>
|
||||||
|
<string name="delete_share">Delete this share</string>
|
||||||
|
<string name="send_share">Send this share</string>
|
||||||
|
<string name="error_loading_shares">Error loading shares</string>
|
||||||
|
<string name="error_adding_share">Error adding share</string>
|
||||||
|
<string name="share_default_name">Share link</string>
|
||||||
|
<string name="error_deleting_share">Error deleting the share</string>
|
||||||
|
<string name="send_share_to">Send share link to</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user