diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3e7a42a9..2ea54c11 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -98,13 +98,21 @@ android:value=".activities.main.MainActivity" /> + + + - + diff --git a/app/src/main/assets/apache_libraries.html b/app/src/main/assets/apache_libraries.html index fd866258..c739366e 100644 --- a/app/src/main/assets/apache_libraries.html +++ b/app/src/main/assets/apache_libraries.html @@ -62,6 +62,9 @@
  • Timber v4.7.0 (Copyright ©2013 Jake Wharton)
  • +
  • +
    Android Upload Service v3.4.2 (Copyright ©2013-2018 Aleksandar Gotev)
    +
  • diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/UploadActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/UploadActivity.java deleted file mode 100644 index 65aa6598..00000000 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/UploadActivity.java +++ /dev/null @@ -1,333 +0,0 @@ -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.net.URLEncoder; -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.AppCompatSpinnerWithoutDefault; -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 uploadRootCategories = new ArrayList<>(); - //private String currentUploadCategory = ""; - private ParseUploadPageTask parseUploadPageTask; - private String categorySelected = "-1"; - private String uploaderProfileIndex = "1"; - private Uri fileUri; - - //UI elements - private MaterialProgressBar progressBar; - private LinearLayout categoriesSpinners; - private AppCompatSpinnerWithoutDefault 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) { - String uploadTitleText = uploadTitle.getText().toString(); - String uploadDescriptionText = uploadDescription.getText().toString(); - - if (uploadTitleText.equals("")) { - uploadTitle.setError("Required"); - } - if (uploadDescriptionText.equals("")) { - uploadDescription.setError("Required"); - } - /*if (categorySelected.equals("-1")){ - //TODO set error - //rootCategorySpinner - }*/ - - if (categorySelected.equals("-1") || uploadTitleText.equals("") || - fileUri == null || uploadDescriptionText.equals("")) { - return; - } - - try { - String uploadId = new MultipartUploadRequest(v.getContext(), uploadIndexUrl) - .setUtf8Charset() - .addParameter("tp-dluploadtitle", uploadTitleText) - .addParameter("tp-dluploadcat", categorySelected) - .addParameter("tp-dluploadtext", uploadDescriptionText) - .addFileToUpload(fileUri.toString(), "tp-dluploadfile") - .addParameter("tp_dluploadicon", "blank.gif") //TODO auto-select this - .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 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 parentCategories, childCategories; - - private CustomOnItemSelectedListener() { - //Disable default constructor - } - - CustomOnItemSelectedListener(ArrayList parentCategories) { - this.parentCategories = parentCategories; - } - - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - //Removes old, unneeded sub categories spinner(s) - int viewIndex = categoriesSpinners.indexOfChild((AppCompatSpinnerWithoutDefault) 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 spinnerArrayAdapter = new ArrayAdapter<>(getApplicationContext(), - android.R.layout.simple_spinner_dropdown_item, tmpSpinnerArray); - spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - - AppCompatSpinnerWithoutDefault subSpinner = new AppCompatSpinnerWithoutDefault(categoriesSpinners.getContext()); - subSpinner.setPromptId(R.string.upload_spinners_prompt); - 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 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); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java index 3f5bd0cf..09734606 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java @@ -147,10 +147,10 @@ class BoardAdapter extends RecyclerView.Adapter { }); if (boardExpandableVisibility.get(subBoardViewHolder.getAdapterPosition() - 1)) { subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); - subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up); + subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } else { subBoardViewHolder.boardExpandable.setVisibility(View.GONE); - subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down); + subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } subBoardViewHolder.showHideExpandable.setOnClickListener(new View.OnClickListener() { @Override @@ -158,10 +158,10 @@ class BoardAdapter extends RecyclerView.Adapter { final boolean visible = boardExpandableVisibility.get(subBoardViewHolder.getAdapterPosition() - 1); if (visible) { subBoardViewHolder.boardExpandable.setVisibility(View.GONE); - subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down); + subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } else { subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); - subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up); + subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } boardExpandableVisibility.set(subBoardViewHolder.getAdapterPosition() - 1, !visible); } @@ -208,10 +208,10 @@ class BoardAdapter extends RecyclerView.Adapter { if (topicExpandableVisibility.get(topicViewHolder.getAdapterPosition() - parsedSubBoards .size() - 2)) { topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); - topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up); + topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } else { topicViewHolder.topicExpandable.setVisibility(View.GONE); - topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down); + topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } topicViewHolder.showHideExpandable.setOnClickListener(new View.OnClickListener() { @Override @@ -220,10 +220,10 @@ class BoardAdapter extends RecyclerView.Adapter { getAdapterPosition() - parsedSubBoards.size() - 2); if (visible) { topicViewHolder.topicExpandable.setVisibility(View.GONE); - topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down); + topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } else { topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); - topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up); + topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } topicExpandableVisibility.set(topicViewHolder.getAdapterPosition() - parsedSubBoards.size() - 2, !visible); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java index 836efc31..e67ed73a 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Objects; import gr.thmmy.mthmmy.R; -import gr.thmmy.mthmmy.activities.UploadActivity; +import gr.thmmy.mthmmy.activities.upload.UploadActivity; import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseApplication; import gr.thmmy.mthmmy.model.Download; @@ -35,7 +35,7 @@ import okhttp3.Request; import okhttp3.Response; import timber.log.Timber; -import static gr.thmmy.mthmmy.activities.UploadActivity.BUNDLE_UPLOAD_CATEGORY; +import static gr.thmmy.mthmmy.activities.upload.UploadActivity.BUNDLE_UPLOAD_CATEGORY; public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.OnLoadMoreListener { /** @@ -48,6 +48,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. public static final String BUNDLE_DOWNLOADS_TITLE = "DOWNLOADS_TITLE"; private static final String downloadsIndexUrl = "https://www.thmmy.gr/smf/index.php?action=tpmod;dl;"; private String downloadsUrl; + private String downloadsNav; private String downloadsTitle; private final ArrayList parsedDownloads = new ArrayList<>(); @@ -143,8 +144,8 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. case R.id.menu_upload: Intent intent = new Intent(DownloadsActivity.this, UploadActivity.class); Bundle extras = new Bundle(); - /*extras.putString(BUNDLE_UPLOAD_CATEGORY, ""); - intent.putExtras(extras);*/ + extras.putString(BUNDLE_UPLOAD_CATEGORY, downloadsNav); + intent.putExtras(extras); startActivity(intent); return true; default: @@ -211,8 +212,11 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. @Override protected void parse(Document downloadPage) throws ParseException { try { + Element downloadsNavElement = downloadPage.select("div.nav").first(); + downloadsNav = downloadsNavElement.text(); + if (downloadsTitle == null || Objects.equals(downloadsTitle, "")) - downloadsTitle = downloadPage.select("div.nav>b>a.nav").last().text(); + downloadsTitle = downloadsNavElement.select("b>a.nav").last().text(); //Removes loading item if (isLoadingMore) { diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java index 5395b447..34a583e0 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java @@ -91,10 +91,10 @@ class DownloadsAdapter extends RecyclerView.Adapter { if (downloadExpandableVisibility.get(downloadViewHolder.getAdapterPosition())) { downloadViewHolder.informationExpandable.setVisibility(View.VISIBLE); - downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_up); + downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } else { downloadViewHolder.informationExpandable.setVisibility(View.GONE); - downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_down); + downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } downloadViewHolder.informationExpandableBtn.setOnClickListener(new View.OnClickListener() { @Override @@ -103,10 +103,10 @@ class DownloadsAdapter extends RecyclerView.Adapter { getAdapterPosition()); if (visible) { downloadViewHolder.informationExpandable.setVisibility(View.GONE); - downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_down); + downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); } else { downloadViewHolder.informationExpandable.setVisibility(View.VISIBLE); - downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_up); + downloadViewHolder.informationExpandableBtn.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); } downloadExpandableVisibility.set(downloadViewHolder.getAdapterPosition(), !visible); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java index 3e6f86cb..59d686a6 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java @@ -84,7 +84,11 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF tabLayout.setupWithViewPager(viewPager); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - tabLayout.getTabAt(Integer.parseInt(sharedPrefs.getString(DEFAULT_HOME_TAB, "0"))).select(); + int preferredTab = Integer.parseInt(sharedPrefs.getString(DEFAULT_HOME_TAB, "0")); + if (preferredTab != 3 || sessionManager.isLoggedIn()) { + tabLayout.getTabAt(preferredTab).select(); + } + setMainActivity(this); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java index a83fc610..2be05a74 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java @@ -124,9 +124,9 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() .error(ResourcesCompat.getDrawable(this.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .placeholder(ResourcesCompat.getDrawable(this.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .transform(new CircleTransform()) .into(thumbnailView); usernameView = findViewById(R.id.profile_activity_username); @@ -310,9 +310,9 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() .error(ResourcesCompat.getDrawable(getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .placeholder(ResourcesCompat.getDrawable(getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .transform(new CircleTransform()) .into(thumbnailView); if (personalText != null) { diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java index b57d2c0d..0f44a511 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java @@ -11,9 +11,10 @@ public class SettingsActivity extends BaseActivity { public static final String DEFAULT_HOME_TAB = "pref_app_main_default_tab_key"; public static final String NOTIFICATION_LED_KEY = "pref_notification_led_enable_key"; public static final String NOTIFICATION_VIBRATION_KEY = "pref_notification_vibration_enable_key"; - public static final String APP_SIGNATURE_ENABLE_KEY = "pref_posting_app_signature_enable_key"; + public static final String POSTING_APP_SIGNATURE_ENABLE_KEY = "pref_posting_app_signature_enable_key"; + public static final String UPLOADING_APP_SIGNATURE_ENABLE_KEY = "pref_uploading_app_signature_enable_key"; - private Fragment preferenceFragment; + private SettingsFragment preferenceFragment; @Override protected void onCreate(Bundle savedInstanceState) { @@ -42,6 +43,8 @@ public class SettingsActivity extends BaseActivity { protected void onResume() { drawer.setSelection(SETTINGS_ID); super.onResume(); - ((SettingsFragment) preferenceFragment).updateUserLoginState(sessionManager.isLoggedIn()); + if (preferenceFragment != null) { + preferenceFragment.updateUserLoginState(sessionManager.isLoggedIn()); + } } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java index c0cf9c3b..19a47dd1 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java @@ -22,10 +22,12 @@ public class SettingsFragment extends PreferenceFragmentCompat { public static final String ARG_IS_LOGGED_IN = "selectedRingtoneKey"; //Preferences xml keys - private static final String POSTING_CATEGORY = "pref_category_posting_key"; private static final String DEFAULT_HOME_TAB = "pref_app_main_default_tab_key"; - private static final String POSTING_APP_SIGNATURE_ENABLE = "pref_posting_app_signature_enable_key"; private static final String SELECTED_NOTIFICATIONS_SOUND = "pref_notifications_select_sound_key"; + private static final String POSTING_CATEGORY = "pref_category_posting_key"; + private static final String POSTING_APP_SIGNATURE_ENABLE = "pref_posting_app_signature_enable_key"; + private static final String UPLOADING_CATEGORY = "pref_category_uploading_key"; + private static final String UPLOADING_APP_SIGNATURE_ENABLE = "pref_uploading_app_signature_enable_key"; //SharedPreferences keys private static final int REQUEST_CODE_ALERT_RINGTONE = 2; @@ -79,6 +81,9 @@ public class SettingsFragment extends PreferenceFragmentCompat { findPreference(POSTING_CATEGORY).setVisible(isLoggedIn); findPreference(POSTING_APP_SIGNATURE_ENABLE).setVisible(isLoggedIn); + findPreference(UPLOADING_CATEGORY).setVisible(isLoggedIn); + findPreference(UPLOADING_APP_SIGNATURE_ENABLE).setVisible(isLoggedIn); + if (!isLoggedIn && defaultHomeTabEntries.contains("Unread")) { defaultHomeTabEntries.remove("Unread"); defaultHomeTabValues.remove("2"); @@ -148,6 +153,12 @@ public class SettingsFragment extends PreferenceFragmentCompat { public void updateUserLoginState(boolean isLoggedIn) { this.isLoggedIn = isLoggedIn; + findPreference(POSTING_CATEGORY).setVisible(isLoggedIn); + findPreference(POSTING_APP_SIGNATURE_ENABLE).setVisible(isLoggedIn); + + findPreference(UPLOADING_CATEGORY).setVisible(isLoggedIn); + findPreference(UPLOADING_APP_SIGNATURE_ENABLE).setVisible(isLoggedIn); + if (!isLoggedIn && defaultHomeTabEntries.contains("Unread")) { defaultHomeTabEntries.remove("Unread"); defaultHomeTabValues.remove("2"); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index cce74faa..09ad1abe 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -119,6 +119,8 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + //Fix for vector drawables on android <21 + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); setContentView(R.layout.activity_topic); viewModel = ViewModelProviders.of(this).get(TopicViewModel.class); @@ -141,8 +143,6 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb } topicPageUrl = ThmmyPage.sanitizeTopicUrl(topicPageUrl); - - thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl), true); //Initializes graphics @@ -300,7 +300,7 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb topicMenuBookmarkClick(); return true; case R.id.menu_info: - AlertDialog.Builder builder = new AlertDialog.Builder(this); + AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyleAccent); LayoutInflater inflater = this.getLayoutInflater(); LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info , null); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 0b676153..368521a4 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -180,9 +180,9 @@ class TopicAdapter extends RecyclerView.Adapter { .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() .error(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .placeholder(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .transform(new CircleTransform()) .into(holder.thumbnail); @@ -439,9 +439,9 @@ class TopicAdapter extends RecyclerView.Adapter { holder.quoteToggle.setVisibility(View.GONE); } else { if (viewProperties.get(position)[isQuoteButtonChecked]) - holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_checked); + holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_checked_accent_24dp); else - holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_unchecked); + holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_unchecked_grey_24dp); //Sets graphics behavior holder.quoteToggle.setOnClickListener(view -> { boolean[] tmp = viewProperties.get(holder.getAdapterPosition()); @@ -450,10 +450,10 @@ class TopicAdapter extends RecyclerView.Adapter { toQuoteList.remove(toQuoteList.indexOf(postsList.indexOf(currentPost))); } else Timber.i("An error occurred while trying to exclude post fromtoQuoteList, post wasn't there!"); - holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_unchecked); + holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_unchecked_grey_24dp); } else { toQuoteList.add(postsList.indexOf(currentPost)); - holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_checked); + holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_checked_accent_24dp); } tmp[isQuoteButtonChecked] = !tmp[isQuoteButtonChecked]; viewProperties.set(holder.getAdapterPosition(), tmp); @@ -468,9 +468,9 @@ class TopicAdapter extends RecyclerView.Adapter { .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() .error(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .placeholder(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail, null)) + , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .transform(new CircleTransform()) .into(holder.thumbnail); holder.username.setText(getSessionManager().getUsername()); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java new file mode 100644 index 00000000..a6556cc3 --- /dev/null +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java @@ -0,0 +1,643 @@ +package gr.thmmy.mthmmy.activities.upload; + +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.provider.MediaStore; +import android.provider.OpenableColumns; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v7.app.AlertDialog; +import android.support.v7.preference.PreferenceManager; +import android.support.v7.widget.AppCompatButton; +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.Toast; + +import net.gotev.uploadservice.MultipartUploadRequest; +import net.gotev.uploadservice.ServerResponse; +import net.gotev.uploadservice.UploadInfo; +import net.gotev.uploadservice.UploadNotificationConfig; +import net.gotev.uploadservice.UploadStatusDelegate; + +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; + +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.AppCompatSpinnerWithoutDefault; +import gr.thmmy.mthmmy.utils.parsing.ParseException; +import gr.thmmy.mthmmy.utils.parsing.ParseTask; +import me.zhanghai.android.materialprogressbar.MaterialProgressBar; +import timber.log.Timber; + +import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.UPLOADING_APP_SIGNATURE_ENABLE_KEY; +import static gr.thmmy.mthmmy.activities.upload.UploadFieldsBuilderActivity.BUNDLE_UPLOAD_FIELD_BUILDER_COURSE; +import static gr.thmmy.mthmmy.activities.upload.UploadFieldsBuilderActivity.BUNDLE_UPLOAD_FIELD_BUILDER_SEMESTER; +import static gr.thmmy.mthmmy.activities.upload.UploadFieldsBuilderActivity.RESULT_DESCRIPTION; +import static gr.thmmy.mthmmy.activities.upload.UploadFieldsBuilderActivity.RESULT_FILENAME; +import static gr.thmmy.mthmmy.activities.upload.UploadFieldsBuilderActivity.RESULT_TITLE; + +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 String uploadedFrommThmmyPromptHtml = "
    uploaded from mTHMMY"; + private static final int REQUEST_CODE_CHOOSE_FILE = 8; + private static final int REQUEST_CODE_CAMERA = 4; + private static final int REQUEST_CODE_FIELDS_BUILDER = 74; + + private static ArrayList uploadRootCategories = new ArrayList<>(); + private ParseUploadPageTask parseUploadPageTask; + private ArrayList bundleCategory; + private String categorySelected = "-1"; + private String uploaderProfileIndex = "1"; + private String uploadFilename; + private Uri fileUri; + private String fileIcon; + + //UI elements + private MaterialProgressBar progressBar; + private LinearLayout categoriesSpinners; + private AppCompatSpinnerWithoutDefault rootCategorySpinner; + private EditText uploadTitle; + private EditText uploadDescription; + private AppCompatButton titleDescriptionBuilderButton; + private AppCompatButton selectFileButton; + //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) { + String tmpUploadCategoryNav = extras.getString(BUNDLE_UPLOAD_CATEGORY); + //something like "THMMY.gr > Downloads > Βασικός Κύκλος > 3ο εξάμηνο > Ηλεκτρικά Κυκλώματα ΙΙ" + if (tmpUploadCategoryNav != null && !tmpUploadCategoryNav.equals("")) { + String[] tmpSplitUploadCategoryNav = tmpUploadCategoryNav.split(">"); + + for (int i = 0; i < tmpSplitUploadCategoryNav.length; ++i) { + tmpSplitUploadCategoryNav[i] = tmpSplitUploadCategoryNav[i].trim(); + } + + if (tmpSplitUploadCategoryNav.length > 2) { + bundleCategory = new ArrayList<>(Arrays.asList(tmpSplitUploadCategoryNav).subList(2, tmpSplitUploadCategoryNav.length)); + } + } + } + + //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.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (categorySelected.equals("-1")) { + Toast.makeText(view.getContext(), "Please choose category first", Toast.LENGTH_SHORT).show(); + return; + } + + int numberOfSpinners = categoriesSpinners.getChildCount(); + + if (numberOfSpinners < 3) { + Toast.makeText(view.getContext(), "Please choose a course category", Toast.LENGTH_SHORT).show(); + return; + } + + String maybeSemester = (String) ((AppCompatSpinnerWithoutDefault) + categoriesSpinners.getChildAt(numberOfSpinners - 2)).getSelectedItem(); + String maybeCourse = (String) ((AppCompatSpinnerWithoutDefault) + categoriesSpinners.getChildAt(numberOfSpinners - 1)).getSelectedItem(); + + if (!maybeSemester.contains("εξάμηνο") && !maybeSemester.contains("Εξάμηνο")) { + Toast.makeText(view.getContext(), "Please choose a course category", Toast.LENGTH_SHORT).show(); + return; + } + if (maybeCourse == null) { + Toast.makeText(view.getContext(), "Please choose a course", Toast.LENGTH_SHORT).show(); + return; + } + + //Fixes course and semester + maybeCourse = maybeCourse.replaceAll("-", "").replace("(ΝΠΣ)", "").trim(); + maybeSemester = maybeSemester.replaceAll("-", "").trim().substring(0, 1); + + Intent intent = new Intent(UploadActivity.this, UploadFieldsBuilderActivity.class); + Bundle extras = new Bundle(); + extras.putString(BUNDLE_UPLOAD_FIELD_BUILDER_COURSE, maybeCourse); + extras.putString(BUNDLE_UPLOAD_FIELD_BUILDER_SEMESTER, maybeSemester); + intent.putExtras(extras); + startActivityForResult(intent, REQUEST_CODE_FIELDS_BUILDER); + } + }); + titleDescriptionBuilderButton.setEnabled(false); + + uploadTitle = findViewById(R.id.upload_title); + uploadDescription = findViewById(R.id.upload_description); + + selectFileButton = findViewById(R.id.upload_select_file_button); + selectFileButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final CharSequence[] options = {"Take photo", "Choose file", + "Cancel"}; + AlertDialog.Builder builder = new AlertDialog.Builder(UploadActivity.this); + builder.setTitle("Upload file"); + builder.setItems(options, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (options[item].equals("Take photo")) { + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + startActivityForResult(intent, REQUEST_CODE_CAMERA); + } else if (options[item].equals("Choose file")) { + 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); + } else if (options[item].equals("Cancel")) { + dialog.dismiss(); + } + } + }); + builder.show(); + } + }); + + findViewById(R.id.upload_upload_button).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String uploadTitleText = uploadTitle.getText().toString(); + String uploadDescriptionText = uploadDescription.getText().toString(); + + if (uploadTitleText.equals("")) { + uploadTitle.setError("Required"); + } + if (fileUri == null) { + selectFileButton.setError("Required"); + } + if (categorySelected.equals("-1")) { + Toast.makeText(view.getContext(), "Please choose category first", Toast.LENGTH_SHORT).show(); + } + + if (categorySelected.equals("-1") || uploadTitleText.equals("") || fileUri == null) { + return; + } + + String tmpDescriptionText = uploadDescriptionText; + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(view.getContext()); + if (sharedPrefs.getBoolean(UPLOADING_APP_SIGNATURE_ENABLE_KEY, true)) { + tmpDescriptionText += uploadedFrommThmmyPromptHtml; + } + + String tempFilePath = null; + if (uploadFilename != null) { + tempFilePath = createTempFile(uploadFilename); + if (tempFilePath == null) { + //Something went wrong, abort + return; + } + } + + try { + final String finalTempFilePath = tempFilePath; + new MultipartUploadRequest(view.getContext(), uploadIndexUrl) + .setUtf8Charset() + .addParameter("tp-dluploadtitle", uploadTitleText) + .addParameter("tp-dluploadcat", categorySelected) + .addParameter("tp-dluploadtext", tmpDescriptionText) + .addFileToUpload(tempFilePath == null + ? fileUri.toString() + : tempFilePath + , "tp-dluploadfile") + .addParameter("tp_dluploadicon", fileIcon) + .addParameter("tp-uploaduser", uploaderProfileIndex) + .setNotificationConfig(new UploadNotificationConfig()) + .setMaxRetries(2) + .setDelegate(new UploadStatusDelegate() { + @Override + public void onProgress(Context context, UploadInfo uploadInfo) { + } + + @Override + public void onError(Context context, UploadInfo uploadInfo, ServerResponse serverResponse, + Exception exception) { + Toast.makeText(context, "Upload failed", Toast.LENGTH_SHORT).show(); + if (finalTempFilePath != null) { + if (!deleteTempFile(finalTempFilePath)) { + Toast.makeText(context, "Failed to delete temp file", Toast.LENGTH_SHORT).show(); + } + } + } + + @Override + public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) { + if (finalTempFilePath != null) { + if (!deleteTempFile(finalTempFilePath)) { + Toast.makeText(context, "Failed to delete temp file", Toast.LENGTH_SHORT).show(); + } + } + } + + @Override + public void onCancelled(Context context, UploadInfo uploadInfo) { + if (finalTempFilePath != null) { + if (!deleteTempFile(finalTempFilePath)) { + Toast.makeText(context, "Failed to delete temp file", Toast.LENGTH_SHORT).show(); + } + } + } + }) + .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 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); + + //Sets bundle selection + if (bundleCategory != null) { + int bundleSelectionIndex = -1, currentIndex = 0; + for (UploadCategory category : uploadRootCategories) { + if (category.getCategoryTitle().contains(bundleCategory.get(0))) { //TODO fix .contains, always false + bundleSelectionIndex = currentIndex; + break; + } + ++currentIndex; + } + + if (bundleSelectionIndex != -1) { + rootCategorySpinner.setSelection(bundleSelectionIndex, true); + } + } + + titleDescriptionBuilderButton.setEnabled(true); + } + } + + @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) { + if (resultCode == Activity.RESULT_CANCELED) { + return; + } + + fileUri = data.getData(); + if (fileUri != null) { + String filename = filenameFromUri(fileUri); + selectFileButton.setText(filename); + + filename = filename.toLowerCase(); + if (filename.endsWith(".jpg")) { + fileIcon = "jpg_image.gif"; + } else if (filename.endsWith(".gif")) { + fileIcon = "gif_image.gif"; + } else if (filename.endsWith(".png")) { + fileIcon = "png_image.gif"; + } else if (filename.endsWith(".html") || filename.endsWith(".htm")) { + fileIcon = "html_file.gif"; + } else if (filename.endsWith(".pdf") || filename.endsWith(".doc") || + filename.endsWith("djvu")) { + fileIcon = "text_file.gif"; + } else if (filename.endsWith(".zip") || filename.endsWith(".rar") || + filename.endsWith(".tar") || filename.endsWith(".tar.gz") || + filename.endsWith(".gz")) { + fileIcon = "archive.gif"; + } else { + fileIcon = "blank.gif"; + } + } + } else if (requestCode == REQUEST_CODE_CAMERA && data != null) { + if (resultCode == Activity.RESULT_CANCELED) { + return; + } + //TODO + } else if (requestCode == REQUEST_CODE_FIELDS_BUILDER) { + if (resultCode == Activity.RESULT_CANCELED) { + return; + } + + uploadFilename = data.getStringExtra(RESULT_FILENAME); + uploadTitle.setText(data.getStringExtra(RESULT_TITLE)); + uploadDescription.setText(data.getStringExtra(RESULT_DESCRIPTION)); + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + @NonNull + private String filenameFromUri(Uri uri) { + String filename = null; + if (uri.getScheme().equals("content")) { + try (Cursor cursor = getContentResolver().query(uri, null, null, null, null)) { + if (cursor != null && cursor.moveToFirst()) { + filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); + } + } + } + if (filename == null) { + filename = uri.getPath(); + int cut = filename.lastIndexOf('/'); + if (cut != -1) { + filename = filename.substring(cut + 1); + } + } + + return filename; + } + + @Nullable + private String createTempFile(String newFilename) { + String oldFilename = filenameFromUri(fileUri); + String fileExtension = oldFilename.substring(oldFilename.indexOf(".")); + String destinationFilename = android.os.Environment.getExternalStorageDirectory().getPath() + + File.separatorChar + "~tmp_mThmmy_uploads" + File.separatorChar + newFilename + fileExtension; + + File tempDirectory = new File(android.os.Environment.getExternalStorageDirectory().getPath() + + File.separatorChar + "~tmp_mThmmy_uploads"); + + if (!tempDirectory.exists()) { + if (!tempDirectory.mkdirs()) { + Timber.w("Temporary directory build returned false in %s", UploadActivity.class.getSimpleName()); + Toast.makeText(this, "Couldn't create temporary directory", Toast.LENGTH_SHORT).show(); + return null; + } + } + + InputStream inputStream; + BufferedInputStream bufferedInputStream = null; + BufferedOutputStream bufferedOutputStream = null; + + try { + inputStream = getContentResolver().openInputStream(fileUri); + if (inputStream == null) { + Timber.w("Input stream was null, %s", UploadActivity.class.getSimpleName()); + return null; + } + + bufferedInputStream = new BufferedInputStream(inputStream); + bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(destinationFilename, false)); + byte[] buf = new byte[1024]; + bufferedInputStream.read(buf); + do { + bufferedOutputStream.write(buf); + } while (bufferedInputStream.read(buf) != -1); + } catch (IOException exception) { + exception.printStackTrace(); + } finally { + try { + if (bufferedInputStream != null) bufferedInputStream.close(); + if (bufferedOutputStream != null) bufferedOutputStream.close(); + } catch (IOException exception) { + exception.printStackTrace(); + } + } + + return destinationFilename; + } + + private boolean deleteTempFile(String destinationFilename) { + File file = new File(destinationFilename); + return file.delete(); + } + + private class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener { + private ArrayList parentCategories, childCategories; + + // Suppresses default constructor + @SuppressWarnings("unused") + private CustomOnItemSelectedListener() { + } + + CustomOnItemSelectedListener(ArrayList parentCategories) { + this.parentCategories = parentCategories; + } + + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + //Removes old, unneeded sub-category spinner(s) + int viewIndex = categoriesSpinners.indexOfChild((AppCompatSpinnerWithoutDefault) 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-category 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 spinnerArrayAdapter = new ArrayAdapter<>(getApplicationContext(), + android.R.layout.simple_spinner_dropdown_item, tmpSpinnerArray); + spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + AppCompatSpinnerWithoutDefault subSpinner = new AppCompatSpinnerWithoutDefault(categoriesSpinners.getContext()); + subSpinner.setPromptId(R.string.upload_spinners_hint); + subSpinner.setPopupBackgroundResource(R.color.primary); + subSpinner.setAdapter(spinnerArrayAdapter); + subSpinner.setOnItemSelectedListener(new CustomOnItemSelectedListener(childCategories)); + categoriesSpinners.addView(subSpinner); + + //Sets bundle selection + if (bundleCategory != null && viewIndex < bundleCategory.size()) { + int bundleSelectionIndex = -1, currentIndex = 0; + for (UploadCategory category : parentCategories) { + if (category.getCategoryTitle().contains(bundleCategory.get(viewIndex))) { + bundleSelectionIndex = currentIndex; + break; + } + ++currentIndex; + } + + if (bundleSelectionIndex != -1) { + subSpinner.setSelection(bundleSelectionIndex, true); + } + } + } + } + + @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 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); + + //Sets bundle selection + if (bundleCategory != null) { + int bundleSelectionIndex = -1, currentIndex = 0; + for (UploadCategory category : uploadRootCategories) { + if (category.getCategoryTitle().contains(bundleCategory.get(0))) { //TODO fix .contains, always false + bundleSelectionIndex = currentIndex; + break; + } + ++currentIndex; + } + + if (bundleSelectionIndex != -1) { + rootCategorySpinner.setSelection(bundleSelectionIndex, true); + } + } + + titleDescriptionBuilderButton.setEnabled(true); + progressBar.setVisibility(ProgressBar.GONE); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java new file mode 100644 index 00000000..73bf6962 --- /dev/null +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java @@ -0,0 +1,481 @@ +package gr.thmmy.mthmmy.activities.upload; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioGroup; +import android.widget.Toast; + +import java.util.Calendar; + +import gr.thmmy.mthmmy.R; +import timber.log.Timber; + +public class UploadFieldsBuilderActivity extends AppCompatActivity { + static final String BUNDLE_UPLOAD_FIELD_BUILDER_COURSE = "UPLOAD_FIELD_BUILDER_COURSE"; + static final String BUNDLE_UPLOAD_FIELD_BUILDER_SEMESTER = "UPLOAD_FIELD_BUILDER_SEMESTER"; + + static final String RESULT_FILENAME = "RESULT_FILENAME"; + static final String RESULT_TITLE = "RESULT_TITLE"; + static final String RESULT_DESCRIPTION = "RESULT_DESCRIPTION"; + + private String course, semester; + + private LinearLayout semesterChooserLinear; + private RadioGroup typeRadio, semesterRadio; + private EditText year; + + private TextWatcher customYearWatcher = new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + String working = s.toString(); + boolean isValid; + + if (working.length() == 4) { + int currentYear = Calendar.getInstance().get(Calendar.YEAR); + int inputYear = Integer.parseInt(working); + + isValid = inputYear <= currentYear && inputYear > 2000; + } else { + isValid = false; + } + + if (!isValid) { + year.setError("Please enter a valid year"); + } else { + year.setError(null); + } + + } + + @Override + public void afterTextChanged(Editable s) { + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_upload_fields_builder); + + Bundle extras = getIntent().getExtras(); + if (extras != null) { + course = extras.getString(BUNDLE_UPLOAD_FIELD_BUILDER_COURSE); + semester = extras.getString(BUNDLE_UPLOAD_FIELD_BUILDER_SEMESTER); + if (course == null || course.equals("") || semester == null || semester.equals("")) { + Toast.makeText(this, "Something went wrong!", Toast.LENGTH_SHORT).show(); + Timber.e("Bundle came empty in %s", UploadFieldsBuilderActivity.class.getSimpleName()); + + Intent returnIntent = new Intent(); + setResult(Activity.RESULT_CANCELED, returnIntent); + finish(); + } + } + + //Initialize toolbar + Toolbar toolbar = findViewById(R.id.toolbar); + toolbar.setTitle("Upload fields builder"); + setSupportActionBar(toolbar); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + } + + semesterChooserLinear = findViewById(R.id.upload_fields_builder_choose_semester); + semesterRadio = findViewById(R.id.upload_fields_builder_semester_radio_group); + year = findViewById(R.id.upload_fields_builder_year); + year.addTextChangedListener(customYearWatcher); + + typeRadio = findViewById(R.id.upload_fields_builder_type_radio_group); + typeRadio.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + if (checkedId == R.id.upload_fields_builder_radio_button_notes) { + semesterChooserLinear.setVisibility(View.GONE); + } else { + semesterChooserLinear.setVisibility(View.VISIBLE); + } + } + }); + + findViewById(R.id.upload_fields_builder_submit).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + int typeId = typeRadio.getCheckedRadioButtonId(), + semesterId = semesterRadio.getCheckedRadioButtonId(); + if (typeId == -1) { + Toast.makeText(view.getContext(), "Please choose a type for the upload", Toast.LENGTH_SHORT).show(); + return; + } else if (semesterChooserLinear.getVisibility() == View.VISIBLE && semesterId == -1) { + Toast.makeText(view.getContext(), "Please choose a semester for the upload", Toast.LENGTH_SHORT).show(); + return; + } else if (year.getText().toString().isEmpty()) { + Toast.makeText(view.getContext(), "Please choose a year for the upload", Toast.LENGTH_SHORT).show(); + return; + } + + Intent returnIntent = new Intent(); + returnIntent.putExtra(RESULT_FILENAME, buildFilename()); + returnIntent.putExtra(RESULT_TITLE, buildTitle()); + returnIntent.putExtra(RESULT_DESCRIPTION, buildDescription()); + setResult(Activity.RESULT_OK, returnIntent); + finish(); + } + }); + } + + @Nullable + private String buildFilename() { + switch (typeRadio.getCheckedRadioButtonId()) { + case R.id.upload_fields_builder_radio_button_exams: + return getGreeklishCourseName() + "_" + getGreeklishPeriod() + "_" + year.getText().toString(); + case R.id.upload_fields_builder_radio_button_exam_solutions: + return getGreeklishCourseName() + "_" + getGreeklishPeriod() + "_" + year.getText().toString() + "_Lyseis"; + case R.id.upload_fields_builder_radio_button_notes: + return getGreeklishCourseName() + "_" + year.getText().toString() + "_Shmeiwseis"; + default: + return null; + } + } + + @Nullable + private String buildTitle() { + switch (typeRadio.getCheckedRadioButtonId()) { + case R.id.upload_fields_builder_radio_button_exams: + return getMinifiedCourseName() + " - " + "Θέματα εξετάσεων " + getPeriod() + " " + year.getText().toString(); + case R.id.upload_fields_builder_radio_button_exam_solutions: + return getMinifiedCourseName() + " - " + "Λύσεις θεμάτων " + getPeriod() + " " + year.getText().toString(); + case R.id.upload_fields_builder_radio_button_notes: + return getMinifiedCourseName() + " - " + "Σημειώσεις παραδόσεων " + year.getText().toString(); + default: + return null; + } + } + + private String buildDescription() { + switch (typeRadio.getCheckedRadioButtonId()) { + case R.id.upload_fields_builder_radio_button_exams: + return "Θέματα εξετάσεων " + getPeriod() + " " + year.getText().toString() + " του μαθήματος \"" + course + "\""; + case R.id.upload_fields_builder_radio_button_exam_solutions: + return "Λύσεις των θεμάτων των εξετάσεων " + getPeriod() + " " + year.getText().toString() + " του μαθήματος \"" + course + "\""; + case R.id.upload_fields_builder_radio_button_notes: + return "Σημειώσεις των παραδόσεων του μαθήματος \"" + course + "\" από το " + year.getText().toString(); + default: + return null; + } + } + + private String getGreeklishPeriod() { + switch (semesterRadio.getCheckedRadioButtonId()) { + case R.id.upload_fields_builder_radio_button_feb: + return "FEB"; + case R.id.upload_fields_builder_radio_button_jun: + return "IOY"; + case R.id.upload_fields_builder_radio_button_sept: + return "SEP"; + default: + return null; + } + } + + private String getPeriod() { + switch (semesterRadio.getCheckedRadioButtonId()) { + case R.id.upload_fields_builder_radio_button_feb: + return "Φεβρουαρίου"; + case R.id.upload_fields_builder_radio_button_jun: + return "Ιουνίου"; + case R.id.upload_fields_builder_radio_button_sept: + return "Σεπτεμβρίου"; + default: + return null; + } + } + + @Nullable + private String getGreeklishCourseName() { + return getGreeklishOrMinifiedCourseName(true); + } + + @Nullable + private String getMinifiedCourseName() { + return getGreeklishOrMinifiedCourseName(false); + } + + + @Nullable + private String getGreeklishOrMinifiedCourseName(boolean greeklish) { + //TODO fill missing values + if (course.contains("Συστήματα Υπολογιστών (Υπολογιστικά Συστήματα)")) { + return greeklish ? "sys_ypologistwn" : "Συσ. Υπολογιστών"; + } else if (course.contains("Τεχνική Μηχανική")) { + return greeklish ? "texn_mhxan" : "Τεχν. Μηχαν."; + } else if (course.contains("Διαφορικές Εξισώσεις")) { + return greeklish ? "diaforikes" : "Διαφορικές"; + } else if (course.contains("Θεωρία Πιθανοτήτων και Στατιστική")) { + return greeklish ? "pithanothtes" : "Πιθανότητες"; + } else if (course.contains("Εφαρμοσμένα Μαθηματικά Ι")) { + return greeklish ? "efarmosmena_math_I" : "Εφαρμοσμένα 1"; + } else if (course.contains("Ηλεκτρικά Κυκλώματα ΙΙ")) { + return greeklish ? "kyklwmata_II" : "Κυκλώματα 2"; + } else if (course.contains("Ηλεκτρολογικά Υλικά")) { + return greeklish ? "ylika" : "Ηλεκτρ. Υλικά"; + } else if (course.contains("Ηλεκτρομαγνητικό Πεδίο Ι")) { + return greeklish ? "pedio_I" : "Πεδίο 1"; + } else if (course.contains("Θεωρία Σημάτων και Γραμμικών Συστημάτων")) { + return greeklish ? "analog_shma" : "Σύματα & Συστήματα"; + } else if (course.contains("Προγραμματιστικές Τεχνικές")) { + return greeklish ? "cpp" : "Προγραμματ. Τεχν."; + } else if (course.contains("Αριθμητική Ανάλυση")) { + return greeklish ? "arith_anal" : "Αριθμ. Ανάλυση"; + } else if (course.contains("Αρχιτεκτονική Υπολογιστών")) { + return greeklish ? "arx_ypologistwn" : "Αρχ. Υπολογιστών"; + } else if (course.contains("Εισαγωγή στην Ενεργειακή Τεχνολογία Ι")) { + return greeklish ? "EET_I" : "ΕΕΤ 1"; + } else if (course.contains("Ηλεκτρικά Κυκλώματα ΙΙΙ")) { + return greeklish ? "kyklwmata_I" : "Κυκλώματα 3"; + } else if (course.contains("Ηλεκτρομαγνητικό Πεδίο ΙΙ")) { + return greeklish ? "pedio_II" : "Πεδίο 2"; + } else if (course.contains("Στοχαστικό Σήμα")) { + return greeklish ? "stox_shma" : "Στοχ. Σήμα"; + } else if (course.contains("Ψηφιακά Συστήματα Ι")) { + return greeklish ? "pshfiaka_I" : "Ψηφιακά 1"; + } else if (course.contains("Αναλογικές Τηλεπικοινωνίες (πρώην Τηλεπικοινωνιακά Συστήματα Ι)")) { + return greeklish ? "anal_thlep" : "Αναλογικές Τηλεπ."; + } else if (course.contains("Διάδοση Ηλεκτρομαγνητικού Κύματος Ι (πρώην Πεδίο ΙΙΙ)")) { + return greeklish ? "diadosi_1" : "Διάδοση 1"; + } else if (course.contains("Δομές Δεδομένων")) { + return greeklish ? "dom_dedomenwn" : "Δομ. Δεδομ."; + } else if (course.contains("Εισαγωγή στην Ενεργειακή Τεχνολογία ΙΙ")) { + return greeklish ? "EET_2" : "ΕΕΤ2"; + } else if (course.contains("Ηλεκτρικές Μετρήσεις Ι")) { + return greeklish ? "metrhseis_1" : "Μετρήσεις 1"; + } else if (course.contains("Ηλεκτρονική ΙΙ")) { + return greeklish ? "hlektronikh_2" : "Ηλεκτρονική 2"; + } else if (course.contains("Συστήματα Αυτομάτου Ελέγχου Ι")) { + return greeklish ? "SAE_1" : "ΣΑΕ 1"; + } else if (course.contains("Γραμμική Άλγεβρα")) { + return greeklish ? "grammikh_algebra" : "Γραμμ. Άλγεβρ."; + } else if (course.contains("Δομημένος Προγραμματισμός")) { + return greeklish ? "C" : "Δομ. Προγραμμ."; + } else if (course.contains("Λογική Σχεδίαση")) { + return greeklish ? "logiki_sxediash" : "Λογική Σχεδίαση"; + } else if (course.contains("Λογισμός Ι")) { + return greeklish ? "logismos_I" : "Λογισμός 1"; + } else if (course.contains("Τεχνικές Σχεδίασης με Η/Υ")) { + return greeklish ? "sxedio" : "Σχέδιο"; + } else if (course.contains("Φυσική Ι")) { + return greeklish ? "fysikh_I" : "Φυσική 1"; + } else if (course.contains("Αντικειμενοστραφής Προγραμματισμός")) { + return greeklish ? "OOP" : "Αντικειμενοστραφής"; + } else if (course.contains("Εφαρμοσμένη Θερμοδυναμική")) { + return greeklish ? "thermodynamikh" : "Θερμοδυναμική"; + } else if (course.contains("Ηλεκτρικά Κυκλώματα Ι")) { + return greeklish ? "kyklwmata_I" : "Κυκλώματα 1"; + } else if (course.contains("Λογισμός ΙΙ")) { + return greeklish ? "logismos_II" : "Λογισμός 2"; + } else if (course.contains("Οργάνωση Υπολογιστών")) { + return greeklish ? "org_ypol" : "Οργάνωση Υπολ."; + } else if (course.contains("Ηλεκτρονική Ι")) { + return greeklish ? "hlektronikh_1" : "Ηλεκτρονική 1"; + } else if (course.contains("Διακριτά μαθηματικά")) { + return greeklish ? "diakrita" : "Διακριτά Μαθηματικά"; + } else if (course.contains("Σήματα και Συστήματα")) { + return greeklish ? "analog_shma" : "Σύματα & Συστήματα"; + } else if (course.contains("Εισαγωγή στις εφαρμογές Πυρηνικής Τεχνολογίας")) { + return greeklish ? "Intro_Purhnikh_Texn" : "Εισ. Πυρηνικη Τεχν."; + } else if (course.contains("Επιχειρησιακή Έρευνα")) { + return greeklish ? "epixeirisiaki" : "Επιχειρησιακή Έρευνα"; + } else if (course.contains("Ημιαγωγά Υλικά: Θεωρία-Διατάξεις")) { + return greeklish ? "Hmiagwga_Ylika" : "Ημιαγωγά Υλικά"; + } else if (course.contains("Μετάδοση Θερμότητας")) { + return greeklish ? "metadosi_therm" : "Μετάδοση Θερμ."; + } else if (course.contains("Συστήματα Ηλεκτρικής Ενέργειας Ι")) { + return greeklish ? "SHE_I" : "ΣΗΕ 1"; + } else if (course.contains("Υψηλές Τάσεις Ι")) { + return greeklish ? "ypshles_I" : "Υψηλές 1"; + } else if (course.contains("Θεωρία και Τεχνολογία Πυρηνικών Αντιδραστήρων")) { + return greeklish ? "texn_antidrasthrwn" : "Τεχνολογία Αντιδραστήρων"; + } else if (course.contains("Τεχνολογία Ηλεκτροτεχνικών Υλικών")) { + return greeklish ? "Hlektrotexnika_Ylika" : "Ηλεκτροτεχνικά Υλικά"; + } else if (course.contains("Ηλεκτρικές Μηχανές Α'")) { + return greeklish ? "mhxanes_A" : "Μηχανές Α"; + } else if (course.contains("Σταθμοί Παραγωγής Ηλεκτρικής Ενέργειας")) { + return greeklish ? "SPHE" : "ΣΠΗΕ"; + } else if (course.contains("Συστήματα Ηλεκτρικής Ενέργειας ΙΙ")) { + return greeklish ? "SHE_II" : "ΣΗΕ 2"; + } else if (course.contains("Υψηλές Τάσεις ΙΙ")) { + return greeklish ? "ypshles_II" : "Υψηλές 2"; + } else if (course.contains("Αρχές Οικονομίας")) { + return greeklish ? "arx_oikonomias" : "Αρχές Οικονομίας"; + } else if (course.contains("Διανεμημένη Παραγωγή")) { + return greeklish ? "dian_paragwgh" : "Διανεμημένη Παραγωγή"; + } else if (course.contains("Διαχείριση Συστημάτων Ηλεκτρικής Ενέργειας")) { + return greeklish ? "dshe" : "ΔΣΗΕ"; + } else if (course.contains("Υψηλές Τάσεις ΙΙΙ")) { + return greeklish ? "ypshles_III" : "Υψηλές 3"; + } else if (course.contains("Ανάλυση Συστημάτων Ηλεκτρικής Ενέργειας")) { + return greeklish ? "ASHE" : "ΑΣΗΕ"; + } else if (course.contains("Ηλεκτρικές Μηχανές Β'")) { + return greeklish ? "mhxanes_B" : "Μηχανές Β"; + } else if (course.contains("Ηλεκτρονικά Ισχύος Ι")) { + return greeklish ? "isxyos_I" : "Ισχύος 1"; + } else if (course.contains("Συστήματα Ηλεκτρικής Ενέργειας ΙΙΙ")) { + return greeklish ? "SHE_III" : "ΣΗΕ 3"; + } else if (course.contains("Σερβοκινητήρια Συστήματα")) { + return greeklish ? "servo" : "Σέρβο"; + } else if (course.contains("Συστήματα Ηλεκτροκίνησης")) { + return greeklish ? "hlektrokinhsh" : "Ηλεκτροκίνηση"; + } else if (course.contains("Υπολογιστικές Μέθοδοι στα Ενεργειακά Συστήματα")) { + return greeklish ? "ymes" : "ΥΜΕΣ"; + } else if (course.contains("Υψηλές Τάσεις 4")) { + return greeklish ? "ypshles_IV" : "Υψηλές 4"; + } else if (course.contains("Ηλεκτρικές Μηχανές Γ'")) { + return greeklish ? "mhxanes_C" : "Μηχανές Γ"; + } else if (course.contains("Ηλεκτρική Οικονομία")) { + return greeklish ? "hlektr_oikonomia" : "Ηλεκτρική Οικονομία"; + } else if (course.contains("Ηλεκτρονικά Ισχύος ΙΙ")) { + return greeklish ? "isxyos_II" : "Ισχύος 2"; + } else if (course.contains("Ανάλυση και Σχεδίαση Αλγορίθμων")) { + return greeklish ? "algorithms" : "Αλγόριθμοι"; + } else if (course.contains("Διακριτά Μαθηματικά")) { + return greeklish ? "diakrita" : "Διακριτά Μαθηματικά"; + } else if (course.contains("Κβαντική Φυσική")) { + return greeklish ? "kvantikh" : "Κβαντική"; + } else if (course.contains("Ρομποτική")) { + return greeklish ? "rompotikh" : "Ρομποτική"; + } else if (course.contains("Τεχνικές Βελτιστοποίησης")) { + return greeklish ? "veltistopoihsh" : "Βελτιστοποίηση"; + } else if (course.contains("Ηλεκτρικές Μετρήσεις ΙΙ")) { + return greeklish ? "metrhseis_II" : "Μετρήσεις 2"; + } else if (course.contains("Ηλεκτρονική ΙΙΙ")) { + return greeklish ? "hlektronikh_III" : "Ηλεκτρονική 3"; + } else if (course.contains("Συστήματα Αυτομάτου Ελέγχου ΙΙ")) { + return greeklish ? "SAE_II" : "ΣΑΕ 2"; + } else if (course.contains("Ψηφιακά Συστήματα ΙΙ")) { + return greeklish ? "pshfiaka_II" : "Ψηφιακά 2"; + } else if (course.contains("Ανάλυση Χρονοσειρών")) { + return greeklish ? "xronoseires" : "Χρονοσειρές"; + } else if (course.contains("Θεωρία Υπολογισμών και Αλγορίθμων")) { + return greeklish ? "thya" : "ΘΥΑ"; + } else if (course.contains("Παράλληλα και Κατανεμημένα Συστήματα")) { + return greeklish ? "parallhla" : "Παράλληλα"; + } else if (course.contains("Προγραμματιζόμενα Κυκλώματα ASIC")) { + return greeklish ? "asic" : "ASIC"; + } else if (course.contains("Προσομοίωση και Μοντελοποίηση Συστημάτων")) { + return greeklish ? "montelopoihsh" : "Μοντελοποίηση"; + } else if (course.contains("Συστήματα Αυτομάτου Ελέγχου ΙΙI")) { + return greeklish ? "SAE_III" : "ΣΑΕ 3"; + } else if (course.contains("Σύνθεση Ενεργών και Παθητικών Κυκλωμάτων")) { + return greeklish ? "synthesh" : "Σύνθεση"; + } else if (course.contains("Δίκτυα Υπολογιστών Ι")) { + return greeklish ? "diktya_I" : "Δίκτυα 1"; + } else if (course.contains("Λειτουργικά Συστήματα")) { + return greeklish ? "OS" : "Λειτουργικά"; + } else if (course.contains("Συστήματα Μικροϋπολογιστών")) { + return greeklish ? "mikro_I" : "Μίκρο 1"; + } else if (course.contains("Ασαφή Συστήματα")) { + return greeklish ? "asafh" : "Ασαφή"; + } else if (course.contains("Γραφική με Υπολογιστές")) { + return greeklish ? "grafikh" : "Γραφική"; + } else if (course.contains("Ενσωματωμένα Συστήματα Πραγματικού Χρόνου")) { + return greeklish ? "enswmatwmena" : "Ενσωματωμένα"; + } else if (course.contains("Τηλεπικοινωνιακή Ηλεκτρονική")) { + return greeklish ? "tilep_ilektr" : "Τηλεπ. Ηλεκτρ."; + } else if (course.contains("Ψηφιακά Συστήματα ΙΙΙ")) { + return greeklish ? "pshfiaka_III" : "Ψηφιακά 3"; + } else if (course.contains("Ψηφιακή Επεξεργασία Εικόνας")) { + return greeklish ? "psee" : "ΨΕΕ"; + } else if (course.contains("Δίκτυα Υπολογιστών ΙΙ")) { + return greeklish ? "diktya_II" : "Δίκτυα 2"; + } else if (course.contains("Μικροεπεξεργαστές και Περιφερειακά")) { + return greeklish ? "mikro_II" : "Μίκρο 2"; + } else if (course.contains("Τεχνολογία Λογισμικού")) { + return greeklish ? "SE" : "Τεχνολογία Λογισμικού"; + } else if (course.contains("Ψηφιακά Φίλτρα")) { + return greeklish ? "filtra" : "Φίλτρα"; + } else if (course.contains("Αναγνώριση Προτύπων")) { + return greeklish ? "protipa" : "Αναγνώριση Προτύπων"; + } else if (course.contains("Ασφάλεια Πληροφοριακών Συστημάτων")) { + return greeklish ? "asfaleia" : "Ασφάλεια"; + } else if (course.contains("Βάσεις Δεδομένων")) { + return greeklish ? "vaseis" : "Βάσεις"; + } else if (course.contains("Βιομηχανική Πληροφορική")) { + return greeklish ? "viomix_plir" : "Βιομηχανική Πληρ"; + } else if (course.contains("Ευφυή Συστήματα Ρομπότ")) { + return greeklish ? "eufuh" : "Ευφυή"; + } else if (course.contains("Συστήματα Πολυμέσων και Εικονική Πραγματικότητα")) { + return greeklish ? "polymesa" : "Πολυμέσα"; + } else if (course.contains("Σχεδίαση Συστημάτων VLSI")) { + return greeklish ? "VLSI" : "VLSI"; + } else if (course.contains("Ακουστική Ι")) { + return greeklish ? "akoystikh_I" : "Ακουστική 1"; + } else if (course.contains("Εφαρμοσμένα Μαθηματικά ΙΙ")) { + return greeklish ? "efarmosmena_math_II" : "Εφαρμοσμένα 2"; + } else if (course.contains("Ηλεκτρακουστική Ι")) { + return greeklish ? "hlektroakoystikh_I" : "Ηλεκτροακουστική 1"; + } else if (course.contains("Οπτική Ι")) { + return greeklish ? "optikh_I" : "Οπτική 1"; + } else if (course.contains("Διάδοση Η/Μ Κύματος ΙΙ")) { + return greeklish ? "diadosi_II" : "Διάδοση 2"; + } else if (course.contains("Ψηφιακές Τηλεπικοινωνίες Ι")) { + return greeklish ? "pshf_thlep_I" : "Ψηφιακές Τηλεπ. 1"; + } else if (course.contains("Ακουστική ΙΙ")) { + return greeklish ? "akoystikh_II" : "Ακουστική 2"; + } else if (course.contains("Βιοϊατρική Τεχνολογία")) { + return greeklish ? "vioiatriki" : "Βιοιατρική"; + } else if (course.contains("Ηλεκτρακουστική ΙΙ")) { + return greeklish ? "hlektroakoystikh_II" : "Ηλεκτροακουστική 2"; + } else if (course.contains("Οπτική ΙΙ")) { + return greeklish ? "optikh_II" : "Οπτική 2"; + } else if (course.contains("Ασύρματος Τηλεπικοινωνία Ι")) { + return greeklish ? "asyrmatos_I" : "Ασύρματος 1"; + } else if (course.contains("Μικροκύματα I")) { + return greeklish ? "mikrokymata_I" : "Μικροκύματα 1"; + } else if (course.contains("Ψηφιακές Τηλεπικοινωνίες ΙΙ")) { + return greeklish ? "pshf_thlep_II" : "Ψηφιακές Τηλεπ. 2"; + } else if (course.contains("Ψηφιακή Επεξεργασία Σήματος")) { + return greeklish ? "PSES" : "ΨΕΣ"; + } else if (course.contains("Εισαγωγή στην Πολιτική Οικονομία")) { + return greeklish ? "polit_oik" : "Πολιτική Οικονομία"; + } else if (course.contains("Θεωρία Σκέδασης")) { + return greeklish ? "skedash" : "Σκέδαση"; + } else if (course.contains("Προηγμένες Τεχνικές Επεξεργασίας Σήματος")) { + return greeklish ? "ptes" : "ΠΤΕΣ"; + } else if (course.contains("Τηλεοπτικά Συστήματα")) { + return greeklish ? "tileoptika" : "Τηλεοπτικά"; + } else if (course.contains("Ασύρματος Τηλεπικοινωνία ΙΙ")) { + return greeklish ? "asyrmatos_II" : "Ασύρματος 2"; + } else if (course.contains("Δίκτυα Τηλεπικοινωνιών")) { + return greeklish ? "diktya_thlep" : "Δίκτυα Τηλέπ."; + } else if (course.contains("Θεωρία Πληροφοριών")) { + return greeklish ? "theoria_plir" : "Θεωρία Πληρ."; + } else if (course.contains("Οπτικές Επικοινωνίες")) { + return greeklish ? "optikes_thlep" : "Οπτικές Τηλεπ."; + } else if (course.contains("Ευρυζωνικά Δίκτυα")) { + return greeklish ? "eyryzwnika" : "Ευρυζωνικά"; + } else if (course.contains("Τεχνικές μη Καταστρεπτικών Δοκιμών")) { + return greeklish ? "non_destructive_tests" : "Μη Καταστρεπτικές Δοκιμές"; + } else if (course.contains("Φωτονική Τεχνολογία")) { + return greeklish ? "fwtonikh" : "Φωτονική"; + } else if (course.contains("Μικροκυματική Τηλεπισκόπηση")) { + return greeklish ? "thlepiskophsh" : "Τηλεπισκόπηση"; + } else if (course.contains("Μικροκύματα II")) { + return greeklish ? "mikrokymata_II" : "Μικροκύματα 2"; + } else { + return null; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 7d75d42e..94521fc9 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -17,6 +17,7 @@ import android.support.design.widget.BottomSheetDialog; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; import android.support.v7.app.AppCompatActivity; +import android.support.v7.preference.PreferenceManager; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; @@ -44,7 +45,7 @@ import java.util.ArrayList; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.activities.AboutActivity; import gr.thmmy.mthmmy.activities.LoginActivity; -import gr.thmmy.mthmmy.activities.UploadActivity; +import gr.thmmy.mthmmy.activities.upload.UploadActivity; import gr.thmmy.mthmmy.activities.bookmarks.BookmarkActivity; import gr.thmmy.mthmmy.activities.downloads.DownloadsActivity; import gr.thmmy.mthmmy.activities.main.MainActivity; @@ -65,7 +66,9 @@ import static gr.thmmy.mthmmy.activities.downloads.DownloadsActivity.BUNDLE_DOWN import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME; +import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DEFAULT_HOME_TAB; import static gr.thmmy.mthmmy.services.DownloadHelper.SAVE_DIR; +import static gr.thmmy.mthmmy.session.SessionManager.SUCCESS; import static gr.thmmy.mthmmy.utils.FileUtils.getMimeType; public abstract class BaseActivity extends AppCompatActivity { @@ -84,8 +87,6 @@ public abstract class BaseActivity extends AppCompatActivity { private SharedPreferences bookmarksFile; private ArrayList topicsBookmarked; private ArrayList boardsBookmarked; - private static Drawable bookmarked; - private static Drawable notBookmarked; //Common UI elements protected Toolbar toolbar; @@ -103,18 +104,6 @@ public abstract class BaseActivity extends AppCompatActivity { if (sessionManager == null) sessionManager = BaseApplication.getInstance().getSessionManager(); - if (bookmarked == null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - bookmarked = getResources().getDrawable(R.drawable.ic_bookmark_true, null); - } else //noinspection deprecation - bookmarked = getResources().getDrawable(R.drawable.ic_bookmark_true); - } - if (notBookmarked == null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - notBookmarked = getResources().getDrawable(R.drawable.ic_bookmark_false, null); - } else //noinspection deprecation - notBookmarked = getResources().getDrawable(R.drawable.ic_bookmark_false); - } if (topicsBookmarked == null || boardsBookmarked == null) { bookmarksFile = getSharedPreferences(BOOKMARKS_SHARED_PREFS, Context.MODE_PRIVATE); loadSavedBookmarks(); @@ -475,6 +464,14 @@ public abstract class BaseActivity extends AppCompatActivity { } protected void onPostExecute(Integer result) { + if (result == SUCCESS) { + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + if (sharedPrefs.getString(DEFAULT_HOME_TAB, "0").equals("2")) { + SharedPreferences.Editor editor = sharedPrefs.edit(); + editor.putString(DEFAULT_HOME_TAB, "0").apply(); + } + } + updateDrawer(); if (mainActivity != null) mainActivity.updateTabs(); @@ -501,9 +498,9 @@ public abstract class BaseActivity extends AppCompatActivity { protected void setTopicBookmark(MenuItem thisPageBookmarkMenuButton) { this.thisPageBookmarkMenuButton = thisPageBookmarkMenuButton; if (thisPageBookmark.matchExists(topicsBookmarked)) { - thisPageBookmarkMenuButton.setIcon(bookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_true_accent_24dp); } else { - thisPageBookmarkMenuButton.setIcon(notBookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_false_accent_24dp); } } @@ -513,19 +510,19 @@ public abstract class BaseActivity extends AppCompatActivity { } loadSavedBookmarks(); if (thisPageBookmark.matchExists(topicsBookmarked)) { - thisPageBookmarkMenuButton.setIcon(bookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_true_accent_24dp); } else { - thisPageBookmarkMenuButton.setIcon(notBookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_false_accent_24dp); } } protected void topicMenuBookmarkClick() { if (thisPageBookmark.matchExists(topicsBookmarked)) { - thisPageBookmarkMenuButton.setIcon(notBookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_false_accent_24dp); toggleTopicToBookmarks(thisPageBookmark); Toast.makeText(getBaseContext(), "Bookmark removed", Toast.LENGTH_SHORT).show(); } else { - thisPageBookmarkMenuButton.setIcon(bookmarked); + thisPageBookmarkMenuButton.setIcon(R.drawable.ic_bookmark_true_accent_24dp); toggleTopicToBookmarks(thisPageBookmark); Toast.makeText(getBaseContext(), "Bookmark added", Toast.LENGTH_SHORT).show(); } @@ -533,18 +530,18 @@ public abstract class BaseActivity extends AppCompatActivity { protected void setBoardBookmark(final ImageButton thisPageBookmarkImageButton) { if (thisPageBookmark.matchExists(boardsBookmarked)) { - thisPageBookmarkImageButton.setImageDrawable(bookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_true_accent_24dp); } else { - thisPageBookmarkImageButton.setImageDrawable(notBookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_false_accent_24dp); } thisPageBookmarkImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (thisPageBookmark.matchExists(boardsBookmarked)) { - thisPageBookmarkImageButton.setImageDrawable(notBookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_false_accent_24dp); Toast.makeText(getBaseContext(), "Bookmark removed", Toast.LENGTH_SHORT).show(); } else { - thisPageBookmarkImageButton.setImageDrawable(bookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_true_accent_24dp); Toast.makeText(getBaseContext(), "Bookmark added", Toast.LENGTH_SHORT).show(); } toggleBoardToBookmarks(thisPageBookmark); @@ -557,9 +554,9 @@ public abstract class BaseActivity extends AppCompatActivity { return; loadSavedBookmarks(); if (thisPageBookmark.matchExists(boardsBookmarked)) { - thisPageBookmarkImageButton.setImageDrawable(bookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_true_accent_24dp); } else { - thisPageBookmarkImageButton.setImageDrawable(notBookmarked); + thisPageBookmarkImageButton.setImageResource(R.drawable.ic_bookmark_false_accent_24dp); } } @@ -651,7 +648,7 @@ public abstract class BaseActivity extends AppCompatActivity { return true; } - //Display popup gor user to grant permission + //Display popup for user to grant permission private void requestPerms() { //Runtime permissions request for devices with API >= 23 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { String[] PERMISSIONS_STORAGE = { diff --git a/app/src/main/res/drawable-hdpi/ic_arrow_drop_down.png b/app/src/main/res/drawable-hdpi/ic_arrow_drop_down.png deleted file mode 100644 index 8c2624cc..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_arrow_drop_down.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_arrow_drop_up.png b/app/src/main/res/drawable-hdpi/ic_arrow_drop_up.png deleted file mode 100644 index f70260ad..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_arrow_drop_up.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_bookmark_false.png b/app/src/main/res/drawable-hdpi/ic_bookmark_false.png deleted file mode 100644 index afb6271f..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_bookmark_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_bookmark_true.png b/app/src/main/res/drawable-hdpi/ic_bookmark_true.png deleted file mode 100644 index ce6dd7a9..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_bookmark_true.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_delete_accent.png b/app/src/main/res/drawable-hdpi/ic_delete_accent.png deleted file mode 100644 index 83e1bb27..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_delete_accent.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_delete_white.png b/app/src/main/res/drawable-hdpi/ic_delete_white.png deleted file mode 100644 index 5e89821e..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_delete_white.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_file_upload.png b/app/src/main/res/drawable-hdpi/ic_file_upload.png deleted file mode 100644 index 4cdd4882..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_file_upload.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_format_quote_checked.png b/app/src/main/res/drawable-hdpi/ic_format_quote_checked.png deleted file mode 100644 index bd7be535..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_format_quote_checked.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_format_quote_unchecked.png b/app/src/main/res/drawable-hdpi/ic_format_quote_unchecked.png deleted file mode 100644 index 3e0e1c63..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_format_quote_unchecked.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_info.png b/app/src/main/res/drawable-hdpi/ic_info.png deleted file mode 100644 index 0932c17c..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_info.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_insert_drive_file.png b/app/src/main/res/drawable-hdpi/ic_insert_drive_file.png deleted file mode 100644 index 6459c357..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_insert_drive_file.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_more_vert.png b/app/src/main/res/drawable-hdpi/ic_more_vert.png deleted file mode 100644 index f3b7a4c4..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_more_vert.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_send.png b/app/src/main/res/drawable-hdpi/ic_send.png deleted file mode 100644 index a8fd035d..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_share.png b/app/src/main/res/drawable-hdpi/ic_share.png deleted file mode 100644 index c832502c..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_arrow_drop_down.png b/app/src/main/res/drawable-mdpi/ic_arrow_drop_down.png deleted file mode 100644 index a617f943..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_arrow_drop_down.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_arrow_drop_up.png b/app/src/main/res/drawable-mdpi/ic_arrow_drop_up.png deleted file mode 100644 index 73f9bb68..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_arrow_drop_up.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_bookmark_false.png b/app/src/main/res/drawable-mdpi/ic_bookmark_false.png deleted file mode 100644 index 79157474..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_bookmark_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_bookmark_true.png b/app/src/main/res/drawable-mdpi/ic_bookmark_true.png deleted file mode 100644 index 06eba446..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_bookmark_true.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_delete_accent.png b/app/src/main/res/drawable-mdpi/ic_delete_accent.png deleted file mode 100644 index 5ac9ef30..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_delete_accent.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_delete_white.png b/app/src/main/res/drawable-mdpi/ic_delete_white.png deleted file mode 100644 index 8d48b838..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_delete_white.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_file_upload.png b/app/src/main/res/drawable-mdpi/ic_file_upload.png deleted file mode 100644 index 3e9f35e9..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_file_upload.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_format_quote_checked.png b/app/src/main/res/drawable-mdpi/ic_format_quote_checked.png deleted file mode 100644 index 9b28f144..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_format_quote_checked.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_format_quote_unchecked.png b/app/src/main/res/drawable-mdpi/ic_format_quote_unchecked.png deleted file mode 100644 index 0b2b07fa..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_format_quote_unchecked.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_info.png b/app/src/main/res/drawable-mdpi/ic_info.png deleted file mode 100644 index 03cf044b..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_info.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_insert_drive_file.png b/app/src/main/res/drawable-mdpi/ic_insert_drive_file.png deleted file mode 100644 index c9904f03..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_insert_drive_file.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_more_vert.png b/app/src/main/res/drawable-mdpi/ic_more_vert.png deleted file mode 100644 index e2fd1495..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_more_vert.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_send.png b/app/src/main/res/drawable-mdpi/ic_send.png deleted file mode 100644 index c914ae97..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_share.png b/app/src/main/res/drawable-mdpi/ic_share.png deleted file mode 100644 index 31ebd45a..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_arrow_drop_down.png b/app/src/main/res/drawable-xhdpi/ic_arrow_drop_down.png deleted file mode 100644 index 79f45456..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_arrow_drop_down.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_arrow_drop_up.png b/app/src/main/res/drawable-xhdpi/ic_arrow_drop_up.png deleted file mode 100644 index b3823901..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_arrow_drop_up.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_bookmark_false.png b/app/src/main/res/drawable-xhdpi/ic_bookmark_false.png deleted file mode 100644 index cded6d60..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_bookmark_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_bookmark_true.png b/app/src/main/res/drawable-xhdpi/ic_bookmark_true.png deleted file mode 100644 index 368c9ead..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_bookmark_true.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_delete_accent.png b/app/src/main/res/drawable-xhdpi/ic_delete_accent.png deleted file mode 100644 index 36f26ac7..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_delete_accent.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_delete_white.png b/app/src/main/res/drawable-xhdpi/ic_delete_white.png deleted file mode 100644 index 3c9e1718..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_delete_white.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_file_upload.png b/app/src/main/res/drawable-xhdpi/ic_file_upload.png deleted file mode 100644 index a592393e..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_file_upload.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_format_quote_checked.png b/app/src/main/res/drawable-xhdpi/ic_format_quote_checked.png deleted file mode 100644 index e56dbcea..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_format_quote_checked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_format_quote_unchecked.png b/app/src/main/res/drawable-xhdpi/ic_format_quote_unchecked.png deleted file mode 100644 index 18a5f529..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_format_quote_unchecked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_info.png b/app/src/main/res/drawable-xhdpi/ic_info.png deleted file mode 100644 index 33ec308a..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_info.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_insert_drive_file.png b/app/src/main/res/drawable-xhdpi/ic_insert_drive_file.png deleted file mode 100644 index 1f2e592d..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_insert_drive_file.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_more_vert.png b/app/src/main/res/drawable-xhdpi/ic_more_vert.png deleted file mode 100644 index 197203bf..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_more_vert.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_send.png b/app/src/main/res/drawable-xhdpi/ic_send.png deleted file mode 100644 index c104e00d..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_share.png b/app/src/main/res/drawable-xhdpi/ic_share.png deleted file mode 100644 index 4560123d..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_down.png b/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_down.png deleted file mode 100644 index a62e15ba..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_down.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_up.png b/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_up.png deleted file mode 100644 index 935d805e..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_arrow_drop_up.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_bookmark_false.png b/app/src/main/res/drawable-xxhdpi/ic_bookmark_false.png deleted file mode 100644 index a837b04d..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_bookmark_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_bookmark_true.png b/app/src/main/res/drawable-xxhdpi/ic_bookmark_true.png deleted file mode 100644 index 0253be02..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_bookmark_true.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete_accent.png b/app/src/main/res/drawable-xxhdpi/ic_delete_accent.png deleted file mode 100644 index 4d806633..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_delete_accent.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete_white.png b/app/src/main/res/drawable-xxhdpi/ic_delete_white.png deleted file mode 100644 index 5d2e8ea3..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_delete_white.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_file_upload.png b/app/src/main/res/drawable-xxhdpi/ic_file_upload.png deleted file mode 100644 index fca1a0a0..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_file_upload.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_quote_checked.png b/app/src/main/res/drawable-xxhdpi/ic_format_quote_checked.png deleted file mode 100644 index f23788f7..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_format_quote_checked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_quote_unchecked.png b/app/src/main/res/drawable-xxhdpi/ic_format_quote_unchecked.png deleted file mode 100644 index 3d17a5d9..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_format_quote_unchecked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_info.png b/app/src/main/res/drawable-xxhdpi/ic_info.png deleted file mode 100644 index f8e64ad7..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_info.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_insert_drive_file.png b/app/src/main/res/drawable-xxhdpi/ic_insert_drive_file.png deleted file mode 100644 index d0c81e69..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_insert_drive_file.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_more_vert.png b/app/src/main/res/drawable-xxhdpi/ic_more_vert.png deleted file mode 100644 index 8492369d..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_more_vert.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_send.png b/app/src/main/res/drawable-xxhdpi/ic_send.png deleted file mode 100644 index 0bb93fd0..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_share.png b/app/src/main/res/drawable-xxhdpi/ic_share.png deleted file mode 100644 index df3f943f..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_down.png b/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_down.png deleted file mode 100644 index fb2d3adc..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_down.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_up.png b/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_up.png deleted file mode 100644 index 18fd806f..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_arrow_drop_up.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bookmark_false.png b/app/src/main/res/drawable-xxxhdpi/ic_bookmark_false.png deleted file mode 100644 index d65bb47d..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_bookmark_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bookmark_true.png b/app/src/main/res/drawable-xxxhdpi/ic_bookmark_true.png deleted file mode 100644 index 59c96d06..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_bookmark_true.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_delete_accent.png b/app/src/main/res/drawable-xxxhdpi/ic_delete_accent.png deleted file mode 100644 index 3ececbea..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_delete_accent.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_delete_white.png b/app/src/main/res/drawable-xxxhdpi/ic_delete_white.png deleted file mode 100644 index e7b2514d..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_delete_white.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_file_upload.png b/app/src/main/res/drawable-xxxhdpi/ic_file_upload.png deleted file mode 100644 index 150624e5..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_file_upload.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_quote_checked.png b/app/src/main/res/drawable-xxxhdpi/ic_format_quote_checked.png deleted file mode 100644 index 1a6cc0ab..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_format_quote_checked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_quote_unchecked.png b/app/src/main/res/drawable-xxxhdpi/ic_format_quote_unchecked.png deleted file mode 100644 index 8cb08365..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_format_quote_unchecked.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_info.png b/app/src/main/res/drawable-xxxhdpi/ic_info.png deleted file mode 100644 index cb42f367..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_info.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_insert_drive_file.png b/app/src/main/res/drawable-xxxhdpi/ic_insert_drive_file.png deleted file mode 100644 index 11563373..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_insert_drive_file.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_more_vert.png b/app/src/main/res/drawable-xxxhdpi/ic_more_vert.png deleted file mode 100644 index 27779e7a..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_more_vert.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_send.png b/app/src/main/res/drawable-xxxhdpi/ic_send.png deleted file mode 100644 index ca6a867c..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_send.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_share.png b/app/src/main/res/drawable-xxxhdpi/ic_share.png deleted file mode 100644 index 43c930eb..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_share.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_arrow_drop_down_accent_24dp.xml b/app/src/main/res/drawable/ic_arrow_drop_down_accent_24dp.xml new file mode 100644 index 00000000..f100d7d9 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_drop_down_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_drop_up_accent_24dp.xml b/app/src/main/res/drawable/ic_arrow_drop_up_accent_24dp.xml new file mode 100644 index 00000000..ff9c29f4 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_drop_up_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_bookmark_false_accent_24dp.xml b/app/src/main/res/drawable/ic_bookmark_false_accent_24dp.xml new file mode 100644 index 00000000..c5178cf2 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_false_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_bookmark_true_accent_24dp.xml b/app/src/main/res/drawable/ic_bookmark_true_accent_24dp.xml new file mode 100644 index 00000000..a1a12213 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_true_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_default_user_thumbnail.png b/app/src/main/res/drawable/ic_default_user_thumbnail.png deleted file mode 100644 index 0803edc6..00000000 Binary files a/app/src/main/res/drawable/ic_default_user_thumbnail.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml b/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml new file mode 100644 index 00000000..d7366bda --- /dev/null +++ b/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_delete_accent_24dp.xml b/app/src/main/res/drawable/ic_delete_accent_24dp.xml new file mode 100644 index 00000000..cda3e2fb --- /dev/null +++ b/app/src/main/res/drawable/ic_delete_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_delete_white_24dp.xml b/app/src/main/res/drawable/ic_delete_white_24dp.xml new file mode 100644 index 00000000..8bed121a --- /dev/null +++ b/app/src/main/res/drawable/ic_delete_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_file_upload.xml b/app/src/main/res/drawable/ic_file_upload.xml deleted file mode 100644 index 74f3b4ca..00000000 --- a/app/src/main/res/drawable/ic_file_upload.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_file_upload_white_24dp.xml b/app/src/main/res/drawable/ic_file_upload_white_24dp.xml new file mode 100644 index 00000000..70e55133 --- /dev/null +++ b/app/src/main/res/drawable/ic_file_upload_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_format_quote_checked_accent_24dp.xml b/app/src/main/res/drawable/ic_format_quote_checked_accent_24dp.xml new file mode 100644 index 00000000..1207e178 --- /dev/null +++ b/app/src/main/res/drawable/ic_format_quote_checked_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_format_quote_unchecked_grey_24dp.xml b/app/src/main/res/drawable/ic_format_quote_unchecked_grey_24dp.xml new file mode 100644 index 00000000..cd548072 --- /dev/null +++ b/app/src/main/res/drawable/ic_format_quote_unchecked_grey_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_info_outline_white_24dp.xml b/app/src/main/res/drawable/ic_info_outline_white_24dp.xml new file mode 100644 index 00000000..af0d4d06 --- /dev/null +++ b/app/src/main/res/drawable/ic_info_outline_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_insert_drive_file_white_24dp.xml b/app/src/main/res/drawable/ic_insert_drive_file_white_24dp.xml new file mode 100644 index 00000000..a431a5e9 --- /dev/null +++ b/app/src/main/res/drawable/ic_insert_drive_file_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_more_vert_white_24dp.xml b/app/src/main/res/drawable/ic_more_vert_white_24dp.xml new file mode 100644 index 00000000..c097d3e4 --- /dev/null +++ b/app/src/main/res/drawable/ic_more_vert_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_send_accent_24dp.xml b/app/src/main/res/drawable/ic_send_accent_24dp.xml new file mode 100644 index 00000000..4d65d14e --- /dev/null +++ b/app/src/main/res/drawable/ic_send_accent_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_share_white_24dp.xml b/app/src/main/res/drawable/ic_share_white_24dp.xml new file mode 100644 index 00000000..045bbc0c --- /dev/null +++ b/app/src/main/res/drawable/ic_share_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout-v21/activity_profile.xml b/app/src/main/res/layout-v21/activity_profile.xml index 21a187bd..22f819cc 100644 --- a/app/src/main/res/layout-v21/activity_profile.xml +++ b/app/src/main/res/layout-v21/activity_profile.xml @@ -41,7 +41,7 @@ android:adjustViewBounds="true" android:contentDescription="@string/post_thumbnail" android:fitsSystemWindows="true" - android:src="@drawable/ic_default_user_thumbnail" + app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" android:transitionName="user_thumbnail" app:layout_collapseMode="parallax"/> diff --git a/app/src/main/res/layout-v21/activity_topic_post_row.xml b/app/src/main/res/layout-v21/activity_topic_post_row.xml index bbce806e..e4363a19 100644 --- a/app/src/main/res/layout-v21/activity_topic_post_row.xml +++ b/app/src/main/res/layout-v21/activity_topic_post_row.xml @@ -1,5 +1,6 @@ @@ -94,7 +95,7 @@ android:clickable="true" android:contentDescription="@string/post_quote_button" android:focusable="true" - android:src="@drawable/ic_format_quote_unchecked" /> + app:srcCompat="@drawable/ic_format_quote_unchecked_grey_24dp" /> #FF9800 #FFFFFF #CCCCCC #E7E7E7 #D926A69A + #D92B2B2B #E91E63 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 19d976d4..879671a4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -116,14 +116,27 @@ Description Select file to upload Upload - Select one + Select a category + + + Select type of upload + Exam subjects + Exam solutions + Course notes + Select period + February + June + September + Select year + Year + Build Settings Settings App - Home default tab + Default home tab Select your preferred, home screen, default tab Default home tab @@ -139,4 +152,8 @@ Posting App signature If enabled, a \"sent from mTHMMY\" message will be inserted at the end of your posts + + Uploading + App signature + If enabled, an \"uploaded from mTHMMY\" message will be inserted at the end of your uploads descriptions diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index bcd578a1..4ffe55a1 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -2,7 +2,6 @@ - + + + +