-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Selecting a Backup Directory * Add a folder backup module * The backup upload information is added to Settings * Update Select or cancel a backup folder * Updating a backup folder * Updated the folder backup * Update backup folder * update backup folder * Updated folder backup and added global exception capture * Updated the backup folder name * Folder backup reconstruction * Update folder backup * Updated the backup folder name * Update folder backup message notification * Update the display of folder backup status * Update folder backup * Update folder backup * Update the folder backup logic * Update the display of folder backup status * Updated the folder backup and photo sync display status logic * Update backup folder FileAlterationMonitor * Updated the folder backup interface * Update folder backup observer * Update the folder backup upload link * Update the folder backup transfer tag * Improve the code - Fix an issue: When select the root of the repo, the file upload fails - Rename variables, classes, functions to make them more readable - Format the code for some classes - Format some UI layout code * Improve the code - Rename variables, classes, functions to make them more readable * Fix and optimize - FIX an issue: When no folder or library is selected, a crash occurs - Optimize UI layout * Improve the code - A bug found, TODO has been marked * Improve the code * remove the leakcanary lib * upgrade app version - gitignore file adds ignore rules * Improvements, optimizations and fixes - Optimize AccountManager Class, add proxy implementation - Optimize the Adapter of the three pages on the home page - format code - Optimize the UI of the star page and recently modified page - Unified image loading framework - Modify some strings, layout, dimens * Improve - Improve strings.xml - upgrade transifex config - format code * add transifex gitignore * modify BottomSheet - Abstract BottomSheetListDIalog - Refactoring the BottomSheet functionality of Activity fragment * improve SearchActivity UI * Refactor, update, optimize - Upgrade app version - Refactor the search page logic - Settings page: Modify the select Backup Folder feature * add SearchPage empty view * add FolderBackupSelectedPathActivity * fix and improve - Optimize and fix the "out of quota" error logic - Add outlined Star Icon - Add filled Delete Icon - update transfer_list_multi_choice_menu.xml - * commit master * Revert "commit master" This reverts commit 3ffc566. * update FolderBackupSelectedPathActivity - add item click listener - update item UI * update bottomsheetdialogfragment * modify SettingsFragment's camera upload tip * Update proguard-project.txt * update FolderBackupSelectedPath feature - upgrade gradle version * fix this xml file: error 'toLeftOf' id --------- Co-authored-by: maxiaoping <634115572@qq.com>
- Loading branch information
1 parent
0b1f818
commit 49ed5ae
Showing
52 changed files
with
2,559 additions
and
1,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...in/java/com/seafile/seadroid2/folderbackup/FolderBackSelectedPathRecyclerViewAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package com.seafile.seadroid2.folderbackup; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.DialogInterface; | ||
import android.support.annotation.NonNull; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.blankj.utilcode.util.CollectionUtils; | ||
import com.cocosw.bottomsheet.BottomSheet; | ||
import com.google.gson.Gson; | ||
import com.seafile.seadroid2.R; | ||
import com.seafile.seadroid2.SettingsManager; | ||
import com.seafile.seadroid2.listener.OnItemClickListener; | ||
|
||
import java.lang.ref.WeakReference; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class FolderBackSelectedPathRecyclerViewAdapter extends RecyclerView.Adapter<FolderBackSelectedPathRecyclerViewAdapter.SearchItemViewHolder> { | ||
private final List<String> mItemList = new ArrayList<>(); | ||
private OnItemClickListener<String> onItemClickListener; | ||
|
||
private final WeakReference<Context> contextWeakReference; | ||
|
||
public FolderBackSelectedPathRecyclerViewAdapter(Context context) { | ||
this.contextWeakReference = new WeakReference<>(context); | ||
} | ||
|
||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) { | ||
this.onItemClickListener = onItemClickListener; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public SearchItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View view = LayoutInflater.from(contextWeakReference.get()).inflate(R.layout.item_text_more, parent, false); | ||
return new SearchItemViewHolder(view); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull FolderBackSelectedPathRecyclerViewAdapter.SearchItemViewHolder viewHolder, int position) { | ||
final int p = position; | ||
viewHolder.title.setText(mItemList.get(p)); | ||
viewHolder.title.setSelected(true); | ||
|
||
viewHolder.icon.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
showRepoBottomSheet(p); | ||
} | ||
}); | ||
|
||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (onItemClickListener != null) { | ||
onItemClickListener.onItemClick(mItemList.get(p), p); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
public List<String> getItemList() { | ||
return mItemList; | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return mItemList.size(); | ||
} | ||
|
||
public void notifyDataChanged(List<String> list) { | ||
mItemList.clear(); | ||
if (!CollectionUtils.isEmpty(list)) { | ||
mItemList.addAll(list); | ||
notifyDataSetChanged(); | ||
} | ||
} | ||
|
||
public void notifyDataClear() { | ||
if (!CollectionUtils.isEmpty(mItemList)) { | ||
mItemList.clear(); | ||
notifyDataSetChanged(); | ||
} | ||
} | ||
|
||
public static class SearchItemViewHolder extends RecyclerView.ViewHolder { | ||
public TextView title; | ||
public View icon; | ||
|
||
public SearchItemViewHolder(View view) { | ||
super(view); | ||
|
||
title = (TextView) view.findViewById(R.id.title); | ||
icon = (View) view.findViewById(R.id.more); | ||
} | ||
} | ||
|
||
private void showRepoBottomSheet(int position) { | ||
BottomSheet.Builder builder = new BottomSheet.Builder((Activity) contextWeakReference.get()); | ||
builder.sheet(R.menu.folder_backup_bottom_sheet_delete).listener(new DialogInterface.OnClickListener() { | ||
@Override | ||
public void onClick(DialogInterface dialog, int which) { | ||
if (which == R.id.delete) { | ||
mItemList.remove(position); | ||
notifyDataSetChanged(); | ||
|
||
String strJsonPath = new Gson().toJson(mItemList); | ||
SettingsManager.instance().saveBackupPaths(strJsonPath); | ||
} | ||
} | ||
}).show(); | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
app/src/main/java/com/seafile/seadroid2/folderbackup/FolderBackupSelectedPathActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package com.seafile.seadroid2.folderbackup; | ||
|
||
import static com.seafile.seadroid2.folderbackup.FolderBackupConfigActivity.BACKUP_SELECT_PATHS; | ||
import static com.seafile.seadroid2.folderbackup.FolderBackupConfigActivity.BACKUP_SELECT_PATHS_SWITCH; | ||
import static com.seafile.seadroid2.ui.fragment.SettingsFragment.FOLDER_BACKUP_REMOTE_PATH; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.LinearLayoutManager; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.support.v7.widget.Toolbar; | ||
import android.text.TextUtils; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
|
||
import com.blankj.utilcode.util.CollectionUtils; | ||
import com.seafile.seadroid2.R; | ||
import com.seafile.seadroid2.SettingsManager; | ||
import com.seafile.seadroid2.folderbackup.selectfolder.StringTools; | ||
import com.seafile.seadroid2.listener.OnItemClickListener; | ||
import com.seafile.seadroid2.ui.activity.BaseActivity; | ||
import com.seafile.seadroid2.ui.bottomsheet.BottomSheetTextFragment; | ||
import com.seafile.seadroid2.ui.widget.SupportRecyclerView; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class FolderBackupSelectedPathActivity extends BaseActivity { | ||
private SupportRecyclerView mRecyclerView; | ||
private FolderBackSelectedPathRecyclerViewAdapter mAdapter; | ||
|
||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
overridePendingTransition(R.anim.fade_in, R.anim.fade_out); | ||
setContentView(R.layout.folder_backup_selected_path_activity); | ||
|
||
mRecyclerView = findViewById(R.id.lv_search); | ||
mAdapter = new FolderBackSelectedPathRecyclerViewAdapter(this); | ||
mAdapter.setOnItemClickListener(new OnItemClickListener<String>() { | ||
@Override | ||
public void onItemClick(String text, int position) { | ||
showBottomDialog(text); | ||
} | ||
}); | ||
|
||
findViewById(R.id.add_backup_folder).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(FolderBackupSelectedPathActivity.this, FolderBackupConfigActivity.class); | ||
intent.putExtra(FOLDER_BACKUP_REMOTE_PATH, true); | ||
startActivity(intent); | ||
} | ||
}); | ||
|
||
mRecyclerView.setAdapter(mAdapter); | ||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); | ||
View t = findViewById(R.id.ll_message_content); | ||
mRecyclerView.setEmptyView(t); | ||
|
||
mRecyclerView.setLoadingMoreEnabled(false); | ||
mRecyclerView.setPullRefreshEnabled(false); | ||
|
||
setSupportActionBar(getActionBarToolbar()); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
getSupportActionBar().setTitle(R.string.settings_folder_backup_select_title); | ||
|
||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
initData(); | ||
} | ||
|
||
private void initData() { | ||
String backupPaths = SettingsManager.instance().getBackupPaths(); | ||
if (!TextUtils.isEmpty(backupPaths)) { | ||
List<String> backupSelectPaths = StringTools.getJsonToList(backupPaths); | ||
mAdapter.notifyDataChanged(backupSelectPaths); | ||
} | ||
} | ||
|
||
private void showBottomDialog(String text) { | ||
BottomSheetTextFragment.newInstance(text).show(getSupportFragmentManager(), BottomSheetTextFragment.class.getSimpleName()); | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
setFinishPage(); | ||
|
||
super.onBackPressed(); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
if (item.getItemId() == android.R.id.home) { | ||
setFinishPage(); | ||
|
||
finish(); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
public void setFinishPage() { | ||
Intent intent = new Intent(); | ||
if (!CollectionUtils.isEmpty(mAdapter.getItemList())) { | ||
intent.putStringArrayListExtra(BACKUP_SELECT_PATHS, (ArrayList<String>) mAdapter.getItemList()); | ||
intent.putExtra(BACKUP_SELECT_PATHS_SWITCH, true); | ||
} | ||
setResult(RESULT_OK, intent); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/seafile/seadroid2/listener/OnItemClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.seafile.seadroid2.listener; | ||
|
||
public interface OnItemClickListener<T> { | ||
void onItemClick(T t, int position); | ||
} |
Oops, something went wrong.