@ -0,0 +1,319 @@ |
|||||
|
package gr.thmmy.mthmmy.activities; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.net.Uri; |
||||
|
import android.os.AsyncTask; |
||||
|
import android.os.Bundle; |
||||
|
import android.support.v7.widget.AppCompatSpinner; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.widget.AdapterView; |
||||
|
import android.widget.ArrayAdapter; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.LinearLayout; |
||||
|
import android.widget.ProgressBar; |
||||
|
import android.widget.Spinner; |
||||
|
|
||||
|
import net.gotev.uploadservice.MultipartUploadRequest; |
||||
|
import net.gotev.uploadservice.UploadNotificationConfig; |
||||
|
|
||||
|
import org.jsoup.nodes.Document; |
||||
|
import org.jsoup.nodes.Element; |
||||
|
import org.jsoup.select.Elements; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
import gr.thmmy.mthmmy.R; |
||||
|
import gr.thmmy.mthmmy.base.BaseActivity; |
||||
|
import gr.thmmy.mthmmy.base.BaseApplication; |
||||
|
import gr.thmmy.mthmmy.model.UploadCategory; |
||||
|
import gr.thmmy.mthmmy.utils.parsing.ParseException; |
||||
|
import gr.thmmy.mthmmy.utils.parsing.ParseTask; |
||||
|
import me.zhanghai.android.materialprogressbar.MaterialProgressBar; |
||||
|
import timber.log.Timber; |
||||
|
|
||||
|
public class UploadActivity extends BaseActivity { |
||||
|
/** |
||||
|
* The key to use when putting upload's category String to {@link UploadActivity}'s Bundle. |
||||
|
*/ |
||||
|
public static final String BUNDLE_UPLOAD_CATEGORY = "UPLOAD_CATEGORY"; |
||||
|
private static final String uploadIndexUrl = "https://www.thmmy.gr/smf/index.php?action=tpmod;dl=upload"; |
||||
|
private static final int REQUEST_CODE_CHOOSE_FILE = 8; |
||||
|
|
||||
|
private static ArrayList<UploadCategory> uploadRootCategories = new ArrayList<>(); |
||||
|
//private String currentUploadCategory = "";
|
||||
|
private ParseUploadPageTask parseUploadPageTask; |
||||
|
private String categorySelected = "0"; |
||||
|
private String uploaderProfileIndex = "1"; |
||||
|
private Uri fileUri; |
||||
|
|
||||
|
//UI elements
|
||||
|
private MaterialProgressBar progressBar; |
||||
|
private LinearLayout categoriesSpinners; |
||||
|
private AppCompatSpinner rootCategorySpinner; |
||||
|
private EditText uploadTitle; |
||||
|
private EditText uploadDescription; |
||||
|
//private static AppCompatButton titleDescriptionBuilderButton;
|
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_upload); |
||||
|
|
||||
|
/*Bundle extras = getIntent().getExtras(); |
||||
|
if (extras != null) { |
||||
|
//TODO auto fill category from bundle
|
||||
|
currentUploadCategory = extras.getString(BUNDLE_UPLOAD_CATEGORY); |
||||
|
if (currentUploadCategory != null && !Objects.equals(currentUploadCategory, "")) { |
||||
|
} |
||||
|
}*/ |
||||
|
|
||||
|
//Initialize toolbar
|
||||
|
toolbar = findViewById(R.id.toolbar); |
||||
|
toolbar.setTitle("Upload"); |
||||
|
setSupportActionBar(toolbar); |
||||
|
if (getSupportActionBar() != null) { |
||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true); |
||||
|
} |
||||
|
|
||||
|
createDrawer(); |
||||
|
drawer.setSelection(UPLOAD_ID); |
||||
|
|
||||
|
progressBar = findViewById(R.id.progressBar); |
||||
|
|
||||
|
findViewById(R.id.upload_outer_scrollview).setVerticalScrollBarEnabled(false); |
||||
|
categoriesSpinners = findViewById(R.id.upload_spinners); |
||||
|
rootCategorySpinner = findViewById(R.id.upload_spinner_category_root); |
||||
|
rootCategorySpinner.setOnItemSelectedListener(new CustomOnItemSelectedListener(uploadRootCategories)); |
||||
|
|
||||
|
/*titleDescriptionBuilderButton = findViewById(R.id.upload_title_description_builder); |
||||
|
titleDescriptionBuilderButton.setEnabled(false); |
||||
|
titleDescriptionBuilderButton.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
//TODO some dialog?
|
||||
|
} |
||||
|
});*/ |
||||
|
|
||||
|
uploadTitle = findViewById(R.id.upload_title); |
||||
|
uploadDescription = findViewById(R.id.upload_description); |
||||
|
|
||||
|
findViewById(R.id.upload_select_file_button).setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
String[] mimeTypes = {"image/jpeg", "text/html", "image/png", "image/jpg", "image/gif", |
||||
|
"application/pdf", "application/rar", "application/x-tar", "application/zip", |
||||
|
"application/msword", "image/vnd.djvu", "application/gz", "application/tar.gz"}; |
||||
|
|
||||
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT) |
||||
|
//.setType("*/*")
|
||||
|
.setType("image/jpeg") |
||||
|
.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); |
||||
|
|
||||
|
startActivityForResult(intent, REQUEST_CODE_CHOOSE_FILE); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
findViewById(R.id.upload_upload_button).setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
if (fileUri != null) { |
||||
|
try { |
||||
|
String uploadId = new MultipartUploadRequest(v.getContext(), uploadIndexUrl) |
||||
|
.addParameter("tp-dluploadtitle", uploadTitle.getText().toString()) |
||||
|
.addParameter("tp-dluploadcat", categorySelected) |
||||
|
.addParameter("tp-dluploadtext", uploadDescription.getText().toString()) |
||||
|
.addFileToUpload(fileUri.toString(), "tp-dluploadfile") |
||||
|
.addParameter("tp_dluploadicon", "blank.gif") |
||||
|
.addParameter("tp-uploaduser", uploaderProfileIndex) |
||||
|
.setNotificationConfig(new UploadNotificationConfig()) |
||||
|
.setMaxRetries(2).startUpload(); |
||||
|
} catch (Exception exception) { |
||||
|
Timber.e(exception, "AndroidUploadService: %s", exception.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
if (uploadRootCategories.isEmpty()) { |
||||
|
parseUploadPageTask = new ParseUploadPageTask(); |
||||
|
parseUploadPageTask.execute(uploadIndexUrl); |
||||
|
} else { |
||||
|
String[] tmpSpinnerArray = new String[uploadRootCategories.size()]; |
||||
|
for (int i = 0; i < uploadRootCategories.size(); ++i) { |
||||
|
tmpSpinnerArray[i] = uploadRootCategories.get(i).getCategoryTitle(); |
||||
|
} |
||||
|
|
||||
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>( |
||||
|
BaseApplication.getInstance().getApplicationContext(), |
||||
|
android.R.layout.simple_spinner_dropdown_item, tmpSpinnerArray); |
||||
|
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
|
rootCategorySpinner.setAdapter(spinnerArrayAdapter); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBackPressed() { |
||||
|
if (drawer.isDrawerOpen()) { |
||||
|
drawer.closeDrawer(); |
||||
|
return; |
||||
|
} |
||||
|
super.onBackPressed(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onResume() { |
||||
|
drawer.setSelection(UPLOAD_ID); |
||||
|
super.onResume(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onDestroy() { |
||||
|
super.onDestroy(); |
||||
|
if (parseUploadPageTask != null && parseUploadPageTask.getStatus() != AsyncTask.Status.RUNNING) |
||||
|
parseUploadPageTask.cancel(true); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) { |
||||
|
if (requestCode == REQUEST_CODE_CHOOSE_FILE && data != null) { |
||||
|
//TODO upload the correct file
|
||||
|
//Check this https://stackoverflow.com/questions/5568874/how-to-extract-the-file-name-from-uri-returned-from-intent-action-get-content/25005243
|
||||
|
fileUri = data.getData(); |
||||
|
} else { |
||||
|
super.onActivityResult(requestCode, resultCode, data); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener { |
||||
|
private ArrayList<UploadCategory> parentCategories, childCategories; |
||||
|
private boolean initialized = false; |
||||
|
|
||||
|
private CustomOnItemSelectedListener() { |
||||
|
//Disable default constructor
|
||||
|
} |
||||
|
|
||||
|
CustomOnItemSelectedListener(ArrayList<UploadCategory> parentCategories) { |
||||
|
this.parentCategories = parentCategories; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
||||
|
//Avoids call on initialization
|
||||
|
if (!initialized) { |
||||
|
initialized = true; |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//Removes old, unneeded sub categories spinner(s)
|
||||
|
int viewIndex = categoriesSpinners.indexOfChild((AppCompatSpinner) view.getParent()); |
||||
|
|
||||
|
if (viewIndex + 1 != categoriesSpinners.getChildCount()) { //Makes sure this is not the last child
|
||||
|
categoriesSpinners.removeViews(viewIndex + 1, categoriesSpinners.getChildCount() - viewIndex - 1); |
||||
|
} |
||||
|
|
||||
|
categorySelected = parentCategories.get(position).getValue(); |
||||
|
|
||||
|
//Adds new sub categories spinner
|
||||
|
if (parentCategories.get(position).hasSubCategories()) { |
||||
|
childCategories = parentCategories.get(position).getSubCategories(); |
||||
|
|
||||
|
String[] tmpSpinnerArray = new String[childCategories.size()]; |
||||
|
for (int i = 0; i < tmpSpinnerArray.length; ++i) { |
||||
|
tmpSpinnerArray[i] = childCategories.get(i).getCategoryTitle(); |
||||
|
} |
||||
|
|
||||
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(getApplicationContext(), |
||||
|
android.R.layout.simple_spinner_dropdown_item, tmpSpinnerArray); |
||||
|
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
|
|
||||
|
AppCompatSpinner subSpinner = new AppCompatSpinner(categoriesSpinners.getContext(), Spinner.MODE_DROPDOWN); |
||||
|
subSpinner.setPopupBackgroundResource(R.color.primary); |
||||
|
subSpinner.setAdapter(spinnerArrayAdapter); |
||||
|
subSpinner.setOnItemSelectedListener(new CustomOnItemSelectedListener(childCategories)); |
||||
|
|
||||
|
categoriesSpinners.addView(subSpinner); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onNothingSelected(AdapterView<?> parent) { |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* An {@link ParseTask} that handles asynchronous fetching of the upload page and parsing the |
||||
|
* upload categories. |
||||
|
*/ |
||||
|
private class ParseUploadPageTask extends ParseTask { |
||||
|
@Override |
||||
|
protected void onPreExecute() { |
||||
|
progressBar.setVisibility(ProgressBar.VISIBLE); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void parse(Document uploadPage) throws ParseException { |
||||
|
Elements categoriesElements; |
||||
|
Element uploaderProfileIndexElement; |
||||
|
|
||||
|
try { |
||||
|
categoriesElements = uploadPage.select("select[name='tp-dluploadcat']>option"); |
||||
|
uploaderProfileIndexElement = uploadPage.select("input[name=\"tp-uploaduser\"]").first(); |
||||
|
} catch (Exception e) { |
||||
|
throw new ParseException("Parsing failed (UploadActivity)"); |
||||
|
} |
||||
|
|
||||
|
uploaderProfileIndex = uploaderProfileIndexElement.attr("value"); |
||||
|
|
||||
|
for (Element category : categoriesElements) { |
||||
|
String categoryValue = category.attr("value"); |
||||
|
String categoryText = category.text(); |
||||
|
|
||||
|
if (categoryText.startsWith("- ")) { |
||||
|
//This is a level one subcategory
|
||||
|
uploadRootCategories.get(uploadRootCategories.size() - 1).addSubCategory(categoryValue, categoryText); |
||||
|
} else if (categoryText.startsWith("-- ")) { |
||||
|
//This is a level two subcategory
|
||||
|
UploadCategory rootLevelCategory = uploadRootCategories.get(uploadRootCategories.size() - 1); |
||||
|
UploadCategory firstLevelCategory = rootLevelCategory.getSubCategories().get(rootLevelCategory.getSubCategories().size() - 1); |
||||
|
firstLevelCategory.addSubCategory(categoryValue, categoryText); |
||||
|
} else if (categoryText.startsWith("--- ")) { |
||||
|
//This is a level three subcategory
|
||||
|
UploadCategory rootLevelCategory = uploadRootCategories.get(uploadRootCategories.size() - 1); |
||||
|
UploadCategory firstLevelCategory = rootLevelCategory.getSubCategories().get(rootLevelCategory.getSubCategories().size() - 1); |
||||
|
UploadCategory secondLevelCategory = firstLevelCategory.getSubCategories().get(firstLevelCategory.getSubCategories().size() - 1); |
||||
|
secondLevelCategory.addSubCategory(categoryValue, categoryText); |
||||
|
} else if (categoryText.startsWith("---- ")) { |
||||
|
//This is a level three subcategory
|
||||
|
UploadCategory rootLevelCategory = uploadRootCategories.get(uploadRootCategories.size() - 1); |
||||
|
UploadCategory firstLevelCategory = rootLevelCategory.getSubCategories().get(rootLevelCategory.getSubCategories().size() - 1); |
||||
|
UploadCategory secondLevelCategory = firstLevelCategory.getSubCategories().get(firstLevelCategory.getSubCategories().size() - 1); |
||||
|
UploadCategory thirdLevelCategory = secondLevelCategory.getSubCategories().get(secondLevelCategory.getSubCategories().size() - 1); |
||||
|
thirdLevelCategory.addSubCategory(categoryValue, categoryText); |
||||
|
} else { |
||||
|
//This is a root category
|
||||
|
uploadRootCategories.add(new UploadCategory(categoryValue, categoryText)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void postExecution(ResultCode result) { |
||||
|
String[] tmpSpinnerArray = new String[uploadRootCategories.size()]; |
||||
|
for (int i = 0; i < uploadRootCategories.size(); ++i) { |
||||
|
tmpSpinnerArray[i] = uploadRootCategories.get(i).getCategoryTitle(); |
||||
|
} |
||||
|
|
||||
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>( |
||||
|
BaseApplication.getInstance().getApplicationContext(), |
||||
|
android.R.layout.simple_spinner_dropdown_item, tmpSpinnerArray); |
||||
|
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
|
rootCategorySpinner.setAdapter(spinnerArrayAdapter); |
||||
|
//titleDescriptionBuilderButton.setEnabled(true);
|
||||
|
|
||||
|
progressBar.setVisibility(ProgressBar.GONE); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package gr.thmmy.mthmmy.model; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
public class UploadCategory { |
||||
|
private String value, categoryTitle; |
||||
|
private ArrayList<UploadCategory> subCategories = new ArrayList<>(); |
||||
|
|
||||
|
private UploadCategory() { |
||||
|
//Disables default constructor
|
||||
|
} |
||||
|
|
||||
|
public UploadCategory(String value, String categoryTitle) { |
||||
|
this.value = value; |
||||
|
this.categoryTitle = categoryTitle; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public String getCategoryTitle() { |
||||
|
return categoryTitle; |
||||
|
} |
||||
|
|
||||
|
public void addSubCategory(String value, String categoryTitle) { |
||||
|
subCategories.add(new UploadCategory(value, categoryTitle)); |
||||
|
} |
||||
|
|
||||
|
public ArrayList<UploadCategory> getSubCategories() { |
||||
|
return subCategories; |
||||
|
} |
||||
|
|
||||
|
public boolean hasSubCategories() { |
||||
|
return !subCategories.isEmpty(); |
||||
|
} |
||||
|
} |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 139 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 196 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 475 B |
@ -0,0 +1,163 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
android:id="@+id/main_content" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:fitsSystemWindows="true" |
||||
|
tools:context=".activities.UploadActivity"> |
||||
|
|
||||
|
<android.support.design.widget.AppBarLayout |
||||
|
android:id="@+id/appbar" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:paddingTop="@dimen/appbar_padding_top" |
||||
|
android:theme="@style/ToolbarTheme"> |
||||
|
|
||||
|
<android.support.v7.widget.Toolbar |
||||
|
android:id="@+id/toolbar" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="?attr/actionBarSize" |
||||
|
android:background="?attr/colorPrimary" |
||||
|
app:popupTheme="@style/ToolbarTheme" /> |
||||
|
</android.support.design.widget.AppBarLayout> |
||||
|
|
||||
|
<ScrollView |
||||
|
android:id="@+id/upload_outer_scrollview" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_gravity="top|start" |
||||
|
android:background="@color/background" |
||||
|
android:paddingEnd="@dimen/activity_horizontal_margin" |
||||
|
android:paddingStart="@dimen/activity_horizontal_margin" |
||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" |
||||
|
tools:context="gr.thmmy.mthmmy.activities.UploadActivity"> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:background="@color/background" |
||||
|
android:focusableInTouchMode="true" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:gravity="center" |
||||
|
android:text="@string/upload_category_pre_text" |
||||
|
android:textAlignment="center" |
||||
|
android:textColor="@color/accent" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/upload_spinners" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:background="@color/background" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<android.support.v7.widget.AppCompatSpinner |
||||
|
android:id="@+id/upload_spinner_category_root" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:popupBackground="@color/primary" /> |
||||
|
</LinearLayout> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:gravity="center" |
||||
|
android:text="@string/upload_title_description_pre_text" |
||||
|
android:textAlignment="center" |
||||
|
android:textColor="@color/accent" /> |
||||
|
|
||||
|
<android.support.v7.widget.AppCompatButton |
||||
|
android:id="@+id/upload_title_description_builder" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:gravity="center" |
||||
|
android:text="@string/upload_title_description_builder" |
||||
|
android:textAlignment="center" |
||||
|
android:textColor="@color/accent" /> |
||||
|
|
||||
|
<android.support.design.widget.TextInputLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:layout_marginTop="6dp"> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/upload_title" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:hint="@string/upload_title_hint" |
||||
|
android:inputType="text" |
||||
|
android:maxLength="500" /> |
||||
|
</android.support.design.widget.TextInputLayout> |
||||
|
|
||||
|
<android.support.design.widget.TextInputLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:layout_marginTop="6dp"> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/upload_description" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:hint="@string/upload_description_hint" |
||||
|
android:inputType="textMultiLine" |
||||
|
android:maxLines="3" /> |
||||
|
</android.support.design.widget.TextInputLayout> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/upload_select_file_button" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="center" |
||||
|
android:layout_marginBottom="6dp" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:drawablePadding="5dp" |
||||
|
android:drawableStart="@drawable/ic_insert_drive_file" |
||||
|
android:gravity="center_vertical" |
||||
|
android:text="@string/upload_select_file" |
||||
|
android:textAlignment="center" |
||||
|
android:textColor="@color/primary_text" /> |
||||
|
|
||||
|
<FrameLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="0dp" |
||||
|
android:layout_gravity="bottom|end" |
||||
|
android:layout_weight="4"> |
||||
|
|
||||
|
<android.support.v7.widget.AppCompatButton |
||||
|
android:id="@+id/upload_upload_button" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="bottom|end" |
||||
|
android:text="@string/upload_upload_button" /> |
||||
|
</FrameLayout> |
||||
|
|
||||
|
</LinearLayout> |
||||
|
</ScrollView> |
||||
|
|
||||
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar |
||||
|
android:id="@+id/progressBar" |
||||
|
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="@dimen/progress_bar_height" |
||||
|
android:indeterminate="true" |
||||
|
android:visibility="invisible" |
||||
|
app:layout_anchor="@id/appbar" |
||||
|
app:layout_anchorGravity="bottom|center" |
||||
|
app:mpb_indeterminateTint="@color/accent" |
||||
|
app:mpb_progressStyle="horizontal" /> |
||||
|
</android.support.design.widget.CoordinatorLayout> |
||||
|
|
||||
|
|
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||
|
<item |
||||
|
android:id="@+id/menu_upload" |
||||
|
android:icon="@drawable/ic_file_upload" |
||||
|
app:showAsAction="ifRoom" |
||||
|
android:title="@string/upload_button"> |
||||
|
</item> |
||||
|
</menu> |