Compare commits
209 Commits
release-1.
...
2.2.1
Author | SHA1 | Date | |
---|---|---|---|
d9a7fa4e44 | |||
9950d4ea65 | |||
98054b89cc | |||
24d56c625e | |||
5970995ef0 | |||
cf75c61704 | |||
8ac92a8b3c | |||
f1f92ba494 | |||
d7b1a226d0 | |||
2bebe1e81d | |||
f5d560c601 | |||
d27000d481 | |||
9aff1cb42a | |||
7fe376fa44 | |||
6da4398369 | |||
dac0f690d8 | |||
8a7031e7f5 | |||
dd5f17d54d | |||
505c930c32 | |||
edb6cdf154 | |||
687b66751f | |||
f14ae18324 | |||
ea52d6c6d2 | |||
40d12c3b97 | |||
32ebf31ef4 | |||
7fc4146c98 | |||
e296a83aab | |||
0fc7c67d0b | |||
143d680627 | |||
69745b027e | |||
7f3aed9bae | |||
5496401a77 | |||
4c0fd3c286 | |||
40f924de2e | |||
1953a9feff | |||
24c71b4beb | |||
958606e476 | |||
39d1007423 | |||
0e673bb256 | |||
246ff6296a | |||
1d0b940c14 | |||
4d3fb54925 | |||
cd81ff74bf | |||
02843b4ca1 | |||
2189bd10bd | |||
35b9647709 | |||
2d2f486182 | |||
640771d4fa | |||
2ba8a80b9f | |||
2f55e7f5d1 | |||
d285115090 | |||
d5cffddc72 | |||
9e2921697b | |||
e868364554 | |||
88a8303b1c | |||
ac1fc696ea | |||
2fe175223c | |||
9cab502e84 | |||
88748998b3 | |||
264ed393cb | |||
821eef91a3 | |||
05afc9fc5a | |||
4cb6948288 | |||
7012c2587c | |||
dbcbd076ea | |||
c633b62fdb | |||
1ce1a15955 | |||
60b95e3c5d | |||
48fb0cf91c | |||
8fcb05b0d2 | |||
074bbfe3cc | |||
84438b740a | |||
d4cd16a111 | |||
5ed053bba7 | |||
598633a20a | |||
8fe53dfd01 | |||
aadbcbd0c6 | |||
e3b901741a | |||
f8275cd7aa | |||
c3afe1044c | |||
a6503ba7c4 | |||
dddc9b0178 | |||
13bc50da40 | |||
b32d291554 | |||
c15e6e99f7 | |||
1512032f05 | |||
e32ccde995 | |||
1be577cd3f | |||
7fa57621d9 | |||
75ac6ff113 | |||
9ef04b1287 | |||
8c903b9658 | |||
08b8275546 | |||
5baacbd801 | |||
56b8b486df | |||
7abfdc9567 | |||
0ab8784a7a | |||
e4ab2f64fc | |||
345d577fbf | |||
22b3802e73 | |||
07a1fa6aad | |||
5c9b53f5ab | |||
572f93d35c | |||
a77716970b | |||
4d998150a3 | |||
90df3a31fe | |||
4904b5899f | |||
f19327431f | |||
0bcbca8bdc | |||
b90b3c3320 | |||
21097da995 | |||
06b71586c1 | |||
d2213c0c14 | |||
4c3b735534 | |||
90dce6fff8 | |||
d9337a24d3 | |||
45ec660ba1 | |||
8b26355fc0 | |||
8effad46f8 | |||
bb24254e66 | |||
13e69cd09b | |||
71839bcfd6 | |||
53efd8b777 | |||
19cd5b6c5e | |||
69082b424a | |||
d8b3477940 | |||
34892e7f43 | |||
d64b035d4a | |||
e2fa79b2a9 | |||
9e658aa38c | |||
e4700ffd69 | |||
e53ef41fc1 | |||
c05e69cfe9 | |||
5c6d5177fb | |||
62a5452437 | |||
5f402c2c60 | |||
85140fbee0 | |||
d350fe96d9 | |||
61a1a4446f | |||
c1e27c9776 | |||
03ec591643 | |||
3ebc1ae3e0 | |||
3c8fb5bc60 | |||
5503fe9951 | |||
7f417da6b3 | |||
4e8a961643 | |||
bf5527a82d | |||
c31cf53023 | |||
0ac2a27549 | |||
dcabfa4f14 | |||
9688c75106 | |||
71bb8cc75d | |||
dcd28e845a | |||
b3e88b0a9d | |||
ce67f59753 | |||
d0b6730de4 | |||
f5e18ed5cc | |||
88394e1c25 | |||
a9030eb8c9 | |||
fff307d45a | |||
b64ee37edd | |||
b4b3c2f5ee | |||
8f3ef29f44 | |||
d00691d71b | |||
4867524b4f | |||
a59e818aa2 | |||
aeca4a0edb | |||
2c60f092f1 | |||
fe0b3a77cc | |||
43c014948a | |||
a497e0a284 | |||
da268b017e | |||
4451adb01c | |||
0cd4e36a66 | |||
742b1894e6 | |||
8d1b47de8e | |||
c38d249571 | |||
c3da1900a0 | |||
b4c0745b40 | |||
e8e0cf904b | |||
99718bc0c8 | |||
d4a5d5ee8c | |||
efffc05a89 | |||
a78018fd08 | |||
33d1373f6e | |||
b15394e97d | |||
2bdeee5429 | |||
39c1ec36a7 | |||
6866154714 | |||
df260f05d2 | |||
d24e7ffc3b | |||
481451c791 | |||
914d5cfa26 | |||
6710aa0810 | |||
87376a2104 | |||
1ec7ac4f9f | |||
25f8277f0a | |||
498bf7a72c | |||
20f687e30e | |||
83e3564c13 | |||
7977aaa2be | |||
6bc13ad4fe | |||
1f6f50977e | |||
1ce1278095 | |||
ce63cde4ee | |||
f23c4074f3 | |||
ace9111225 | |||
4aeeb95308 | |||
056413e0b0 |
31
.drone.yml
Normal file
31
.drone.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: gitnex-ci-test
|
||||
|
||||
steps:
|
||||
|
||||
- name: test
|
||||
image: nextcloudci/android:android-49
|
||||
commands:
|
||||
- ./gradlew test
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: gitnex-ci-build
|
||||
|
||||
steps:
|
||||
|
||||
- name: build
|
||||
image: nextcloudci/android:android-49
|
||||
commands:
|
||||
- ./gradlew build
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- master
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -180,6 +180,9 @@ crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Crowdin
|
||||
crowdin.yml
|
||||
|
||||
### AndroidStudio Patch ###
|
||||
|
||||
!/gradle/wrapper/gradle-wrapper.jar
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Changelog
|
||||
[Check out the release notes](https://gitea.com/mmarif/GitNex/releases)
|
||||
[Check out the release notes](https://gitea.com/gitnex/GitNex/releases)
|
||||
|
@ -3,14 +3,14 @@
|
||||
Please take a few minutes to read this document to make the process of contribution more easy and healthy for all involved.
|
||||
|
||||
## Pull Requests
|
||||
Patches, enhancements, features are always welcome. The MR should focus on the scope of work and avoid many unnecessary commits. Please provide as much detail and context as possible to explain the work submitted.
|
||||
Patches, enhancements, features are always welcome. The PR should focus on the scope of work and avoid many unnecessary commits. Please provide as much detail and context as possible to explain the work submitted.
|
||||
|
||||
Please ask if you are not sure about the scope of work to be submitted to avoid waste of time spent on the work.
|
||||
|
||||
**How to submit MR/PR**
|
||||
**How to submit a PR**
|
||||
Fork this repository. Pull the forked repository from your namespace to your local machine. Create new branch and work on the bug/feature/enhancement you would like to submit. Push it to your forked version. From there create Pull Request(PR) against **master** branch.
|
||||
|
||||
**IMPORTANT:** By submitting MR, you agree to allow GitNex to license your work under the same license as that used by GitNex.
|
||||
**IMPORTANT:** By submitting PR, you agree to allow GitNex to license your work under the same license as that used by GitNex.
|
||||
|
||||
## Issues and Reports
|
||||
*1st of please be polite and gentle while commenting or creating new issue to maintain a healthy environment.*
|
||||
@ -20,10 +20,3 @@ Before creating an issue please take a moment and search the repository issues(o
|
||||
In case you want to submit a bug report, please provide as much details as possible to better debug the problem. The important part is how to reproduce the bug and steps to reproduce are appreciated.
|
||||
|
||||
**Note:** Please contact the project directly via email(gitnex@swatian.com) if have to share sensitive and security related details.
|
||||
|
||||
## Translation
|
||||
Help us translate GitNex to your native language.
|
||||
|
||||
Take a look [here](https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/res/values/strings.xml) for strings, please ignore the lines with `translatable="false"`. It is recommended to create a Pull Request with your changes.
|
||||
|
||||
Check the structure of other languages for example [French](https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/res/values-fr/strings.xml).
|
22
CONTRIBUTORS.md
Normal file
22
CONTRIBUTORS.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Contributors
|
||||
This part lists all PUBLIC individuals having contributed content to the code.
|
||||
|
||||
* M M Arif (mmarif)
|
||||
* 6543
|
||||
|
||||
# Translators
|
||||
This part lists all PUBLIC individuals having contributed content to the translation.
|
||||
*Entries are in alphabetical order*
|
||||
|
||||
* 6543
|
||||
* ButterflyOfFire (BoFFire)
|
||||
* IndeedNotJames
|
||||
* Lunny Xiao (xiaolunwen)
|
||||
* mmarif
|
||||
* Nadezhda Moiseeva (digitalkiller)
|
||||
* PsychotherapistSam
|
||||
* Rodion Borisov (vintproykt)
|
||||
* valeriezhao1013
|
||||
* Voyvode
|
||||
|
||||
**Thank you for all your work** :+1:
|
39
README.md
39
README.md
@ -1,6 +1,10 @@
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
[](https://gitea.com/gitnex/GitNex/releases)
|
||||
[](https://drone.gitea.com/gitnex/GitNex)
|
||||
[](https://crowdin.com/project/gitnex)
|
||||
|
||||
[<img alt="Become a Patroen" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="40"/>](https://www.patreon.com/mmarif) [<img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"/>](https://liberapay.com/mmarif/donate)
|
||||
[<img alt="Become a Patroen" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="40"/>](https://www.patreon.com/mmarif)
|
||||
[<img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg" height="40"/>](https://liberapay.com/mmarif/donate)
|
||||
|
||||
# GitNex - Android client for Gitea
|
||||
|
||||
@ -10,12 +14,14 @@ GitNex is licensed under GPLv3 License. See the LICENSE file for the full licens
|
||||
No trackers are used and source code is available here for anyone to audit.
|
||||
|
||||
## Downloads
|
||||
[<img alt='Get it on F-droid' src='https://gitlab.com/fdroid/artwork/raw/master/badge/get-it-on.png' height="80"/>](https://f-droid.org/en/packages/org.mian.gitnex/) [<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height="80"/>](https://play.google.com/store/apps/details?id=org.mian.gitnex) [Download APK](https://gitea.com/mmarif/GitNex/releases)
|
||||
[<img alt='Get it on F-droid' src='https://gitlab.com/fdroid/artwork/raw/master/badge/get-it-on.png' height="80"/>](https://f-droid.org/en/packages/org.mian.gitnex/)
|
||||
[<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height="80"/>](https://play.google.com/store/apps/details?id=org.mian.gitnex)
|
||||
[<img alt='Download APK' src='https://gitnex.com/img/download-apk.png' height="80"/>](https://gitea.com/gitnex/GitNex/releases)
|
||||
|
||||
## Note about Gitea version
|
||||
Please make sure that you are on Gitea **1.7.x** stable release or later. Below this may not work as one would expect because of the newly added objects to the API at later versions. Please consider updating your Gitea server.
|
||||
Please make sure that you are on Gitea **1.9.x** stable release or later. Below this may not work as one would expect because of the newly added objects to the API at later versions. Please consider updating your Gitea server.
|
||||
|
||||
Check the versions [compatibility page](https://gitea.com/mmarif/GitNex/wiki/Compatibility) which lists all the supported versions with compatibility ratio.
|
||||
Check the versions [compatibility page](https://gitea.com/gitnex/GitNex/wiki/Compatibility) which lists all the supported versions with compatibility ratio.
|
||||
|
||||
## Build from source
|
||||
Option 1 - Download the source code, open it in Android Studio and build it there.
|
||||
@ -29,25 +35,37 @@ Option 2 - Open terminal(Linux) and cd to the project dir. Run `./gradlew build`
|
||||
- Create repository
|
||||
- Create organization
|
||||
- Issues list
|
||||
- [MANY MORE](https://gitea.com/mmarif/GitNex/wiki/Features)
|
||||
- [MANY MORE](https://gitea.com/gitnex/GitNex/wiki/Features)
|
||||
|
||||
## Contributing
|
||||
[CONTRIBUTING](https://gitea.com/mmarif/GitNex/src/branch/master/CONTRIBUTING.md)
|
||||
[CONTRIBUTING](https://gitea.com/gitnex/GitNex/src/branch/master/CONTRIBUTING.md)
|
||||
|
||||
## Translation
|
||||
Help us translate GitNex to your native language.
|
||||
|
||||
We use [Crowdin](https://crowdin.com/project/gitnex) for translation.
|
||||
If your language is not listed, please request [here](https://gitea.com/gitnex/GitNex/issues) to add it to the project.
|
||||
|
||||
**Link: https://crowdin.com/project/GitNex**
|
||||
|
||||
## Screenshots:
|
||||
[Screenshots](https://gitea.com/mmarif/GitNex/src/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots)
|
||||
|
||||
<img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/001.png" alt="001.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/002.png" alt="002.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/003.png" alt="003.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/004.png" alt="004.png" width="200"/>
|
||||
---|---|---|---
|
||||
<img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/005.png" alt="005.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/006.png" alt="006.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/007.png" alt="007.png" width="200"/> | <img src="https://gitea.com/gitnex/GitNex/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/008.png" alt="008.png" width="200"/>
|
||||
|
||||
|
||||
## FAQ
|
||||
[Faq](https://gitea.com/mmarif/GitNex/wiki/FAQ)
|
||||
[Faq](https://gitea.com/gitnex/GitNex/wiki/FAQ)
|
||||
|
||||
## Links
|
||||
[Website](https://gitnex.com)
|
||||
|
||||
[Wiki](https://gitea.com/mmarif/GitNex/wiki/Home)
|
||||
[Wiki](https://gitea.com/gitnex/GitNex/wiki/Home)
|
||||
|
||||
[Website Repository](https://gitlab.com/mmarif4u/gitnex-website)
|
||||
|
||||
[Troubleshoot Guide](https://gitea.com/mmarif/GitNex/wiki/Troubleshoot-Guide)
|
||||
[Troubleshoot Guide](https://gitea.com/gitnex/GitNex/wiki/Troubleshoot-Guide)
|
||||
|
||||
## Thanks
|
||||
Thanks to all the open source libraries, contributors and donators.
|
||||
@ -65,5 +83,6 @@ Open source libraries
|
||||
- Abumoallim/android-multi-select-dialog
|
||||
- Pes/materialcolorpicker
|
||||
- Hendraanggrian/socialview
|
||||
- Fython/BreadcrumbsView
|
||||
|
||||
[Follow me on Fediverse - mastodon.social/@mmarif](https://mastodon.social/@mmarif)
|
||||
|
@ -6,8 +6,8 @@ android {
|
||||
applicationId "org.mian.gitnex"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 45
|
||||
versionName "1.5.0"
|
||||
versionCode 71
|
||||
versionName "2.2.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
@ -23,12 +23,12 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def lifecycle_version = "2.2.0-alpha01"
|
||||
final def markwon_version = "3.0.0"
|
||||
def lifecycle_version = "2.2.0-beta01"
|
||||
final def markwon_version = "4.1.1"
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha07'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
@ -47,21 +47,27 @@ dependencies {
|
||||
implementation "com.vdurmont:emoji-java:4.0.0"
|
||||
implementation "com.pes.materialcolorpicker:library:1.2.5"
|
||||
|
||||
implementation "ru.noties.markwon:core:$markwon_version"
|
||||
implementation "ru.noties.markwon:ext-strikethrough:$markwon_version"
|
||||
implementation "ru.noties.markwon:ext-tables:$markwon_version"
|
||||
implementation "ru.noties.markwon:ext-tasklist:$markwon_version"
|
||||
implementation "ru.noties.markwon:syntax-highlight:$markwon_version"
|
||||
implementation "ru.noties.markwon:image-okhttp:$markwon_version"
|
||||
implementation "ru.noties.markwon:html:$markwon_version"
|
||||
implementation "ru.noties.markwon:recycler:$markwon_version"
|
||||
implementation "ru.noties.markwon:recycler-table:$markwon_version"
|
||||
implementation "ru.noties.markwon:image-gif:$markwon_version"
|
||||
implementation "ru.noties.markwon:image-svg:$markwon_version"
|
||||
implementation "io.noties.markwon:core:$markwon_version"
|
||||
implementation "io.noties.markwon:ext-latex:$markwon_version"
|
||||
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
|
||||
implementation "io.noties.markwon:ext-tables:$markwon_version"
|
||||
implementation "io.noties.markwon:ext-tasklist:$markwon_version"
|
||||
implementation "io.noties.markwon:html:$markwon_version"
|
||||
implementation "io.noties.markwon:image:$markwon_version"
|
||||
implementation "io.noties.markwon:image-picasso:$markwon_version"
|
||||
implementation "io.noties.markwon:linkify:$markwon_version"
|
||||
implementation "io.noties.markwon:recycler:$markwon_version"
|
||||
implementation "io.noties.markwon:recycler-table:$markwon_version"
|
||||
implementation "io.noties.markwon:simple-ext:$markwon_version"
|
||||
implementation "io.noties.markwon:syntax-highlight:$markwon_version"
|
||||
implementation "com.caverock:androidsvg:1.4"
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.14"
|
||||
|
||||
implementation "com.hendraanggrian.appcompat:socialview:0.2"
|
||||
implementation "com.hendraanggrian.appcompat:socialview-commons:0.2"
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
|
||||
|
||||
implementation "com.github.HamidrezaAmz:BreadcrumbsView:0.2.9"
|
||||
}
|
||||
|
@ -2,9 +2,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.mian.gitnex">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/app_logo"
|
||||
@ -13,7 +10,19 @@
|
||||
android:roundIcon="@mipmap/app_logo_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".activities.AdminGetUsersActivity"></activity>
|
||||
<activity
|
||||
android:name=".activities.FileViewActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".activities.NewFileActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".activities.RepoWatchersActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".activities.RepoStargazersActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity android:name=".activities.AdminGetUsersActivity" />
|
||||
<activity
|
||||
android:name=".activities.AddRemoveAssigneesActivity"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog" />
|
||||
@ -56,6 +65,10 @@
|
||||
android:launchMode="singleTask" />
|
||||
<activity android:name=".activities.NewRepoActivity" />
|
||||
<activity android:name=".activities.NewOrganizationActivity" />
|
||||
<activity android:name=".activities.OpenRepoInBrowserActivity" />
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
</manifest>
|
280
app/src/main/java/org/mian/gitnex/actions/RepositoryActions.java
Normal file
280
app/src/main/java/org/mian/gitnex/actions/RepositoryActions.java
Normal file
@ -0,0 +1,280 @@
|
||||
package org.mian.gitnex.actions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepositoryActions {
|
||||
|
||||
public static void starRepository(final Context context) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(context);
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
Call<JsonElement> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.starRepository(Authorization.returnAuthentication(context, loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
tinyDb.putBoolean("repoCreated", true);
|
||||
Toasty.info(context, context.getString(R.string.starRepositorySuccess));
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void unStarRepository(final Context context) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(context);
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
Call<JsonElement> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.unStarRepository(Authorization.returnAuthentication(context, loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
tinyDb.putBoolean("repoCreated", true);
|
||||
Toasty.info(context, context.getString(R.string.unStarRepositorySuccess));
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void watchRepository(final Context context) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(context);
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
Call<JsonElement> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.watchRepository(Authorization.returnAuthentication(context, loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
|
||||
tinyDb.putBoolean("repoCreated", true);
|
||||
Toasty.info(context, context.getString(R.string.watchRepositorySuccess));
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void unWatchRepository(final Context context) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(context);
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
Call<JsonElement> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.unWatchRepository(Authorization.returnAuthentication(context, loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.code() == 204) {
|
||||
|
||||
tinyDb.putBoolean("repoCreated", true);
|
||||
Toasty.info(context, context.getString(R.string.unWatchRepositorySuccess));
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -323,10 +323,11 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli
|
||||
|
||||
private void getMilestones(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid) {
|
||||
|
||||
String msState = "open";
|
||||
Call<List<Milestones>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, msState);
|
||||
|
||||
call.enqueue(new Callback<List<Milestones>>() {
|
||||
|
||||
|
@ -56,6 +56,8 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
||||
private Button editIssueButton;
|
||||
private Spinner editIssueMilestoneSpinner;
|
||||
|
||||
private String msState = "open";
|
||||
|
||||
List<Milestones> milestonesList = new ArrayList<>();
|
||||
private ArrayAdapter<Mention> defaultMentionAdapter;
|
||||
|
||||
@ -331,7 +333,7 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
||||
Call<List<Milestones>> call_ = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, msState);
|
||||
|
||||
final int finalMsId = msId;
|
||||
|
||||
|
@ -0,0 +1,149 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class FileViewActivity extends AppCompatActivity {
|
||||
|
||||
private View.OnClickListener onClickListener;
|
||||
private TextView singleFileContents;
|
||||
final Context ctx = this;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_file_view);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
|
||||
|
||||
ImageView closeActivity = findViewById(R.id.close);
|
||||
singleFileContents = findViewById(R.id.singleFileContents);
|
||||
singleFileContents.setVisibility(View.GONE);
|
||||
mProgressBar = findViewById(R.id.progress_bar);
|
||||
|
||||
String singleFileName = getIntent().getStringExtra("singleFileName");
|
||||
|
||||
TextView toolbar_title = findViewById(R.id.toolbar_title);
|
||||
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
|
||||
toolbar_title.setText(singleFileName);
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
||||
if(connToInternet) {
|
||||
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName);
|
||||
}
|
||||
else {
|
||||
Toasty.info(getApplicationContext(), getString(R.string.checkNetConnection));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getSingleFileContents(String instanceUrl, String token, final String owner, String repo, final String filename) {
|
||||
|
||||
Call<Files> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getSingleFileContents(token, owner, repo, filename);
|
||||
|
||||
call.enqueue(new Callback<Files>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Files> call, @NonNull retrofit2.Response<Files> response) {
|
||||
|
||||
if (response.code() == 200) {
|
||||
|
||||
AppUtil appUtil = new AppUtil();
|
||||
assert response.body() != null;
|
||||
|
||||
if(!response.body().getContent().equals("")) {
|
||||
singleFileContents.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
singleFileContents.setText(appUtil.decodeBase64(response.body().getContent()));
|
||||
}
|
||||
else {
|
||||
singleFileContents.setText("");
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.info(ctx, ctx.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(getApplicationContext(), getString(R.string.labelGeneralError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Files> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initCloseListener() {
|
||||
onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getIntent().removeExtra("singleFileName");
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -10,26 +10,33 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import okhttp3.OkHttpClient;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.ext.tables.TablePlugin;
|
||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import io.noties.markwon.html.HtmlPlugin;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||
import io.noties.markwon.image.ImageItem;
|
||||
import io.noties.markwon.image.ImagesPlugin;
|
||||
import io.noties.markwon.image.SchemeHandler;
|
||||
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
@ -63,6 +70,8 @@ import org.mian.gitnex.viewmodels.IssueCommentsViewModel;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
@ -286,22 +295,60 @@ public class IssueDetailActivity extends AppCompatActivity {
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(getApplicationContext()))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(getApplicationContext()))
|
||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
||||
@Override
|
||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
||||
plugin.addSchemeHandler(new SchemeHandler() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||
|
||||
final int resourceId = getApplicationContext().getResources().getIdentifier(
|
||||
raw.substring("drawable://".length()),
|
||||
"drawable",
|
||||
getApplicationContext().getPackageName());
|
||||
|
||||
final Drawable drawable = getApplicationContext().getDrawable(resourceId);
|
||||
|
||||
assert drawable != null;
|
||||
return ImageItem.withResult(drawable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Collection<String> supportedSchemes() {
|
||||
return Collections.singleton("drawable");
|
||||
}
|
||||
});
|
||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create(getApplicationContext().getResources()));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(getApplicationContext().getResources()));
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||
}
|
||||
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder
|
||||
.codeTextColor(tinyDb.getInt("codeBlockColor"))
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||
.linkColor(getApplicationContext().getResources().getColor(R.color.lightBlue));
|
||||
.linkColor(getResources().getColor(R.color.lightBlue));
|
||||
}
|
||||
})
|
||||
.usePlugin(TablePlugin.create(getApplicationContext()))
|
||||
.usePlugin(TaskListPlugin.create(getApplicationContext()))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create())
|
||||
.build();
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
@ -310,11 +357,11 @@ public class IssueDetailActivity extends AppCompatActivity {
|
||||
tinyDb.putString("issueState", singleIssue.getState());
|
||||
tinyDb.putString("issueTitle", singleIssue.getTitle());
|
||||
|
||||
Picasso.get().load(singleIssue.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(assigneeAvatar);
|
||||
Picasso.get().load(singleIssue.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(assigneeAvatar);
|
||||
issueTitle.setText(getString(R.string.issueTitleWithId, singleIssue.getNumber(), singleIssue.getTitle()));
|
||||
String cleanIssueDescription = singleIssue.getBody().trim();
|
||||
final CharSequence bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueDescription));
|
||||
issueDescription.setText(UserMentions.UserMentionsFunc(getApplicationContext(), bodyWithMD, cleanIssueDescription));
|
||||
Spanned bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueDescription));
|
||||
markwon.setParsedMarkdown(issueDescription, UserMentions.UserMentionsFunc(getApplicationContext(), bodyWithMD, cleanIssueDescription));
|
||||
|
||||
RelativeLayout.LayoutParams paramsDesc = (RelativeLayout.LayoutParams)issueDescription.getLayoutParams();
|
||||
|
||||
@ -327,7 +374,7 @@ public class IssueDetailActivity extends AppCompatActivity {
|
||||
|
||||
ImageView assigneesView = new ImageView(getApplicationContext());
|
||||
|
||||
Picasso.get().load(singleIssue.getAssignees().get(i).getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(80, 80).centerCrop().into(assigneesView);
|
||||
Picasso.get().load(singleIssue.getAssignees().get(i).getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(100, 100).centerCrop().into(assigneesView);
|
||||
|
||||
assigneesLayout.addView(assigneesView);
|
||||
assigneesView.setLayoutParams(params1);
|
||||
@ -431,7 +478,7 @@ public class IssueDetailActivity extends AppCompatActivity {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||
String createdTime = prettyTime.format(singleIssue.getCreated_at());
|
||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||
issueCreatedTime.setText(createdTime);
|
||||
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||
issueCreatedTime.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getCreated_at()), getApplicationContext()));
|
||||
break;
|
||||
@ -439,14 +486,14 @@ public class IssueDetailActivity extends AppCompatActivity {
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(singleIssue.getCreated_at());
|
||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||
issueCreatedTime.setText(createdTime);
|
||||
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(singleIssue.getCreated_at());
|
||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||
issueCreatedTime.setText(createdTime);
|
||||
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
|
@ -194,16 +194,20 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
|
||||
instanceHost = instanceUrl;
|
||||
}
|
||||
|
||||
String instanceUrlWithProtocol;
|
||||
if(protocol.toLowerCase().equals("https")) {
|
||||
instanceUrl = "https://" + instanceHost + "/api/v1/";
|
||||
instanceUrlWithProtocol = "https://" + instanceHost;
|
||||
}
|
||||
else {
|
||||
instanceUrl = "http://" + instanceHost + "/api/v1/";
|
||||
instanceUrlWithProtocol = "https://" + instanceHost;
|
||||
}
|
||||
|
||||
tinyDb.putString("instanceUrlRaw", instanceHost);
|
||||
tinyDb.putString("loginUid", loginUid);
|
||||
tinyDb.putString("instanceUrl", instanceUrl);
|
||||
tinyDb.putString("instanceUrlWithProtocol", instanceUrlWithProtocol);
|
||||
|
||||
if(connToInternet) {
|
||||
|
||||
|
@ -21,6 +21,7 @@ import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.fragments.AboutFragment;
|
||||
import org.mian.gitnex.fragments.ExploreRepositoriesFragment;
|
||||
import org.mian.gitnex.fragments.MyRepositoriesFragment;
|
||||
import org.mian.gitnex.fragments.NavSubMenuBottomSheetFragment;
|
||||
import org.mian.gitnex.fragments.OrganizationsFragment;
|
||||
@ -148,7 +149,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
userAvatar = hView.findViewById(R.id.userAvatar);
|
||||
if (!userAvatarNav.equals("")) {
|
||||
Picasso.get().load(userAvatarNav).networkPolicy(NetworkPolicy.OFFLINE).transform(new RoundedTransformation(100, 0)).resize(180, 180).centerCrop().into(userAvatar);
|
||||
Picasso.get().load(userAvatarNav).networkPolicy(NetworkPolicy.OFFLINE).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(userAvatar);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -278,6 +279,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
|
||||
new StarredRepositoriesFragment()).commit();
|
||||
break;
|
||||
case R.id.nav_explore:
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
|
||||
new ExploreRepositoriesFragment()).commit();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
@ -330,6 +336,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
if (response.code() == 200) {
|
||||
|
||||
assert userDetails != null;
|
||||
if(userDetails.getIs_admin() != null) {
|
||||
tinyDb.putBoolean("userIsAdmin", userDetails.getIs_admin());
|
||||
}
|
||||
tinyDb.putString("userLogin", userDetails.getLogin());
|
||||
tinyDb.putInt("userId", userDetails.getId());
|
||||
if(!userDetails.getFullname().equals("")) {
|
||||
@ -351,9 +360,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
userAvatar = hView.findViewById(R.id.userAvatar);
|
||||
if (!Objects.requireNonNull(userDetails).getAvatar().equals("")) {
|
||||
Picasso.get().load(userDetails.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(180, 180).centerCrop().into(userAvatar);
|
||||
Picasso.get().load(userDetails.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(160, 160).centerCrop().into(userAvatar);
|
||||
} else {
|
||||
userAvatar.setImageResource(R.mipmap.ic_launcher_round);
|
||||
userAvatar.setImageResource(R.mipmap.app_logo_round);
|
||||
}
|
||||
|
||||
userFullName = hView.findViewById(R.id.userFullname);
|
||||
|
@ -0,0 +1,335 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Branches;
|
||||
import org.mian.gitnex.models.NewFile;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class NewFileActivity extends AppCompatActivity {
|
||||
|
||||
public ImageView closeActivity;
|
||||
private View.OnClickListener onClickListener;
|
||||
private Button newFileCreate;
|
||||
|
||||
private EditText newFileName;
|
||||
private EditText newFileContent;
|
||||
private EditText newFileBranchName;
|
||||
private EditText newFileCommitMessage;
|
||||
private Spinner newFileBranchesSpinner;
|
||||
final Context ctx = this;
|
||||
|
||||
List<Branches> branchesList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_new_file);
|
||||
|
||||
boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
closeActivity = findViewById(R.id.close);
|
||||
newFileName = findViewById(R.id.newFileName);
|
||||
newFileContent = findViewById(R.id.newFileContent);
|
||||
newFileBranchName = findViewById(R.id.newFileBranchName);
|
||||
newFileCommitMessage = findViewById(R.id.newFileCommitMessage);
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
||||
newFileCreate = findViewById(R.id.newFileCreate);
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
||||
newFileBranchesSpinner = findViewById(R.id.newFileBranchesSpinner);
|
||||
newFileBranchesSpinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
||||
getBranches(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||
|
||||
newFileBranchesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
|
||||
{
|
||||
public void onItemSelected(AdapterView<?> arg0,
|
||||
View arg1, int arg2, long arg3)
|
||||
{
|
||||
Branches bModelValue = (Branches) newFileBranchesSpinner.getSelectedItem();
|
||||
Log.i("bModelSelected", bModelValue.toString());
|
||||
|
||||
if(bModelValue.toString().equals("No branch")) {
|
||||
newFileBranchName.setEnabled(true);
|
||||
}
|
||||
else {
|
||||
newFileBranchName.setEnabled(false);
|
||||
newFileBranchName.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> arg0) {}
|
||||
});
|
||||
|
||||
disableProcessButton();
|
||||
|
||||
if(!connToInternet) {
|
||||
|
||||
newFileCreate.setEnabled(false);
|
||||
GradientDrawable shape = new GradientDrawable();
|
||||
shape.setCornerRadius( 8 );
|
||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
||||
newFileCreate.setBackground(shape);
|
||||
|
||||
} else {
|
||||
|
||||
newFileCreate.setOnClickListener(createFileListener);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private View.OnClickListener createFileListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
processNewFile();
|
||||
}
|
||||
};
|
||||
|
||||
private void processNewFile() {
|
||||
|
||||
boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
|
||||
AppUtil appUtil = new AppUtil();
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
String newFileName_ = newFileName.getText().toString();
|
||||
String newFileContent_ = newFileContent.getText().toString();
|
||||
String newFileBranchName_ = newFileBranchName.getText().toString();
|
||||
String newFileCommitMessage_ = newFileCommitMessage.getText().toString();
|
||||
|
||||
Branches currentBranch = (Branches) newFileBranchesSpinner.getSelectedItem();
|
||||
|
||||
if(!connToInternet) {
|
||||
|
||||
Toasty.info(getApplicationContext(), getResources().getString(R.string.checkNetConnection));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(newFileName_.equals("") || newFileContent_.equals("") || newFileCommitMessage_.equals("")) {
|
||||
|
||||
Toasty.info(getApplicationContext(), getString(R.string.newFileRequiredFields));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(currentBranch.toString().equals("No branch")) {
|
||||
|
||||
if(newFileBranchName_.equals("")) {
|
||||
Toasty.info(getApplicationContext(), getString(R.string.newFileRequiredFieldNewBranchName));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if(!appUtil.checkStringsWithDash(newFileBranchName_)) {
|
||||
|
||||
Toasty.info(getApplicationContext(), getString(R.string.newFileInvalidBranchName));
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(appUtil.charactersLength(newFileCommitMessage_) > 255) {
|
||||
|
||||
Toasty.info(getApplicationContext(), getString(R.string.newFileCommitMessageError));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
disableProcessButton();
|
||||
createNewFile(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, newFileName_, appUtil.encodeBase64(newFileContent_), newFileBranchName_, newFileCommitMessage_, currentBranch.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createNewFile(final String instanceUrl, final String token, String repoOwner, String repoName, String fileName, String fileContent, String fileBranchName, String fileCommitMessage, String currentBranch) {
|
||||
|
||||
NewFile createNewFileJsonStr;
|
||||
if(currentBranch.equals("No branch")) {
|
||||
createNewFileJsonStr = new NewFile("", fileContent, fileCommitMessage, fileBranchName);
|
||||
}
|
||||
else {
|
||||
createNewFileJsonStr = new NewFile(currentBranch, fileContent, fileCommitMessage, "");
|
||||
}
|
||||
|
||||
Call<JsonElement> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.createNewFile(token, repoOwner, repoName, fileName, createNewFileJsonStr);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.code() == 201) {
|
||||
|
||||
enableProcessButton();
|
||||
Toasty.info(getApplicationContext(), getString(R.string.newFileSuccessMessage));
|
||||
finish();
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
enableProcessButton();
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if(response.code() == 404) {
|
||||
enableProcessButton();
|
||||
Toasty.info(getApplicationContext(), getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
enableProcessButton();
|
||||
Toasty.info(getApplicationContext(), getString(R.string.orgCreatedError));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
enableProcessButton();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void getBranches(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid) {
|
||||
|
||||
Call<List<Branches>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getBranches(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<List<Branches>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
|
||||
List<Branches> branchesList_ = response.body();
|
||||
|
||||
branchesList.add(new Branches("No branch"));
|
||||
assert branchesList_ != null;
|
||||
if(branchesList_.size() > 0) {
|
||||
for (int i = 0; i < branchesList_.size(); i++) {
|
||||
|
||||
Branches data = new Branches(
|
||||
branchesList_.get(i).getName()
|
||||
);
|
||||
branchesList.add(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ArrayAdapter<Branches> adapter = new ArrayAdapter<>(getApplicationContext(),
|
||||
R.layout.spinner_item, branchesList);
|
||||
|
||||
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
|
||||
newFileBranchesSpinner.setAdapter(adapter);
|
||||
enableProcessButton();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Branches>> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initCloseListener() {
|
||||
onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void disableProcessButton() {
|
||||
|
||||
newFileCreate.setEnabled(false);
|
||||
GradientDrawable shape = new GradientDrawable();
|
||||
shape.setCornerRadius( 8 );
|
||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
||||
newFileCreate.setBackground(shape);
|
||||
|
||||
}
|
||||
|
||||
private void enableProcessButton() {
|
||||
|
||||
newFileCreate.setEnabled(true);
|
||||
GradientDrawable shape = new GradientDrawable();
|
||||
shape.setCornerRadius( 8 );
|
||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
||||
newFileCreate.setBackground(shape);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class OpenRepoInBrowserActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
|
||||
if (!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
|
||||
String repoFullNameBrowser = getIntent().getStringExtra("repoFullNameBrowser");
|
||||
Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullNameBrowser);
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, url);
|
||||
startActivity(i);
|
||||
finish();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,8 @@ package org.mian.gitnex.activities;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
@ -63,7 +62,7 @@ public class OrgTeamMembersActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
getIntent().getStringExtra("teamId");
|
||||
Log.i("teamId", getIntent().getStringExtra("teamId"));
|
||||
//Log.i("teamId", getIntent().getStringExtra("teamId"));
|
||||
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), Integer.valueOf(teamId));
|
||||
|
||||
@ -71,7 +70,7 @@ public class OrgTeamMembersActivity extends AppCompatActivity {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, int teamId) {
|
||||
|
||||
TeamMembersByOrgViewModel teamMembersModel = ViewModelProviders.of(this).get(TeamMembersByOrgViewModel.class);
|
||||
TeamMembersByOrgViewModel teamMembersModel = new ViewModelProvider(this).get(TeamMembersByOrgViewModel.class);
|
||||
|
||||
teamMembersModel.getMembersByOrgList(instanceUrl, instanceToken, teamId).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.gson.JsonElement;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@ -10,7 +11,9 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -24,6 +27,7 @@ import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.fragments.BranchesFragment;
|
||||
import org.mian.gitnex.fragments.ClosedIssuesFragment;
|
||||
import org.mian.gitnex.fragments.CollaboratorsFragment;
|
||||
import org.mian.gitnex.fragments.FilesFragment;
|
||||
import org.mian.gitnex.fragments.IssuesFragment;
|
||||
import org.mian.gitnex.fragments.LabelsFragment;
|
||||
import org.mian.gitnex.fragments.MilestonesFragment;
|
||||
@ -32,9 +36,11 @@ import org.mian.gitnex.fragments.RepoBottomSheetFragment;
|
||||
import org.mian.gitnex.fragments.RepoInfoFragment;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.models.WatchRepository;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.Objects;
|
||||
import android.net.Uri;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -79,14 +85,23 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
|
||||
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
|
||||
|
||||
View tabHeader = LayoutInflater.from(this).inflate(R.layout.badge, null);
|
||||
@SuppressLint("InflateParams") View tabHeader = LayoutInflater.from(this).inflate(R.layout.badge, null);
|
||||
textViewBadge = tabHeader.findViewById(R.id.counterBadge);
|
||||
if(!tinyDb.getString("issuesCounter").isEmpty()) {
|
||||
getRepoInfo(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||
}
|
||||
Objects.requireNonNull(tabLayout.getTabAt(1)).setCustomView(tabHeader);
|
||||
Objects.requireNonNull(tabLayout.getTabAt(2)).setCustomView(tabHeader);
|
||||
|
||||
TabLayout.Tab tabOpenIssues = tabLayout.getTabAt(2);
|
||||
ColorStateList textColor = tabLayout.getTabTextColors();
|
||||
assert tabOpenIssues != null;
|
||||
TextView openIssueTabView = Objects.requireNonNull(tabOpenIssues.getCustomView()).findViewById(R.id.counterBadgeText);
|
||||
openIssueTabView.setTextColor(textColor);
|
||||
|
||||
}
|
||||
|
||||
checkRepositoryStarStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||
checkRepositoryWatchStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,7 +122,6 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
@ -153,6 +167,20 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
case "createRelease":
|
||||
startActivity(new Intent(RepoDetailActivity.this, CreateReleaseActivity.class));
|
||||
break;
|
||||
case "openWebRepo":
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
|
||||
if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName);
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, url);
|
||||
startActivity(i);
|
||||
break;
|
||||
case "newFile":
|
||||
startActivity(new Intent(RepoDetailActivity.this, NewFileActivity.class));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -160,7 +188,7 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -177,21 +205,23 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
switch (position) {
|
||||
case 0: // information
|
||||
return RepoInfoFragment.newInstance(repoOwner, repoName);
|
||||
case 1: // issues
|
||||
case 1: // files
|
||||
return FilesFragment.newInstance(repoOwner, repoName);
|
||||
case 2: // issues
|
||||
fragment = new IssuesFragment();
|
||||
break;
|
||||
case 2: // closed issues
|
||||
case 3: // closed issues
|
||||
fragment = new ClosedIssuesFragment();
|
||||
break;
|
||||
case 3: // milestones
|
||||
case 4: // milestones
|
||||
return MilestonesFragment.newInstance(repoOwner, repoName);
|
||||
case 4: // labels
|
||||
case 5: // labels
|
||||
return LabelsFragment.newInstance(repoOwner, repoName);
|
||||
case 5: // branches
|
||||
case 6: // branches
|
||||
return BranchesFragment.newInstance(repoOwner, repoName);
|
||||
case 6: // releases
|
||||
case 7: // releases
|
||||
return ReleasesFragment.newInstance(repoOwner, repoName);
|
||||
case 7: // collaborators
|
||||
case 8: // collaborators
|
||||
return CollaboratorsFragment.newInstance(repoOwner, repoName);
|
||||
}
|
||||
return fragment;
|
||||
@ -199,7 +229,7 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 8;
|
||||
return 9;
|
||||
}
|
||||
|
||||
}
|
||||
@ -242,4 +272,67 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
|
||||
|
||||
}
|
||||
|
||||
private void checkRepositoryStarStatus(String instanceUrl, String instanceToken, final String owner, String repo) {
|
||||
|
||||
Call<JsonElement> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.checkRepoStarStatus(instanceToken, owner, repo);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
tinyDb.putInt("repositoryStarStatus", response.code());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void checkRepositoryWatchStatus(String instanceUrl, String instanceToken, final String owner, String repo) {
|
||||
|
||||
Call<WatchRepository> call;
|
||||
|
||||
call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.checkRepoWatchStatus(instanceToken, owner, repo);
|
||||
|
||||
call.enqueue(new Callback<WatchRepository>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<WatchRepository> call, @NonNull retrofit2.Response<WatchRepository> response) {
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
|
||||
if(response.code() == 200) {
|
||||
assert response.body() != null;
|
||||
if(response.body().getSubscribed()) {
|
||||
tinyDb.putBoolean("repositoryWatchStatus", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tinyDb.putBoolean("repositoryWatchStatus", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<WatchRepository> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import android.view.View;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepoStargazersAdapter;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoStargazersActivity extends AppCompatActivity {
|
||||
|
||||
private TextView noDataStargazers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private RepoStargazersAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_repo_stargazers);
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
ImageView closeActivity = findViewById(R.id.close);
|
||||
TextView toolbarTitle = findViewById(R.id.toolbar_title);
|
||||
noDataStargazers = findViewById(R.id.noDataStargazers);
|
||||
mGridView = findViewById(R.id.gridView);
|
||||
mProgressBar = findViewById(R.id.progress_bar);
|
||||
|
||||
String repoFullNameForStars = getIntent().getStringExtra("repoFullNameForStars");
|
||||
String[] parts = repoFullNameForStars.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
||||
toolbarTitle.setText(R.string.repoStargazersInMenu);
|
||||
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
||||
|
||||
RepoStargazersViewModel repoStargazersModel = new ViewModelProvider(this).get(RepoStargazersViewModel.class);
|
||||
|
||||
repoStargazersModel.getRepoStargazers(instanceUrl, instanceToken, repoOwner, repoName).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserInfo> stargazersListMain) {
|
||||
adapter = new RepoStargazersAdapter(getApplicationContext(), stargazersListMain);
|
||||
if(adapter.getCount() > 0) {
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataStargazers.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataStargazers.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initCloseListener() {
|
||||
onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import android.view.View;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepoWatchersAdapter;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoWatchersActivity extends AppCompatActivity {
|
||||
|
||||
private TextView noDataWatchers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private RepoWatchersAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_repo_watchers);
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
ImageView closeActivity = findViewById(R.id.close);
|
||||
TextView toolbarTitle = findViewById(R.id.toolbar_title);
|
||||
noDataWatchers = findViewById(R.id.noDataWatchers);
|
||||
mGridView = findViewById(R.id.gridView);
|
||||
mProgressBar = findViewById(R.id.progress_bar);
|
||||
|
||||
String repoFullNameForWatchers = getIntent().getStringExtra("repoFullNameForWatchers");
|
||||
String[] parts = repoFullNameForWatchers.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
||||
toolbarTitle.setText(R.string.repoWatchersInMenu);
|
||||
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
||||
|
||||
RepoWatchersViewModel repoWatchersModel = new ViewModelProvider(this).get(RepoWatchersViewModel.class);
|
||||
|
||||
repoWatchersModel.getRepoWatchers(instanceUrl, instanceToken, repoOwner, repoName).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserInfo> watchersListMain) {
|
||||
adapter = new RepoWatchersAdapter(getApplicationContext(), watchersListMain);
|
||||
if(adapter.getCount() > 0) {
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataWatchers.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataWatchers.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initCloseListener() {
|
||||
onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -2,8 +2,10 @@ package org.mian.gitnex.activities;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
|
||||
/**
|
||||
@ -20,6 +22,9 @@ public class SponsorsActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_sponsors);
|
||||
|
||||
ImageView closeActivity = findViewById(R.id.close);
|
||||
TextView liberaPaySponsorsThomas = findViewById(R.id.liberaPaySponsorsThomas);
|
||||
|
||||
liberaPaySponsorsThomas.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
|
@ -98,7 +98,7 @@ public class AdminGetUsersAdapter extends RecyclerView.Adapter<AdminGetUsersAdap
|
||||
holder.userRole.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(140, 140).centerCrop().into(holder.userAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.userAvatar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,12 +1,13 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.UrlHelper;
|
||||
import org.mian.gitnex.models.Branches;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.List;
|
||||
@ -66,7 +67,9 @@ public class BranchesAdapter extends RecyclerView.Adapter<BranchesAdapter.Branch
|
||||
holder.branchCommitAuthor.setText(mCtx.getResources().getString(R.string.commitAuthor, currentItem.getCommit().getAuthor().getUsername()));
|
||||
}
|
||||
|
||||
holder.branchCommitHash.setText(mCtx.getResources().getString(R.string.commitHash, UrlHelper.cleanUrl(instanceUrl), currentItem.getCommit().getUrl()));
|
||||
holder.branchCommitHash.setText(
|
||||
Html.fromHtml("<a href='" + currentItem.getCommit().getUrl() + "'>" + mCtx.getResources().getString(R.string.commitLinkBranchesTab) + "</a> "));
|
||||
holder.branchCommitHash.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,22 +3,21 @@ package org.mian.gitnex.adapters;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.IssueDetailActivity;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.UserMentions;
|
||||
import org.mian.gitnex.models.Issues;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
@ -27,22 +26,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tables.TableTheme;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -122,8 +107,6 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
private TextView issueNumber;
|
||||
private ImageView issueAssigneeAvatar;
|
||||
private TextView issueTitle;
|
||||
private TextView issueDescription;
|
||||
//private ImageView issueState;
|
||||
private TextView issueCreatedTime;
|
||||
private TextView issueCommentsCount;
|
||||
private ImageView issueType;
|
||||
@ -135,9 +118,8 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
issueNumber = itemView.findViewById(R.id.issueNumber);
|
||||
issueAssigneeAvatar = itemView.findViewById(R.id.assigneeAvatar);
|
||||
issueTitle = itemView.findViewById(R.id.issueTitle);
|
||||
issueDescription = itemView.findViewById(R.id.issueDescription);
|
||||
issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount);
|
||||
//issueState = itemView.findViewById(R.id.issueStatus);
|
||||
LinearLayout frameCommentsCount = itemView.findViewById(R.id.frameCommentsCount);
|
||||
issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime);
|
||||
issueType = itemView.findViewById(R.id.issueType);
|
||||
|
||||
@ -157,7 +139,7 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
|
||||
}
|
||||
});
|
||||
issueDescription.setOnClickListener(new View.OnClickListener() {
|
||||
frameCommentsCount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@ -183,26 +165,6 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
final String locale = tinyDb.getString("locale");
|
||||
final String timeFormat = tinyDb.getString("dateFormat");
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(context))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(context))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder
|
||||
.codeTextColor(tinyDb.getInt("codeBlockColor"))
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||
.linkColor(context.getResources().getColor(R.color.lightBlue));
|
||||
}
|
||||
})
|
||||
.usePlugin(TablePlugin.create(context))
|
||||
.usePlugin(TaskListPlugin.create(context))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.build();
|
||||
|
||||
if (!issuesModel.getUser().getFull_name().equals("")) {
|
||||
issueAssigneeAvatar.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueCreator) + issuesModel.getUser().getFull_name(), context));
|
||||
} else {
|
||||
@ -210,9 +172,9 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
}
|
||||
|
||||
if (issuesModel.getUser().getAvatar_url() != null) {
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(issueAssigneeAvatar);
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
|
||||
} else {
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(issueAssigneeAvatar);
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
|
||||
}
|
||||
|
||||
if (issuesModel.getPull_request() == null) {
|
||||
@ -223,28 +185,12 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
issueType.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueTypePullRequest), context));
|
||||
}
|
||||
|
||||
issueTitle.setText(context.getResources().getString(R.string.hash) + issuesModel.getNumber() + " " + issuesModel.getTitle());
|
||||
String issueNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
|
||||
issueTitle.setText(Html.fromHtml(issueNumber_ + " " + issuesModel.getTitle()));
|
||||
|
||||
issueNumber.setText(String.valueOf(issuesModel.getNumber()));
|
||||
issueCommentsCount.setText(String.valueOf(issuesModel.getComments()));
|
||||
|
||||
if (!issuesModel.getBody().equals("")) {
|
||||
String cleanIssueDescription = issuesModel.getBody().trim();
|
||||
issueDescription.setVisibility(View.VISIBLE);
|
||||
final CharSequence bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueDescription));
|
||||
issueDescription.setText(UserMentions.UserMentionsFunc(context, bodyWithMD, cleanIssueDescription));
|
||||
}
|
||||
else {
|
||||
issueDescription.setText("");
|
||||
issueDescription.setVisibility(View.GONE);
|
||||
}
|
||||
/*if (issuesModel.getState().equals("open")) {
|
||||
issueState.setImageResource(R.drawable.ic_issue_open);
|
||||
issueState.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueStatusTextOpen), context));
|
||||
} else {
|
||||
issueState.setImageResource(R.drawable.ic_issue_closed);
|
||||
issueState.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueStatusTextClosed), context));
|
||||
}*/
|
||||
|
||||
switch (timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||
|
@ -77,7 +77,7 @@ public class CollaboratorsAdapter extends BaseAdapter {
|
||||
private void initData(ViewHolder viewHolder, int position) {
|
||||
|
||||
Collaborators currentItem = collaboratorsList.get(position);
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(viewHolder.collaboratorAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(180, 180).centerCrop().into(viewHolder.collaboratorAvatar);
|
||||
|
||||
if(!currentItem.getFull_name().equals("")) {
|
||||
viewHolder.collaboratorName.setText(currentItem.getFull_name());
|
||||
|
@ -0,0 +1,216 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepositoriesAdapter.ReposSearchViewHolder> {
|
||||
|
||||
|
||||
private List<UserRepositories> searchedReposList;
|
||||
private Context mCtx;
|
||||
|
||||
public ExploreRepositoriesAdapter(List<UserRepositories> dataList, Context mCtx) {
|
||||
this.mCtx = mCtx;
|
||||
this.searchedReposList = dataList;
|
||||
}
|
||||
|
||||
static class ReposSearchViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView image;
|
||||
private TextView mTextView1;
|
||||
private TextView mTextView2;
|
||||
private TextView fullName;
|
||||
private ImageView repoPrivatePublic;
|
||||
private TextView repoStars;
|
||||
private TextView repoForks;
|
||||
private TextView repoOpenIssuesCount;
|
||||
|
||||
private ReposSearchViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
mTextView1 = itemView.findViewById(R.id.repoName);
|
||||
mTextView2 = itemView.findViewById(R.id.repoDescription);
|
||||
image = itemView.findViewById(R.id.imageAvatar);
|
||||
fullName = itemView.findViewById(R.id.repoFullName);
|
||||
repoPrivatePublic = itemView.findViewById(R.id.imageRepoType);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoForks = itemView.findViewById(R.id.repoForks);
|
||||
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
|
||||
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Context context = v.getContext();
|
||||
TextView repoFullName = v.findViewById(R.id.repoFullName);
|
||||
|
||||
Intent intent = new Intent(context, RepoDetailActivity.class);
|
||||
intent.putExtra("repoFullName", repoFullName.getText().toString());
|
||||
|
||||
TinyDB tinyDb = new TinyDB(context);
|
||||
tinyDb.putString("repoFullName", repoFullName.getText().toString());
|
||||
tinyDb.putBoolean("resumeIssues", true);
|
||||
context.startActivity(intent);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
reposDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.repo_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.repoStargazers:
|
||||
|
||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.repoWatchers:
|
||||
|
||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.repoOpenInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullName.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ExploreRepositoriesAdapter.ReposSearchViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.repos_list, parent, false);
|
||||
return new ExploreRepositoriesAdapter.ReposSearchViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final ExploreRepositoriesAdapter.ReposSearchViewHolder holder, int position) {
|
||||
|
||||
final UserRepositories currentItem = searchedReposList.get(position);
|
||||
|
||||
|
||||
holder.mTextView2.setVisibility(View.GONE);
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
} else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
holder.mTextView1.setText(currentItem.getName());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2.setVisibility(View.VISIBLE);
|
||||
holder.mTextView2.setText(currentItem.getDescription());
|
||||
}
|
||||
holder.fullName.setText(currentItem.getFullname());
|
||||
if(currentItem.getPrivateFlag()) {
|
||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_lock_bold);
|
||||
}
|
||||
else {
|
||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_public);
|
||||
}
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
holder.repoForks.setText(currentItem.getForks_count());
|
||||
holder.repoOpenIssuesCount.setText(currentItem.getOpen_issues_count());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return searchedReposList.size();
|
||||
}
|
||||
}
|
212
app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java
Normal file
212
app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java
Normal file
@ -0,0 +1,212 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHolder> implements Filterable {
|
||||
|
||||
private List<Files> filesList;
|
||||
private Context mCtx;
|
||||
private List<Files> filesListFull;
|
||||
|
||||
private FilesAdapterListener filesListener;
|
||||
|
||||
public interface FilesAdapterListener {
|
||||
void onClickDir(String str);
|
||||
void onClickFile(String str);
|
||||
}
|
||||
|
||||
class FilesViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView fileTypeImage;
|
||||
private TextView fileName;
|
||||
private TextView fileType;
|
||||
|
||||
private FilesViewHolder(View itemView) {
|
||||
|
||||
super(itemView);
|
||||
fileName = itemView.findViewById(R.id.fileName);
|
||||
fileTypeImage = itemView.findViewById(R.id.fileImage);
|
||||
fileType = itemView.findViewById(R.id.fileType);
|
||||
|
||||
//ImageView filesDropdownMenu = itemView.findViewById(R.id.filesDropdownMenu);
|
||||
|
||||
fileName.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Context context = v.getContext();
|
||||
|
||||
if(fileType.getText().toString().equals("file")) {
|
||||
filesListener.onClickFile(fileName.getText().toString());
|
||||
}
|
||||
else if(fileType.getText().toString().equals("dir")) {
|
||||
filesListener.onClickDir(fileName.getText().toString());
|
||||
}
|
||||
else {
|
||||
Toasty.info(context, context.getString(R.string.filesGenericError));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*filesDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.files_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.deleteFile:
|
||||
|
||||
Intent intent = new Intent(context, DeleteFileActivity.class);
|
||||
intent.putExtra("repoFullNameForDeleteFile", fullName.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.editFile:
|
||||
|
||||
Intent intentW = new Intent(context, EditFileActivity.class);
|
||||
intentW.putExtra("repoFullNameForEditFile", fullName.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.openInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenFileInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("fileFullNameBrowser", fullName.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public FilesAdapter(Context mCtx, List<Files> filesListMain, FilesAdapterListener filesListener) {
|
||||
this.mCtx = mCtx;
|
||||
this.filesList = filesListMain;
|
||||
filesListFull = new ArrayList<>(filesList);
|
||||
this.filesListener = filesListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public FilesAdapter.FilesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.files_list, parent, false);
|
||||
return new FilesAdapter.FilesViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull FilesAdapter.FilesViewHolder holder, int position) {
|
||||
|
||||
Files currentItem = filesList.get(position);
|
||||
|
||||
holder.fileType.setText(currentItem.getType());
|
||||
holder.fileName.setText(currentItem.getName());
|
||||
|
||||
if(currentItem.getType().equals("file")) {
|
||||
holder.fileTypeImage.setImageDrawable(mCtx.getResources().getDrawable(R.drawable.ic_file_new));
|
||||
}
|
||||
else if(currentItem.getType().equals("dir")) {
|
||||
holder.fileTypeImage.setImageDrawable(mCtx.getResources().getDrawable(R.drawable.ic_folder_24));
|
||||
}
|
||||
else {
|
||||
holder.fileTypeImage.setImageDrawable(mCtx.getResources().getDrawable(R.drawable.ic_question_mark_24));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return filesList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return filesFilter;
|
||||
}
|
||||
|
||||
private Filter filesFilter = new Filter() {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
List<Files> filteredList = new ArrayList<>();
|
||||
|
||||
if (constraint == null || constraint.length() == 0) {
|
||||
filteredList.addAll(filesListFull);
|
||||
} else {
|
||||
String filterPattern = constraint.toString().toLowerCase().trim();
|
||||
|
||||
for (Files item : filesListFull) {
|
||||
if (item.getName().toLowerCase().contains(filterPattern) || item.getPath().toLowerCase().contains(filterPattern)) {
|
||||
filteredList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FilterResults results = new FilterResults();
|
||||
results.values = filteredList;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
filesList.clear();
|
||||
filesList.addAll((List) results.values);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -3,7 +3,9 @@ package org.mian.gitnex.adapters;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -14,8 +16,8 @@ import com.squareup.picasso.Picasso;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.ReplyToIssueActivity;
|
||||
import org.mian.gitnex.helpers.UserMentions;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.UserMentions;
|
||||
import org.mian.gitnex.models.IssueComments;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
@ -24,26 +26,32 @@ import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tables.TableTheme;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.ext.tables.TablePlugin;
|
||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import io.noties.markwon.html.HtmlPlugin;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||
import io.noties.markwon.image.ImageItem;
|
||||
import io.noties.markwon.image.ImagesPlugin;
|
||||
import io.noties.markwon.image.SchemeHandler;
|
||||
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -171,34 +179,72 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
||||
}
|
||||
|
||||
if (currentItem.getUser().getAvatar_url() != null) {
|
||||
Picasso.get().load(currentItem.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(holder.issueCommenterAvatar);
|
||||
Picasso.get().load(currentItem.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.issueCommenterAvatar);
|
||||
} else {
|
||||
Picasso.get().load(currentItem.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(holder.issueCommenterAvatar);
|
||||
Picasso.get().load(currentItem.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.issueCommenterAvatar);
|
||||
}
|
||||
|
||||
String cleanIssueComments = currentItem.getBody().trim();
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(mCtx))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.create(mCtx))
|
||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
||||
@Override
|
||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
||||
plugin.addSchemeHandler(new SchemeHandler() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||
|
||||
final int resourceId = mCtx.getResources().getIdentifier(
|
||||
raw.substring("drawable://".length()),
|
||||
"drawable",
|
||||
mCtx.getPackageName());
|
||||
|
||||
final Drawable drawable = mCtx.getDrawable(resourceId);
|
||||
|
||||
assert drawable != null;
|
||||
return ImageItem.withResult(drawable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Collection<String> supportedSchemes() {
|
||||
return Collections.singleton("drawable");
|
||||
}
|
||||
});
|
||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||
}
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder
|
||||
.codeTextColor(tinyDb.getInt("codeBlockColor"))
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"));
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||
.linkColor(mCtx.getResources().getColor(R.color.lightBlue));
|
||||
}
|
||||
})
|
||||
.usePlugin(TablePlugin.create(mCtx))
|
||||
.usePlugin(TaskListPlugin.create(mCtx))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create())
|
||||
.build();
|
||||
|
||||
final CharSequence bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueComments));
|
||||
holder.issueComment.setText(UserMentions.UserMentionsFunc(mCtx, bodyWithMD, cleanIssueComments));
|
||||
Spanned bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueComments));
|
||||
markwon.setParsedMarkdown(holder.issueComment, UserMentions.UserMentionsFunc(mCtx, bodyWithMD, cleanIssueComments));
|
||||
|
||||
String edited;
|
||||
|
||||
|
@ -3,22 +3,21 @@ package org.mian.gitnex.adapters;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.IssueDetailActivity;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.UserMentions;
|
||||
import org.mian.gitnex.models.Issues;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
@ -27,22 +26,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tables.TableTheme;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -122,8 +107,6 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
private TextView issueNumber;
|
||||
private ImageView issueAssigneeAvatar;
|
||||
private TextView issueTitle;
|
||||
private TextView issueDescription;
|
||||
//private ImageView issueState;
|
||||
private TextView issueCreatedTime;
|
||||
private TextView issueCommentsCount;
|
||||
private ImageView issueType;
|
||||
@ -135,9 +118,8 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
issueNumber = itemView.findViewById(R.id.issueNumber);
|
||||
issueAssigneeAvatar = itemView.findViewById(R.id.assigneeAvatar);
|
||||
issueTitle = itemView.findViewById(R.id.issueTitle);
|
||||
issueDescription = itemView.findViewById(R.id.issueDescription);
|
||||
issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount);
|
||||
//issueState = itemView.findViewById(R.id.issueStatus);
|
||||
LinearLayout frameCommentsCount = itemView.findViewById(R.id.frameCommentsCount);
|
||||
issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime);
|
||||
issueType = itemView.findViewById(R.id.issueType);
|
||||
|
||||
@ -157,7 +139,7 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
|
||||
}
|
||||
});
|
||||
issueDescription.setOnClickListener(new View.OnClickListener() {
|
||||
frameCommentsCount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@ -183,26 +165,6 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
final String locale = tinyDb.getString("locale");
|
||||
final String timeFormat = tinyDb.getString("dateFormat");
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(context))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(context))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder
|
||||
.codeTextColor(tinyDb.getInt("codeBlockColor"))
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||
.linkColor(context.getResources().getColor(R.color.lightBlue));
|
||||
}
|
||||
})
|
||||
.usePlugin(TablePlugin.create(context))
|
||||
.usePlugin(TaskListPlugin.create(context))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.build();
|
||||
|
||||
if (!issuesModel.getUser().getFull_name().equals("")) {
|
||||
issueAssigneeAvatar.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueCreator) + issuesModel.getUser().getFull_name(), context));
|
||||
} else {
|
||||
@ -210,9 +172,9 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
|
||||
if (issuesModel.getUser().getAvatar_url() != null) {
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(issueAssigneeAvatar);
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
|
||||
} else {
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(issueAssigneeAvatar);
|
||||
Picasso.get().load(issuesModel.getUser().getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
|
||||
}
|
||||
|
||||
if (issuesModel.getPull_request() == null) {
|
||||
@ -223,28 +185,12 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
issueType.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueTypePullRequest), context));
|
||||
}
|
||||
|
||||
issueTitle.setText(context.getResources().getString(R.string.hash) + issuesModel.getNumber() + " " + issuesModel.getTitle());
|
||||
String issueNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
|
||||
issueTitle.setText(Html.fromHtml(issueNumber_ + " " + issuesModel.getTitle()));
|
||||
|
||||
issueNumber.setText(String.valueOf(issuesModel.getNumber()));
|
||||
issueCommentsCount.setText(String.valueOf(issuesModel.getComments()));
|
||||
|
||||
if (!issuesModel.getBody().equals("")) {
|
||||
String cleanIssueDescription = issuesModel.getBody().trim();
|
||||
issueDescription.setVisibility(View.VISIBLE);
|
||||
final CharSequence bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(cleanIssueDescription));
|
||||
issueDescription.setText(UserMentions.UserMentionsFunc(context, bodyWithMD, cleanIssueDescription));
|
||||
}
|
||||
else {
|
||||
issueDescription.setText("");
|
||||
issueDescription.setVisibility(View.GONE);
|
||||
}
|
||||
/*if (issuesModel.getState().equals("open")) {
|
||||
issueState.setImageResource(R.drawable.ic_issue_open);
|
||||
issueState.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueStatusTextOpen), context));
|
||||
} else {
|
||||
issueState.setImageResource(R.drawable.ic_issue_closed);
|
||||
issueState.setOnClickListener(new ClickListener(context.getResources().getString(R.string.issueStatusTextClosed), context));
|
||||
}*/
|
||||
|
||||
switch (timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||
|
@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -42,13 +41,12 @@ public class LabelsAdapter extends RecyclerView.Adapter<LabelsAdapter.LabelsView
|
||||
private TextView labelId;
|
||||
private TextView labelColor;
|
||||
private ImageView labelsView;
|
||||
private ImageView labelsOptionsMenu;
|
||||
|
||||
private LabelsViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
labelsView = itemView.findViewById(R.id.labelsView);
|
||||
labelsOptionsMenu = itemView.findViewById(R.id.labelsOptionsMenu);
|
||||
ImageView labelsOptionsMenu = itemView.findViewById(R.id.labelsOptionsMenu);
|
||||
labelTitle = itemView.findViewById(R.id.labelTitle);
|
||||
labelId = itemView.findViewById(R.id.labelId);
|
||||
labelColor = itemView.findViewById(R.id.labelColor);
|
||||
@ -146,6 +144,7 @@ public class LabelsAdapter extends RecyclerView.Adapter<LabelsAdapter.LabelsView
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
//.useFont(Typeface.DEFAULT)
|
||||
.bold()
|
||||
.textColor(new ColorInverter().getContrastColor(color))
|
||||
.fontSize(36)
|
||||
.width(LabelWidthCalculator.customWidth(getMaxLabelLength()))
|
||||
|
@ -83,7 +83,7 @@ public class MembersByOrgAdapter extends BaseAdapter implements Filterable {
|
||||
private void initData(MembersByOrgAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = membersList.get(position);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(viewHolder.memberAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
|
@ -3,12 +3,16 @@ package org.mian.gitnex.adapters;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
@ -21,25 +25,31 @@ import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tables.TableTheme;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.ext.tables.TablePlugin;
|
||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import io.noties.markwon.html.HtmlPlugin;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||
import io.noties.markwon.image.ImageItem;
|
||||
import io.noties.markwon.image.ImagesPlugin;
|
||||
import io.noties.markwon.image.SchemeHandler;
|
||||
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -59,6 +69,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
private TextView msClosedIssues;
|
||||
private TextView msDueDate;
|
||||
private ImageView msStatus;
|
||||
private ProgressBar msProgress;
|
||||
|
||||
private MilestonesViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
@ -69,8 +80,9 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
msOpenIssues = itemView.findViewById(R.id.milestoneIssuesOpen);
|
||||
msClosedIssues = itemView.findViewById(R.id.milestoneIssuesClosed);
|
||||
msDueDate = itemView.findViewById(R.id.milestoneDueDate);
|
||||
msProgress = itemView.findViewById(R.id.milestoneProgress);
|
||||
|
||||
/*issueTitle.setOnClickListener(new View.OnClickListener() {
|
||||
/*msTitle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@ -113,8 +125,45 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(mCtx))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(mCtx))
|
||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
||||
@Override
|
||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
||||
plugin.addSchemeHandler(new SchemeHandler() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||
|
||||
final int resourceId = mCtx.getResources().getIdentifier(
|
||||
raw.substring("drawable://".length()),
|
||||
"drawable",
|
||||
mCtx.getPackageName());
|
||||
|
||||
final Drawable drawable = mCtx.getDrawable(resourceId);
|
||||
|
||||
assert drawable != null;
|
||||
return ImageItem.withResult(drawable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Collection<String> supportedSchemes() {
|
||||
return Collections.singleton("drawable");
|
||||
}
|
||||
});
|
||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||
}
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
@ -127,11 +176,12 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
.usePlugin(TablePlugin.create(mCtx))
|
||||
.usePlugin(TaskListPlugin.create(mCtx))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create())
|
||||
.build();
|
||||
|
||||
holder.msTitle.setText(currentItem.getTitle());
|
||||
Spanned msTitle = markwon.toMarkdown(currentItem.getTitle());
|
||||
markwon.setParsedMarkdown(holder.msTitle, msTitle);
|
||||
//holder.msStatus.setText(currentItem.getState());
|
||||
|
||||
if(currentItem.getState().equals("open")) {
|
||||
@ -183,6 +233,24 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
holder.msClosedIssues.setText(String.valueOf(currentItem.getClosed_issues()));
|
||||
holder.msClosedIssues.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneClosedIssues, currentItem.getClosed_issues()), mCtx));
|
||||
|
||||
if ((currentItem.getOpen_issues() + currentItem.getClosed_issues()) > 0) {
|
||||
|
||||
if (currentItem.getOpen_issues() == 0) {
|
||||
holder.msProgress.setProgress(100);
|
||||
holder.msProgress.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneCompletion, 100), mCtx));
|
||||
}
|
||||
else {
|
||||
int msCompletion = 100 * currentItem.getClosed_issues() / (currentItem.getOpen_issues() + currentItem.getClosed_issues());
|
||||
holder.msProgress.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneCompletion, msCompletion), mCtx));
|
||||
holder.msProgress.setProgress(msCompletion);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
holder.msProgress.setProgress(0);
|
||||
holder.msProgress.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneCompletion, 0), mCtx));
|
||||
}
|
||||
|
||||
if(currentItem.getDue_on() != null) {
|
||||
|
||||
if (timeFormat.equals("normal") || timeFormat.equals("pretty")) {
|
||||
@ -216,7 +284,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
||||
|
||||
}
|
||||
else {
|
||||
holder.msDueDate.setVisibility(View.INVISIBLE);
|
||||
holder.msDueDate.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
@ -12,13 +13,21 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
@ -39,7 +48,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
||||
private TextView fullNameMy;
|
||||
private ImageView repoPrivatePublicMy;
|
||||
private TextView repoStarsMy;
|
||||
private TextView repoWatchersMy;
|
||||
private TextView repoForksMy;
|
||||
private TextView repoOpenIssuesCountMy;
|
||||
|
||||
private MyReposViewHolder(View itemView) {
|
||||
@ -50,8 +59,9 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
||||
fullNameMy = itemView.findViewById(R.id.repoFullNameMy);
|
||||
repoPrivatePublicMy = itemView.findViewById(R.id.imageRepoTypeMy);
|
||||
repoStarsMy = itemView.findViewById(R.id.repoStarsMy);
|
||||
repoWatchersMy = itemView.findViewById(R.id.repoWatchersMy);
|
||||
repoForksMy = itemView.findViewById(R.id.repoForksMy);
|
||||
repoOpenIssuesCountMy = itemView.findViewById(R.id.repoOpenIssuesCountMy);
|
||||
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -70,6 +80,69 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
||||
}
|
||||
});
|
||||
|
||||
reposDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.repo_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.repoStargazers:
|
||||
|
||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||
intent.putExtra("repoFullNameForStars", fullNameMy.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.repoWatchers:
|
||||
|
||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||
intentW.putExtra("repoFullNameForWatchers", fullNameMy.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.repoOpenInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullNameMy.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,19 +167,29 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String charac = String.valueOf(currentItem.getName().charAt(0));
|
||||
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(16)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRound(charac, color);
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.imageMy);
|
||||
} else {
|
||||
holder.imageMy.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.imageMy.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
holder.imageMy.setImageDrawable(drawable);
|
||||
holder.mTextView1My.setText(currentItem.getName());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2My.setVisibility(View.VISIBLE);
|
||||
@ -120,7 +203,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
||||
holder.repoPrivatePublicMy.setImageResource(R.drawable.ic_public);
|
||||
}
|
||||
holder.repoStarsMy.setText(currentItem.getStars_count());
|
||||
holder.repoWatchersMy.setText(currentItem.getWatchers_count());
|
||||
holder.repoForksMy.setText(currentItem.getForks_count());
|
||||
holder.repoOpenIssuesCountMy.setText(currentItem.getOpen_issues_count());
|
||||
|
||||
}
|
||||
|
@ -76,11 +76,10 @@ public class OrganizationsListAdapter extends RecyclerView.Adapter<Organizations
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull OrganizationsViewHolder holder, int position) {
|
||||
|
||||
|
||||
UserOrganizations currentItem = orgList.get(position);
|
||||
holder.mTextView2.setVisibility(View.GONE);
|
||||
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(holder.image);
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
holder.mTextView1.setText(currentItem.getUsername());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2.setVisibility(View.VISIBLE);
|
||||
|
@ -65,7 +65,7 @@ public class ProfileFollowersAdapter extends RecyclerView.Adapter<ProfileFollowe
|
||||
holder.userName.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(140, 140).centerCrop().into(holder.userAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.userAvatar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class ProfileFollowingAdapter extends RecyclerView.Adapter<ProfileFollowi
|
||||
holder.userName.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(140, 140).centerCrop().into(holder.userAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.userAvatar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,11 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -11,22 +15,30 @@ import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.models.Releases;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.ext.tables.TablePlugin;
|
||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import io.noties.markwon.html.HtmlPlugin;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||
import io.noties.markwon.image.ImageItem;
|
||||
import io.noties.markwon.image.ImagesPlugin;
|
||||
import io.noties.markwon.image.SchemeHandler;
|
||||
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -75,6 +87,8 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ReleasesAdapter.ReleasesViewHolder holder, int position) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(mCtx);
|
||||
|
||||
Releases currentItem = releasesList.get(position);
|
||||
|
||||
holder.releaseTitle.setText(currentItem.getName());
|
||||
@ -113,34 +127,77 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(mCtx))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(mCtx))
|
||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
||||
@Override
|
||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
||||
plugin.addSchemeHandler(new SchemeHandler() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||
|
||||
final int resourceId = mCtx.getResources().getIdentifier(
|
||||
raw.substring("drawable://".length()),
|
||||
"drawable",
|
||||
mCtx.getPackageName());
|
||||
|
||||
final Drawable drawable = mCtx.getDrawable(resourceId);
|
||||
|
||||
assert drawable != null;
|
||||
return ImageItem.withResult(drawable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Collection<String> supportedSchemes() {
|
||||
return Collections.singleton("drawable");
|
||||
}
|
||||
});
|
||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(mCtx.getResources()));
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||
}
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder
|
||||
.codeTextColor(Color.GREEN)
|
||||
.codeBackgroundColor(Color.BLACK)
|
||||
.codeTextColor(tinyDb.getInt("codeBlockColor"))
|
||||
.codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||
.linkColor(mCtx.getResources().getColor(R.color.lightBlue));
|
||||
}
|
||||
})
|
||||
.usePlugin(TablePlugin.create(mCtx))
|
||||
.usePlugin(TaskListPlugin.create(mCtx))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create())
|
||||
.build();
|
||||
|
||||
final CharSequence bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(currentItem.getBody()));
|
||||
Spanned bodyWithMD = markwon.toMarkdown(EmojiParser.parseToUnicode(currentItem.getBody()));
|
||||
|
||||
if(!currentItem.getBody().equals("")) {
|
||||
holder.releaseDescription.setText(bodyWithMD);
|
||||
markwon.setParsedMarkdown(holder.releaseDescription, bodyWithMD);
|
||||
}
|
||||
else {
|
||||
holder.releaseDescription.setVisibility(View.GONE);
|
||||
}
|
||||
holder.releaseZipDownload.setText(currentItem.getZipball_url());
|
||||
holder.releaseTarDownload.setText(currentItem.getTarball_url());
|
||||
|
||||
holder.releaseZipDownload.setText(
|
||||
Html.fromHtml("<a href='" + currentItem.getZipball_url() + "'>" + mCtx.getResources().getString(R.string.zipArchiveDownloadReleasesTab) + "</a> "));
|
||||
holder.releaseZipDownload.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
holder.releaseTarDownload.setText(
|
||||
Html.fromHtml("<a href='" + currentItem.getTarball_url() + "'>" + mCtx.getResources().getString(R.string.tarArchiveDownloadReleasesTab) + "</a> "));
|
||||
holder.releaseTarDownload.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,91 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoStargazersAdapter extends BaseAdapter {
|
||||
|
||||
private List<UserInfo> stargazersList;
|
||||
private Context mCtx;
|
||||
|
||||
private class ViewHolder {
|
||||
|
||||
private ImageView memberAvatar;
|
||||
private TextView memberName;
|
||||
|
||||
ViewHolder(View v) {
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
}
|
||||
}
|
||||
|
||||
public RepoStargazersAdapter(Context mCtx, List<UserInfo> membersListMain) {
|
||||
this.mCtx = mCtx;
|
||||
this.stargazersList = membersListMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return stargazersList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
RepoStargazersAdapter.ViewHolder viewHolder;
|
||||
|
||||
if (finalView == null) {
|
||||
finalView = LayoutInflater.from(mCtx).inflate(R.layout.repo_stargazers_list, null);
|
||||
viewHolder = new RepoStargazersAdapter.ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
viewHolder = (RepoStargazersAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
|
||||
}
|
||||
|
||||
private void initData(RepoStargazersAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = stargazersList.get(position);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
}
|
||||
else {
|
||||
viewHolder.memberName.setText(currentItem.getLogin());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoWatchersAdapter extends BaseAdapter {
|
||||
|
||||
private List<UserInfo> watchersList;
|
||||
private Context mCtx;
|
||||
|
||||
private class ViewHolder {
|
||||
|
||||
private ImageView memberAvatar;
|
||||
private TextView memberName;
|
||||
|
||||
ViewHolder(View v) {
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
}
|
||||
}
|
||||
|
||||
public RepoWatchersAdapter(Context mCtx, List<UserInfo> membersListMain) {
|
||||
this.mCtx = mCtx;
|
||||
this.watchersList = membersListMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return watchersList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
RepoWatchersAdapter.ViewHolder viewHolder;
|
||||
|
||||
if (finalView == null) {
|
||||
finalView = LayoutInflater.from(mCtx).inflate(R.layout.repo_watchers_list, null);
|
||||
viewHolder = new RepoWatchersAdapter.ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
viewHolder = (RepoWatchersAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
|
||||
}
|
||||
|
||||
private void initData(RepoWatchersAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = watchersList.get(position);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
}
|
||||
else {
|
||||
viewHolder.memberName.setText(currentItem.getLogin());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -4,8 +4,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
@ -14,10 +17,16 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -39,10 +48,11 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
||||
private TextView fullName;
|
||||
private ImageView repoPrivatePublic;
|
||||
private TextView repoStars;
|
||||
private TextView repoWatchers;
|
||||
private TextView repoForks;
|
||||
private TextView repoOpenIssuesCount;
|
||||
|
||||
private ReposViewHolder(View itemView) {
|
||||
|
||||
super(itemView);
|
||||
mTextView1 = itemView.findViewById(R.id.repoName);
|
||||
mTextView2 = itemView.findViewById(R.id.repoDescription);
|
||||
@ -50,15 +60,16 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
||||
fullName = itemView.findViewById(R.id.repoFullName);
|
||||
repoPrivatePublic = itemView.findViewById(R.id.imageRepoType);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoWatchers = itemView.findViewById(R.id.repoWatchers);
|
||||
repoForks = itemView.findViewById(R.id.repoForks);
|
||||
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
|
||||
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Context context = v.getContext();
|
||||
TextView repoFullName = (TextView) v.findViewById(R.id.repoFullName);
|
||||
TextView repoFullName = v.findViewById(R.id.repoFullName);
|
||||
|
||||
Intent intent = new Intent(context, RepoDetailActivity.class);
|
||||
intent.putExtra("repoFullName", repoFullName.getText().toString());
|
||||
@ -70,6 +81,70 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
reposDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.repo_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.repoStargazers:
|
||||
|
||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.repoWatchers:
|
||||
|
||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.repoOpenInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullName.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,19 +169,29 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String charac = String.valueOf(currentItem.getName().charAt(0));
|
||||
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(16)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRound(charac, color);
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
} else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
holder.image.setImageDrawable(drawable);
|
||||
holder.mTextView1.setText(currentItem.getName());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2.setVisibility(View.VISIBLE);
|
||||
@ -120,7 +205,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_public);
|
||||
}
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
holder.repoWatchers.setText(currentItem.getWatchers_count());
|
||||
holder.repoForks.setText(currentItem.getForks_count());
|
||||
holder.repoOpenIssuesCount.setText(currentItem.getOpen_issues_count());
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
@ -12,13 +13,21 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
@ -39,7 +48,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
||||
private TextView fullName;
|
||||
private ImageView repoPrivatePublic;
|
||||
private TextView repoStars;
|
||||
private TextView repoWatchers;
|
||||
private TextView repoForks;
|
||||
private TextView repoOpenIssuesCount;
|
||||
|
||||
private OrgReposViewHolder(View itemView) {
|
||||
@ -50,8 +59,9 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
||||
fullName = itemView.findViewById(R.id.repoFullName);
|
||||
repoPrivatePublic = itemView.findViewById(R.id.imageRepoType);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoWatchers = itemView.findViewById(R.id.repoWatchers);
|
||||
repoForks = itemView.findViewById(R.id.repoForks);
|
||||
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
|
||||
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -70,6 +80,69 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
||||
}
|
||||
});
|
||||
|
||||
reposDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.repo_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.repoStargazers:
|
||||
|
||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.repoWatchers:
|
||||
|
||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.repoOpenInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullName.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -95,19 +168,29 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String charac = String.valueOf(currentItem.getName().charAt(0));
|
||||
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(16)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRound(charac, color);
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
} else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
holder.image.setImageDrawable(drawable);
|
||||
holder.mTextView1.setText(currentItem.getName());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2.setVisibility(View.VISIBLE);
|
||||
@ -121,7 +204,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_public);
|
||||
}
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
holder.repoWatchers.setText(currentItem.getWatchers_count());
|
||||
holder.repoForks.setText(currentItem.getForks_count());
|
||||
holder.repoOpenIssuesCount.setText(currentItem.getOpen_issues_count());
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
@ -12,13 +13,21 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
@ -39,7 +48,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
||||
private TextView fullName;
|
||||
private ImageView repoPrivatePublic;
|
||||
private TextView repoStars;
|
||||
private TextView repoWatchers;
|
||||
private TextView repoForks;
|
||||
private TextView repoOpenIssuesCount;
|
||||
|
||||
private StarredReposViewHolder(View itemView) {
|
||||
@ -50,8 +59,9 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
||||
fullName = itemView.findViewById(R.id.repoFullName);
|
||||
repoPrivatePublic = itemView.findViewById(R.id.imageRepoType);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoWatchers = itemView.findViewById(R.id.repoWatchers);
|
||||
repoForks = itemView.findViewById(R.id.repoForks);
|
||||
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
|
||||
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -70,6 +80,69 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
||||
}
|
||||
});
|
||||
|
||||
reposDropdownMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final Context context = v.getContext();
|
||||
Context context_ = new ContextThemeWrapper(context, R.style.popupMenuStyle);
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu(context_, v);
|
||||
popupMenu.inflate(R.menu.repo_dotted_list_menu);
|
||||
|
||||
Object menuHelper;
|
||||
Class[] argTypes;
|
||||
try {
|
||||
|
||||
Field fMenuHelper = PopupMenu.class.getDeclaredField("mPopup");
|
||||
fMenuHelper.setAccessible(true);
|
||||
menuHelper = fMenuHelper.get(popupMenu);
|
||||
argTypes = new Class[] { boolean.class };
|
||||
menuHelper.getClass().getDeclaredMethod("setForceShowIcon",
|
||||
argTypes).invoke(menuHelper, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
popupMenu.show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.repoStargazers:
|
||||
|
||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.repoWatchers:
|
||||
|
||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||
context.startActivity(intentW);
|
||||
break;
|
||||
|
||||
case R.id.repoOpenInBrowser:
|
||||
|
||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullName.getText());
|
||||
context.startActivity(intentOpenInBrowser);
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -95,19 +168,29 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String charac = String.valueOf(currentItem.getName().charAt(0));
|
||||
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(16)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRound(charac, color);
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
} else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
holder.image.setImageDrawable(drawable);
|
||||
holder.mTextView1.setText(currentItem.getName());
|
||||
if (!currentItem.getDescription().equals("")) {
|
||||
holder.mTextView2.setVisibility(View.VISIBLE);
|
||||
@ -121,7 +204,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_public);
|
||||
}
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
holder.repoWatchers.setText(currentItem.getWatchers_count());
|
||||
holder.repoForks.setText(currentItem.getForks_count());
|
||||
holder.repoOpenIssuesCount.setText(currentItem.getOpen_issues_count());
|
||||
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class TeamMembersByOrgAdapter extends BaseAdapter {
|
||||
private void initData(TeamMembersByOrgAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = teamMembersList.get(position);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(viewHolder.memberAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
|
@ -141,7 +141,7 @@ public class UserSearchAdapter extends RecyclerView.Adapter<UserSearchAdapter.Us
|
||||
}
|
||||
|
||||
if (!currentItem.getAvatar().equals("")) {
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(holder.userAvatar);
|
||||
Picasso.get().load(currentItem.getAvatar()).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.userAvatar);
|
||||
}
|
||||
|
||||
if(getItemCount() > 0) {
|
||||
|
@ -49,6 +49,7 @@ public class AboutFragment extends Fragment {
|
||||
final TextView appVerBuild;
|
||||
final TextView donationLink;
|
||||
final TextView donationLinkPatreon;
|
||||
final TextView translateLink;
|
||||
final TextView creditsButton;
|
||||
final TextView sponsorsButton;
|
||||
final TextView appWebsite;
|
||||
@ -64,6 +65,7 @@ public class AboutFragment extends Fragment {
|
||||
creditsButton = v.findViewById(R.id.creditsButton);
|
||||
donationLink = v.findViewById(R.id.donationLink);
|
||||
donationLinkPatreon = v.findViewById(R.id.donationLinkPatreon);
|
||||
translateLink = v.findViewById(R.id.translateLink);
|
||||
sponsorsButton = v.findViewById(R.id.sponsorsButton);
|
||||
appWebsite = v.findViewById(R.id.appWebsite);
|
||||
appRepo = v.findViewById(R.id.appRepo);
|
||||
@ -90,6 +92,16 @@ public class AboutFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
translateLink.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||
intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
appWebsite.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent();
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -125,7 +125,7 @@ public class BranchesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
BranchesViewModel branchesModel = ViewModelProviders.of(this).get(BranchesViewModel.class);
|
||||
BranchesViewModel branchesModel = new ViewModelProvider(this).get(BranchesViewModel.class);
|
||||
|
||||
branchesModel.getBranchesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Branches>>() {
|
||||
@Override
|
||||
|
@ -263,6 +263,7 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
|
@ -6,11 +6,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.CollaboratorsAdapter;
|
||||
@ -26,6 +27,7 @@ import java.util.List;
|
||||
|
||||
public class CollaboratorsFragment extends Fragment {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private CollaboratorsAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private TextView noDataCollaborators;
|
||||
@ -69,6 +71,8 @@ public class CollaboratorsFragment extends Fragment {
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
noDataCollaborators = v.findViewById(R.id.noDataCollaborators);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
|
||||
mGridView = v.findViewById(R.id.gridView);
|
||||
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
@ -94,7 +98,7 @@ public class CollaboratorsFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
CollaboratorsViewModel collaboratorsModel = ViewModelProviders.of(this).get(CollaboratorsViewModel.class);
|
||||
CollaboratorsViewModel collaboratorsModel = new ViewModelProvider(this).get(CollaboratorsViewModel.class);
|
||||
|
||||
collaboratorsModel.getCollaboratorsList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Collaborators>>() {
|
||||
@Override
|
||||
@ -109,6 +113,7 @@ public class CollaboratorsFragment extends Fragment {
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataCollaborators.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,194 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.ExploreRepositoriesAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.ExploreRepositories;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
+ * Template Author M M Arif
|
||||
+ * Author 6543
|
||||
+ */
|
||||
|
||||
public class ExploreRepositoriesFragment extends Fragment {
|
||||
|
||||
private static String repoNameF = "param2";
|
||||
private static String repoOwnerF = "param1";
|
||||
private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView noData;
|
||||
private TextView searchKeyword;
|
||||
private Boolean repoTypeInclude = true;
|
||||
private String sort = "updated";
|
||||
private String order = "asc";
|
||||
|
||||
private ExploreRepositoriesAdapter adapter;
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
public ExploreRepositoriesFragment() {
|
||||
}
|
||||
|
||||
public static ExploreRepositoriesFragment newInstance(String param1, String param2) {
|
||||
ExploreRepositoriesFragment fragment = new ExploreRepositoriesFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(repoOwnerF, param1);
|
||||
args.putString(repoNameF, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
String repoName = getArguments().getString(repoNameF);
|
||||
String repoOwner = getArguments().getString(repoOwnerF);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
boolean connToInternet = AppUtil.haveNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_explore_repo, container, false);
|
||||
//setHasOptionsMenu(true);
|
||||
((MainActivity) Objects.requireNonNull(getActivity())).setActionBarTitle(getResources().getString(R.string.pageTitleExplore));
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
searchKeyword = v.findViewById(R.id.searchKeyword);
|
||||
noData = v.findViewById(R.id.noData);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerViewReposSearch);
|
||||
|
||||
if(connToInternet) {
|
||||
|
||||
searchKeyword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
if(!searchKeyword.getText().toString().equals("")) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
loadSearchReposList(instanceUrl, instanceToken, loginUid, searchKeyword.getText().toString(), repoTypeInclude, sort, order, getContext());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return v;
|
||||
|
||||
}
|
||||
|
||||
private void loadSearchReposList(String instanceUrl, String instanceToken, String loginUid, String searchKeyword, Boolean repoTypeInclude, String sort, String order, final Context context) {
|
||||
|
||||
Call<ExploreRepositories> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.queryRepos(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), searchKeyword, repoTypeInclude, sort, order);
|
||||
|
||||
call.enqueue(new Callback<ExploreRepositories>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ExploreRepositories> call, @NonNull Response<ExploreRepositories> response) {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
assert response.body() != null;
|
||||
getReposList(response.body().getSearchedData(), context);
|
||||
} else {
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ExploreRepositories> call, @NonNull Throwable t) {
|
||||
Log.i("onFailure", t.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void getReposList(List<UserRepositories> dataList, Context context) {
|
||||
|
||||
adapter = new ExploreRepositoriesAdapter(dataList, context);
|
||||
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
if(adapter.getItemCount() > 0) {
|
||||
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.GONE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
noData.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onButtonPressed(Uri uri) {
|
||||
if (mListener != null) {
|
||||
mListener.onFragmentInteraction(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
public interface OnFragmentInteractionListener {
|
||||
void onFragmentInteraction(Uri uri);
|
||||
}
|
||||
}
|
301
app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java
Normal file
301
app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java
Normal file
@ -0,0 +1,301 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.FileViewActivity;
|
||||
import org.mian.gitnex.adapters.FilesAdapter;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.FilesViewModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import moe.feng.common.view.breadcrumbs.BreadcrumbsView;
|
||||
import moe.feng.common.view.breadcrumbs.DefaultBreadcrumbsCallback;
|
||||
import moe.feng.common.view.breadcrumbs.model.BreadcrumbItem;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapterListener {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private FilesAdapter adapter;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView noDataFiles;
|
||||
private LinearLayout filesFrame;
|
||||
private TextView fileStructure;
|
||||
private static String repoNameF = "param2";
|
||||
private static String repoOwnerF = "param1";
|
||||
private BreadcrumbsView mBreadcrumbsView;
|
||||
|
||||
private String repoName;
|
||||
private String repoOwner;
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
public FilesFragment() {
|
||||
}
|
||||
|
||||
public static FilesFragment newInstance(String param1, String param2) {
|
||||
FilesFragment fragment = new FilesFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(repoOwnerF, param1);
|
||||
args.putString(repoNameF, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
repoName = getArguments().getString(repoNameF);
|
||||
repoOwner = getArguments().getString(repoOwnerF);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_files, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
noDataFiles = v.findViewById(R.id.noDataFiles);
|
||||
filesFrame = v.findViewById(R.id.filesFrame);
|
||||
|
||||
fileStructure = v.findViewById(R.id.fileStructure);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
|
||||
mBreadcrumbsView = v.findViewById(R.id.breadcrumbs_view);
|
||||
mBreadcrumbsView.setItems(new ArrayList<>(Arrays.asList(
|
||||
BreadcrumbItem.createSimpleItem(getResources().getString(R.string.filesBreadcrumbRoot))
|
||||
)));
|
||||
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
private static BreadcrumbItem createItem(String title) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(title);
|
||||
return new BreadcrumbItem(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickDir(String dirName) {
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
StringBuilder breadcrumbBuilder = new StringBuilder();
|
||||
|
||||
breadcrumbBuilder.append(fileStructure.getText().toString()).append("/").append(dirName);
|
||||
|
||||
fileStructure.setText(breadcrumbBuilder);
|
||||
|
||||
mBreadcrumbsView.addItem(createItem(dirName));
|
||||
mBreadcrumbsView.setCallback(new DefaultBreadcrumbsCallback<BreadcrumbItem>() {
|
||||
@Override
|
||||
public void onNavigateBack(BreadcrumbItem item, int position) {
|
||||
|
||||
if(position == 0) {
|
||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
fileStructure.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
String filterDir = fileStructure.getText().toString();
|
||||
String result = filterDir.substring(0, filterDir.indexOf(item.getSelectedItem()));
|
||||
fileStructure.setText(result + item.getSelectedItem());
|
||||
fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, fileStructure.getText().toString());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNewLocation(BreadcrumbItem newItem, int changedPosition) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, fileStructure.getText().toString());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickFile(String fileName) {
|
||||
|
||||
Intent intent = new Intent(getContext(), FileViewActivity.class);
|
||||
|
||||
if(!fileStructure.getText().toString().equals("Root")) {
|
||||
|
||||
intent.putExtra("singleFileName", fileStructure.getText().toString()+"/"+fileName);
|
||||
}
|
||||
else {
|
||||
|
||||
intent.putExtra("singleFileName", fileName);
|
||||
}
|
||||
|
||||
Objects.requireNonNull(getContext()).startActivity(intent);
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
FilesViewModel filesModel = new ViewModelProvider(this).get(FilesViewModel.class);
|
||||
|
||||
filesModel.getFilesList(instanceUrl, instanceToken, owner, repo, getContext()).observe(this, new Observer<List<Files>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<Files> filesListMain) {
|
||||
adapter = new FilesAdapter(getContext(), filesListMain, FilesFragment.this);
|
||||
|
||||
mBreadcrumbsView.removeItemAfter(1);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
noDataFiles.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
noDataFiles.setVisibility(View.VISIBLE);
|
||||
}
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void fetchDataAsyncSub(String instanceUrl, String instanceToken, String owner, String repo, String filesDir) {
|
||||
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
FilesViewModel filesModel2 = new ViewModelProvider(this).get(FilesViewModel.class);
|
||||
|
||||
filesModel2.getFilesList2(instanceUrl, instanceToken, owner, repo, filesDir, getContext()).observe(this, new Observer<List<Files>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<Files> filesListMain2) {
|
||||
adapter = new FilesAdapter(getContext(), filesListMain2, FilesFragment.this);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
noDataFiles.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
noDataFiles.setVisibility(View.VISIBLE);
|
||||
}
|
||||
filesFrame.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
boolean connToInternet = AppUtil.haveNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
}
|
||||
|
||||
searchView.setOnQueryTextListener(new androidx.appcompat.widget.SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void onButtonPressed(Uri uri) {
|
||||
if (mListener != null) {
|
||||
mListener.onFragmentInteraction(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
public interface OnFragmentInteractionListener {
|
||||
void onFragmentInteraction(Uri uri);
|
||||
}
|
||||
}
|
@ -262,6 +262,7 @@ public class IssuesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -142,7 +142,7 @@ public class LabelsFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
LabelsViewModel labelsModel = ViewModelProviders.of(this).get(LabelsViewModel.class);
|
||||
LabelsViewModel labelsModel = new ViewModelProvider(this).get(LabelsViewModel.class);
|
||||
|
||||
labelsModel.getLabelsList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Labels>>() {
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -81,7 +81,7 @@ public class MembersByOrgFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) {
|
||||
|
||||
MembersByOrgViewModel membersModel = ViewModelProviders.of(this).get(MembersByOrgViewModel.class);
|
||||
MembersByOrgViewModel membersModel= new ViewModelProvider(this).get(MembersByOrgViewModel.class);
|
||||
|
||||
membersModel.getMembersList(instanceUrl, instanceToken, owner).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
@ -112,6 +112,7 @@ public class MembersByOrgFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -125,7 +126,9 @@ public class MembersByOrgFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mGridView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -46,6 +46,7 @@ public class MilestonesFragment extends Fragment {
|
||||
|
||||
private String repoName;
|
||||
private String repoOwner;
|
||||
private String msState = "all";
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
@ -103,7 +104,7 @@ public class MilestonesFragment extends Fragment {
|
||||
@Override
|
||||
public void run() {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, msState);
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
@ -127,7 +128,7 @@ public class MilestonesFragment extends Fragment {
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
if(tinyDb.getBoolean("milestoneCreated")) {
|
||||
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, msState);
|
||||
tinyDb.putBoolean("milestoneCreated", false);
|
||||
}
|
||||
}
|
||||
@ -150,9 +151,9 @@ public class MilestonesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
MilestonesViewModel msModel = ViewModelProviders.of(this).get(MilestonesViewModel.class);
|
||||
MilestonesViewModel msModel = new ViewModelProvider(this).get(MilestonesViewModel.class);
|
||||
|
||||
msModel.getMilestonesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Milestones>>() {
|
||||
msModel.getMilestonesList(instanceUrl, instanceToken, owner, repo, msState).observe(this, new Observer<List<Milestones>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<Milestones> msListMain) {
|
||||
adapter = new MilestonesAdapter(getContext(), msListMain);
|
||||
@ -182,6 +183,7 @@ public class MilestonesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -195,7 +197,9 @@ public class MilestonesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -171,7 +171,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String username) {
|
||||
|
||||
MyRepositoriesViewModel myRepoModel = ViewModelProviders.of(this).get(MyRepositoriesViewModel.class);
|
||||
MyRepositoriesViewModel myRepoModel = new ViewModelProvider(this).get(MyRepositoriesViewModel.class);
|
||||
|
||||
myRepoModel.getCurrentUserRepositories(instanceUrl, instanceToken, username).observe(this, new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
@ -203,6 +203,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -216,7 +217,9 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -104,7 +104,7 @@ public class OrganizationInfoFragment extends Fragment {
|
||||
if (response.code() == 200) {
|
||||
|
||||
assert orgInfo != null;
|
||||
Picasso.get().load(orgInfo.getAvatar_url()).transform(new RoundedTransformation(100, 0)).resize(200, 200).centerCrop().into(orgAvatar);
|
||||
Picasso.get().load(orgInfo.getAvatar_url()).transform(new RoundedTransformation(8, 0)).resize(180, 180).centerCrop().into(orgAvatar);
|
||||
orgDescInfo.setText(orgInfo.getDescription());
|
||||
orgWebsiteInfo.setText(orgInfo.getWebsite());
|
||||
orgLocationInfo.setText(orgInfo.getLocation());
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -141,7 +141,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
OrganizationListViewModel orgModel = ViewModelProviders.of(this).get(OrganizationListViewModel.class);
|
||||
OrganizationListViewModel orgModel = new ViewModelProvider(this).get(OrganizationListViewModel.class);
|
||||
|
||||
orgModel.getUserOrgs(instanceUrl, instanceToken).observe(this, new Observer<List<UserOrganizations>>() {
|
||||
@Override
|
||||
@ -173,6 +173,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -186,7 +187,9 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -109,7 +109,7 @@ public class ProfileEmailsFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
ProfileEmailsViewModel profileEmailModel = ViewModelProviders.of(this).get(ProfileEmailsViewModel.class);
|
||||
ProfileEmailsViewModel profileEmailModel = new ViewModelProvider(this).get(ProfileEmailsViewModel.class);
|
||||
|
||||
profileEmailModel.getEmailsList(instanceUrl, instanceToken).observe(this, new Observer<List<Emails>>() {
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -108,7 +108,7 @@ public class ProfileFollowersFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
ProfileFollowersViewModel pfModel = ViewModelProviders.of(this).get(ProfileFollowersViewModel.class);
|
||||
ProfileFollowersViewModel pfModel = new ViewModelProvider(this).get(ProfileFollowersViewModel.class);
|
||||
|
||||
pfModel.getFollowersList(instanceUrl, instanceToken).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -108,7 +108,7 @@ public class ProfileFollowingFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
ProfileFollowingViewModel pfModel = ViewModelProviders.of(this).get(ProfileFollowingViewModel.class);
|
||||
ProfileFollowingViewModel pfModel = new ViewModelProvider(this).get(ProfileFollowingViewModel.class);
|
||||
|
||||
pfModel.getFollowingList(instanceUrl, instanceToken).observe(this, new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class ProfileFragment extends Fragment {
|
||||
TextView userEmail = v.findViewById(R.id.userEmail);
|
||||
|
||||
userFullName.setText(tinyDb.getString("userFullname"));
|
||||
Picasso.get().load(tinyDb.getString("userAvatar")).transform(new RoundedTransformation(100, 0)).resize(180, 180).centerCrop().into(userAvatar);
|
||||
Picasso.get().load(tinyDb.getString("userAvatar")).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(userAvatar);
|
||||
userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
|
||||
userEmail.setText(tinyDb.getString("userEmail"));
|
||||
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -141,7 +141,7 @@ public class ReleasesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||
|
||||
ReleasesViewModel releasesModel = ViewModelProviders.of(this).get(ReleasesViewModel.class);
|
||||
ReleasesViewModel releasesModel = new ViewModelProvider(this).get(ReleasesViewModel.class);
|
||||
|
||||
releasesModel.getReleasesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Releases>>() {
|
||||
@Override
|
||||
|
@ -8,6 +8,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.actions.RepositoryActions;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@ -24,11 +26,19 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.repo_bottom_sheet_layout, container, false);
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(getContext());
|
||||
|
||||
TextView createLabel = v.findViewById(R.id.createLabel);
|
||||
TextView createIssue = v.findViewById(R.id.createNewIssue);
|
||||
TextView createMilestone = v.findViewById(R.id.createNewMilestone);
|
||||
TextView addCollaborator = v.findViewById(R.id.addCollaborator);
|
||||
TextView createRelease = v.findViewById(R.id.createRelease);
|
||||
TextView openWebRepo = v.findViewById(R.id.openWebRepo);
|
||||
TextView newFile = v.findViewById(R.id.newFile);
|
||||
TextView starRepository = v.findViewById(R.id.starRepository);
|
||||
TextView unStarRepository = v.findViewById(R.id.unStarRepository);
|
||||
TextView watchRepository = v.findViewById(R.id.watchRepository);
|
||||
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
|
||||
|
||||
createLabel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -38,13 +48,19 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
});
|
||||
|
||||
createIssue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bmListener.onButtonClicked("newIssue");
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
if(tinyDb.getBoolean("hasIssues")) {
|
||||
createIssue.setVisibility(View.VISIBLE);
|
||||
createIssue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bmListener.onButtonClicked("newIssue");
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
createIssue.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
createMilestone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -70,6 +86,88 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
});
|
||||
|
||||
openWebRepo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bmListener.onButtonClicked("openWebRepo");
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
newFile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bmListener.onButtonClicked("newFile");
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
if(tinyDb.getInt("repositoryStarStatus") == 204) { // star a repo
|
||||
|
||||
starRepository.setVisibility(View.GONE);
|
||||
|
||||
unStarRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.unStarRepository(getContext());
|
||||
tinyDb.putInt("repositoryStarStatus", 404);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else if(tinyDb.getInt("repositoryStarStatus") == 404) {
|
||||
|
||||
unStarRepository.setVisibility(View.GONE);
|
||||
|
||||
starRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.starRepository(getContext());
|
||||
tinyDb.putInt("repositoryStarStatus", 204);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if(tinyDb.getBoolean("repositoryWatchStatus")) { // watch a repo
|
||||
|
||||
watchRepository.setVisibility(View.GONE);
|
||||
|
||||
unWatchRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.unWatchRepository(getContext());
|
||||
tinyDb.putBoolean("repositoryWatchStatus", false);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
unWatchRepository.setVisibility(View.GONE);
|
||||
|
||||
watchRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.watchRepository(getContext());
|
||||
tinyDb.putBoolean("repositoryWatchStatus", true);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,31 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import okhttp3.OkHttpClient;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.ext.tables.TablePlugin;
|
||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import io.noties.markwon.html.HtmlPlugin;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||
import io.noties.markwon.image.ImageItem;
|
||||
import io.noties.markwon.image.ImagesPlugin;
|
||||
import io.noties.markwon.image.SchemeHandler;
|
||||
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import ru.noties.markwon.AbstractMarkwonPlugin;
|
||||
import ru.noties.markwon.Markwon;
|
||||
import ru.noties.markwon.core.CorePlugin;
|
||||
import ru.noties.markwon.core.MarkwonTheme;
|
||||
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import ru.noties.markwon.ext.tables.TablePlugin;
|
||||
import ru.noties.markwon.ext.tables.TableTheme;
|
||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||
import ru.noties.markwon.html.HtmlPlugin;
|
||||
import ru.noties.markwon.image.ImagesPlugin;
|
||||
import ru.noties.markwon.image.gif.GifPlugin;
|
||||
import ru.noties.markwon.image.okhttp.OkHttpImagesPlugin;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -42,6 +47,8 @@ import org.mian.gitnex.util.TinyDB;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -208,6 +215,8 @@ public class RepoInfoFragment extends Fragment {
|
||||
|
||||
private void getRepoInfo(String instanceUrl, String token, final String owner, String repo, final String locale, final String timeFormat) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(getContext());
|
||||
|
||||
Call<UserRepositories> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
@ -220,53 +229,64 @@ public class RepoInfoFragment extends Fragment {
|
||||
|
||||
UserRepositories repoInfo = response.body();
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
if (isAdded()) {
|
||||
|
||||
if (response.code() == 200) {
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
assert repoInfo != null;
|
||||
repoNameInfo.setText(repoInfo.getName());
|
||||
repoOwnerInfo.setText(owner);
|
||||
repoDescriptionInfo.setText(repoInfo.getDescription());
|
||||
repoWebsiteInfo.setText(repoInfo.getWebsite());
|
||||
repoSizeInfo.setText(AppUtil.formatFileSize(repoInfo.getSize()));
|
||||
repoDefaultBranchInfo.setText(repoInfo.getDefault_branch());
|
||||
repoSshUrlInfo.setText(repoInfo.getSsh_url());
|
||||
repoCloneUrlInfo.setText(repoInfo.getClone_url());
|
||||
repoRepoUrlInfo.setText(repoInfo.getHtml_url());
|
||||
repoForksCountInfo.setText(repoInfo.getForks_count());
|
||||
if (response.code() == 200) {
|
||||
|
||||
switch (timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||
String createdTime = prettyTime.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
repoCreatedAtInfo.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(repoInfo.getCreated_at()), getContext()));
|
||||
break;
|
||||
assert repoInfo != null;
|
||||
repoNameInfo.setText(repoInfo.getName());
|
||||
repoOwnerInfo.setText(owner);
|
||||
repoDescriptionInfo.setText(repoInfo.getDescription());
|
||||
repoWebsiteInfo.setText(repoInfo.getWebsite());
|
||||
repoSizeInfo.setText(AppUtil.formatFileSize(repoInfo.getSize()));
|
||||
repoDefaultBranchInfo.setText(repoInfo.getDefault_branch());
|
||||
repoSshUrlInfo.setText(repoInfo.getSsh_url());
|
||||
repoCloneUrlInfo.setText(repoInfo.getClone_url());
|
||||
repoRepoUrlInfo.setText(repoInfo.getHtml_url());
|
||||
repoForksCountInfo.setText(repoInfo.getForks_count());
|
||||
|
||||
if(repoInfo.getHas_issues() != null) {
|
||||
tinyDb.putBoolean("hasIssues", repoInfo.getHas_issues());
|
||||
}
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
break;
|
||||
else {
|
||||
tinyDb.putBoolean("hasIssues", true);
|
||||
}
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
break;
|
||||
|
||||
switch (timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||
String createdTime = prettyTime.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
repoCreatedAtInfo.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(repoInfo.getCreated_at()), getContext()));
|
||||
break;
|
||||
}
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
break;
|
||||
}
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||
String createdTime = formatter.format(repoInfo.getCreated_at());
|
||||
repoCreatedAtInfo.setText(createdTime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
pageContent.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
pageContent.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
else {
|
||||
Log.e("onFailure", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
Log.e("onFailure", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -292,12 +312,51 @@ public class RepoInfoFragment extends Fragment {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
|
||||
|
||||
if (response.code() == 200) {
|
||||
if (isAdded()) {
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(getContext()))
|
||||
if (response.code() == 200) {
|
||||
|
||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(getContext()))
|
||||
.usePlugin(CorePlugin.create())
|
||||
.usePlugin(OkHttpImagesPlugin.create(new OkHttpClient()))
|
||||
.usePlugin(ImagesPlugin.createWithAssets(getContext()))
|
||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
||||
@Override
|
||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
||||
plugin.addSchemeHandler(new SchemeHandler() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||
|
||||
final int resourceId = getContext().getResources().getIdentifier(
|
||||
raw.substring("drawable://".length()),
|
||||
"drawable",
|
||||
getContext().getPackageName());
|
||||
|
||||
final Drawable drawable = getContext().getDrawable(resourceId);
|
||||
|
||||
assert drawable != null;
|
||||
return ImageItem.withResult(drawable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Collection<String> supportedSchemes() {
|
||||
return Collections.singleton("drawable");
|
||||
}
|
||||
});
|
||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create(getContext().getResources()));
|
||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(getContext().getResources()));
|
||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||
}
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
@ -310,40 +369,39 @@ public class RepoInfoFragment extends Fragment {
|
||||
.usePlugin(TablePlugin.create(getContext()))
|
||||
.usePlugin(TaskListPlugin.create(getContext()))
|
||||
.usePlugin(HtmlPlugin.create())
|
||||
.usePlugin(GifPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create())
|
||||
.build();
|
||||
|
||||
CharSequence bodyWithMD = null;
|
||||
if (response.body() != null) {
|
||||
bodyWithMD = markwon.toMarkdown(response.body());
|
||||
Spanned bodyWithMD = null;
|
||||
if (response.body() != null) {
|
||||
bodyWithMD = markwon.toMarkdown(response.body());
|
||||
}
|
||||
assert bodyWithMD != null;
|
||||
markwon.setParsedMarkdown(repoFileContents, bodyWithMD);
|
||||
|
||||
|
||||
} else if (response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
} else if (response.code() == 403) {
|
||||
|
||||
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
|
||||
|
||||
} else if (response.code() == 404) {
|
||||
|
||||
fileContentsFrameHeader.setVisibility(View.GONE);
|
||||
fileContentsFrame.setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
|
||||
Toasty.info(getContext(), getString(R.string.genericError));
|
||||
|
||||
}
|
||||
repoFileContents.setText(bodyWithMD);
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
fileContentsFrameHeader.setVisibility(View.GONE);
|
||||
fileContentsFrame.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.info(getContext(), getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -123,7 +123,7 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) {
|
||||
|
||||
RepositoriesByOrgViewModel orgRepoModel = ViewModelProviders.of(this).get(RepositoriesByOrgViewModel.class);
|
||||
RepositoriesByOrgViewModel orgRepoModel = new ViewModelProvider(this).get(RepositoriesByOrgViewModel.class);
|
||||
|
||||
orgRepoModel.getRepositoriesByOrg(instanceUrl, instanceToken, owner).observe(this, new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
@ -155,6 +155,7 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -168,7 +169,9 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -144,7 +144,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
RepositoriesListViewModel repoModel = ViewModelProviders.of(this).get(RepositoriesListViewModel.class);
|
||||
RepositoriesListViewModel repoModel = new ViewModelProvider(this).get(RepositoriesListViewModel.class);
|
||||
|
||||
repoModel.getUserRepositories(instanceUrl, instanceToken).observe(this, new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
@ -176,6 +176,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -189,7 +190,9 @@ public class RepositoriesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ public class SettingsFragment extends Fragment {
|
||||
|
||||
private Context ctx = null;
|
||||
|
||||
private static String[] langList = {"English", "French", "German", "Russian"};
|
||||
private static String[] langList = {"Arabic", "Chinese", "English", "Finnish", "French", "German", "Italian", "Persian", "Russian", "Serbian"};
|
||||
private static int langSelectedChoice = 0;
|
||||
|
||||
private static String[] timeList = {"Pretty", "Normal"};
|
||||
@ -68,7 +68,7 @@ public class SettingsFragment extends Fragment {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||
intent.setData(Uri.parse(getResources().getString(R.string.appRepoContributingLink)));
|
||||
intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -185,10 +185,6 @@ public class SettingsFragment extends Fragment {
|
||||
tinyDb.putInt("codeBlockId", i);
|
||||
|
||||
switch (codeBlockList[i]) {
|
||||
case "Green - Black":
|
||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||
break;
|
||||
case "White - Black":
|
||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
|
||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||
@ -248,8 +244,14 @@ public class SettingsFragment extends Fragment {
|
||||
tinyDb.putInt("langId", i);
|
||||
|
||||
switch (langList[i]) {
|
||||
case "English":
|
||||
tinyDb.putString("locale", "en");
|
||||
case "Arabic":
|
||||
tinyDb.putString("locale", "ar");
|
||||
break;
|
||||
case "Chinese":
|
||||
tinyDb.putString("locale", "zh");
|
||||
break;
|
||||
case "Finnish":
|
||||
tinyDb.putString("locale", "fi");
|
||||
break;
|
||||
case "French":
|
||||
tinyDb.putString("locale", "fr");
|
||||
@ -257,9 +259,18 @@ public class SettingsFragment extends Fragment {
|
||||
case "German":
|
||||
tinyDb.putString("locale", "de");
|
||||
break;
|
||||
case "Italian":
|
||||
tinyDb.putString("locale", "it");
|
||||
break;
|
||||
case "Persian":
|
||||
tinyDb.putString("locale", "fa");
|
||||
break;
|
||||
case "Russian":
|
||||
tinyDb.putString("locale", "ru");
|
||||
break;
|
||||
case "Serbian":
|
||||
tinyDb.putString("locale", "sr");
|
||||
break;
|
||||
default:
|
||||
tinyDb.putString("locale", "en");
|
||||
break;
|
||||
@ -309,16 +320,10 @@ public class SettingsFragment extends Fragment {
|
||||
tinyDb.putString("timeStr", timeList[i]);
|
||||
tinyDb.putInt("timeId", i);
|
||||
|
||||
switch (timeList[i]) {
|
||||
case "Pretty":
|
||||
tinyDb.putString("dateFormat", "pretty");
|
||||
break;
|
||||
case "Normal":
|
||||
tinyDb.putString("dateFormat", "normal");
|
||||
break;
|
||||
default:
|
||||
tinyDb.putString("dateFormat", "pretty");
|
||||
break;
|
||||
if ("Normal".equals(timeList[i])) {
|
||||
tinyDb.putString("dateFormat", "normal");
|
||||
} else {
|
||||
tinyDb.putString("dateFormat", "pretty");
|
||||
}
|
||||
|
||||
dialogInterfaceTime.dismiss();
|
||||
|
@ -13,9 +13,13 @@ import org.mian.gitnex.activities.AddRemoveAssigneesActivity;
|
||||
import org.mian.gitnex.activities.AddRemoveLabelsActivity;
|
||||
import org.mian.gitnex.activities.EditIssueActivity;
|
||||
import org.mian.gitnex.activities.ReplyToIssueActivity;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ClipData;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -37,6 +41,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
||||
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue);
|
||||
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees);
|
||||
TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl);
|
||||
|
||||
replyToIssue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -78,6 +83,32 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
});
|
||||
|
||||
copyIssueUrl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
// get url of repo
|
||||
String repoFullName = tinyDB.getString("repoFullName");
|
||||
String instanceUrlWithProtocol = "https://" + tinyDB.getString("instanceUrlRaw");
|
||||
if(!tinyDB.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
|
||||
// get issue Url
|
||||
String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber");
|
||||
|
||||
// copy to clipboard
|
||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(getContext()).getSystemService(android.content.Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("issueUrl", issueUrl);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
dismiss();
|
||||
|
||||
Toasty.info(getContext(), getContext().getString(R.string.copyIssueUrlToastMsg));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(tinyDB.getString("issueState").equals("open")) { // close issue
|
||||
|
||||
reOpenIssue.setVisibility(View.GONE);
|
||||
|
@ -7,7 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -166,7 +166,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken) {
|
||||
|
||||
StarredRepositoriesViewModel starredRepoModel = ViewModelProviders.of(this).get(StarredRepositoriesViewModel.class);
|
||||
StarredRepositoriesViewModel starredRepoModel = new ViewModelProvider(this).get(StarredRepositoriesViewModel.class);
|
||||
|
||||
starredRepoModel.getUserStarredRepositories(instanceUrl, instanceToken).observe(this, new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
@ -198,6 +198,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -211,7 +212,9 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -124,7 +124,7 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
|
||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) {
|
||||
|
||||
TeamsByOrgViewModel teamModel = ViewModelProviders.of(this).get(TeamsByOrgViewModel.class);
|
||||
TeamsByOrgViewModel teamModel = new ViewModelProvider(this).get(TeamsByOrgViewModel.class);
|
||||
|
||||
teamModel.getTeamsByOrg(instanceUrl, instanceToken, owner).observe(this, new Observer<List<Teams>>() {
|
||||
@Override
|
||||
@ -156,6 +156,7 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
androidx.appcompat.widget.SearchView searchView = (androidx.appcompat.widget.SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
searchView.setQueryHint(getContext().getString(R.string.strFilter));
|
||||
|
||||
if(!connToInternet) {
|
||||
return;
|
||||
@ -169,7 +170,9 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.getFilter().filter(newText);
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -3,6 +3,9 @@ package org.mian.gitnex.interfaces;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.mian.gitnex.models.AddEmail;
|
||||
import org.mian.gitnex.models.Branches;
|
||||
import org.mian.gitnex.models.ExploreRepositories;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import org.mian.gitnex.models.NewFile;
|
||||
import org.mian.gitnex.models.UpdateIssueAssignee;
|
||||
import org.mian.gitnex.models.UpdateIssueState;
|
||||
import org.mian.gitnex.models.Collaborators;
|
||||
@ -25,6 +28,7 @@ import org.mian.gitnex.models.UserOrganizations;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.models.UserSearch;
|
||||
import org.mian.gitnex.models.UserTokens;
|
||||
import org.mian.gitnex.models.WatchRepository;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
@ -98,7 +102,7 @@ public interface ApiInterface {
|
||||
Call<Issues> replyCommentToIssue(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex, @Body Issues jsonStr);
|
||||
|
||||
@GET("repos/{owner}/{repo}/milestones") // get milestones by repo
|
||||
Call<List<Milestones>> getMilestones(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
Call<List<Milestones>> getMilestones(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Query("state") String state);
|
||||
|
||||
@GET("repos/{owner}/{repo}/branches") // get branches
|
||||
Call<List<Branches>> getBranches(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
@ -204,4 +208,43 @@ public interface ApiInterface {
|
||||
|
||||
@GET("admin/users") // get all users
|
||||
Call<List<UserInfo>> adminGetUsers(@Header("Authorization") String token);
|
||||
}
|
||||
|
||||
@GET("repos/{owner}/{repo}/stargazers") // get all repo stars
|
||||
Call<List<UserInfo>> getRepoStargazers(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@GET("repos/{owner}/{repo}/subscribers") // get all repo watchers
|
||||
Call<List<UserInfo>> getRepoWatchers(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@GET("repos/search") // get all the repos which match the query string
|
||||
Call<ExploreRepositories> queryRepos(@Header("Authorization") String token, @Query("q") String searchKeyword, @Query("private") Boolean repoTypeInclude, @Query("sort") String sort, @Query("order") String order);
|
||||
|
||||
@POST("repos/{owner}/{repo}/contents/{file}") // create new file
|
||||
Call<JsonElement> createNewFile(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("file") String fileName, @Body NewFile jsonStr);
|
||||
|
||||
@GET("repos/{owner}/{repo}/contents") // get all the files and dirs of a repository
|
||||
Call<List<Files>> getFiles(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@GET("repos/{owner}/{repo}/contents/{file}") // get single file contents
|
||||
Call<Files> getSingleFileContents(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("file") String file);
|
||||
|
||||
@GET("repos/{owner}/{repo}/contents/{fileDir}") // get all the sub files and dirs of a repository
|
||||
Call<List<Files>> getDirFiles(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("fileDir") String fileDir);
|
||||
|
||||
@GET("user/starred/{owner}/{repo}") // check star status of a repository
|
||||
Call<JsonElement> checkRepoStarStatus(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@PUT("user/starred/{owner}/{repo}") // star a repository
|
||||
Call<JsonElement> starRepository(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@DELETE("user/starred/{owner}/{repo}") // un star a repository
|
||||
Call<JsonElement> unStarRepository(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@GET("repos/{owner}/{repo}/subscription") // check watch status of a repository
|
||||
Call<WatchRepository> checkRepoWatchStatus(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@PUT("repos/{owner}/{repo}/subscription") // watch a repository
|
||||
Call<JsonElement> watchRepository(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@DELETE("repos/{owner}/{repo}/subscription") // un watch a repository
|
||||
Call<JsonElement> unWatchRepository(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.mian.gitnex.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class ExploreRepositories {
|
||||
|
||||
private ArrayList<UserRepositories> data;
|
||||
private Boolean ok;
|
||||
|
||||
public ArrayList<UserRepositories> getSearchedData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Boolean getOk() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
74
app/src/main/java/org/mian/gitnex/models/Files.java
Normal file
74
app/src/main/java/org/mian/gitnex/models/Files.java
Normal file
@ -0,0 +1,74 @@
|
||||
package org.mian.gitnex.models;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class Files {
|
||||
|
||||
private String name;
|
||||
private String path;
|
||||
private String sha;
|
||||
private String type;
|
||||
private int size;
|
||||
private String encoding;
|
||||
private String content;
|
||||
private String target;
|
||||
private String url;
|
||||
private String html_url;
|
||||
private String git_url;
|
||||
private String download_url;
|
||||
private String submodule_git_url;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getSha() {
|
||||
return sha;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getHtml_url() {
|
||||
return html_url;
|
||||
}
|
||||
|
||||
public String getGit_url() {
|
||||
return git_url;
|
||||
}
|
||||
|
||||
public String getDownload_url() {
|
||||
return download_url;
|
||||
}
|
||||
|
||||
public String getSubmodule_git_url() {
|
||||
return submodule_git_url;
|
||||
}
|
||||
}
|
99
app/src/main/java/org/mian/gitnex/models/NewFile.java
Normal file
99
app/src/main/java/org/mian/gitnex/models/NewFile.java
Normal file
@ -0,0 +1,99 @@
|
||||
package org.mian.gitnex.models;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class NewFile {
|
||||
|
||||
private String branch;
|
||||
private String content;
|
||||
private String message;
|
||||
private String new_branch;
|
||||
|
||||
private authorObject author;
|
||||
private committerObject committer;
|
||||
|
||||
public String getBranch() {
|
||||
return branch;
|
||||
}
|
||||
|
||||
public void setBranch(String branch) {
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
public String getContents() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContents(String contents) {
|
||||
this.content = contents;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getNew_branch() {
|
||||
return new_branch;
|
||||
}
|
||||
|
||||
public void setNew_branch(String new_branch) {
|
||||
this.new_branch = new_branch;
|
||||
}
|
||||
|
||||
public class authorObject {
|
||||
|
||||
private String email;
|
||||
private String name;
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public class committerObject {
|
||||
|
||||
private String email;
|
||||
private String name;
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public NewFile(String branch, String content, String message, String new_branch) {
|
||||
this.branch = branch;
|
||||
this.content = content;
|
||||
this.message = message;
|
||||
this.new_branch = new_branch;
|
||||
}
|
||||
}
|
@ -27,7 +27,8 @@ public class UserRepositories {
|
||||
private String ssh_url;
|
||||
private String website;
|
||||
private String forks_count;
|
||||
|
||||
private Boolean has_issues;
|
||||
private String avatar_url;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@ -96,4 +97,12 @@ public class UserRepositories {
|
||||
public String getForks_count() {
|
||||
return forks_count;
|
||||
}
|
||||
|
||||
public Boolean getHas_issues() {
|
||||
return has_issues;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package org.mian.gitnex.models;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class WatchRepository {
|
||||
|
||||
private Boolean subscribed;
|
||||
private Boolean ignored;
|
||||
private String reason;
|
||||
private String created_at;
|
||||
private String url;
|
||||
private String repository_url;
|
||||
|
||||
public Boolean getSubscribed() {
|
||||
return subscribed;
|
||||
}
|
||||
|
||||
public Boolean getIgnored() {
|
||||
return ignored;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getRepository_url() {
|
||||
return repository_url;
|
||||
}
|
||||
}
|
@ -7,9 +7,11 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Base64;
|
||||
import android.util.DisplayMetrics;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
@ -77,6 +79,10 @@ public class AppUtil {
|
||||
return str.matches("^[\\w.-]+$");
|
||||
}
|
||||
|
||||
public Boolean checkStringsWithDash(String str) { // [a-zA-Z0-9-_. ]
|
||||
return str.matches("^[\\w-]+$");
|
||||
}
|
||||
|
||||
public Boolean checkIntegers(String str) {
|
||||
return str.matches("\\d+");
|
||||
}
|
||||
@ -180,4 +186,28 @@ public class AppUtil {
|
||||
|
||||
}
|
||||
|
||||
public String encodeBase64(String str) {
|
||||
|
||||
String base64Str = str;
|
||||
if(!str.equals("")) {
|
||||
byte[] data = str.getBytes(StandardCharsets.UTF_8);
|
||||
base64Str = Base64.encodeToString(data, Base64.DEFAULT);
|
||||
}
|
||||
|
||||
return base64Str;
|
||||
|
||||
}
|
||||
|
||||
public String decodeBase64(String str) {
|
||||
|
||||
String base64Str = str;
|
||||
if(!str.equals("")) {
|
||||
byte[] data = Base64.decode(base64Str, Base64.DEFAULT);
|
||||
base64Str = new String(data, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
return base64Str;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
117
app/src/main/java/org/mian/gitnex/viewmodels/FilesViewModel.java
Normal file
117
app/src/main/java/org/mian/gitnex/viewmodels/FilesViewModel.java
Normal file
@ -0,0 +1,117 @@
|
||||
package org.mian.gitnex.viewmodels;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class FilesViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<Files>> filesList;
|
||||
private static MutableLiveData<List<Files>> filesList2;
|
||||
|
||||
public LiveData<List<Files>> getFilesList(String instanceUrl, String token, String owner, String repo, Context ctx) {
|
||||
|
||||
filesList = new MutableLiveData<>();
|
||||
loadFilesList(instanceUrl, token, owner, repo, ctx);
|
||||
|
||||
return filesList;
|
||||
}
|
||||
|
||||
private static void loadFilesList(String instanceUrl, String token, String owner, String repo, final Context ctx) {
|
||||
|
||||
Call<List<Files>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getFiles(token, owner, repo);
|
||||
|
||||
call.enqueue(new Callback<List<Files>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Files>> call, @NonNull Response<List<Files>> response) {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
Collections.sort(response.body(), new Comparator<Files>() {
|
||||
@Override
|
||||
public int compare(Files byType1, Files byType2) {
|
||||
return byType1.getType().compareTo(byType2.getType());
|
||||
}
|
||||
});
|
||||
|
||||
filesList.postValue(response.body());
|
||||
} else {
|
||||
Toasty.info(ctx, ctx.getString(R.string.noDataFilesTab));
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Files>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public LiveData<List<Files>> getFilesList2(String instanceUrl, String token, String owner, String repo, String filesDir, Context ctx) {
|
||||
|
||||
filesList2 = new MutableLiveData<>();
|
||||
loadFilesList2(instanceUrl, token, owner, repo, filesDir, ctx);
|
||||
|
||||
return filesList2;
|
||||
}
|
||||
|
||||
private static void loadFilesList2(String instanceUrl, String token, String owner, String repo, String filesDir, final Context ctx) {
|
||||
|
||||
Call<List<Files>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getDirFiles(token, owner, repo, filesDir);
|
||||
|
||||
call.enqueue(new Callback<List<Files>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Files>> call, @NonNull Response<List<Files>> response) {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
Collections.sort(response.body(), new Comparator<Files>() {
|
||||
@Override
|
||||
public int compare(Files byType1, Files byType2) {
|
||||
return byType1.getType().compareTo(byType2.getType());
|
||||
}
|
||||
});
|
||||
|
||||
filesList2.postValue(response.body());
|
||||
} else {
|
||||
Toasty.info(ctx, ctx.getString(R.string.noDataFilesTab));
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Files>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -20,20 +20,20 @@ public class MilestonesViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<Milestones>> milestonesList;
|
||||
|
||||
public LiveData<List<Milestones>> getMilestonesList(String instanceUrl, String token, String owner, String repo) {
|
||||
public LiveData<List<Milestones>> getMilestonesList(String instanceUrl, String token, String owner, String repo, String msState) {
|
||||
|
||||
milestonesList = new MutableLiveData<>();
|
||||
loadMilestonesList(instanceUrl, token, owner, repo);
|
||||
loadMilestonesList(instanceUrl, token, owner, repo, msState);
|
||||
|
||||
return milestonesList;
|
||||
}
|
||||
|
||||
public static void loadMilestonesList(String instanceUrl, String token, String owner, String repo) {
|
||||
public static void loadMilestonesList(String instanceUrl, String token, String owner, String repo, String msState) {
|
||||
|
||||
Call<List<Milestones>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getMilestones(token, owner, repo);
|
||||
.getMilestones(token, owner, repo, msState);
|
||||
|
||||
call.enqueue(new Callback<List<Milestones>>() {
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
package org.mian.gitnex.viewmodels;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoStargazersViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<UserInfo>> stargazersList;
|
||||
|
||||
public LiveData<List<UserInfo>> getRepoStargazers(String instanceUrl, String token, String repoOwner, String repoName) {
|
||||
|
||||
stargazersList = new MutableLiveData<>();
|
||||
loadRepoStargazers(instanceUrl, token, repoOwner, repoName);
|
||||
|
||||
return stargazersList;
|
||||
}
|
||||
|
||||
public static void loadRepoStargazers(String instanceUrl, String token, String repoOwner, String repoName) {
|
||||
|
||||
Call<List<UserInfo>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getRepoStargazers(token, repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<List<UserInfo>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
stargazersList.postValue(response.body());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package org.mian.gitnex.viewmodels;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoWatchersViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<UserInfo>> watchersList;
|
||||
|
||||
public LiveData<List<UserInfo>> getRepoWatchers(String instanceUrl, String token, String repoOwner, String repoName) {
|
||||
|
||||
watchersList = new MutableLiveData<>();
|
||||
loadRepoWatchers(instanceUrl, token, repoOwner, repoName);
|
||||
|
||||
return watchersList;
|
||||
}
|
||||
|
||||
public static void loadRepoWatchers(String instanceUrl, String token, String repoOwner, String repoName) {
|
||||
|
||||
Call<List<UserInfo>> call = RetrofitClient
|
||||
.getInstance(instanceUrl)
|
||||
.getApiInterface()
|
||||
.getRepoWatchers(token, repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<List<UserInfo>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
watchersList.postValue(response.body());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
5
app/src/main/res/drawable/ic_comment_16.xml
Normal file
5
app/src/main/res/drawable/ic_comment_16.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="16dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_comment_20.xml
Normal file
5
app/src/main/res/drawable/ic_comment_20.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="20dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_content_copy.xml
Normal file
5
app/src/main/res/drawable/ic_content_copy.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_file.xml
Normal file
5
app/src/main/res/drawable/ic_file.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z"/>
|
||||
</vector>
|
11
app/src/main/res/drawable/ic_file_new.xml
Normal file
11
app/src/main/res/drawable/ic_file_new.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:width="512dp"
|
||||
android:height="512dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="16"
|
||||
tools:ignore="VectorRaster">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="m13.707,3.293 l-3,-3c-0.1875,-0.1875 -0.4419,-0.293 -0.707,-0.293h-7c-0.5522,0 -1,0.4478 -1,1v14c0,0.5527 0.4478,1 1,1h10c0.5522,0 1,-0.4473 1,-1v-11c0,-0.2651 -0.1055,-0.5195 -0.293,-0.707zM8,12h-3v-2h3zM11,9h-6v-2h6zM11,4c-0.5523,0 -1,-0.4478 -1,-1v-2l3,3z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_filter.xml
Normal file
5
app/src/main/res/drawable/ic_filter.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_folder_24.xml
Normal file
5
app/src/main/res/drawable/ic_folder_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_forks_24.xml
Normal file
5
app/src/main/res/drawable/ic_forks_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M14,4l2.29,2.29 -2.88,2.88 1.42,1.42 2.88,-2.88L20,10L20,4zM10,4L4,4v6l2.29,-2.29 4.71,4.7L11,20h2v-8.41l-5.29,-5.3z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_open_in_browser.xml
Normal file
5
app/src/main/res/drawable/ic_open_in_browser.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19,4L5,4c-1.11,0 -2,0.9 -2,2v12c0,1.1 0.89,2 2,2h4v-2L5,18L5,8h14v10h-4v2h4c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.89,-2 -2,-2zM12,10l-4,4h3v6h2v-6h3l-4,-4z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_question_mark_24.xml
Normal file
5
app/src/main/res/drawable/ic_question_mark_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_star_border_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_star_border_24dp.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z"/>
|
||||
</vector>
|
6
app/src/main/res/drawable/ic_unwatch.xml
Normal file
6
app/src/main/res/drawable/ic_unwatch.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:viewportHeight="511.999" android:viewportWidth="511.999"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M508.745,246.041c-4.574,-6.257 -113.557,-153.206 -252.748,-153.206S7.818,239.784 3.249,246.035c-4.332,5.936 -4.332,13.987 0,19.923c4.569,6.257 113.557,153.206 252.748,153.206s248.174,-146.95 252.748,-153.201C513.083,260.028 513.083,251.971 508.745,246.041zM255.997,385.406c-102.529,0 -191.33,-97.533 -217.617,-129.418c26.253,-31.913 114.868,-129.395 217.617,-129.395c102.524,0 191.319,97.516 217.617,129.418C447.361,287.923 358.746,385.406 255.997,385.406z"/>
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M255.997,154.725c-55.842,0 -101.275,45.433 -101.275,101.275s45.433,101.275 101.275,101.275s101.275,-45.433 101.275,-101.275S311.839,154.725 255.997,154.725zM255.997,323.516c-37.23,0 -67.516,-30.287 -67.516,-67.516s30.287,-67.516 67.516,-67.516s67.516,30.287 67.516,67.516S293.227,323.516 255.997,323.516z"/>
|
||||
</vector>
|
31
app/src/main/res/drawable/progress_bar.xml
Normal file
31
app/src/main/res/drawable/progress_bar.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@android:id/background"
|
||||
android:top="2dp"
|
||||
android:bottom="2dp"
|
||||
android:right="1dp"
|
||||
android:left="1dp">
|
||||
<shape>
|
||||
<corners android:radius="15dp"/>
|
||||
<solid android:color="@color/divider"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@android:id/progress"
|
||||
android:top="3dp"
|
||||
android:bottom="3dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp">
|
||||
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="15dp" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
<corners android:radius="35dp"/>
|
||||
<corners android:radius="5dp"/>
|
||||
|
||||
</shape>
|
Binary file not shown.
BIN
app/src/main/res/font/roboto.ttf
Normal file
BIN
app/src/main/res/font/roboto.ttf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/sourcecodeproregular.ttf
Normal file
BIN
app/src/main/res/font/sourcecodeproregular.ttf
Normal file
Binary file not shown.
@ -10,7 +10,6 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
@ -72,7 +71,7 @@
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="@style/Base.Widget.AppCompat.ProgressBar"
|
||||
android:layout_width="match_parent"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user