mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Design mofifications to single share view
This commit is contained in:
parent
780af9d07d
commit
8462b4bec1
5 changed files with 20 additions and 82 deletions
|
|
@ -40,7 +40,7 @@
|
|||
android:name=".ShareActivity"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/title_activity_share"
|
||||
android:theme="@style/LightNoTitle">
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
||||
|
|
|
|||
|
|
@ -12,45 +12,18 @@
|
|||
android:layout_height="fill_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_marginBottom="48dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip"
|
||||
android:layout_marginTop="48dip"
|
||||
android:background="#EAFFFFFF"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill"
|
||||
android:background="#AA000000"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:paddingTop="8dip" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:src="@drawable/ic_download" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:text="@string/upload_overlay_title"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#818181"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/titleEdit"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
@ -58,16 +31,7 @@
|
|||
android:scrollHorizontally="false"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/share_title_hint"
|
||||
android:textColor="#363636" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#dadada"
|
||||
android:orientation="vertical" >
|
||||
</LinearLayout>
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/descEdit"
|
||||
|
|
@ -75,24 +39,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="textMultiLine"
|
||||
android:hint="@string/share_description_hint"
|
||||
android:textColor="#363636" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#dadada"
|
||||
android:orientation="vertical" >
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/uploadButton"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="@string/share_upload_button" />
|
||||
/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/menu_settings"
|
||||
android:title="@string/menu_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never" />
|
||||
<item android:id="@+id/menu_upload_single"
|
||||
android:title="@string/menu_upload_single"
|
||||
android:icon="@android:drawable/ic_menu_send"
|
||||
android:enabled="false"
|
||||
android:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
<string name="share_upload_button">Upload</string>
|
||||
<string name="multiple_share_base_title">Name this set</string>
|
||||
<string name="provider_modifications">Modifications</string>
|
||||
<string name="menu_upload_single">Upload</string>
|
||||
|
||||
<plurals name="contributions_subtitle">
|
||||
<item quantity="zero">No uploads yet</item>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
private CommonsApplication app;
|
||||
|
||||
private ImageView backgroundImageView;
|
||||
private Button uploadButton;
|
||||
private EditText titleEdit;
|
||||
private EditText descEdit;
|
||||
|
||||
|
|
@ -87,9 +86,7 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
super.onAuthCookieAcquired(authCookie);
|
||||
app.getApi().setAuthCookie(authCookie);
|
||||
Intent intent = getIntent();
|
||||
|
||||
final Context that = this;
|
||||
|
||||
|
||||
if(intent.getAction().equals(Intent.ACTION_SEND)) {
|
||||
mediaUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
if(intent.hasExtra(UploadService.EXTRA_SOURCE)) {
|
||||
|
|
@ -107,14 +104,6 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
uploadServiceIntent.setAction(UploadService.ACTION_START_SERVICE);
|
||||
startService(uploadServiceIntent);
|
||||
bindService(uploadServiceIntent, uploadServiceConnection, Context.BIND_AUTO_CREATE);
|
||||
|
||||
uploadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
StartUploadTask task = new SingleStartUploadTask(ShareActivity.this, uploadService, titleEdit.getText().toString(), mediaUri, descEdit.getText().toString(), mimeType, source);
|
||||
task.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +130,6 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
backgroundImageView = (ImageView)findViewById(R.id.backgroundImage);
|
||||
titleEdit = (EditText)findViewById(R.id.titleEdit);
|
||||
descEdit = (EditText)findViewById(R.id.descEdit);
|
||||
uploadButton = (Button)findViewById(R.id.uploadButton);
|
||||
|
||||
TextWatcher uploadEnabler = new TextWatcher() {
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
|
||||
|
|
@ -149,12 +137,7 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}
|
||||
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if(titleEdit.getText().length() != 0) {
|
||||
uploadButton.setEnabled(true);
|
||||
} else {
|
||||
uploadButton.setEnabled(false);
|
||||
}
|
||||
|
||||
actionMenu.findItem(R.id.menu_upload_single).setEnabled(titleEdit.getText().length() != 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -177,9 +160,11 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private Menu actionMenu;
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getSupportMenuInflater().inflate(R.menu.activity_share, menu);
|
||||
actionMenu = menu;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -190,6 +175,10 @@ public class ShareActivity extends AuthenticatedActivity {
|
|||
case android.R.id.home:
|
||||
NavUtils.navigateUpFromSameTask(this);
|
||||
return true;
|
||||
case R.id.menu_upload_single:
|
||||
StartUploadTask task = new SingleStartUploadTask(ShareActivity.this, uploadService, titleEdit.getText().toString(), mediaUri, descEdit.getText().toString(), mimeType, source);
|
||||
task.execute();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue