Merge branch 'backport-243' of gitnex/GitNex into master

This commit is contained in:
M M Arif 2019-12-25 19:18:17 +00:00
commit e422e3e254
3 changed files with 11 additions and 5 deletions

View File

@ -23,12 +23,12 @@ android {
} }
dependencies { dependencies {
def lifecycle_version = "2.2.0-rc02" def lifecycle_version = "2.2.0-rc03"
final def markwon_version = "4.1.1" final def markwon_version = "4.1.1"
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:1.1.0" implementation "androidx.appcompat:appcompat:1.1.0"
implementation "com.google.android.material:material:1.2.0-alpha02" implementation "com.google.android.material:material:1.2.0-alpha03"
implementation "androidx.constraintlayout:constraintlayout:1.1.3" implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.legacy:legacy-support-v4:1.0.0"
testImplementation "junit:junit:4.12" testImplementation "junit:junit:4.12"

View File

@ -73,7 +73,6 @@ public class FileViewActivity extends AppCompatActivity {
TextView toolbar_title = findViewById(R.id.toolbar_title); TextView toolbar_title = findViewById(R.id.toolbar_title);
toolbar_title.setMovementMethod(new ScrollingMovementMethod()); toolbar_title.setMovementMethod(new ScrollingMovementMethod());
toolbar_title.setText(singleFileName);
initCloseListener(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);
@ -82,6 +81,7 @@ public class FileViewActivity extends AppCompatActivity {
singleFileName = URLDecoder.decode(singleFileName, "UTF-8"); singleFileName = URLDecoder.decode(singleFileName, "UTF-8");
singleFileName = singleFileName.replaceAll("//", "/"); singleFileName = singleFileName.replaceAll("//", "/");
singleFileName = singleFileName.startsWith("/") ? singleFileName.substring(1) : singleFileName;
} }
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
@ -91,6 +91,8 @@ public class FileViewActivity extends AppCompatActivity {
} }
toolbar_title.setText(singleFileName);
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName); getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName);
} }

View File

@ -140,6 +140,10 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
fileStructure.setText(breadcrumbBuilder); fileStructure.setText(breadcrumbBuilder);
String dirName_ = fileStructure.getText().toString();
dirName_ = dirName_.startsWith("/") ? dirName_.substring(1) : dirName_;
final String finalDirName_ = dirName_;
mBreadcrumbsView.addItem(createItem(dirName)); mBreadcrumbsView.addItem(createItem(dirName));
mBreadcrumbsView.setCallback(new DefaultBreadcrumbsCallback<BreadcrumbItem>() { mBreadcrumbsView.setCallback(new DefaultBreadcrumbsCallback<BreadcrumbItem>() {
@Override @Override
@ -154,7 +158,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
String filterDir = fileStructure.getText().toString(); String filterDir = fileStructure.getText().toString();
String result = filterDir.substring(0, filterDir.indexOf(item.getSelectedItem())); String result = filterDir.substring(0, filterDir.indexOf(item.getSelectedItem()));
fileStructure.setText(result + item.getSelectedItem()); fileStructure.setText(result + item.getSelectedItem());
fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, fileStructure.getText().toString()); fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, finalDirName_);
} }
@ -164,7 +168,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
} }
}); });
fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, fileStructure.getText().toString()); fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, finalDirName_);
} }